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

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

Issue 214523005: DevTools: report timeline progress while recording. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 24 matching lines...) Expand all
35 WebInspector.TimelineModel = function() 35 WebInspector.TimelineModel = function()
36 { 36 {
37 this._filters = []; 37 this._filters = [];
38 this._bindings = new WebInspector.TimelineModel.InterRecordBindings(); 38 this._bindings = new WebInspector.TimelineModel.InterRecordBindings();
39 39
40 this.reset(); 40 this.reset();
41 41
42 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E ventTypes.TimelineEventRecorded, this._onRecordAdded, this); 42 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E ventTypes.TimelineEventRecorded, this._onRecordAdded, this);
43 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E ventTypes.TimelineStarted, this._onStarted, this); 43 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E ventTypes.TimelineStarted, this._onStarted, this);
44 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E ventTypes.TimelineStopped, this._onStopped, this); 44 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E ventTypes.TimelineStopped, this._onStopped, this);
45 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E ventTypes.TimelineProgress, this._onProgress, this);
45 } 46 }
46 47
47 WebInspector.TimelineModel.TransferChunkLengthBytes = 5000000; 48 WebInspector.TimelineModel.TransferChunkLengthBytes = 5000000;
48 49
49 WebInspector.TimelineModel.RecordType = { 50 WebInspector.TimelineModel.RecordType = {
50 Root: "Root", 51 Root: "Root",
51 Program: "Program", 52 Program: "Program",
52 EventDispatch: "EventDispatch", 53 EventDispatch: "EventDispatch",
53 54
54 GPUTask: "GPUTask", 55 GPUTask: "GPUTask",
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 WebSocketDestroy : "WebSocketDestroy", 108 WebSocketDestroy : "WebSocketDestroy",
108 109
109 EmbedderCallback : "EmbedderCallback", 110 EmbedderCallback : "EmbedderCallback",
110 } 111 }
111 112
112 WebInspector.TimelineModel.Events = { 113 WebInspector.TimelineModel.Events = {
113 RecordAdded: "RecordAdded", 114 RecordAdded: "RecordAdded",
114 RecordsCleared: "RecordsCleared", 115 RecordsCleared: "RecordsCleared",
115 RecordingStarted: "RecordingStarted", 116 RecordingStarted: "RecordingStarted",
116 RecordingStopped: "RecordingStopped", 117 RecordingStopped: "RecordingStopped",
118 RecordingProgress: "RecordingProgress",
117 RecordFilterChanged: "RecordFilterChanged" 119 RecordFilterChanged: "RecordFilterChanged"
118 } 120 }
119 121
120 /** 122 /**
121 * @param {!Array.<!WebInspector.TimelineModel.Record>} recordsArray 123 * @param {!Array.<!WebInspector.TimelineModel.Record>} recordsArray
122 * @param {?function(!WebInspector.TimelineModel.Record)|?function(!WebInspector .TimelineModel.Record,number)} preOrderCallback 124 * @param {?function(!WebInspector.TimelineModel.Record)|?function(!WebInspector .TimelineModel.Record,number)} preOrderCallback
123 * @param {function(!WebInspector.TimelineModel.Record)|function(!WebInspector.T imelineModel.Record,number)=} postOrderCallback 125 * @param {function(!WebInspector.TimelineModel.Record)|function(!WebInspector.T imelineModel.Record,number)=} postOrderCallback
124 * @return {boolean} 126 * @return {boolean}
125 */ 127 */
126 WebInspector.TimelineModel.forAllRecords = function(recordsArray, preOrderCallba ck, postOrderCallback) 128 WebInspector.TimelineModel.forAllRecords = function(recordsArray, preOrderCallba ck, postOrderCallback)
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 _filterChanged: function() 213 _filterChanged: function()
212 { 214 {
213 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordFi lterChanged); 215 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordFi lterChanged);
214 }, 216 },
215 217
216 startRecording: function() 218 startRecording: function()
217 { 219 {
218 this._clientInitiatedRecording = true; 220 this._clientInitiatedRecording = true;
219 this.reset(); 221 this.reset();
220 var maxStackFrames = WebInspector.settings.timelineCaptureStacks.get() ? 30 : 0; 222 var maxStackFrames = WebInspector.settings.timelineCaptureStacks.get() ? 30 : 0;
221 this._bufferEvents = WebInspector.experimentsSettings.timelineNoLiveUpda te.isEnabled() && !WebInspector.settings.timelineLiveUpdate.get(); 223 this._bufferEvents = WebInspector.experimentsSettings.timelineNoLiveUpda te.isEnabled();
222 var includeGPUEvents = WebInspector.experimentsSettings.gpuTimeline.isEn abled(); 224 var includeGPUEvents = WebInspector.experimentsSettings.gpuTimeline.isEn abled();
223 var liveEvents = [ WebInspector.TimelineModel.RecordType.BeginFrame, 225 var liveEvents = [ WebInspector.TimelineModel.RecordType.BeginFrame,
224 WebInspector.TimelineModel.RecordType.DrawFrame, 226 WebInspector.TimelineModel.RecordType.DrawFrame,
225 WebInspector.TimelineModel.RecordType.RequestMainThre adFrame, 227 WebInspector.TimelineModel.RecordType.RequestMainThre adFrame,
226 WebInspector.TimelineModel.RecordType.ActivateLayerTr ee ]; 228 WebInspector.TimelineModel.RecordType.ActivateLayerTr ee ];
227 var includeCounters = true; 229 var includeCounters = true;
228 WebInspector.timelineManager.start(maxStackFrames, this._bufferEvents, l iveEvents.join(","), includeCounters, includeGPUEvents, this._fireRecordingStart ed.bind(this)); 230 WebInspector.timelineManager.start(maxStackFrames, this._bufferEvents, l iveEvents.join(","), includeCounters, includeGPUEvents, this._fireRecordingStart ed.bind(this));
229 }, 231 },
230 232
231 stopRecording: function() 233 stopRecording: function()
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 * @param {!WebInspector.Event} event 283 * @param {!WebInspector.Event} event
282 */ 284 */
283 _onStopped: function(event) 285 _onStopped: function(event)
284 { 286 {
285 if (event.data) { 287 if (event.data) {
286 // Stopped from console. 288 // Stopped from console.
287 this._fireRecordingStopped(null); 289 this._fireRecordingStopped(null);
288 } 290 }
289 }, 291 },
290 292
293 /**
294 * @param {!WebInspector.Event} event
295 */
296 _onProgress: function(event)
297 {
298 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gProgress, event.data);
299 },
300
291 _fireRecordingStarted: function() 301 _fireRecordingStarted: function()
292 { 302 {
293 this._collectionEnabled = true; 303 this._collectionEnabled = true;
294 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStarted); 304 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStarted);
295 }, 305 },
296 306
297 /** 307 /**
298 * @param {?Protocol.Error} error 308 * @param {?Protocol.Error} error
299 * @param {!Array.<!TimelineAgent.TimelineEvent>=} events 309 * @param {!Array.<!TimelineAgent.TimelineEvent>=} events
300 */ 310 */
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 WebInspector.TimelineModel._quadFromRectData = function(data) 1191 WebInspector.TimelineModel._quadFromRectData = function(data)
1182 { 1192 {
1183 if (typeof data["x"] === "undefined" || typeof data["y"] === "undefined") 1193 if (typeof data["x"] === "undefined" || typeof data["y"] === "undefined")
1184 return null; 1194 return null;
1185 var x0 = data["x"]; 1195 var x0 = data["x"];
1186 var x1 = data["x"] + data["width"]; 1196 var x1 = data["x"] + data["width"];
1187 var y0 = data["y"]; 1197 var y0 = data["y"];
1188 var y1 = data["y"] + data["height"]; 1198 var y1 = data["y"] + data["height"];
1189 return [x0, y0, x1, y0, x1, y1, x0, y1]; 1199 return [x0, y0, x1, y0, x1, y1, x0, y1];
1190 } 1200 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/TimelineManager.js ('k') | Source/devtools/front_end/TimelinePanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698