| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 20 matching lines...) Expand all Loading... |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @extends {WebInspector.TargetAwareObject} | 33 * @extends {WebInspector.TargetAwareObject} |
| 34 * @param {!WebInspector.Target} target | 34 * @param {!WebInspector.Target} target |
| 35 */ | 35 */ |
| 36 WebInspector.TimelineManager = function(target) | 36 WebInspector.TimelineManager = function(target) |
| 37 { | 37 { |
| 38 WebInspector.TargetAwareObject.call(this, target); | 38 WebInspector.TargetAwareObject.call(this, target); |
| 39 this._dispatcher = new WebInspector.TimelineDispatcher(this); | 39 this._dispatcher = new WebInspector.TimelineDispatcher(this); |
| 40 this._enablementCount = 0; | 40 this._enablementCount = 0; |
| 41 this._sessionId = ""; |
| 41 TimelineAgent.enable(WebInspector.experimentsSettings.timelineTracingMode.is
Enabled() ? WebInspector.TimelineManager.defaultTracingCategories : ""); | 42 TimelineAgent.enable(WebInspector.experimentsSettings.timelineTracingMode.is
Enabled() ? WebInspector.TimelineManager.defaultTracingCategories : ""); |
| 42 } | 43 } |
| 43 | 44 |
| 44 WebInspector.TimelineManager.EventTypes = { | 45 WebInspector.TimelineManager.EventTypes = { |
| 45 TimelineStarted: "TimelineStarted", | 46 TimelineStarted: "TimelineStarted", |
| 46 TimelineStopped: "TimelineStopped", | 47 TimelineStopped: "TimelineStopped", |
| 47 TimelineEventRecorded: "TimelineEventRecorded", | 48 TimelineEventRecorded: "TimelineEventRecorded", |
| 48 TimelineProgress: "TimelineProgress" | 49 TimelineProgress: "TimelineProgress" |
| 49 } | 50 } |
| 50 | 51 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 masterProfile = profile; | 121 masterProfile = profile; |
| 121 } | 122 } |
| 122 | 123 |
| 123 function allDoneCallback() | 124 function allDoneCallback() |
| 124 { | 125 { |
| 125 callback(masterError, masterProfile); | 126 callback(masterError, masterProfile); |
| 126 } | 127 } |
| 127 }, | 128 }, |
| 128 | 129 |
| 129 /** | 130 /** |
| 131 * @return {string} |
| 132 */ |
| 133 sessionId: function() |
| 134 { |
| 135 return this._sessionId; |
| 136 }, |
| 137 |
| 138 /** |
| 130 * @param {function(?Protocol.Error)|undefined} callback | 139 * @param {function(?Protocol.Error)|undefined} callback |
| 131 * @param {?Protocol.Error} error | 140 * @param {?Protocol.Error} error |
| 132 * @param {!Array.<!TimelineAgent.TimelineEvent>=} events | 141 * @param {!Array.<!TimelineAgent.TimelineEvent>=} events |
| 133 */ | 142 */ |
| 134 _processBufferedEvents: function(callback, error, events) | 143 _processBufferedEvents: function(callback, error, events) |
| 135 { | 144 { |
| 136 if (events) { | 145 if (events) { |
| 137 for (var i = 0; i < events.length; ++i) | 146 for (var i = 0; i < events.length; ++i) |
| 138 this._dispatcher.eventRecorded(events[i]); | 147 this._dispatcher.eventRecorded(events[i]); |
| 139 } | 148 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 185 |
| 177 /** | 186 /** |
| 178 * @return {boolean} | 187 * @return {boolean} |
| 179 */ | 188 */ |
| 180 isStarted: function() | 189 isStarted: function() |
| 181 { | 190 { |
| 182 return !!this._started; | 191 return !!this._started; |
| 183 }, | 192 }, |
| 184 | 193 |
| 185 /** | 194 /** |
| 195 * @param {string} sessionId |
| 186 * @param {boolean=} consoleTimeline | 196 * @param {boolean=} consoleTimeline |
| 187 */ | 197 */ |
| 188 started: function(consoleTimeline) | 198 started: function(sessionId, consoleTimeline) |
| 189 { | 199 { |
| 190 if (consoleTimeline) { | 200 if (consoleTimeline) { |
| 191 // Wake up timeline panel module. | 201 // Wake up timeline panel module. |
| 192 WebInspector.moduleManager.loadModule("timeline"); | 202 WebInspector.moduleManager.loadModule("timeline"); |
| 193 } | 203 } |
| 194 this._started = true; | 204 this._started = true; |
| 205 this._manager._sessionId = sessionId; |
| 195 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even
tTypes.TimelineStarted, consoleTimeline); | 206 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even
tTypes.TimelineStarted, consoleTimeline); |
| 196 }, | 207 }, |
| 197 | 208 |
| 198 /** | 209 /** |
| 199 * @param {boolean=} consoleTimeline | 210 * @param {boolean=} consoleTimeline |
| 200 */ | 211 */ |
| 201 stopped: function(consoleTimeline) | 212 stopped: function(consoleTimeline) |
| 202 { | 213 { |
| 203 this._started = false; | 214 this._started = false; |
| 204 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even
tTypes.TimelineStopped, consoleTimeline); | 215 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even
tTypes.TimelineStopped, consoleTimeline); |
| 205 }, | 216 }, |
| 206 | 217 |
| 207 /** | 218 /** |
| 208 * @param {number} count | 219 * @param {number} count |
| 209 */ | 220 */ |
| 210 progress: function(count) | 221 progress: function(count) |
| 211 { | 222 { |
| 212 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even
tTypes.TimelineProgress, count); | 223 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even
tTypes.TimelineProgress, count); |
| 213 } | 224 } |
| 214 } | 225 } |
| 215 | 226 |
| 216 /** | 227 /** |
| 217 * @type {!WebInspector.TimelineManager} | 228 * @type {!WebInspector.TimelineManager} |
| 218 */ | 229 */ |
| 219 WebInspector.timelineManager; | 230 WebInspector.timelineManager; |
| OLD | NEW |