Changeset 146975 in webkit


Ignore:
Timestamp:
Mar 27, 2013 2:29:05 AM (11 years ago)
Author:
yurys@chromium.org
Message:

Web Inspector: update Timeline.TimelineEvent definition to include DOM counters and native memory stats
https://bugs.webkit.org/show_bug.cgi?id=113376

Reviewed by Vsevolod Vlasov.

Added missing fields to Timeline.TimelineEvent type definition in Inspector.json

  • inspector/Inspector.json:
  • inspector/InspectorTimelineAgent.cpp:

(WebCore::InspectorTimelineAgent::innerAddRecordToTimeline):
(WebCore::InspectorTimelineAgent::setDOMCounters):
Switched InspectorTimelineAgent to the new typed event builders.
(WebCore::InspectorTimelineAgent::setNativeHeapStatistics):

  • inspector/InspectorTimelineAgent.h:

(InspectorTimelineAgent):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r146973 r146975  
     12013-03-27  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Web Inspector: update Timeline.TimelineEvent definition to include DOM counters and native memory stats
     4        https://bugs.webkit.org/show_bug.cgi?id=113376
     5
     6        Reviewed by Vsevolod Vlasov.
     7
     8        Added missing fields to Timeline.TimelineEvent type definition in Inspector.json
     9
     10        * inspector/Inspector.json:
     11        * inspector/InspectorTimelineAgent.cpp:
     12        (WebCore::InspectorTimelineAgent::innerAddRecordToTimeline):
     13        (WebCore::InspectorTimelineAgent::setDOMCounters):
     14        Switched InspectorTimelineAgent to the new typed event builders.
     15        (WebCore::InspectorTimelineAgent::setNativeHeapStatistics):
     16        * inspector/InspectorTimelineAgent.h:
     17        (InspectorTimelineAgent):
     18
    1192013-03-27  Vsevolod Vlasov  <vsevik@chromium.org>
    220
  • trunk/Source/WebCore/inspector/Inspector.json

    r146777 r146975  
    25992599        "types": [
    26002600            {
     2601                "id": "DOMCounters",
     2602                "type": "object",
     2603                "properties": [
     2604                    { "name": "documents", "type": "integer" },
     2605                    { "name": "nodes", "type": "integer" },
     2606                    { "name": "jsEventListeners", "type": "integer" }
     2607                ],
     2608                "description": "Current values of DOM counters.",
     2609                "hidden": true
     2610            },
     2611            {
    26012612                "id": "TimelineEvent",
    26022613                "type": "object",
     
    26052616                    { "name": "thread", "type": "string", "optional": true, "description": "If present, identifies the thread that produced the event.", "hidden": true },
    26062617                    { "name": "data", "type": "object", "description": "Event data." },
    2607                     { "name": "children", "type": "array", "optional": true, "items": { "$ref": "TimelineEvent" }, "description": "Nested records." }
     2618                    { "name": "children", "type": "array", "optional": true, "items": { "$ref": "TimelineEvent" }, "description": "Nested records." },
     2619                    { "name": "counters", "$ref": "DOMCounters", "optional": true, "hidden": true, "description": "Current values of DOM counters." },
     2620                    { "name": "usedHeapSize", "type": "integer", "optional": true, "hidden": true, "description": "Current size of JS heap." },
     2621                    { "name": "nativeHeapStatistics", "type": "object", "optional": true, "hidden": true, "description": "Native heap statistics." }
    26082622                ],
    26092623                "description": "Timeline record contains information about the recorded activity."
  • trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp

    r146476 r146975  
    541541void InspectorTimelineAgent::innerAddRecordToTimeline(PassRefPtr<InspectorObject> prpRecord, const String& type)
    542542{
    543     RefPtr<InspectorObject> record(prpRecord);
     543    RefPtr<TypeBuilder::Timeline::TimelineEvent> record = TypeBuilder::Timeline::TimelineEvent::runtimeCast(prpRecord);
    544544    record->setString("type", type);
    545545    if (type == TimelineRecordType::Program)
     
    563563}
    564564
    565 void InspectorTimelineAgent::setDOMCounters(InspectorObject* record)
    566 {
    567     record->setNumber("usedHeapSize", getUsedHeapSize());
     565void InspectorTimelineAgent::setDOMCounters(TypeBuilder::Timeline::TimelineEvent* record)
     566{
     567    record->setUsedHeapSize(getUsedHeapSize());
    568568
    569569    if (m_state->getBoolean(TimelineAgentState::includeDomCounters)) {
    570         RefPtr<InspectorObject> counters = InspectorObject::create();
    571         counters->setNumber("nodes", (m_inspectorType == PageInspector) ? InspectorCounters::counterValue(InspectorCounters::NodeCounter) : 0);
    572         counters->setNumber("documents", (m_inspectorType == PageInspector) ? InspectorCounters::counterValue(InspectorCounters::DocumentCounter) : 0);
    573         counters->setNumber("jsEventListeners", ThreadLocalInspectorCounters::current().counterValue(ThreadLocalInspectorCounters::JSEventListenerCounter));
    574         record->setObject("counters", counters.release());
     570        int documentCount = 0;
     571        int nodeCount = 0;
     572        if (m_inspectorType == PageInspector) {
     573            documentCount = InspectorCounters::counterValue(InspectorCounters::DocumentCounter);
     574            nodeCount = InspectorCounters::counterValue(InspectorCounters::NodeCounter);
     575        }
     576        int listenerCount = ThreadLocalInspectorCounters::current().counterValue(ThreadLocalInspectorCounters::JSEventListenerCounter);
     577        RefPtr<TypeBuilder::Timeline::DOMCounters> counters = TypeBuilder::Timeline::DOMCounters::create()
     578            .setDocuments(documentCount)
     579            .setNodes(nodeCount)
     580            .setJsEventListeners(listenerCount);
     581        record->setCounters(counters.release());
    575582    }
    576583}
    577584
    578 void InspectorTimelineAgent::setNativeHeapStatistics(InspectorObject* record)
     585void InspectorTimelineAgent::setNativeHeapStatistics(TypeBuilder::Timeline::TimelineEvent* record)
    579586{
    580587    if (!m_memoryAgent)
     
    591598    MemoryUsageSupport::processMemorySizesInBytes(&privateBytes, &sharedBytes);
    592599    stats->setNumber("PrivateBytes", privateBytes);
    593     record->setObject("nativeHeapStatistics", stats.release());
     600    record->setNativeHeapStatistics(stats.release());
    594601}
    595602
  • trunk/Source/WebCore/inspector/InspectorTimelineAgent.h

    r146476 r146975  
    215215    void pushCurrentRecord(PassRefPtr<InspectorObject>, const String& type, bool captureCallStack, Frame*, bool hasLowLevelDetails = false);
    216216
    217     void setDOMCounters(InspectorObject* record);
    218     void setNativeHeapStatistics(InspectorObject* record);
     217    void setDOMCounters(TypeBuilder::Timeline::TimelineEvent* record);
     218    void setNativeHeapStatistics(TypeBuilder::Timeline::TimelineEvent* record);
    219219    void setFrameIdentifier(InspectorObject* record, Frame*);
    220220    void pushGCEventRecords();
Note: See TracChangeset for help on using the changeset viewer.