Changeset 121767 in webkit
- Timestamp:
- Jul 3, 2012 8:27:06 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r121765 r121767 1 2012-07-03 Eugene Klyuchnikov <eustas.bug@gmail.com> 2 3 Web Inspector: Forward message loop instrumentation data to frontend. 4 https://bugs.webkit.org/show_bug.cgi?id=89584 5 6 Reviewed by Yury Semikhatsky. 7 8 Transmit collected message loop tasks to inspector frontend. 9 Now "Program" should be a top-level event on browsers that 10 support message loop instrumentation. 11 Frontend was changed so that user will not see any changes. 12 13 * inspector/timeline/timeline-enum-stability-expected.txt: 14 1 15 2012-07-03 Vsevolod Vlasov <vsevik@chromium.org> 2 16 -
trunk/LayoutTests/inspector/timeline/timeline-enum-stability-expected.txt
r121763 r121767 5 5 { 6 6 Root : "Root" 7 Program : "Program" 7 8 EventDispatch : "EventDispatch" 8 9 BeginFrame : "BeginFrame" -
trunk/Source/WebCore/ChangeLog
r121766 r121767 1 2012-07-03 Eugene Klyuchnikov <eustas.bug@gmail.com> 2 3 Web Inspector: Forward message loop instrumentation data to frontend. 4 https://bugs.webkit.org/show_bug.cgi?id=89584 5 6 Reviewed by Yury Semikhatsky. 7 8 Transmit collected message loop tasks to inspector frontend. 9 Now "Program" should be a top-level event on browsers that 10 support message loop instrumentation. 11 Frontend was changed so that user will not see any changes. 12 13 * inspector/InspectorTimelineAgent.cpp: 14 (TimelineRecordType): 15 Added new event type - "Program" 16 (WebCore::InspectorTimelineAgent::willProcessTask): 17 Begin "Program" event. 18 (WebCore::InspectorTimelineAgent::didProcessTask): 19 Finish "Program" event. 20 (WebCore::InspectorTimelineAgent::setHeapSizeStatistic): 21 Do not add counters to "Program" events. 22 (WebCore): 23 (WebCore::InspectorTimelineAgent::innerSetHeapSizeStatistic): 24 Renamed from "setHeapSizeStatistic" 25 * inspector/InspectorTimelineAgent.h: 26 (InspectorTimelineAgent): 27 * inspector/front-end/MemoryStatistics.js: 28 (WebInspector.MemoryStatistics.prototype._onRecordAdded): 29 Unwraps "Program" events. 30 (WebInspector.MemoryStatistics.prototype._innerRecordAdded): 31 Renamed from "_onRecordAdded" 32 * inspector/front-end/TimelineFrameController.js: 33 (WebInspector.TimelineFrameController.prototype._addRecord): 34 Unwraps "Program" events. 35 (WebInspector.TimelineFrameController.prototype._innerAddRecord): 36 Renamed from "_addRecord" 37 * inspector/front-end/TimelineModel.js: 38 * inspector/front-end/TimelineOverviewPane.js: 39 (WebInspector.TimelineCategoryStrips.prototype.update.appendRecord): 40 Filter out "Program" category. 41 (WebInspector.TimelineCategoryStrips.prototype.update): 42 * inspector/front-end/TimelinePanel.js: 43 (WebInspector.TimelinePanel.prototype._createStatusbarButtons): 44 Filter out "Program" category. 45 (WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline): 46 Unwraps "Program" events. 47 * inspector/front-end/TimelinePresentationModel.js: 48 (WebInspector.TimelinePresentationModel.categories): 49 Added "Program" category. 50 (WebInspector.TimelinePresentationModel.recordStyle): 51 Ditto. 52 (WebInspector.TimelinePresentationModel.prototype.addRecord): 53 Unwraps "Program" events. 54 (WebInspector.TimelinePresentationModel.prototype._addRecord): 55 Renamed from "addRecord" 56 1 57 2012-07-03 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> 2 58 -
trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp
r121763 r121767 61 61 // Must be kept in sync with WebInspector.TimelineModel.RecordType in TimelineModel.js 62 62 namespace TimelineRecordType { 63 static const char Program[] = "Program"; 64 63 65 static const char EventDispatch[] = "EventDispatch"; 64 66 static const char BeginFrame[] = "BeginFrame"; … … 343 345 recordRaw->setString("frameId", frameId); 344 346 } 345 setHeapSizeStatistic (recordRaw.get());347 setHeapSizeStatistics(recordRaw.get()); 346 348 // FIXME: runtimeCast is a hack. We do it because we can't build TimelineEvent directly now. 347 349 RefPtr<TypeBuilder::Timeline::TimelineEvent> record = TypeBuilder::Timeline::TimelineEvent::runtimeCast(recordRaw.release()); … … 428 430 void InspectorTimelineAgent::willProcessTask() 429 431 { 430 // TODO: Record task processing start time.432 pushCurrentRecord(InspectorObject::create(), TimelineRecordType::Program, false, 0); 431 433 } 432 434 433 435 void InspectorTimelineAgent::didProcessTask() 434 436 { 435 // TODO: Record task processing end time.437 didCompleteCurrentRecord(TimelineRecordType::Program); 436 438 } 437 439 … … 444 446 void InspectorTimelineAgent::innerAddRecordToTimeline(PassRefPtr<InspectorObject> prpRecord, const String& type, const String& frameId) 445 447 { 448 DEFINE_STATIC_LOCAL(String, program, (TimelineRecordType::Program)); 449 446 450 RefPtr<InspectorObject> record(prpRecord); 447 451 record->setString("type", type); 448 452 if (!frameId.isEmpty()) 449 453 record->setString("frameId", frameId); 450 setHeapSizeStatistic(record.get()); 454 if (type != program) 455 setHeapSizeStatistics(record.get()); 456 451 457 if (m_recordStack.isEmpty()) { 452 458 // FIXME: runtimeCast is a hack. We do it because we can't build TimelineEvent directly now. … … 459 465 } 460 466 461 void InspectorTimelineAgent::setHeapSizeStatistic (InspectorObject* record)467 void InspectorTimelineAgent::setHeapSizeStatistics(InspectorObject* record) 462 468 { 463 469 size_t usedHeapSize = 0; -
trunk/Source/WebCore/inspector/InspectorTimelineAgent.h
r121763 r121767 164 164 165 165 void pushCurrentRecord(PassRefPtr<InspectorObject>, const String& type, bool captureCallStack, Frame*); 166 void setHeapSizeStatistic (InspectorObject* record);167 166 void setHeapSizeStatistics(InspectorObject* record); 167 168 168 void didCompleteCurrentRecord(const String& type); 169 169 void appendRecord(PassRefPtr<InspectorObject> data, const String& type, bool captureCallStack, Frame*); -
trunk/Source/WebCore/inspector/front-end/MemoryStatistics.js
r118674 r121767 258 258 _onRecordAdded: function(event) 259 259 { 260 var counters = event.data["counters"]; 261 if (!counters) 262 return; 263 this._counters.push({ 264 time: event.data.endTime || event.data.startTime, 265 documentCount: counters["documents"], 266 nodeCount: counters["nodes"], 267 listenerCount: counters["jsEventListeners"] 268 }); 260 var statistics = this._counters; 261 function addStatistics(record) 262 { 263 var counters = record["counters"]; 264 if (!counters) 265 return; 266 statistics.push({ 267 time: record.endTime || record.startTime, 268 documentCount: counters["documents"], 269 nodeCount: counters["nodes"], 270 listenerCount: counters["jsEventListeners"] 271 }); 272 } 273 WebInspector.TimelinePresentationModel.forAllRecords([event.data], null, addStatistics); 269 274 }, 270 275 -
trunk/Source/WebCore/inspector/front-end/TimelineFrameController.js
r119485 r121767 62 62 _addRecord: function(record) 63 63 { 64 var records; 65 if (record.type === WebInspector.TimelineModel.RecordType.Program) 66 records = record["children"] || []; 67 else 68 records = [record]; 69 records.forEach(this._innerAddRecord, this); 70 }, 71 72 _innerAddRecord: function(record) 73 { 64 74 if (record.type === WebInspector.TimelineModel.RecordType.BeginFrame && this._lastFrame) 65 75 this._flushFrame(record); -
trunk/Source/WebCore/inspector/front-end/TimelineModel.js
r121763 r121767 45 45 WebInspector.TimelineModel.RecordType = { 46 46 Root: "Root", 47 Program: "Program", 47 48 EventDispatch: "EventDispatch", 48 49 -
trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js
r121084 r121767 886 886 var recordEnd = Math.ceil((WebInspector.TimelineModel.endTimeInSeconds(record) - timeOffset) * scale); 887 887 var category = WebInspector.TimelinePresentationModel.categoryForRecord(record); 888 if (category.overviewStripGroupIndex < 0) 889 return; 888 890 var bar = lastBarByGroup[category.overviewStripGroupIndex]; 889 891 // This bar may be merged with previous -- so just adjust the previous bar. -
trunk/Source/WebCore/inspector/front-end/TimelinePanel.js
r121690 r121767 233 233 for (var categoryName in categories) { 234 234 var category = categories[categoryName]; 235 if (category.overviewStripGroupIndex < 0) 236 continue; 235 237 this.statusBarFilters.appendChild(this._createTimelineCategoryStatusBarCheckbox(category, this._onCategoryCheckboxClicked.bind(this, category))); 236 238 } … … 496 498 _innerAddRecordToTimeline: function(record, parentRecord) 497 499 { 498 var formattedRecord= this._presentationModel.addRecord(record, parentRecord);499 ++this._allRecordsCount;500 var records = this._presentationModel.addRecord(record, parentRecord); 501 this._allRecordsCount += records.length; 500 502 var recordTypes = WebInspector.TimelineModel.RecordType; 501 503 var timeStampRecords = this._timeStampRecords; … … 508 510 hasVisibleRecords |= presentationModel.isVisible(record); 509 511 } 510 var records = [ formattedRecord ];511 512 WebInspector.TimelinePresentationModel.forAllRecords(records, processRecord); 513 514 function isAdoptedRecord(record) 515 { 516 return record.parent !== presentationModel.rootRecord; 517 } 512 518 // Tell caller update is necessary either if we added a visible record or if we re-parented a record. 513 return hasVisibleRecords || formattedRecord.parent !== this._presentationModel.rootRecord;519 return hasVisibleRecords || records.some(isAdoptedRecord); 514 520 }, 515 521 -
trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js
r121763 r121767 48 48 return WebInspector.TimelinePresentationModel._categories; 49 49 WebInspector.TimelinePresentationModel._categories = { 50 program: new WebInspector.TimelineCategory("program", WebInspector.UIString("Program"), -1, "#BBBBBB", "#DDDDDD", "#FFFFFF"), 50 51 loading: new WebInspector.TimelineCategory("loading", WebInspector.UIString("Loading"), 0, "#5A8BCC", "#8EB6E9", "#70A2E3"), 51 52 scripting: new WebInspector.TimelineCategory("scripting", WebInspector.UIString("Scripting"), 1, "#D8AA34", "#F3D07A", "#F1C453"), … … 69 70 var recordStyles = {}; 70 71 recordStyles[recordTypes.Root] = { title: "#root", category: categories["loading"] }; 72 recordStyles[recordTypes.Program] = { title: WebInspector.UIString("Program"), category: categories["program"] }; 71 73 recordStyles[recordTypes.EventDispatch] = { title: WebInspector.UIString("Event"), category: categories["scripting"] }; 72 74 recordStyles[recordTypes.BeginFrame] = { title: WebInspector.UIString("Frame Start"), category: categories["rendering"] }; … … 104 106 WebInspector.TimelinePresentationModel.categoryForRecord = function(record) 105 107 { 106 return WebInspector.TimelinePresentationModel.recordStyle(record).category;108 return WebInspector.TimelinePresentationModel.recordStyle(record).category; 107 109 } 108 110 … … 118 120 } 119 121 120 WebInspector.TimelinePresentationModel.forAllRecords = function(recordsArray, callback) 122 /** 123 * @param {Array} recordsArray 124 * @param {?function(*)} preOrderCallback 125 * @param {function(*)=} postOrderCallback 126 */ 127 WebInspector.TimelinePresentationModel.forAllRecords = function(recordsArray, preOrderCallback, postOrderCallback) 121 128 { 122 129 if (!recordsArray) … … 128 135 if (entry.index < records.length) { 129 136 var record = records[entry.index]; 130 if ( callback(record))137 if (preOrderCallback && preOrderCallback(record)) 131 138 return; 132 139 if (record.children) 133 stack.push({array: record.children, index: 0}); 140 stack.push({array: record.children, index: 0, record: record}); 141 else if (postOrderCallback && postOrderCallback(record)) 142 return; 134 143 ++entry.index; 135 } else 144 } else { 145 if (entry.record && postOrderCallback && postOrderCallback(entry.record)) 146 return; 136 147 stack.pop(); 148 } 137 149 } 138 150 } … … 206 218 addRecord: function(record, parentRecord) 207 219 { 220 if (this._minimumRecordTime === -1 || record.startTime < this._minimumRecordTime) 221 this._minimumRecordTime = WebInspector.TimelineModel.startTimeInSeconds(record); 222 223 var records; 224 if (record.type === WebInspector.TimelineModel.RecordType.Program) 225 records = record.children; 226 else 227 records = [record]; 228 229 var formattedRecords = []; 230 var recordsCount = records.length; 231 for (var i = 0; i < recordsCount; ++i) 232 formattedRecords.push(this._innerAddRecord(records[i], parentRecord)); 233 return formattedRecords; 234 }, 235 236 _innerAddRecord: function(record, parentRecord) 237 { 208 238 var connectedToOldRecord = false; 209 239 var recordTypes = WebInspector.TimelineModel.RecordType; 210 211 if (this._minimumRecordTime === -1 || record.startTime < this._minimumRecordTime)212 this._minimumRecordTime = WebInspector.TimelineModel.startTimeInSeconds(record);213 240 214 241 switch (record.type) { … … 258 285 var childrenCount = children ? children.length : 0; 259 286 for (var i = 0; i < childrenCount; ++i) 260 this. addRecord(children[i], formattedRecord);287 this._innerAddRecord(children[i], formattedRecord); 261 288 262 289 formattedRecord.calculateAggregatedStats(WebInspector.TimelinePresentationModel.categories());
Note: See TracChangeset
for help on using the changeset viewer.