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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/profiler/CPUProfileView.js

Issue 2566983004: DevTools: Fix profiler private field accesses. (Closed)
Patch Set: Created 4 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 url: script ? script.contentURL() : '', 183 url: script ? script.contentURL() : '',
184 lineNumber: scriptLocation.lineNumber, 184 lineNumber: scriptLocation.lineNumber,
185 columnNumber: scriptLocation.columnNumber || 0 185 columnNumber: scriptLocation.columnNumber || 0
186 }]); 186 }]);
187 187
188 target.consoleModel.addMessage(message); 188 target.consoleModel.addMessage(message);
189 } 189 }
190 190
191 startRecordingProfile() { 191 startRecordingProfile() {
192 var target = UI.context.flavor(SDK.Target); 192 var target = UI.context.flavor(SDK.Target);
193 if (this._profileBeingRecorded || !target) 193 if (this.profileBeingRecorded() || !target)
194 return; 194 return;
195 var profile = new Profiler.CPUProfileHeader(target, this); 195 var profile = new Profiler.CPUProfileHeader(target, this);
196 this.setProfileBeingRecorded(profile); 196 this.setProfileBeingRecorded(profile);
197 SDK.targetManager.suspendAllTargets(); 197 SDK.targetManager.suspendAllTargets();
198 this.addProfile(profile); 198 this.addProfile(profile);
199 profile.updateStatus(Common.UIString('Recording\u2026')); 199 profile.updateStatus(Common.UIString('Recording\u2026'));
200 this._recording = true; 200 this._recording = true;
201 target.cpuProfilerModel.startRecording(); 201 target.cpuProfilerModel.startRecording();
202 } 202 }
203 203
204 stopRecordingProfile() { 204 stopRecordingProfile() {
205 this._recording = false; 205 this._recording = false;
206 if (!this._profileBeingRecorded || !this._profileBeingRecorded.target()) 206 if (!this.profileBeingRecorded() || !this.profileBeingRecorded().target())
207 return; 207 return;
208 208
209 var recordedProfile; 209 var recordedProfile;
210 210
211 /** 211 /**
212 * @param {?Protocol.Profiler.Profile} profile 212 * @param {?Protocol.Profiler.Profile} profile
213 * @this {Profiler.CPUProfileType} 213 * @this {Profiler.CPUProfileType}
214 */ 214 */
215 function didStopProfiling(profile) { 215 function didStopProfiling(profile) {
216 if (!this._profileBeingRecorded) 216 if (!this.profileBeingRecorded())
217 return; 217 return;
218 console.assert(profile); 218 console.assert(profile);
219 this._profileBeingRecorded.setProtocolProfile(profile); 219 this.profileBeingRecorded().setProtocolProfile(profile);
220 this._profileBeingRecorded.updateStatus(''); 220 this.profileBeingRecorded().updateStatus('');
221 recordedProfile = this._profileBeingRecorded; 221 recordedProfile = this.profileBeingRecorded();
222 this.setProfileBeingRecorded(null); 222 this.setProfileBeingRecorded(null);
223 } 223 }
224 224
225 /** 225 /**
226 * @this {Profiler.CPUProfileType} 226 * @this {Profiler.CPUProfileType}
227 */ 227 */
228 function fireEvent() { 228 function fireEvent() {
229 this.dispatchEventToListeners(Profiler.ProfileType.Events.ProfileComplete, recordedProfile); 229 this.dispatchEventToListeners(Profiler.ProfileType.Events.ProfileComplete, recordedProfile);
230 } 230 }
231 231
232 this._profileBeingRecorded.target() 232 this.profileBeingRecorded().target()
233 .cpuProfilerModel.stopRecording() 233 .cpuProfilerModel.stopRecording()
234 .then(didStopProfiling.bind(this)) 234 .then(didStopProfiling.bind(this))
235 .then(SDK.targetManager.resumeAllTargets.bind(SDK.targetManager)) 235 .then(SDK.targetManager.resumeAllTargets.bind(SDK.targetManager))
236 .then(fireEvent.bind(this)); 236 .then(fireEvent.bind(this));
237 } 237 }
238 238
239 /** 239 /**
240 * @override 240 * @override
241 * @param {string} title 241 * @param {string} title
242 * @return {!Profiler.ProfileHeader} 242 * @return {!Profiler.ProfileHeader}
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 /** 326 /**
327 * @unrestricted 327 * @unrestricted
328 */ 328 */
329 Profiler.CPUFlameChartDataProvider = class extends Profiler.ProfileFlameChartDat aProvider { 329 Profiler.CPUFlameChartDataProvider = class extends Profiler.ProfileFlameChartDat aProvider {
330 /** 330 /**
331 * @param {!SDK.CPUProfileDataModel} cpuProfile 331 * @param {!SDK.CPUProfileDataModel} cpuProfile
332 * @param {?SDK.Target} target 332 * @param {?SDK.Target} target
333 */ 333 */
334 constructor(cpuProfile, target) { 334 constructor(cpuProfile, target) {
335 super(target); 335 super();
336 this._cpuProfile = cpuProfile; 336 this._cpuProfile = cpuProfile;
337 this._target = target;
337 } 338 }
338 339
339 /** 340 /**
340 * @override 341 * @override
341 * @return {!UI.FlameChart.TimelineData} 342 * @return {!UI.FlameChart.TimelineData}
342 */ 343 */
343 _calculateTimelineData() { 344 _calculateTimelineData() {
344 /** @type {!Array.<?Profiler.CPUFlameChartDataProvider.ChartEntry>} */ 345 /** @type {!Array.<?Profiler.CPUFlameChartDataProvider.ChartEntry>} */
345 var entries = []; 346 var entries = [];
346 /** @type {!Array.<number>} */ 347 /** @type {!Array.<number>} */
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 * @param {!SDK.CPUProfileNode} node 458 * @param {!SDK.CPUProfileNode} node
458 */ 459 */
459 constructor(depth, duration, startTime, selfTime, node) { 460 constructor(depth, duration, startTime, selfTime, node) {
460 this.depth = depth; 461 this.depth = depth;
461 this.duration = duration; 462 this.duration = duration;
462 this.startTime = startTime; 463 this.startTime = startTime;
463 this.selfTime = selfTime; 464 this.selfTime = selfTime;
464 this.node = node; 465 this.node = node;
465 } 466 }
466 }; 467 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698