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

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

Issue 722693002: DevTools: show progress when retrieving recorded trace events (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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 | « no previous file | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * @implements {WebInspector.TargetManager.Observer} 10 * @implements {WebInspector.TargetManager.Observer}
11 */ 11 */
12 WebInspector.TracingManager = function() 12 WebInspector.TracingManager = function()
13 { 13 {
14 WebInspector.Object.call(this); 14 WebInspector.Object.call(this);
15 this._active = false; 15 this._active = false;
16 this._eventBufferSize = 0;
17 this._eventsRetrieved = 0;
16 WebInspector.targetManager.observeTargets(this); 18 WebInspector.targetManager.observeTargets(this);
17 } 19 }
18 20
19 WebInspector.TracingManager.Events = { 21 WebInspector.TracingManager.Events = {
22 "RetrieveEventsProgress": "RetrieveEventsProgress",
20 "BufferUsage": "BufferUsage", 23 "BufferUsage": "BufferUsage",
21 "TracingStarted": "TracingStarted", 24 "TracingStarted": "TracingStarted",
22 "EventsCollected": "EventsCollected", 25 "EventsCollected": "EventsCollected",
23 "TracingStopped": "TracingStopped", 26 "TracingStopped": "TracingStopped",
24 "TracingComplete": "TracingComplete" 27 "TracingComplete": "TracingComplete"
25 } 28 }
26 29
27 /** @typedef {!{ 30 /** @typedef {!{
28 cat: string, 31 cat: string,
29 pid: number, 32 pid: number,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 66
64 /** 67 /**
65 * @return {?WebInspector.Target} 68 * @return {?WebInspector.Target}
66 */ 69 */
67 target: function() 70 target: function()
68 { 71 {
69 return this._target; 72 return this._target;
70 }, 73 },
71 74
72 /** 75 /**
73 * @param {number} usage 76 * @param {number=} usage
77 * @param {number=} eventCount
78 * @param {number=} percentFull
74 */ 79 */
75 _bufferUsage: function(usage) 80 _bufferUsage: function(usage, eventCount, percentFull)
76 { 81 {
77 this.dispatchEventToListeners(WebInspector.TracingManager.Events.BufferU sage, usage); 82 this._eventBufferSize = eventCount;
83 this.dispatchEventToListeners(WebInspector.TracingManager.Events.BufferU sage, usage || percentFull);
78 }, 84 },
79 85
80 /** 86 /**
81 * @param {!Array.<!WebInspector.TracingManager.EventPayload>} events 87 * @param {!Array.<!WebInspector.TracingManager.EventPayload>} events
82 */ 88 */
83 _eventsCollected: function(events) 89 _eventsCollected: function(events)
84 { 90 {
85 this.dispatchEventToListeners(WebInspector.TracingManager.Events.EventsC ollected, events); 91 this.dispatchEventToListeners(WebInspector.TracingManager.Events.EventsC ollected, events);
92 this._eventsRetrieved += events.length;
93 if (!this._eventBufferSize)
94 return;
95 if (this._eventsRetrieved > this._eventBufferSize)
96 this._eventsRetrieved = this._eventBufferSize;
97 this.dispatchEventToListeners(WebInspector.TracingManager.Events.Retriev eEventsProgress, this._eventsRetrieved / this._eventBufferSize);
86 }, 98 },
87 99
88 _tracingComplete: function() 100 _tracingComplete: function()
89 { 101 {
102 this._eventBufferSize = 0;
103 this._eventsRetrieved = 0;
90 this.dispatchEventToListeners(WebInspector.TracingManager.Events.Tracing Complete); 104 this.dispatchEventToListeners(WebInspector.TracingManager.Events.Tracing Complete);
91 }, 105 },
92 106
93 /** 107 /**
94 * @param {string} categoryFilter 108 * @param {string} categoryFilter
95 * @param {string} options 109 * @param {string} options
96 * @param {function(?string)=} callback 110 * @param {function(?string)=} callback
97 */ 111 */
98 start: function(categoryFilter, options, callback) 112 start: function(categoryFilter, options, callback)
99 { 113 {
(...skipping 30 matching lines...) Expand all
130 * @implements {TracingAgent.Dispatcher} 144 * @implements {TracingAgent.Dispatcher}
131 * @param {!WebInspector.TracingManager} tracingManager 145 * @param {!WebInspector.TracingManager} tracingManager
132 */ 146 */
133 WebInspector.TracingDispatcher = function(tracingManager) 147 WebInspector.TracingDispatcher = function(tracingManager)
134 { 148 {
135 this._tracingManager = tracingManager; 149 this._tracingManager = tracingManager;
136 } 150 }
137 151
138 WebInspector.TracingDispatcher.prototype = { 152 WebInspector.TracingDispatcher.prototype = {
139 /** 153 /**
140 * @param {number} usage 154 * @param {number=} usage
155 * @param {number=} eventCount
156 * @param {number=} percentFull
141 */ 157 */
142 bufferUsage: function(usage) 158 bufferUsage: function(usage, eventCount, percentFull)
143 { 159 {
144 this._tracingManager._bufferUsage(usage); 160 this._tracingManager._bufferUsage(usage, eventCount, percentFull);
145 }, 161 },
146 162
147 /** 163 /**
148 * @param {!Array.<!WebInspector.TracingManager.EventPayload>} data 164 * @param {!Array.<!WebInspector.TracingManager.EventPayload>} data
149 */ 165 */
150 dataCollected: function(data) 166 dataCollected: function(data)
151 { 167 {
152 this._tracingManager._eventsCollected(data); 168 this._tracingManager._eventsCollected(data);
153 }, 169 },
154 170
155 tracingComplete: function() 171 tracingComplete: function()
156 { 172 {
157 this._tracingManager._tracingComplete(); 173 this._tracingManager._tracingComplete();
158 } 174 }
159 } 175 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698