Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(456)

Side by Side Diff: Source/devtools/front_end/timeline/TimelineModel.js

Issue 1305373004: DevTools: move session logic from TracingModel to TimelineModel (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: review comments addressed Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 WebInspector.TimelineModel.Events = { 157 WebInspector.TimelineModel.Events = {
158 RecordsCleared: "RecordsCleared", 158 RecordsCleared: "RecordsCleared",
159 RecordingStarted: "RecordingStarted", 159 RecordingStarted: "RecordingStarted",
160 RecordingStopped: "RecordingStopped", 160 RecordingStopped: "RecordingStopped",
161 RecordFilterChanged: "RecordFilterChanged", 161 RecordFilterChanged: "RecordFilterChanged",
162 BufferUsage: "BufferUsage", 162 BufferUsage: "BufferUsage",
163 RetrieveEventsProgress: "RetrieveEventsProgress" 163 RetrieveEventsProgress: "RetrieveEventsProgress"
164 } 164 }
165 165
166 WebInspector.TimelineModel.MainThreadName = "main"; 166 WebInspector.TimelineModel.MainThreadName = "main";
167
168 WebInspector.TimelineModel.WorkerThreadName = "DedicatedWorker Thread"; 167 WebInspector.TimelineModel.WorkerThreadName = "DedicatedWorker Thread";
168 WebInspector.TimelineModel.RendererMainThreadName = "CrRendererMain";
169 169
170 /** 170 /**
171 * @param {!Array.<!WebInspector.TracingModel.Event>} events 171 * @param {!Array.<!WebInspector.TracingModel.Event>} events
172 * @param {function(!WebInspector.TracingModel.Event)} onStartEvent 172 * @param {function(!WebInspector.TracingModel.Event)} onStartEvent
173 * @param {function(!WebInspector.TracingModel.Event)} onEndEvent 173 * @param {function(!WebInspector.TracingModel.Event)} onEndEvent
174 * @param {function(!WebInspector.TracingModel.Event,?WebInspector.TracingModel. Event)=} onInstantEvent 174 * @param {function(!WebInspector.TracingModel.Event,?WebInspector.TracingModel. Event)=} onInstantEvent
175 */ 175 */
176 WebInspector.TimelineModel.forEachEvent = function(events, onStartEvent, onEndEv ent, onInstantEvent) 176 WebInspector.TimelineModel.forEachEvent = function(events, onStartEvent, onEndEv ent, onInstantEvent)
177 { 177 {
178 var stack = []; 178 var stack = [];
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 if (postOrderCallback && postOrderCallback(record, depth)) 217 if (postOrderCallback && postOrderCallback(record, depth))
218 return true; 218 return true;
219 } 219 }
220 return false; 220 return false;
221 } 221 }
222 return processRecords(recordsArray, 0); 222 return processRecords(recordsArray, 0);
223 } 223 }
224 224
225 WebInspector.TimelineModel.TransferChunkLengthBytes = 5000000; 225 WebInspector.TimelineModel.TransferChunkLengthBytes = 5000000;
226 226
227 WebInspector.TimelineModel.DevToolsMetadataEvent = {
228 TracingStartedInPage: "TracingStartedInPage",
229 TracingSessionIdForWorker: "TracingSessionIdForWorker",
230 };
231
227 /** 232 /**
228 * @constructor 233 * @constructor
229 * @param {string} name 234 * @param {string} name
230 */ 235 */
231 WebInspector.TimelineModel.VirtualThread = function(name) 236 WebInspector.TimelineModel.VirtualThread = function(name)
232 { 237 {
233 this.name = name; 238 this.name = name;
234 /** @type {!Array<!WebInspector.TracingModel.Event>} */ 239 /** @type {!Array<!WebInspector.TracingModel.Event>} */
235 this.events = []; 240 this.events = [];
236 /** @type {!Map<!WebInspector.AsyncEventGroup, !Array<!WebInspector.TracingM odel.AsyncEvent>>} */ 241 /** @type {!Map<!WebInspector.AsyncEventGroup, !Array<!WebInspector.TracingM odel.AsyncEvent>>} */
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 { 293 {
289 var initiator = this._event.initiator; 294 var initiator = this._event.initiator;
290 return initiator ? initiator._timelineRecord : null; 295 return initiator ? initiator._timelineRecord : null;
291 }, 296 },
292 297
293 /** 298 /**
294 * @return {?WebInspector.Target} 299 * @return {?WebInspector.Target}
295 */ 300 */
296 target: function() 301 target: function()
297 { 302 {
298 return this._event.thread.target(); 303 var threadName = this._event.thread.name();
304 //FIXME: correctly specify target
305 return threadName === WebInspector.TimelineModel.RendererMainThreadName ? WebInspector.targetManager.targets()[0] || null : null;
299 }, 306 },
300 307
301 /** 308 /**
302 * @return {number} 309 * @return {number}
303 */ 310 */
304 selfTime: function() 311 selfTime: function()
305 { 312 {
306 return this._event.selfTime; 313 return this._event.selfTime;
307 }, 314 },
308 315
(...skipping 11 matching lines...) Expand all
320 startTime: function() 327 startTime: function()
321 { 328 {
322 return this._event.startTime; 329 return this._event.startTime;
323 }, 330 },
324 331
325 /** 332 /**
326 * @return {string} 333 * @return {string}
327 */ 334 */
328 thread: function() 335 thread: function()
329 { 336 {
330 if (this._event.thread.name() === "CrRendererMain") 337 if (this._event.thread.name() === WebInspector.TimelineModel.RendererMai nThreadName)
331 return WebInspector.TimelineModel.MainThreadName; 338 return WebInspector.TimelineModel.MainThreadName;
332 return this._event.thread.name(); 339 return this._event.thread.name();
333 }, 340 },
334 341
335 /** 342 /**
336 * @return {number} 343 * @return {number}
337 */ 344 */
338 endTime: function() 345 endTime: function()
339 { 346 {
340 return this._endTime || this._event.endTime || this._event.startTime; 347 return this._endTime || this._event.endTime || this._event.startTime;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 448
442 /** 449 /**
443 * @return {!WebInspector.TimelineModel} 450 * @return {!WebInspector.TimelineModel}
444 */ 451 */
445 timelineModel: function() 452 timelineModel: function()
446 { 453 {
447 return this._model; 454 return this._model;
448 } 455 }
449 } 456 }
450 457
458 /** @typedef {!{page: !Array<!WebInspector.TracingModel.Event>, workers: !Array< !WebInspector.TracingModel.Event>}} */
459 WebInspector.TimelineModel.MetadataEvents;
460
451 WebInspector.TimelineModel.prototype = { 461 WebInspector.TimelineModel.prototype = {
452 /** 462 /**
453 * @param {boolean} captureCauses 463 * @param {boolean} captureCauses
454 * @param {boolean} enableJSSampling 464 * @param {boolean} enableJSSampling
455 * @param {boolean} captureMemory 465 * @param {boolean} captureMemory
456 * @param {boolean} capturePictures 466 * @param {boolean} capturePictures
457 * @param {boolean} captureFilmStrip 467 * @param {boolean} captureFilmStrip
458 */ 468 */
459 startRecording: function(captureCauses, enableJSSampling, captureMemory, cap turePictures, captureFilmStrip) 469 startRecording: function(captureCauses, enableJSSampling, captureMemory, cap turePictures, captureFilmStrip)
460 { 470 {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 581
572 /** 582 /**
573 * @return {!Array.<!WebInspector.TimelineModel.Record>} 583 * @return {!Array.<!WebInspector.TimelineModel.Record>}
574 */ 584 */
575 records: function() 585 records: function()
576 { 586 {
577 return this._records; 587 return this._records;
578 }, 588 },
579 589
580 /** 590 /**
591 * @return {?string}
592 */
593 sessionId: function()
594 {
595 return this._sessionId;
596 },
597
598 /**
581 * @return {?WebInspector.Target} 599 * @return {?WebInspector.Target}
582 */ 600 */
583 target: function() 601 target: function()
584 { 602 {
585 // FIXME: Consider returning null for loaded traces. 603 // FIXME: Consider returning null for loaded traces.
586 return this._targets[0]; 604 return this._targets[0];
587 }, 605 },
588 606
589 /** 607 /**
590 * @param {!Array.<!WebInspector.TracingManager.EventPayload>} events 608 * @param {!Array.<!WebInspector.TracingManager.EventPayload>} events
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 { 768 {
751 if (!cpuProfile) 769 if (!cpuProfile)
752 return; 770 return;
753 if (!this._cpuProfiles) 771 if (!this._cpuProfiles)
754 this._cpuProfiles = new Map(); 772 this._cpuProfiles = new Map();
755 this._cpuProfiles.set(targetId, cpuProfile); 773 this._cpuProfiles.set(targetId, cpuProfile);
756 }, 774 },
757 775
758 _didStopRecordingTraceEvents: function() 776 _didStopRecordingTraceEvents: function()
759 { 777 {
760 this._injectCpuProfileEvents(); 778 var metadataEvents = this._processMetadataEvents();
779 this._injectCpuProfileEvents(metadataEvents);
761 this._tracingModel.tracingComplete(); 780 this._tracingModel.tracingComplete();
762 781
763 var metaEvents = this._tracingModel.devtoolsPageMetadataEvents();
764 var workerMetadataEvents = this._tracingModel.devtoolsWorkerMetadataEven ts();
765
766 this._resetProcessingState(); 782 this._resetProcessingState();
767 var startTime = 0; 783 var startTime = 0;
768 for (var i = 0, length = metaEvents.length; i < length; i++) { 784 for (var i = 0, length = metadataEvents.page.length; i < length; i++) {
769 var metaEvent = metaEvents[i]; 785 var metaEvent = metadataEvents.page[i];
770 var process = metaEvent.thread.process(); 786 var process = metaEvent.thread.process();
771 var endTime = i + 1 < length ? metaEvents[i + 1].startTime : Infinit y; 787 var endTime = i + 1 < length ? metadataEvents.page[i + 1].startTime : Infinity;
772 this._currentPage = metaEvent.args["data"] && metaEvent.args["data"] ["page"]; 788 this._currentPage = metaEvent.args["data"] && metaEvent.args["data"] ["page"];
773 for (var thread of process.sortedThreads()) { 789 for (var thread of process.sortedThreads()) {
774 if (thread.name() === WebInspector.TimelineModel.WorkerThreadNam e && !workerMetadataEvents.some(function(e) { return e.args["data"]["workerThrea dId"] === thread.id(); })) 790 if (thread.name() === WebInspector.TimelineModel.WorkerThreadNam e && !metadataEvents.workers.some(function(e) { return e.args["data"]["workerThr eadId"] === thread.id(); }))
775 continue; 791 continue;
776 this._processThreadEvents(startTime, endTime, metaEvent.thread, thread); 792 this._processThreadEvents(startTime, endTime, metaEvent.thread, thread);
777 } 793 }
778 startTime = endTime; 794 startTime = endTime;
779 } 795 }
780 this._inspectedTargetEvents.sort(WebInspector.TracingModel.Event.compare StartTime); 796 this._inspectedTargetEvents.sort(WebInspector.TracingModel.Event.compare StartTime);
781 797
782 this._cpuProfiles = null; 798 this._cpuProfiles = null;
783 this._buildTimelineRecords(); 799 this._buildTimelineRecords();
784 this._buildGPUTasks(); 800 this._buildGPUTasks();
785 this._insertFirstPaintEvent(); 801 this._insertFirstPaintEvent();
786 this._resetProcessingState(); 802 this._resetProcessingState();
787 803
788 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStopped); 804 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStopped);
789 }, 805 },
790 806
791 /** 807 /**
808 * @return {!WebInspector.TimelineModel.MetadataEvents}
809 */
810 _processMetadataEvents: function()
811 {
812 var metadataEvents = this._tracingModel.devToolsMetadataEvents();
813
814 var pageDevToolsMetadataEvents = [];
815 var workersDevToolsMetadataEvents = [];
816 for (var event of metadataEvents) {
817 if (event.name === WebInspector.TimelineModel.DevToolsMetadataEvent. TracingStartedInPage)
818 pageDevToolsMetadataEvents.push(event);
819 else if (event.name === WebInspector.TimelineModel.DevToolsMetadataE vent.TracingSessionIdForWorker)
820 workersDevToolsMetadataEvents.push(event);
821 }
822 if (!pageDevToolsMetadataEvents.length) {
823 // The trace is probably coming not from DevTools. Make a mock Metad ata event.
824 var pageMetaEvent = this._loadedFromFile ? this._makeMockPageMetadat aEvent() : null;
825 if (!pageMetaEvent) {
826 console.error(WebInspector.TimelineModel.DevToolsMetadataEvent.T racingStartedInPage + " event not found.");
827 return {page: [], workers: []};
828 }
829 pageDevToolsMetadataEvents.push(pageMetaEvent);
830 }
831 var sessionId = pageDevToolsMetadataEvents[0].args["sessionId"] || pageD evToolsMetadataEvents[0].args["data"]["sessionId"];
832 this._sessionId = sessionId;
833
834 var mismatchingIds = new Set();
835 /**
836 * @param {!WebInspector.TracingModel.Event} event
837 * @return {boolean}
838 */
839 function checkSessionId(event)
840 {
841 var args = event.args;
842 // FIXME: put sessionId into args["data"] for TracingStartedInPage e vent.
843 if (args["data"])
844 args = args["data"];
845 var id = args["sessionId"];
846 if (id === sessionId)
847 return true;
848 mismatchingIds.add(id);
849 return false;
850 }
851 var result = {
852 page: pageDevToolsMetadataEvents.filter(checkSessionId).sort(WebInsp ector.TracingModel.Event.compareStartTime),
853 workers: workersDevToolsMetadataEvents.filter(checkSessionId).sort(W ebInspector.TracingModel.Event.compareStartTime)
854 };
855 if (mismatchingIds.size)
856 WebInspector.console.error("Timeline recording was started in more t han one page simultaneously. Session id mismatch: " + this._sessionId + " and " + mismatchingIds.valuesArray() + ".");
857 return result;
858 },
859
860 /**
861 * @return {?WebInspector.TracingModel.Event}
862 */
863 _makeMockPageMetadataEvent: function()
864 {
865 var rendererMainThreadName = WebInspector.TimelineModel.RendererMainThre adName;
866 // FIXME: pick up the first renderer process for now.
867 var process = Object.values(this._tracingModel.sortedProcesses()).filter (function(p) { return p.threadByName(rendererMainThreadName); })[0];
868 var thread = process && process.threadByName(rendererMainThreadName);
869 if (!thread)
870 return null;
871 var pageMetaEvent = new WebInspector.TracingModel.Event(
872 WebInspector.TracingModel.DevToolsMetadataEventCategory,
873 WebInspector.TimelineModel.DevToolsMetadataEvent.TracingStartedInPag e,
874 WebInspector.TracingModel.Phase.Metadata,
875 this._tracingModel.minimumRecordTime(), thread);
876 pageMetaEvent.addArgs({"data": {"sessionId": "mockSessionId"}});
877 return pageMetaEvent;
878 },
879
880 /**
792 * @param {number} pid 881 * @param {number} pid
793 * @param {number} tid 882 * @param {number} tid
794 * @param {?ProfilerAgent.CPUProfile} cpuProfile 883 * @param {?ProfilerAgent.CPUProfile} cpuProfile
795 */ 884 */
796 _injectCpuProfileEvent: function(pid, tid, cpuProfile) 885 _injectCpuProfileEvent: function(pid, tid, cpuProfile)
797 { 886 {
798 if (!cpuProfile) 887 if (!cpuProfile)
799 return; 888 return;
800 var cpuProfileEvent = /** @type {!WebInspector.TracingManager.EventPaylo ad} */ ({ 889 var cpuProfileEvent = /** @type {!WebInspector.TracingManager.EventPaylo ad} */ ({
801 cat: WebInspector.TracingModel.DevToolsMetadataEventCategory, 890 cat: WebInspector.TracingModel.DevToolsMetadataEventCategory,
802 ph: WebInspector.TracingModel.Phase.Instant, 891 ph: WebInspector.TracingModel.Phase.Instant,
803 ts: this._tracingModel.maximumRecordTime() * 1000, 892 ts: this._tracingModel.maximumRecordTime() * 1000,
804 pid: pid, 893 pid: pid,
805 tid: tid, 894 tid: tid,
806 name: WebInspector.TimelineModel.RecordType.CpuProfile, 895 name: WebInspector.TimelineModel.RecordType.CpuProfile,
807 args: { data: { cpuProfile: cpuProfile } } 896 args: { data: { cpuProfile: cpuProfile } }
808 }); 897 });
809 this._tracingModel.addEvents([cpuProfileEvent]); 898 this._tracingModel.addEvents([cpuProfileEvent]);
810 }, 899 },
811 900
812 _injectCpuProfileEvents: function() 901 /**
902 * @param {!WebInspector.TimelineModel.MetadataEvents} metadataEvents
903 */
904 _injectCpuProfileEvents: function(metadataEvents)
813 { 905 {
814 if (!this._cpuProfiles) 906 if (!this._cpuProfiles)
815 return; 907 return;
816 var mainMetaEvent = this._tracingModel.devtoolsPageMetadataEvents().peek Last(); 908 var mainMetaEvent = metadataEvents.page.peekLast();
817 if (!mainMetaEvent) 909 if (!mainMetaEvent)
818 return; 910 return;
819 var pid = mainMetaEvent.thread.process().id(); 911 var pid = mainMetaEvent.thread.process().id();
820 var mainTarget = this._targets[0]; 912 var mainTarget = this._targets[0];
821 var mainCpuProfile = this._cpuProfiles.get(mainTarget.id()); 913 var mainCpuProfile = this._cpuProfiles.get(mainTarget.id());
822 this._injectCpuProfileEvent(pid, mainMetaEvent.thread.id(), mainCpuProfi le); 914 this._injectCpuProfileEvent(pid, mainMetaEvent.thread.id(), mainCpuProfi le);
823 var workerMetadataEvents = this._tracingModel.devtoolsWorkerMetadataEven ts(); 915 for (var metaEvent of metadataEvents.workers) {
824 for (var metaEvent of workerMetadataEvents) {
825 var workerId = metaEvent.args["data"]["workerId"]; 916 var workerId = metaEvent.args["data"]["workerId"];
826 var target = mainTarget.workerManager ? mainTarget.workerManager.tar getByWorkerId(workerId) : null; 917 var target = mainTarget.workerManager ? mainTarget.workerManager.tar getByWorkerId(workerId) : null;
827 if (!target) 918 if (!target)
828 continue; 919 continue;
829 var cpuProfile = this._cpuProfiles.get(target.id()); 920 var cpuProfile = this._cpuProfiles.get(target.id());
830 this._injectCpuProfileEvent(pid, metaEvent.args["data"]["workerThrea dId"], cpuProfile); 921 this._injectCpuProfileEvent(pid, metaEvent.args["data"]["workerThrea dId"], cpuProfile);
831 } 922 }
832 this._cpuProfiles = null; 923 this._cpuProfiles = null;
833 }, 924 },
834 925
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 /** @type {!Array.<!WebInspector.TracingModel.Event>} */ 1382 /** @type {!Array.<!WebInspector.TracingModel.Event>} */
1292 this._inspectedTargetEvents = []; 1383 this._inspectedTargetEvents = [];
1293 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */ 1384 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */
1294 this._records = []; 1385 this._records = [];
1295 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */ 1386 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */
1296 this._mainThreadTasks = []; 1387 this._mainThreadTasks = [];
1297 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */ 1388 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */
1298 this._gpuTasks = []; 1389 this._gpuTasks = [];
1299 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */ 1390 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */
1300 this._eventDividerRecords = []; 1391 this._eventDividerRecords = [];
1392 /** @type {?string} */
1393 this._sessionId = null;
1394 this._loadedFromFile = false;
1301 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordsC leared); 1395 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordsC leared);
1302 }, 1396 },
1303 1397
1304 /** 1398 /**
1305 * @return {number} 1399 * @return {number}
1306 */ 1400 */
1307 minimumRecordTime: function() 1401 minimumRecordTime: function()
1308 { 1402 {
1309 return this._tracingModel.minimumRecordTime(); 1403 return this._tracingModel.minimumRecordTime();
1310 }, 1404 },
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 /** 1973 /**
1880 * @constructor 1974 * @constructor
1881 * @implements {WebInspector.OutputStream} 1975 * @implements {WebInspector.OutputStream}
1882 * @param {!WebInspector.TimelineModel} model 1976 * @param {!WebInspector.TimelineModel} model
1883 * @param {!WebInspector.Progress} progress 1977 * @param {!WebInspector.Progress} progress
1884 * @param {function()=} canceledCallback 1978 * @param {function()=} canceledCallback
1885 */ 1979 */
1886 WebInspector.TracingModelLoader = function(model, progress, canceledCallback) 1980 WebInspector.TracingModelLoader = function(model, progress, canceledCallback)
1887 { 1981 {
1888 this._model = model; 1982 this._model = model;
1889 this._loader = new WebInspector.TracingModel.Loader(model._tracingModel);
1890 1983
1891 this._canceledCallback = canceledCallback; 1984 this._canceledCallback = canceledCallback;
1892 this._progress = progress; 1985 this._progress = progress;
1893 this._progress.setTitle(WebInspector.UIString("Loading")); 1986 this._progress.setTitle(WebInspector.UIString("Loading"));
1894 this._progress.setTotalWork(WebInspector.TracingModelLoader._totalProgress); // Unknown, will loop the values. 1987 this._progress.setTotalWork(WebInspector.TracingModelLoader._totalProgress); // Unknown, will loop the values.
1895 1988
1896 this._state = WebInspector.TracingModelLoader.State.Initial; 1989 this._state = WebInspector.TracingModelLoader.State.Initial;
1897 this._buffer = ""; 1990 this._buffer = "";
1898 this._firstChunk = true; 1991 this._firstChunk = true;
1899 this._wasCanceledOnce = false; 1992 this._wasCanceledOnce = false;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1976 2069
1977 if (this._firstChunk) { 2070 if (this._firstChunk) {
1978 this._firstChunk = false; 2071 this._firstChunk = false;
1979 if (this._looksLikeAppVersion(items[0])) { 2072 if (this._looksLikeAppVersion(items[0])) {
1980 this._reportErrorAndCancelLoading(WebInspector.UIString("Legacy Timeline format is not supported.")); 2073 this._reportErrorAndCancelLoading(WebInspector.UIString("Legacy Timeline format is not supported."));
1981 return; 2074 return;
1982 } 2075 }
1983 } 2076 }
1984 2077
1985 try { 2078 try {
1986 this._loader.loadNextChunk(items); 2079 this._model._tracingModel.addEvents(items);
1987 } catch(e) { 2080 } catch(e) {
1988 this._reportErrorAndCancelLoading(WebInspector.UIString("Malformed t imeline data: %s", e.toString())); 2081 this._reportErrorAndCancelLoading(WebInspector.UIString("Malformed t imeline data: %s", e.toString()));
1989 return; 2082 return;
1990 } 2083 }
1991 }, 2084 },
1992 2085
1993 /** 2086 /**
1994 * @param {string=} message 2087 * @param {string=} message
1995 */ 2088 */
1996 _reportErrorAndCancelLoading: function(message) 2089 _reportErrorAndCancelLoading: function(message)
(...skipping 10 matching lines...) Expand all
2007 _looksLikeAppVersion: function(item) 2100 _looksLikeAppVersion: function(item)
2008 { 2101 {
2009 return typeof item === "string" && item.indexOf("Chrome") !== -1; 2102 return typeof item === "string" && item.indexOf("Chrome") !== -1;
2010 }, 2103 },
2011 2104
2012 /** 2105 /**
2013 * @override 2106 * @override
2014 */ 2107 */
2015 close: function() 2108 close: function()
2016 { 2109 {
2017 this._loader.finish(); 2110 this._model._loadedFromFile = true;
2018 this._model.tracingComplete(); 2111 this._model.tracingComplete();
2019 if (this._progress) 2112 if (this._progress)
2020 this._progress.done(); 2113 this._progress.done();
2021 } 2114 }
2022 } 2115 }
2023 2116
2024 /** 2117 /**
2025 * @constructor 2118 * @constructor
2026 * @param {!WebInspector.OutputStream} stream 2119 * @param {!WebInspector.OutputStream} stream
2027 * @implements {WebInspector.OutputStreamDelegate} 2120 * @implements {WebInspector.OutputStreamDelegate}
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
2363 /** @type {!Object.<string, !Array.<!WebInspector.InvalidationTrackingEv ent>>} */ 2456 /** @type {!Object.<string, !Array.<!WebInspector.InvalidationTrackingEv ent>>} */
2364 this._invalidations = {}; 2457 this._invalidations = {};
2365 /** @type {!Object.<number, !Array.<!WebInspector.InvalidationTrackingEv ent>>} */ 2458 /** @type {!Object.<number, !Array.<!WebInspector.InvalidationTrackingEv ent>>} */
2366 this._invalidationsByNodeId = {}; 2459 this._invalidationsByNodeId = {};
2367 2460
2368 this._lastRecalcStyle = undefined; 2461 this._lastRecalcStyle = undefined;
2369 this._lastPaintWithLayer = undefined; 2462 this._lastPaintWithLayer = undefined;
2370 this._didPaint = false; 2463 this._didPaint = false;
2371 } 2464 }
2372 } 2465 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sdk/TracingModel.js ('k') | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698