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

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

Issue 476773002: Nuke TimelineAllEventsReceived event (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
« no previous file with comments | « Source/devtools/front_end/sdk/TimelineManager.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.TimelineModel} 7 * @extends {WebInspector.TimelineModel}
8 * @implements {WebInspector.TargetManager.Observer} 8 * @implements {WebInspector.TargetManager.Observer}
9 */ 9 */
10 WebInspector.TimelineModelImpl = function() 10 WebInspector.TimelineModelImpl = function()
11 { 11 {
12 WebInspector.TimelineModel.call(this); 12 WebInspector.TimelineModel.call(this);
13 /** @type {?WebInspector.Target} */ 13 /** @type {?WebInspector.Target} */
14 this._currentTarget = null; 14 this._currentTarget = null;
15 this._filters = []; 15 this._filters = [];
16 this._bindings = new WebInspector.TimelineModelImpl.InterRecordBindings(); 16 this._bindings = new WebInspector.TimelineModelImpl.InterRecordBindings();
17 17
18 this.reset(); 18 this.reset();
19 19
20 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineEventRecorded, this._onRecordAdded , this); 20 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineEventRecorded, this._onRecordAdded , this);
21 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineStarted, this._onStarted, this); 21 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineStarted, this._onStarted, this);
22 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineStopped, this._onStopped, this); 22 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineStopped, this._onStopped, this);
23 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineAllEventsReceived, this._onAllEven tsReceived, this);
24 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineProgress, this._onProgress, this); 23 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineProgress, this._onProgress, this);
25 WebInspector.targetManager.observeTargets(this); 24 WebInspector.targetManager.observeTargets(this);
26 } 25 }
27 26
28 WebInspector.TimelineModelImpl.TransferChunkLengthBytes = 5000000; 27 WebInspector.TimelineModelImpl.TransferChunkLengthBytes = 5000000;
29 28
30 WebInspector.TimelineModelImpl.prototype = { 29 WebInspector.TimelineModelImpl.prototype = {
31 /** 30 /**
32 * @param {!WebInspector.Target} target 31 * @param {!WebInspector.Target} target
33 */ 32 */
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 * @param {!WebInspector.Event} event 125 * @param {!WebInspector.Event} event
127 */ 126 */
128 _onStopped: function(event) 127 _onStopped: function(event)
129 { 128 {
130 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target); 129 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target);
131 if (timelineManager.target() !== this._currentTarget) 130 if (timelineManager.target() !== this._currentTarget)
132 return; 131 return;
133 // We were buffering events, discard those that got through, the real on es are coming! 132 // We were buffering events, discard those that got through, the real on es are coming!
134 this.reset(); 133 this.reset();
135 this._currentTarget = timelineManager.target(); 134 this._currentTarget = timelineManager.target();
136 if (event.data) { 135
136 var events = /** @type {!Array.<!TimelineAgent.TimelineEvent>} */ (event .data.events);
137 for (var i = 0; i < events.length; ++i)
138 this._addRecord(events[i]);
139
140 if (event.data.consoleTimeline) {
137 // Stopped from console. 141 // Stopped from console.
138 this._fireRecordingStopped(null, null); 142 this._fireRecordingStopped(null, null);
139 } 143 }
140 },
141 144
142 /**
143 * @param {!WebInspector.Event} event
144 */
145 _onAllEventsReceived: function(event)
146 {
147 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target);
148 if (timelineManager.target() !== this._currentTarget)
149 return;
150 this._collectionEnabled = false; 145 this._collectionEnabled = false;
151 }, 146 },
152 147
153 /** 148 /**
154 * @param {!WebInspector.Event} event 149 * @param {!WebInspector.Event} event
155 */ 150 */
156 _onProgress: function(event) 151 _onProgress: function(event)
157 { 152 {
158 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target); 153 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target);
159 if (timelineManager.target() === this._currentTarget) 154 if (timelineManager.target() === this._currentTarget)
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 break; 630 break;
636 length += itemLength; 631 length += itemLength;
637 data.push(item); 632 data.push(item);
638 ++this._recordIndex; 633 ++this._recordIndex;
639 } 634 }
640 if (this._recordIndex === this._payloads.length) 635 if (this._recordIndex === this._payloads.length)
641 data.push(data.pop() + "]"); 636 data.push(data.pop() + "]");
642 stream.write(data.join(separator), this._writeNextChunk.bind(this)); 637 stream.write(data.join(separator), this._writeNextChunk.bind(this));
643 } 638 }
644 } 639 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sdk/TimelineManager.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698