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

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
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 26 matching lines...) Expand all
56 */ 59 */
57 targetRemoved: function(target) 60 targetRemoved: function(target)
58 { 61 {
59 if (this._target !== target) 62 if (this._target !== target)
60 return; 63 return;
61 delete this._target; 64 delete this._target;
62 }, 65 },
63 66
64 /** 67 /**
65 * @param {number} usage 68 * @param {number} usage
69 * @param {number} eventCount
66 */ 70 */
67 _bufferUsage: function(usage) 71 _bufferUsage: function(usage, eventCount)
68 { 72 {
73 this._eventBufferSize = eventCount;
69 this.dispatchEventToListeners(WebInspector.TracingManager.Events.BufferU sage, usage); 74 this.dispatchEventToListeners(WebInspector.TracingManager.Events.BufferU sage, usage);
70 }, 75 },
71 76
72 /** 77 /**
73 * @param {!Array.<!WebInspector.TracingManager.EventPayload>} events 78 * @param {!Array.<!WebInspector.TracingManager.EventPayload>} events
74 */ 79 */
75 _eventsCollected: function(events) 80 _eventsCollected: function(events)
76 { 81 {
77 this.dispatchEventToListeners(WebInspector.TracingManager.Events.EventsC ollected, events); 82 this.dispatchEventToListeners(WebInspector.TracingManager.Events.EventsC ollected, events);
83 this._eventsRetrieved += events.length;
84 if (this._eventsRetrieved > this._eventBufferSize)
85 this._eventsRetrieved = this._eventBufferSize;
86 this.dispatchEventToListeners(WebInspector.TracingManager.Events.Retriev eEventsProgress, this._eventsRetrieved / this._eventBufferSize);
alph 2014/11/12 15:41:11 division by zero?
yurys 2014/11/17 12:59:37 Done.
78 }, 87 },
79 88
80 _tracingComplete: function() 89 _tracingComplete: function()
81 { 90 {
91 this._eventBufferSize = 0;
92 this._eventsRetrieved = 0;
82 this.dispatchEventToListeners(WebInspector.TracingManager.Events.Tracing Complete); 93 this.dispatchEventToListeners(WebInspector.TracingManager.Events.Tracing Complete);
83 }, 94 },
84 95
85 /** 96 /**
86 * @param {string} categoryFilter 97 * @param {string} categoryFilter
87 * @param {string} options 98 * @param {string} options
88 * @param {function(?string)=} callback 99 * @param {function(?string)=} callback
89 */ 100 */
90 start: function(categoryFilter, options, callback) 101 start: function(categoryFilter, options, callback)
91 { 102 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 * @param {!WebInspector.TracingManager} tracingManager 134 * @param {!WebInspector.TracingManager} tracingManager
124 */ 135 */
125 WebInspector.TracingDispatcher = function(tracingManager) 136 WebInspector.TracingDispatcher = function(tracingManager)
126 { 137 {
127 this._tracingManager = tracingManager; 138 this._tracingManager = tracingManager;
128 } 139 }
129 140
130 WebInspector.TracingDispatcher.prototype = { 141 WebInspector.TracingDispatcher.prototype = {
131 /** 142 /**
132 * @param {number} usage 143 * @param {number} usage
144 * @param {number} eventCount
133 */ 145 */
134 bufferUsage: function(usage) 146 bufferUsage: function(usage, eventCount)
135 { 147 {
136 this._tracingManager._bufferUsage(usage); 148 this._tracingManager._bufferUsage(usage, eventCount);
137 }, 149 },
138 150
139 /** 151 /**
140 * @param {!Array.<!WebInspector.TracingManager.EventPayload>} data 152 * @param {!Array.<!WebInspector.TracingManager.EventPayload>} data
141 */ 153 */
142 dataCollected: function(data) 154 dataCollected: function(data)
143 { 155 {
144 this._tracingManager._eventsCollected(data); 156 this._tracingManager._eventsCollected(data);
145 }, 157 },
146 158
147 tracingComplete: function() 159 tracingComplete: function()
148 { 160 {
149 this._tracingManager._tracingComplete(); 161 this._tracingManager._tracingComplete();
150 } 162 }
151 } 163 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | Source/devtools/protocol.json » ('J')

Powered by Google App Engine
This is Rietveld 408576698