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

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

Issue 254613002: DevTools: add Tracing agent on back-end (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: removed a stray call to TracingAgent.enable() Created 6 years, 8 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 DeleteObject: "D" 58 DeleteObject: "D"
59 }; 59 };
60 60
61 WebInspector.TracingModel.MetadataEvent = { 61 WebInspector.TracingModel.MetadataEvent = {
62 ProcessSortIndex: "process_sort_index", 62 ProcessSortIndex: "process_sort_index",
63 ProcessName: "process_name", 63 ProcessName: "process_name",
64 ThreadSortIndex: "thread_sort_index", 64 ThreadSortIndex: "thread_sort_index",
65 ThreadName: "thread_name" 65 ThreadName: "thread_name"
66 } 66 }
67 67
68 WebInspector.TracingModel.DevToolsMetadataEventCategory = "disabled-by-default-d evtools.timeline";
69
70 WebInspector.TracingModel.DevToolsMetadataEvent = {
71 TracingStartedInPage: "TracingStartedInPage",
72 SetLayerTreeId: "SetLayerTreeId"
73 };
74
68 WebInspector.TracingModel.prototype = { 75 WebInspector.TracingModel.prototype = {
69 /** 76 /**
70 * @param {string} categoryPatterns 77 * @param {string} categoryFilter
78 */
79 enable: function(categoryFilter)
80 {
81 TracingAgent.enable(categoryFilter);
82 },
83
84 /**
85 * @param {string} categoryFilter
71 * @param {string} options 86 * @param {string} options
72 * @param {function(?string)=} callback 87 * @param {function(?string)=} callback
73 */ 88 */
74 start: function(categoryPatterns, options, callback) 89 start: function(categoryFilter, options, callback)
75 { 90 {
76 this.reset(); 91 this.reset();
77 var bufferUsageReportingIntervalMs = 500; 92 var bufferUsageReportingIntervalMs = 500;
78 TracingAgent.start(categoryPatterns, options, bufferUsageReportingInterv alMs, callback); 93 /**
94 * @param {?string} error
95 * @param {string} sessionId
96 * @this {WebInspector.TracingModel}
97 */
98 function callbackWrapper(error, sessionId)
99 {
100 this._sessionId = sessionId;
101 callback(error);
102 }
103 TracingAgent.start(categoryFilter, options, bufferUsageReportingInterval Ms, callbackWrapper.bind(this));
79 this._active = true; 104 this._active = true;
105 this._sessionId = null;
80 }, 106 },
81 107
82 /** 108 /**
83 * @param {function()} callback 109 * @param {function()} callback
84 */ 110 */
85 stop: function(callback) 111 stop: function(callback)
86 { 112 {
87 if (!this._active) { 113 if (!this._active) {
88 callback(); 114 callback();
89 return; 115 return;
90 } 116 }
91 this._pendingStopCallback = callback; 117 this._pendingStopCallback = callback;
92 TracingAgent.end(); 118 TracingAgent.end();
93 }, 119 },
94 120
95 /** 121 /**
122 * @return {?string}
123 */
124 sessionId: function()
125 {
126 return this._sessionId;
127 },
128
129 /**
96 * @param {number} usage 130 * @param {number} usage
97 */ 131 */
98 _bufferUsage: function(usage) 132 _bufferUsage: function(usage)
99 { 133 {
100 this.dispatchEventToListeners(WebInspector.TracingModel.Events.BufferUsa ge, usage); 134 this.dispatchEventToListeners(WebInspector.TracingModel.Events.BufferUsa ge, usage);
101 }, 135 },
102 136
103 /** 137 /**
104 * @param {!Array.<!WebInspector.TracingModel.EventPayload>} events 138 * @param {!Array.<!WebInspector.TracingModel.EventPayload>} events
105 */ 139 */
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 * @constructor 460 * @constructor
427 * @implements {TracingAgent.Dispatcher} 461 * @implements {TracingAgent.Dispatcher}
428 * @param {!WebInspector.TracingModel} tracingModel 462 * @param {!WebInspector.TracingModel} tracingModel
429 */ 463 */
430 WebInspector.TracingDispatcher = function(tracingModel) 464 WebInspector.TracingDispatcher = function(tracingModel)
431 { 465 {
432 this._tracingModel = tracingModel; 466 this._tracingModel = tracingModel;
433 } 467 }
434 468
435 WebInspector.TracingDispatcher.prototype = { 469 WebInspector.TracingDispatcher.prototype = {
470 /**
471 * @param {number} usage
472 */
436 bufferUsage: function(usage) 473 bufferUsage: function(usage)
437 { 474 {
438 this._tracingModel._bufferUsage(usage); 475 this._tracingModel._bufferUsage(usage);
439 }, 476 },
440 477
478 /**
479 * @param {!Array.<!WebInspector.TracingModel.EventPayload>} data
480 */
441 dataCollected: function(data) 481 dataCollected: function(data)
442 { 482 {
443 this._tracingModel._eventsCollected(data); 483 this._tracingModel._eventsCollected(data);
444 }, 484 },
445 485
446 tracingComplete: function() 486 tracingComplete: function()
447 { 487 {
448 this._tracingModel._tracingComplete(); 488 this._tracingModel._tracingComplete();
449 } 489 }
450 } 490 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sdk/TimelineManager.js ('k') | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698