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

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

Issue 319743002: Timeline: decouple TimelineFrameModel from TimelineModel (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 /** 237 /**
238 * @param {boolean} captureStacks 238 * @param {boolean} captureStacks
239 * @param {boolean} captureMemory 239 * @param {boolean} captureMemory
240 */ 240 */
241 startRecording: function(captureStacks, captureMemory) 241 startRecording: function(captureStacks, captureMemory)
242 { 242 {
243 this._clientInitiatedRecording = true; 243 this._clientInitiatedRecording = true;
244 this.reset(); 244 this.reset();
245 var maxStackFrames = captureStacks ? 30 : 0; 245 var maxStackFrames = captureStacks ? 30 : 0;
246 this._bufferEvents = WebInspector.experimentsSettings.timelineNoLiveUpda te.isEnabled();
247 var includeGPUEvents = WebInspector.experimentsSettings.gpuTimeline.isEn abled(); 246 var includeGPUEvents = WebInspector.experimentsSettings.gpuTimeline.isEn abled();
248 var liveEvents = [ WebInspector.TimelineModel.RecordType.BeginFrame, 247 var liveEvents = [ WebInspector.TimelineModel.RecordType.BeginFrame,
249 WebInspector.TimelineModel.RecordType.DrawFrame, 248 WebInspector.TimelineModel.RecordType.DrawFrame,
250 WebInspector.TimelineModel.RecordType.RequestMainThre adFrame, 249 WebInspector.TimelineModel.RecordType.RequestMainThre adFrame,
251 WebInspector.TimelineModel.RecordType.ActivateLayerTr ee ]; 250 WebInspector.TimelineModel.RecordType.ActivateLayerTr ee ];
252 this._timelineManager.start(maxStackFrames, this._bufferEvents, liveEven ts.join(","), captureMemory, includeGPUEvents, this._fireRecordingStarted.bind(t his)); 251 this._timelineManager.start(maxStackFrames, WebInspector.experimentsSett ings.timelineNoLiveUpdate.isEnabled(), liveEvents.join(","), captureMemory, incl udeGPUEvents, this._fireRecordingStarted.bind(this));
253 }, 252 },
254 253
255 stopRecording: function() 254 stopRecording: function()
256 { 255 {
257 if (!this._clientInitiatedRecording) { 256 if (!this._clientInitiatedRecording) {
258 this._timelineManager.start(undefined, undefined, undefined, undefin ed, undefined, stopTimeline.bind(this)); 257 this._timelineManager.start(undefined, undefined, undefined, undefin ed, undefined, stopTimeline.bind(this));
259 return; 258 return;
260 } 259 }
261 260
262 /** 261 /**
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // Started from console. 344 // Started from console.
346 this._fireRecordingStarted(); 345 this._fireRecordingStarted();
347 } 346 }
348 }, 347 },
349 348
350 /** 349 /**
351 * @param {!WebInspector.Event} event 350 * @param {!WebInspector.Event} event
352 */ 351 */
353 _onStopped: function(event) 352 _onStopped: function(event)
354 { 353 {
354 // If we were buffering events, discard those that got through, the real ones are coming!
355 if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled())
356 this.reset();
355 if (event.data) { 357 if (event.data) {
356 // Stopped from console. 358 // Stopped from console.
357 this._fireRecordingStopped(null, null); 359 this._fireRecordingStopped(null, null);
358 } 360 }
359 }, 361 },
360 362
361 /** 363 /**
362 * @param {!WebInspector.Event} event 364 * @param {!WebInspector.Event} event
363 */ 365 */
364 _onProgress: function(event) 366 _onProgress: function(event)
365 { 367 {
366 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gProgress, event.data); 368 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gProgress, event.data);
367 }, 369 },
368 370
369 _fireRecordingStarted: function() 371 _fireRecordingStarted: function()
370 { 372 {
371 this._collectionEnabled = true; 373 this._collectionEnabled = true;
372 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStarted); 374 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStarted);
373 }, 375 },
374 376
375 /** 377 /**
376 * @param {?Protocol.Error} error 378 * @param {?Protocol.Error} error
377 * @param {?ProfilerAgent.CPUProfile} cpuProfile 379 * @param {?ProfilerAgent.CPUProfile} cpuProfile
378 */ 380 */
379 _fireRecordingStopped: function(error, cpuProfile) 381 _fireRecordingStopped: function(error, cpuProfile)
380 { 382 {
381 this._bufferEvents = false;
382 this._collectionEnabled = false; 383 this._collectionEnabled = false;
383 if (cpuProfile) 384 if (cpuProfile)
384 WebInspector.TimelineJSProfileProcessor.mergeJSProfileIntoTimeline(t his, cpuProfile); 385 WebInspector.TimelineJSProfileProcessor.mergeJSProfileIntoTimeline(t his, cpuProfile);
385 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStopped); 386 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStopped);
386 }, 387 },
387 388
388 /** 389 /**
389 * @return {boolean}
390 */
391 bufferEvents: function()
yurys 2014/06/06 07:07:34 You will need to rebase.
392 {
393 return this._bufferEvents;
394 },
395
396 /**
397 * @param {!TimelineAgent.TimelineEvent} payload 390 * @param {!TimelineAgent.TimelineEvent} payload
398 */ 391 */
399 _addRecord: function(payload) 392 _addRecord: function(payload)
400 { 393 {
401 this._internStrings(payload); 394 this._internStrings(payload);
402 this._payloads.push(payload); 395 this._payloads.push(payload);
403 396
404 var record = this._innerAddRecord(payload, null); 397 var record = this._innerAddRecord(payload, null);
405 this._updateBoundaries(record); 398 this._updateBoundaries(record);
406 this._records.push(record); 399 this._records.push(record);
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 function recordTimestampComparator(a, b) 1444 function recordTimestampComparator(a, b)
1452 { 1445 {
1453 // Never return 0, as the merge function will squash identical entri es. 1446 // Never return 0, as the merge function will squash identical entri es.
1454 return a.startTime() < b.startTime() ? -1 : 1; 1447 return a.startTime() < b.startTime() ? -1 : 1;
1455 } 1448 }
1456 var result = this._backgroundRecordsBuffer.mergeOrdered(records, recordT imestampComparator); 1449 var result = this._backgroundRecordsBuffer.mergeOrdered(records, recordT imestampComparator);
1457 this._backgroundRecordsBuffer = []; 1450 this._backgroundRecordsBuffer = [];
1458 return result; 1451 return result;
1459 } 1452 }
1460 } 1453 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/timeline/TimelineFrameModel.js ('k') | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698