Title: [144039] trunk/Source/WebCore
Revision
144039
Author
ca...@chromium.org
Date
2013-02-26 04:42:58 -0800 (Tue, 26 Feb 2013)

Log Message

Web Inspector: display background events on Timeline
https://bugs.webkit.org/show_bug.cgi?id=108599

Reviewed by Pavel Feldman.

- add optional `thread' field to timeline event;
- if thread field is present, display the event as 'background' (hollow bar / list icon), align to nearest foreground event;
- do not account background events in Frame mode of overview.

* inspector/Inspector.json:
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::appendBackgroundThreadRecord):
(WebCore):
* inspector/InspectorTimelineAgent.h:
(InspectorTimelineAgent):
* inspector/front-end/TimelineFrameController.js:
(WebInspector.TimelineFrameController.prototype._addRecord):
* inspector/front-end/TimelinePanel.js:
(WebInspector.TimelineRecordListRow.prototype.update):
(WebInspector.TimelineRecordGraphRow.prototype.update):
* inspector/front-end/TimelinePresentationModel.js:
(WebInspector.TimelinePresentationModel.Record):
(WebInspector.TimelinePresentationModel.insertRetrospecitveRecord):
(WebInspector.TimelinePresentationModel.Record.prototype.get isBackground):
* inspector/front-end/timelinePanel.css:
(.timeline-tree-item.background .timeline-tree-icon):
(.timeline-graph-side.background .timeline-graph-bar):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (144038 => 144039)


--- trunk/Source/WebCore/ChangeLog	2013-02-26 12:33:03 UTC (rev 144038)
+++ trunk/Source/WebCore/ChangeLog	2013-02-26 12:42:58 UTC (rev 144039)
@@ -1,3 +1,33 @@
+2013-02-01  Andrey Kosyakov  <ca...@chromium.org>
+
+        Web Inspector: display background events on Timeline
+        https://bugs.webkit.org/show_bug.cgi?id=108599
+
+        Reviewed by Pavel Feldman.
+
+        - add optional `thread' field to timeline event;
+        - if thread field is present, display the event as 'background' (hollow bar / list icon), align to nearest foreground event;
+        - do not account background events in Frame mode of overview.
+
+        * inspector/Inspector.json:
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::appendBackgroundThreadRecord):
+        (WebCore):
+        * inspector/InspectorTimelineAgent.h:
+        (InspectorTimelineAgent):
+        * inspector/front-end/TimelineFrameController.js:
+        (WebInspector.TimelineFrameController.prototype._addRecord):
+        * inspector/front-end/TimelinePanel.js:
+        (WebInspector.TimelineRecordListRow.prototype.update):
+        (WebInspector.TimelineRecordGraphRow.prototype.update):
+        * inspector/front-end/TimelinePresentationModel.js:
+        (WebInspector.TimelinePresentationModel.Record):
+        (WebInspector.TimelinePresentationModel.insertRetrospecitveRecord):
+        (WebInspector.TimelinePresentationModel.Record.prototype.get isBackground):
+        * inspector/front-end/timelinePanel.css:
+        (.timeline-tree-item.background .timeline-tree-icon):
+        (.timeline-graph-side.background .timeline-graph-bar):
+
 2013-02-26  Kentaro Hara  <hara...@chromium.org>
 
         [V8] Rename BatchedCallback to BatchedMethod

Modified: trunk/Source/WebCore/inspector/Inspector.json (144038 => 144039)


--- trunk/Source/WebCore/inspector/Inspector.json	2013-02-26 12:33:03 UTC (rev 144038)
+++ trunk/Source/WebCore/inspector/Inspector.json	2013-02-26 12:42:58 UTC (rev 144039)
@@ -2595,6 +2595,7 @@
                 "type": "object",
                 "properties": [
                     { "name": "type", "type": "string", "description": "Event type." },
+                    { "name": "thread", "type": "string", "optional": true, "description": "If present, identifies the thread that produced the event." },
                     { "name": "data", "type": "object", "description": "Event data." },
                     { "name": "children", "type": "array", "optional": true, "items": { "$ref": "TimelineEvent" }, "description": "Nested records." }
                 ],

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (144038 => 144039)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2013-02-26 12:33:03 UTC (rev 144038)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2013-02-26 12:42:58 UTC (rev 144039)
@@ -650,6 +650,17 @@
     addRecordToTimeline(record.release(), type, frameId);
 }
 
+void InspectorTimelineAgent::appendBackgroundThreadRecord(PassRefPtr<InspectorObject> data, const String& type, double startTime, double endTime, const String& threadName)
+{
+    RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(timestampFromMicroseconds(startTime), 0);
+    record->setObject("data", data);
+    record->setString("type", type);
+    record->setString("thread", threadName);
+    record->setNumber("endTime", timestampFromMicroseconds(endTime));
+    RefPtr<TypeBuilder::Timeline::TimelineEvent> recordChecked = TypeBuilder::Timeline::TimelineEvent::runtimeCast(record.release());
+    m_frontend->eventRecorded(recordChecked.release());
+}
+
 void InspectorTimelineAgent::pushCurrentRecord(PassRefPtr<InspectorObject> data, const String& type, bool captureCallStack, Frame* frame, bool hasLowLevelDetails)
 {
     pushGCEventRecords();

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (144038 => 144039)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2013-02-26 12:33:03 UTC (rev 144038)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2013-02-26 12:42:58 UTC (rev 144039)
@@ -191,17 +191,20 @@
         
     InspectorTimelineAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorMemoryAgent*, InspectorCompositeState*, InspectorType, InspectorClient*);
 
+    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 didCompleteCurrentRecord(const String& type);
+
+    void setHeapSizeStatistics(InspectorObject* record);
+    void pushGCEventRecords();
     void commitFrameRecord();
-    void appendRecord(PassRefPtr<InspectorObject> data, const String& type, bool captureCallStack, Frame*);
+
     void addRecordToTimeline(PassRefPtr<InspectorObject>, const String& type, const String& frameId);
     void innerAddRecordToTimeline(PassRefPtr<InspectorObject>, const String& type, const String& frameId);
-
-    void pushGCEventRecords();
     void clearRecordStack();
 
 #if ENABLE(WEB_SOCKETS)

Modified: trunk/Source/WebCore/inspector/front-end/TimelineFrameController.js (144038 => 144039)


--- trunk/Source/WebCore/inspector/front-end/TimelineFrameController.js	2013-02-26 12:33:03 UTC (rev 144038)
+++ trunk/Source/WebCore/inspector/front-end/TimelineFrameController.js	2013-02-26 12:42:58 UTC (rev 144039)
@@ -62,6 +62,8 @@
     _addRecord: function(record)
     {
         var records;
+        if (record.isBackground)
+            return;
         if (record.type === WebInspector.TimelineModel.RecordType.Program)
             records = record["children"] || [];
         else

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePanel.js (144038 => 144039)


--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2013-02-26 12:33:03 UTC (rev 144038)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2013-02-26 12:42:58 UTC (rev 144039)
@@ -1372,6 +1372,8 @@
             this.element.addStyleClass("warning");
         else if (record.childHasWarning)
             this.element.addStyleClass("child-warning");
+        if (record.isBackground)
+            this.element.addStyleClass("background");
 
         this._typeElement.textContent = record.title;
 
@@ -1444,7 +1446,12 @@
     update: function(record, isEven, calculator, expandOffset, index)
     {
         this._record = record;
-        this.element.className = "timeline-graph-side timeline-category-" + record.category.name + (isEven ? " even" : "");
+        this.element.className = "timeline-graph-side timeline-category-" + record.category.name;
+        if (isEven)
+            this.element.addStyleClass("even");
+        if (record.isBackground)
+            this.element.addStyleClass("background");
+
         var barPosition = calculator.computeBarGraphWindowPosition(record);
         this._barWithChildrenElement.style.left = barPosition.left + "px";
         this._barWithChildrenElement.style.width = barPosition.widthWithChildren + "px";

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js (144038 => 144039)


--- trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2013-02-26 12:33:03 UTC (rev 144038)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2013-02-26 12:42:58 UTC (rev 144039)
@@ -518,7 +518,10 @@
     this._children = [];
     if (!hidden && parentRecord) {
         this.parent = parentRecord;
-        parentRecord.children.push(this);
+        if (this.isBackground && parentRecord === presentationModel._rootRecord)
+            WebInspector.TimelinePresentationModel.insertRetrospecitveRecord(parentRecord, this);
+        else
+            parentRecord.children.push(this);
     }
     if (origin)
         this._origin = origin;
@@ -618,12 +621,8 @@
                 var openRecord = recordStack[index - 1];
                 if (openRecord.startTime > timeRecord.startTime)
                     continue;
-                function compareStartTime(value, record)
-                {
-                    return value < record.startTime ? -1 : 1;
-                }
                 timeRecord.parent.children.splice(timeRecord.parent.children.indexOf(timeRecord));
-                openRecord.children.splice(insertionIndexForObjectInListSortedByFunction(timeRecord.startTime, openRecord.children, compareStartTime), 0, timeRecord);
+                WebInspector.TimelinePresentationModel.insertRetrospecitveRecord(openRecord, timeRecord);
                 break;
             }
         }
@@ -684,6 +683,16 @@
     }
 }
 
+WebInspector.TimelinePresentationModel.insertRetrospecitveRecord = function(parent, record)
+{
+    function compareStartTime(value, record)
+    {
+        return value < record.startTime ? -1 : 1;
+    }
+    
+    parent.children.splice(insertionIndexForObjectInListSortedByFunction(record.startTime, parent.children, compareStartTime), 0, record);
+}
+
 WebInspector.TimelinePresentationModel.Record.prototype = {
     get lastChildEndTime()
     {
@@ -784,6 +793,14 @@
     },
 
     /**
+     * @return {boolean}
+     */
+    get isBackground()
+    {
+        return !!this._record.thread;
+    },
+
+    /**
      * @return {Object}
      */
     get data()

Modified: trunk/Source/WebCore/inspector/front-end/timelinePanel.css (144038 => 144039)


--- trunk/Source/WebCore/inspector/front-end/timelinePanel.css	2013-02-26 12:33:03 UTC (rev 144038)
+++ trunk/Source/WebCore/inspector/front-end/timelinePanel.css	2013-02-26 12:42:58 UTC (rev 144039)
@@ -267,6 +267,10 @@
     position: absolute;
 }
 
+.timeline-tree-item.background .timeline-tree-icon {
+    background: none !important;
+}
+
 .timeline-tree-item.even {
     background-color: rgba(0, 0, 0, 0.05);
 }
@@ -358,6 +362,11 @@
     opacity: 0.7;
 }
 
+.timeline-graph-side.background .timeline-graph-bar {
+    background: transparent !important;
+    border-width: 2px;
+}
+
 .timeline-graph-side.even {
     background-color: rgba(0, 0, 0, 0.05);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to