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

Side by Side Diff: Source/devtools/front_end/sdk/TracingModel.js

Issue 276793002: Revert "Support warning decorations in Timeline flame chart based on trace events" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: upload correct patch thsi time Created 6 years, 7 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 2014 The Chromium Authors. All rights reserved. 2 * Copyright 2014 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /** 7 /**
8 * @constructor 8 * @constructor
9 * @extends {WebInspector.Object} 9 * @extends {WebInspector.Object}
10 */ 10 */
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 * @param {!Array.<!WebInspector.TracingModel.EventPayload>} events 167 * @param {!Array.<!WebInspector.TracingModel.EventPayload>} events
168 */ 168 */
169 _eventsCollected: function(events) 169 _eventsCollected: function(events)
170 { 170 {
171 for (var i = 0; i < events.length; ++i) 171 for (var i = 0; i < events.length; ++i)
172 this._addEvent(events[i]); 172 this._addEvent(events[i]);
173 }, 173 },
174 174
175 _tracingComplete: function() 175 _tracingComplete: function()
176 { 176 {
177 this._bindings = new WebInspector.TracingModel.EventBindings(this);
178 this._active = false; 177 this._active = false;
179 if (!this._pendingStopCallback) 178 if (!this._pendingStopCallback)
180 return; 179 return;
181 this._pendingStopCallback(); 180 this._pendingStopCallback();
182 this._pendingStopCallback = null; 181 this._pendingStopCallback = null;
183 }, 182 },
184 183
185 /**
186 * @return {!WebInspector.TracingModel.EventBindings}
187 */
188 bindings: function()
189 {
190 return this._bindings;
191 },
192
193 reset: function() 184 reset: function()
194 { 185 {
195 this._processById = {}; 186 this._processById = {};
196 this._minimumRecordTime = null; 187 this._minimumRecordTime = null;
197 this._maximumRecordTime = null; 188 this._maximumRecordTime = null;
198 this._sessionId = null; 189 this._sessionId = null;
199 this._inspectedTargetProcessId = null; 190 this._inspectedTargetProcessId = null;
200 this._inspectedTargetMainThread = null; 191 this._inspectedTargetMainThread = null;
201 this._inspectedTargetMainThreadEvents = []; 192 this._inspectedTargetMainThreadEvents = [];
202 this._inspectedTargetLayerTreeHostId = 0; 193 this._inspectedTargetLayerTreeHostId = 0;
203 this._frameLifecycleEvents = []; 194 this._frameLifecycleEvents = [];
204 this._bindings = null;
205 }, 195 },
206 196
207 /** 197 /**
208 * @param {!WebInspector.TracingModel.EventPayload} payload 198 * @param {!WebInspector.TracingModel.EventPayload} payload
209 */ 199 */
210 _addEvent: function(payload) 200 _addEvent: function(payload)
211 { 201 {
212 var process = this._processById[payload.pid]; 202 var process = this._processById[payload.pid];
213 if (!process) { 203 if (!process) {
214 process = new WebInspector.TracingModel.Process(payload.pid); 204 process = new WebInspector.TracingModel.Process(payload.pid);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 */ 284 */
295 sortedProcesses: function() 285 sortedProcesses: function()
296 { 286 {
297 return WebInspector.TracingModel.NamedObject._sort(Object.values(this._p rocessById)); 287 return WebInspector.TracingModel.NamedObject._sort(Object.values(this._p rocessById));
298 }, 288 },
299 289
300 __proto__: WebInspector.Object.prototype 290 __proto__: WebInspector.Object.prototype
301 } 291 }
302 292
303 /** 293 /**
304 * @param {!WebInspector.TracingModel} model
305 * @constructor
306 */
307 WebInspector.TracingModel.EventBindings = function(model)
308 {
309 this._eventToWarning = new Map();
310 this._model = model;
311 this._calculateWarnings();
312 }
313
314 WebInspector.TracingModel.EventBindings.prototype = {
315 /**
316 * @param {!WebInspector.TracingModel.Event} event
317 * @return {string|undefined}
318 */
319 eventWarning: function(event)
320 {
321 return this._eventToWarning.get(event);
322 },
323
324 _calculateWarnings: function()
325 {
326 var events = this._model.inspectedTargetMainThreadEvents();
327 var currentScriptEvent = null;
328 for (var i = 0, length = events.length; i < length; i++) {
329 var event = events[i];
330 if (currentScriptEvent && event.startTime > currentScriptEvent.endTi me)
331 currentScriptEvent = null;
332 if (event.name === WebInspector.TimelineModel.RecordType.Layout && c urrentScriptEvent)
333 this._eventToWarning.put(event, WebInspector.UIString("Forced sy nchronous layout is a possible performance bottleneck."));
334 if (!currentScriptEvent && (event.name === WebInspector.TimelineMode l.RecordType.EvaluateScript || event.name === WebInspector.TimelineModel.RecordT ype.FunctionCall))
335 currentScriptEvent = event;
336 }
337 }
338 }
339
340 /**
341 * @constructor 294 * @constructor
342 * @param {!WebInspector.TracingModel.EventPayload} payload 295 * @param {!WebInspector.TracingModel.EventPayload} payload
343 * @param {number} level 296 * @param {number} level
344 */ 297 */
345 WebInspector.TracingModel.Event = function(payload, level) 298 WebInspector.TracingModel.Event = function(payload, level)
346 { 299 {
347 this.name = payload.name; 300 this.name = payload.name;
348 this.category = payload.cat; 301 this.category = payload.cat;
349 this.startTime = payload.ts; 302 this.startTime = payload.ts;
350 this.args = payload.args; 303 this.args = payload.args;
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 dataCollected: function(data) 545 dataCollected: function(data)
593 { 546 {
594 this._tracingModel._eventsCollected(data); 547 this._tracingModel._eventsCollected(data);
595 }, 548 },
596 549
597 tracingComplete: function() 550 tracingComplete: function()
598 { 551 {
599 this._tracingModel._tracingComplete(); 552 this._tracingModel._tracingComplete();
600 } 553 }
601 } 554 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/inspector.html ('k') | Source/devtools/front_end/timeline/TimelineFlameChart.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698