Title: [144749] trunk/Source/WebCore
Revision
144749
Author
ca...@chromium.org
Date
2013-03-05 04:23:37 -0800 (Tue, 05 Mar 2013)

Log Message

Web Inspector: [refactoring] set frame identifiers in timeline records early, do not keep them in event stack
https://bugs.webkit.org/show_bug.cgi?id=111345

Reviewed by Pavel Feldman.

* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::pushGCEventRecords):
(WebCore::InspectorTimelineAgent::addRecordToTimeline):
(WebCore::InspectorTimelineAgent::innerAddRecordToTimeline):
(WebCore::InspectorTimelineAgent::setFrameIdentifier):
(WebCore):
(WebCore::InspectorTimelineAgent::didCompleteCurrentRecord):
(WebCore::InspectorTimelineAgent::appendRecord):
(WebCore::InspectorTimelineAgent::pushCurrentRecord):
(WebCore::InspectorTimelineAgent::commitFrameRecord):
* inspector/InspectorTimelineAgent.h:
(WebCore::InspectorTimelineAgent::TimelineRecordEntry::TimelineRecordEntry):
(TimelineRecordEntry):
(InspectorTimelineAgent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (144748 => 144749)


--- trunk/Source/WebCore/ChangeLog	2013-03-05 11:34:38 UTC (rev 144748)
+++ trunk/Source/WebCore/ChangeLog	2013-03-05 12:23:37 UTC (rev 144749)
@@ -1,3 +1,25 @@
+2013-03-04  Andrey Kosyakov  <ca...@chromium.org>
+
+        Web Inspector: [refactoring] set frame identifiers in timeline records early, do not keep them in event stack
+        https://bugs.webkit.org/show_bug.cgi?id=111345
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::pushGCEventRecords):
+        (WebCore::InspectorTimelineAgent::addRecordToTimeline):
+        (WebCore::InspectorTimelineAgent::innerAddRecordToTimeline):
+        (WebCore::InspectorTimelineAgent::setFrameIdentifier):
+        (WebCore):
+        (WebCore::InspectorTimelineAgent::didCompleteCurrentRecord):
+        (WebCore::InspectorTimelineAgent::appendRecord):
+        (WebCore::InspectorTimelineAgent::pushCurrentRecord):
+        (WebCore::InspectorTimelineAgent::commitFrameRecord):
+        * inspector/InspectorTimelineAgent.h:
+        (WebCore::InspectorTimelineAgent::TimelineRecordEntry::TimelineRecordEntry):
+        (TimelineRecordEntry):
+        (InspectorTimelineAgent):
+
 2013-03-05  Tommy Widenflycht  <tom...@google.com>
 
         MediaStream API: Add the getStreamById method on RTCPeerConnection

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (144748 => 144749)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2013-03-05 11:34:38 UTC (rev 144748)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2013-03-05 12:23:37 UTC (rev 144749)
@@ -133,7 +133,7 @@
         RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(timestampFromMicroseconds(i->startTime), m_maxCallStackDepth);
         record->setObject("data", TimelineRecordFactory::createGCEventData(i->collectedBytes));
         record->setNumber("endTime", timestampFromMicroseconds(i->endTime));
-        addRecordToTimeline(record.release(), TimelineRecordType::GCEvent, String());
+        addRecordToTimeline(record.release(), TimelineRecordType::GCEvent);
     }
 }
 
@@ -532,18 +532,16 @@
 }
 #endif // ENABLE(WEB_SOCKETS)
 
-void InspectorTimelineAgent::addRecordToTimeline(PassRefPtr<InspectorObject> record, const String& type, const String& frameId)
+void InspectorTimelineAgent::addRecordToTimeline(PassRefPtr<InspectorObject> record, const String& type)
 {
     commitFrameRecord();
-    innerAddRecordToTimeline(record, type, frameId);
+    innerAddRecordToTimeline(record, type);
 }
 
-void InspectorTimelineAgent::innerAddRecordToTimeline(PassRefPtr<InspectorObject> prpRecord, const String& type, const String& frameId)
+void InspectorTimelineAgent::innerAddRecordToTimeline(PassRefPtr<InspectorObject> prpRecord, const String& type)
 {
     RefPtr<InspectorObject> record(prpRecord);
     record->setString("type", type);
-    if (!frameId.isEmpty())
-        record->setString("frameId", frameId);
     if (type == TimelineRecordType::Program)
         setNativeHeapStatistics(record.get());
     else
@@ -597,6 +595,16 @@
     record->setObject("nativeHeapStatistics", stats.release());
 }
 
+void InspectorTimelineAgent::setFrameIdentifier(InspectorObject* record, Frame* frame)
+{
+    if (!frame || !m_pageAgent)
+        return;
+    String frameId;
+    if (frame && m_pageAgent)
+        frameId = m_pageAgent->frameId(frame);
+    record->setString("frameId", frameId);
+}
+
 void InspectorTimelineAgent::didCompleteCurrentRecord(const String& type)
 {
     // An empty stack could merely mean that the timeline agent was turned on in the middle of
@@ -617,7 +625,7 @@
         size_t usedHeapSizeDelta = getUsedHeapSize() - entry.usedHeapSizeAtStart;
         if (usedHeapSizeDelta)
             entry.record->setNumber("usedHeapSizeDelta", usedHeapSizeDelta);
-        addRecordToTimeline(entry.record, type, entry.frameId);
+        addRecordToTimeline(entry.record, type);
     }
 }
 
@@ -642,10 +650,8 @@
     RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(timestamp(), captureCallStack ? m_maxCallStackDepth : 0);
     record->setObject("data", data);
     record->setString("type", type);
-    String frameId;
-    if (frame && m_pageAgent)
-        frameId = m_pageAgent->frameId(frame);
-    addRecordToTimeline(record.release(), type, frameId);
+    setFrameIdentifier(record.get(), frame);
+    addRecordToTimeline(record.release(), type);
 }
 
 void InspectorTimelineAgent::appendBackgroundThreadRecord(PassRefPtr<InspectorObject> data, const String& type, double startTime, double endTime, const String& threadName)
@@ -664,10 +670,8 @@
     pushGCEventRecords();
     commitFrameRecord();
     RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(timestamp(), captureCallStack ? m_maxCallStackDepth : 0);
-    String frameId;
-    if (frame && m_pageAgent)
-        frameId = m_pageAgent->frameId(frame);
-    m_recordStack.append(TimelineRecordEntry(record.release(), data, InspectorArray::create(), type, frameId, getUsedHeapSize()));
+    setFrameIdentifier(record.get(), frame);
+    m_recordStack.append(TimelineRecordEntry(record.release(), data, InspectorArray::create(), type, getUsedHeapSize()));
     if (hasLowLevelDetails && !m_platformInstrumentationClientInstalledAtStackDepth && !PlatformInstrumentation::hasClient()) {
         m_platformInstrumentationClientInstalledAtStackDepth = m_recordStack.size();
         PlatformInstrumentation::setClient(this);
@@ -680,7 +684,7 @@
         return;
     
     m_pendingFrameRecord->setObject("data", InspectorObject::create());
-    innerAddRecordToTimeline(m_pendingFrameRecord.release(), TimelineRecordType::BeginFrame, "");
+    innerAddRecordToTimeline(m_pendingFrameRecord.release(), TimelineRecordType::BeginFrame);
 }
 
 void InspectorTimelineAgent::clearRecordStack()

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (144748 => 144749)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2013-03-05 11:34:38 UTC (rev 144748)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2013-03-05 12:23:37 UTC (rev 144749)
@@ -186,15 +186,14 @@
     friend class TimelineTraceEventProcessor;
 
     struct TimelineRecordEntry {
-        TimelineRecordEntry(PassRefPtr<InspectorObject> record, PassRefPtr<InspectorObject> data, PassRefPtr<InspectorArray> children, const String& type, const String& frameId, size_t usedHeapSizeAtStart)
-            : record(record), data(data), children(children), type(type), frameId(frameId), usedHeapSizeAtStart(usedHeapSizeAtStart)
+        TimelineRecordEntry(PassRefPtr<InspectorObject> record, PassRefPtr<InspectorObject> data, PassRefPtr<InspectorArray> children, const String& type, size_t usedHeapSizeAtStart)
+            : record(record), data(data), children(children), type(type), usedHeapSizeAtStart(usedHeapSizeAtStart)
         {
         }
         RefPtr<InspectorObject> record;
         RefPtr<InspectorObject> data;
         RefPtr<InspectorArray> children;
         String type;
-        String frameId;
         size_t usedHeapSizeAtStart;
     };
         
@@ -203,17 +202,19 @@
     void appendBackgroundThreadRecord(PassRefPtr<InspectorObject> data, const String& type, double startTime, double endTime, const String& threadName);
     void appendRecord(PassRefPtr<InspectorObject> data, const String& type, bool captureCallStack, Frame*);
     void pushCurrentRecord(PassRefPtr<InspectorObject>, const String& type, bool captureCallStack, Frame*, bool hasLowLevelDetails = false);
+
     void setDOMCounters(InspectorObject* record);
     void setNativeHeapStatistics(InspectorObject* record);
+    void setFrameIdentifier(InspectorObject* record, Frame*);
+    void pushGCEventRecords();
 
     void didCompleteCurrentRecord(const String& type);
 
     void setHeapSizeStatistics(InspectorObject* record);
-    void pushGCEventRecords();
     void commitFrameRecord();
 
-    void addRecordToTimeline(PassRefPtr<InspectorObject>, const String& type, const String& frameId);
-    void innerAddRecordToTimeline(PassRefPtr<InspectorObject>, const String& type, const String& frameId);
+    void addRecordToTimeline(PassRefPtr<InspectorObject>, const String& type);
+    void innerAddRecordToTimeline(PassRefPtr<InspectorObject>, const String& type);
     void clearRecordStack();
 
     double timestamp();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to