OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 LatencyInfoFlow: "LatencyInfo.Flow", | 153 LatencyInfoFlow: "LatencyInfo.Flow", |
154 InputLatencyMouseMove: "InputLatency::MouseMove", | 154 InputLatencyMouseMove: "InputLatency::MouseMove", |
155 InputLatencyMouseWheel: "InputLatency::MouseWheel", | 155 InputLatencyMouseWheel: "InputLatency::MouseWheel", |
156 ImplSideFling: "InputHandlerProxy::HandleGestureFling::started", | 156 ImplSideFling: "InputHandlerProxy::HandleGestureFling::started", |
157 GCIdleLazySweep: "ThreadState::performIdleLazySweep", | 157 GCIdleLazySweep: "ThreadState::performIdleLazySweep", |
158 GCCompleteSweep: "ThreadState::completeSweep", | 158 GCCompleteSweep: "ThreadState::completeSweep", |
159 GCCollectGarbage: "BlinkGCMarking", | 159 GCCollectGarbage: "BlinkGCMarking", |
160 | 160 |
161 // CpuProfile is a virtual event created on frontend to support | 161 // CpuProfile is a virtual event created on frontend to support |
162 // serialization of CPU Profiles within tracing timeline data. | 162 // serialization of CPU Profiles within tracing timeline data. |
163 CpuProfile: "CpuProfile" | 163 CpuProfile: "CpuProfile", |
164 | |
165 Extension: "Extension" | |
caseq
2016/07/11 18:58:38
This shouldn't be necessary.
| |
164 } | 166 } |
165 | 167 |
166 WebInspector.TimelineModel.Category = { | 168 WebInspector.TimelineModel.Category = { |
167 Console: "blink.console", | 169 Console: "blink.console", |
168 UserTiming: "blink.user_timing", | 170 UserTiming: "blink.user_timing", |
169 LatencyInfo: "latencyInfo" | 171 LatencyInfo: "latencyInfo" |
170 }; | 172 }; |
171 | 173 |
172 /** | 174 /** |
173 * @enum {string} | 175 * @enum {string} |
174 */ | 176 */ |
175 WebInspector.TimelineModel.WarningType = { | 177 WebInspector.TimelineModel.WarningType = { |
176 ForcedStyle: "ForcedStyle", | 178 ForcedStyle: "ForcedStyle", |
177 ForcedLayout: "ForcedLayout", | 179 ForcedLayout: "ForcedLayout", |
178 IdleDeadlineExceeded: "IdleDeadlineExceeded", | 180 IdleDeadlineExceeded: "IdleDeadlineExceeded", |
179 V8Deopt: "V8Deopt" | 181 V8Deopt: "V8Deopt" |
180 } | 182 } |
181 | 183 |
182 WebInspector.TimelineModel.MainThreadName = "main"; | 184 WebInspector.TimelineModel.MainThreadName = "main"; |
185 WebInspector.TimelineModel.ExtensionThreadName = "extension"; | |
caseq
2016/07/11 18:58:38
ditto.
| |
183 WebInspector.TimelineModel.WorkerThreadName = "DedicatedWorker Thread"; | 186 WebInspector.TimelineModel.WorkerThreadName = "DedicatedWorker Thread"; |
184 WebInspector.TimelineModel.RendererMainThreadName = "CrRendererMain"; | 187 WebInspector.TimelineModel.RendererMainThreadName = "CrRendererMain"; |
185 | 188 |
186 /** | 189 /** |
187 * @enum {symbol} | 190 * @enum {symbol} |
188 */ | 191 */ |
189 WebInspector.TimelineModel.AsyncEventGroup = { | 192 WebInspector.TimelineModel.AsyncEventGroup = { |
190 animation: Symbol("animation"), | 193 animation: Symbol("animation"), |
191 console: Symbol("console"), | 194 console: Symbol("console"), |
192 userTiming: Symbol("userTiming"), | 195 userTiming: Symbol("userTiming"), |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
474 * @return {?WebInspector.Target} | 477 * @return {?WebInspector.Target} |
475 */ | 478 */ |
476 target: function() | 479 target: function() |
477 { | 480 { |
478 // FIXME: Consider returning null for loaded traces. | 481 // FIXME: Consider returning null for loaded traces. |
479 return WebInspector.targetManager.targets()[0]; | 482 return WebInspector.targetManager.targets()[0]; |
480 }, | 483 }, |
481 | 484 |
482 /** | 485 /** |
483 * @param {!WebInspector.TracingModel} tracingModel | 486 * @param {!WebInspector.TracingModel} tracingModel |
487 * @param {!Array.<!WebInspector.ExtensionTraceProvider>} traceProviders | |
484 * @param {boolean=} produceTraceStartedInPage | 488 * @param {boolean=} produceTraceStartedInPage |
485 */ | 489 */ |
486 setEvents: function(tracingModel, produceTraceStartedInPage) | 490 setEvents: function(tracingModel, traceProviders, produceTraceStartedInPage) |
487 { | 491 { |
488 this.reset(); | 492 this.reset(); |
489 this._resetProcessingState(); | 493 this._resetProcessingState(); |
490 | 494 |
491 this._minimumRecordTime = tracingModel.minimumRecordTime(); | 495 this._minimumRecordTime = tracingModel.minimumRecordTime(); |
492 this._maximumRecordTime = tracingModel.maximumRecordTime(); | 496 this._maximumRecordTime = tracingModel.maximumRecordTime(); |
493 | 497 |
494 var metadataEvents = this._processMetadataEvents(tracingModel, !!produce TraceStartedInPage); | 498 var metadataEvents = this._processMetadataEvents(tracingModel, !!produce TraceStartedInPage); |
495 var startTime = 0; | 499 var startTime = 0; |
496 for (var i = 0, length = metadataEvents.page.length; i < length; i++) { | 500 for (var i = 0, length = metadataEvents.page.length; i < length; i++) { |
497 var metaEvent = metadataEvents.page[i]; | 501 var metaEvent = metadataEvents.page[i]; |
498 var process = metaEvent.thread.process(); | 502 var process = metaEvent.thread.process(); |
499 var endTime = i + 1 < length ? metadataEvents.page[i + 1].startTime : Infinity; | 503 var endTime = i + 1 < length ? metadataEvents.page[i + 1].startTime : Infinity; |
500 this._currentPage = metaEvent.args["data"] && metaEvent.args["data"] ["page"]; | 504 this._currentPage = metaEvent.args["data"] && metaEvent.args["data"] ["page"]; |
501 for (var thread of process.sortedThreads()) { | 505 for (var thread of process.sortedThreads()) { |
502 if (thread.name() === WebInspector.TimelineModel.WorkerThreadNam e && !metadataEvents.workers.some(function(e) { return e.args["data"]["workerThr eadId"] === thread.id(); })) | 506 if (thread.name() === WebInspector.TimelineModel.WorkerThreadNam e && !metadataEvents.workers.some(function(e) { return e.args["data"]["workerThr eadId"] === thread.id(); })) |
503 continue; | 507 continue; |
504 this._processThreadEvents(startTime, endTime, metaEvent.thread, thread); | 508 this._processThreadEvents(startTime, endTime, metaEvent.thread, thread); |
505 } | 509 } |
506 startTime = endTime; | 510 startTime = endTime; |
507 } | 511 } |
508 this._inspectedTargetEvents.sort(WebInspector.TracingModel.Event.compare StartTime); | 512 this._inspectedTargetEvents.sort(WebInspector.TracingModel.Event.compare StartTime); |
509 | 513 |
510 this._processBrowserEvents(tracingModel); | 514 this._processBrowserEvents(tracingModel); |
515 this._processExtensionEvents(traceProviders); | |
511 this._buildTimelineRecords(); | 516 this._buildTimelineRecords(); |
512 this._buildGPUEvents(tracingModel); | 517 this._buildGPUEvents(tracingModel); |
513 this._insertFirstPaintEvent(); | 518 this._insertFirstPaintEvent(); |
514 this._resetProcessingState(); | 519 this._resetProcessingState(); |
515 }, | 520 }, |
516 | 521 |
517 /** | 522 /** |
518 * @param {!WebInspector.TracingModel} tracingModel | 523 * @param {!WebInspector.TracingModel} tracingModel |
519 * @param {boolean} produceTraceStartedInPage | 524 * @param {boolean} produceTraceStartedInPage |
520 * @return {!WebInspector.TimelineModel.MetadataEvents} | 525 * @return {!WebInspector.TimelineModel.MetadataEvents} |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
621 if (!browserMain) | 626 if (!browserMain) |
622 return; | 627 return; |
623 // Disregard regular events, we don't need them yet, but still process t o get proper metadata. | 628 // Disregard regular events, we don't need them yet, but still process t o get proper metadata. |
624 browserMain.events().forEach(this._processBrowserEvent, this); | 629 browserMain.events().forEach(this._processBrowserEvent, this); |
625 /** @type {!Map<!WebInspector.TimelineModel.AsyncEventGroup, !Array<!Web Inspector.TracingModel.AsyncEvent>>} */ | 630 /** @type {!Map<!WebInspector.TimelineModel.AsyncEventGroup, !Array<!Web Inspector.TracingModel.AsyncEvent>>} */ |
626 var asyncEventsByGroup = new Map(); | 631 var asyncEventsByGroup = new Map(); |
627 this._processAsyncEvents(asyncEventsByGroup, browserMain.asyncEvents()); | 632 this._processAsyncEvents(asyncEventsByGroup, browserMain.asyncEvents()); |
628 this._mergeAsyncEvents(this._mainThreadAsyncEventsByGroup, asyncEventsBy Group); | 633 this._mergeAsyncEvents(this._mainThreadAsyncEventsByGroup, asyncEventsBy Group); |
629 }, | 634 }, |
630 | 635 |
636 /** | |
637 * @param {!Array.<!WebInspector.ExtensionTraceProvider>} traceProviders | |
638 */ | |
639 _processExtensionEvents: function(traceProviders) | |
640 { | |
641 for (var traceProvider of traceProviders) { | |
642 traceProvider.tracingModel.threadByName("Extension", "Thread 0").eve nts().forEach(function(entry) { | |
643 this._extensionEvents.push(entry); | |
644 }, this); | |
645 } | |
646 }, | |
647 | |
631 _buildTimelineRecords: function() | 648 _buildTimelineRecords: function() |
632 { | 649 { |
633 var topLevelRecords = this._buildTimelineRecordsForThread(this.mainThrea dEvents()); | 650 var topLevelRecords = this._buildTimelineRecordsForThread(this.mainThrea dEvents()); |
634 for (var i = 0; i < topLevelRecords.length; i++) { | 651 for (var i = 0; i < topLevelRecords.length; i++) { |
635 var record = topLevelRecords[i]; | 652 var record = topLevelRecords[i]; |
636 if (WebInspector.TracingModel.isTopLevelEvent(record.traceEvent())) | 653 if (WebInspector.TracingModel.isTopLevelEvent(record.traceEvent())) |
637 this._mainThreadTasks.push(record); | 654 this._mainThreadTasks.push(record); |
638 } | 655 } |
639 | 656 |
640 /** | 657 /** |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1068 events = events.mergeOrdered(source.get(group) || [], WebInspector.T racingModel.Event.compareStartAndEndTime); | 1085 events = events.mergeOrdered(source.get(group) || [], WebInspector.T racingModel.Event.compareStartAndEndTime); |
1069 target.set(group, events); | 1086 target.set(group, events); |
1070 } | 1087 } |
1071 }, | 1088 }, |
1072 | 1089 |
1073 reset: function() | 1090 reset: function() |
1074 { | 1091 { |
1075 this._virtualThreads = []; | 1092 this._virtualThreads = []; |
1076 /** @type {!Array<!WebInspector.TracingModel.Event>} */ | 1093 /** @type {!Array<!WebInspector.TracingModel.Event>} */ |
1077 this._mainThreadEvents = []; | 1094 this._mainThreadEvents = []; |
1095 /** @type {!Array<!WebInspector.TracingModel.Event>} */ | |
1096 this._extensionEvents = []; | |
1078 /** @type {!Map<!WebInspector.TimelineModel.AsyncEventGroup, !Array<!Web Inspector.TracingModel.AsyncEvent>>} */ | 1097 /** @type {!Map<!WebInspector.TimelineModel.AsyncEventGroup, !Array<!Web Inspector.TracingModel.AsyncEvent>>} */ |
1079 this._mainThreadAsyncEventsByGroup = new Map(); | 1098 this._mainThreadAsyncEventsByGroup = new Map(); |
1080 /** @type {!Array<!WebInspector.TracingModel.Event>} */ | 1099 /** @type {!Array<!WebInspector.TracingModel.Event>} */ |
1081 this._inspectedTargetEvents = []; | 1100 this._inspectedTargetEvents = []; |
1082 /** @type {!Array<!WebInspector.TimelineModel.Record>} */ | 1101 /** @type {!Array<!WebInspector.TimelineModel.Record>} */ |
1083 this._records = []; | 1102 this._records = []; |
1084 /** @type {!Array<!WebInspector.TimelineModel.Record>} */ | 1103 /** @type {!Array<!WebInspector.TimelineModel.Record>} */ |
1085 this._mainThreadTasks = []; | 1104 this._mainThreadTasks = []; |
1086 /** @type {!Array<!WebInspector.TracingModel.Event>} */ | 1105 /** @type {!Array<!WebInspector.TracingModel.Event>} */ |
1087 this._gpuEvents = []; | 1106 this._gpuEvents = []; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1123 | 1142 |
1124 /** | 1143 /** |
1125 * @return {!Array.<!WebInspector.TracingModel.Event>} | 1144 * @return {!Array.<!WebInspector.TracingModel.Event>} |
1126 */ | 1145 */ |
1127 mainThreadEvents: function() | 1146 mainThreadEvents: function() |
1128 { | 1147 { |
1129 return this._mainThreadEvents; | 1148 return this._mainThreadEvents; |
1130 }, | 1149 }, |
1131 | 1150 |
1132 /** | 1151 /** |
1152 * @return {!Array.<!WebInspector.TracingModel.Event>} | |
1153 */ | |
1154 extensionEvents: function() | |
1155 { | |
1156 return this._extensionEvents; | |
1157 }, | |
1158 | |
1159 /** | |
1133 * @param {!Array.<!WebInspector.TracingModel.Event>} events | 1160 * @param {!Array.<!WebInspector.TracingModel.Event>} events |
1134 */ | 1161 */ |
1135 _setMainThreadEvents: function(events) | 1162 _setMainThreadEvents: function(events) |
1136 { | 1163 { |
1137 this._mainThreadEvents = events; | 1164 this._mainThreadEvents = events; |
1138 }, | 1165 }, |
1139 | 1166 |
1140 /** | 1167 /** |
1141 * @return {!Map<!WebInspector.TimelineModel.AsyncEventGroup, !Array.<!WebIn spector.TracingModel.AsyncEvent>>} | 1168 * @return {!Map<!WebInspector.TimelineModel.AsyncEventGroup, !Array.<!WebIn spector.TracingModel.AsyncEvent>>} |
1142 */ | 1169 */ |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1748 if (!id) | 1775 if (!id) |
1749 return; | 1776 return; |
1750 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */ | 1777 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */ |
1751 var initiatorMap = this._initiatorByType.get(initiatorType); | 1778 var initiatorMap = this._initiatorByType.get(initiatorType); |
1752 if (isInitiator) | 1779 if (isInitiator) |
1753 initiatorMap.set(id, event); | 1780 initiatorMap.set(id, event); |
1754 else | 1781 else |
1755 event.initiator = initiatorMap.get(id) || null; | 1782 event.initiator = initiatorMap.get(id) || null; |
1756 } | 1783 } |
1757 } | 1784 } |
OLD | NEW |