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

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

Issue 471393002: Revert of Make profiling lock global rather than per Target (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
« no previous file with comments | « Source/devtools/front_end/sdk/Target.js ('k') | Source/devtools/front_end/sdk/TracingModel.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 (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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 /** 62 /**
63 * @param {number=} maxCallStackDepth 63 * @param {number=} maxCallStackDepth
64 * @param {string=} liveEvents 64 * @param {string=} liveEvents
65 * @param {boolean=} includeCounters 65 * @param {boolean=} includeCounters
66 * @param {boolean=} includeGPUEvents 66 * @param {boolean=} includeGPUEvents
67 * @param {function(?Protocol.Error)=} callback 67 * @param {function(?Protocol.Error)=} callback
68 */ 68 */
69 start: function(maxCallStackDepth, liveEvents, includeCounters, includeGPUEv ents, callback) 69 start: function(maxCallStackDepth, liveEvents, includeCounters, includeGPUEv ents, callback)
70 { 70 {
71 this._enablementCount++; 71 this._enablementCount++;
72 WebInspector.profilingLock.acquire(); 72 this.target().profilingLock.acquire();
73 if (WebInspector.experimentsSettings.timelineJSCPUProfile.isEnabled() && maxCallStackDepth) { 73 if (WebInspector.experimentsSettings.timelineJSCPUProfile.isEnabled() && maxCallStackDepth) {
74 this._configureCpuProfilerSamplingInterval(); 74 this._configureCpuProfilerSamplingInterval();
75 this._jsProfilerStarted = true; 75 this._jsProfilerStarted = true;
76 this.target().profilerAgent().start(); 76 this.target().profilerAgent().start();
77 } 77 }
78 if (this._enablementCount === 1) 78 if (this._enablementCount === 1)
79 this.target().timelineAgent().start(maxCallStackDepth, true, liveEve nts, includeCounters, includeGPUEvents, callback); 79 this.target().timelineAgent().start(maxCallStackDepth, true, liveEve nts, includeCounters, includeGPUEvents, callback);
80 else if (callback) 80 else if (callback)
81 callback(null); 81 callback(null);
82 }, 82 },
(...skipping 13 matching lines...) Expand all
96 var masterProfile = null; 96 var masterProfile = null;
97 var callbackBarrier = new CallbackBarrier(); 97 var callbackBarrier = new CallbackBarrier();
98 98
99 if (this._jsProfilerStarted) { 99 if (this._jsProfilerStarted) {
100 this.target().profilerAgent().stop(callbackBarrier.createCallback(pr ofilerCallback)); 100 this.target().profilerAgent().stop(callbackBarrier.createCallback(pr ofilerCallback));
101 this._jsProfilerStarted = false; 101 this._jsProfilerStarted = false;
102 } 102 }
103 if (!this._enablementCount) 103 if (!this._enablementCount)
104 this.target().timelineAgent().stop(callbackBarrier.createCallback(ti melineCallback)); 104 this.target().timelineAgent().stop(callbackBarrier.createCallback(ti melineCallback));
105 105
106 callbackBarrier.callWhenDone(allDoneCallback); 106 callbackBarrier.callWhenDone(allDoneCallback.bind(this));
107 107
108 /** 108 /**
109 * @param {?Protocol.Error} error 109 * @param {?Protocol.Error} error
110 */ 110 */
111 function timelineCallback(error) 111 function timelineCallback(error)
112 { 112 {
113 masterError = masterError || error; 113 masterError = masterError || error;
114 } 114 }
115 115
116 /** 116 /**
117 * @param {?Protocol.Error} error 117 * @param {?Protocol.Error} error
118 * @param {!ProfilerAgent.CPUProfile} profile 118 * @param {!ProfilerAgent.CPUProfile} profile
119 */ 119 */
120 function profilerCallback(error, profile) 120 function profilerCallback(error, profile)
121 { 121 {
122 masterError = masterError || error; 122 masterError = masterError || error;
123 masterProfile = profile; 123 masterProfile = profile;
124 } 124 }
125 125
126 /**
127 * @this {WebInspector.TimelineManager}
128 */
126 function allDoneCallback() 129 function allDoneCallback()
127 { 130 {
128 WebInspector.profilingLock.release(); 131 this.target().profilingLock.release();
129 callback(masterError, masterProfile); 132 callback(masterError, masterProfile);
130 } 133 }
131 }, 134 },
132 135
133 /** 136 /**
134 * @param {boolean=} consoleTimeline 137 * @param {boolean=} consoleTimeline
135 * @param {!Array.<!TimelineAgent.TimelineEvent>=} events 138 * @param {!Array.<!TimelineAgent.TimelineEvent>=} events
136 */ 139 */
137 _stopped: function(consoleTimeline, events) 140 _stopped: function(consoleTimeline, events)
138 { 141 {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 }, 213 },
211 214
212 /** 215 /**
213 * @param {number} count 216 * @param {number} count
214 */ 217 */
215 progress: function(count) 218 progress: function(count)
216 { 219 {
217 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even tTypes.TimelineProgress, count); 220 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even tTypes.TimelineProgress, count);
218 } 221 }
219 } 222 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sdk/Target.js ('k') | Source/devtools/front_end/sdk/TracingModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698