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

Side by Side Diff: Source/devtools/front_end/CPUProfilerModel.js

Issue 220903002: DevTools: wrap DebuggerAgent.Location with DebuggerModel.Location. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: All tests!!! Created 6 years, 8 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/CPUProfileView.js ('k') | Source/devtools/front_end/CSSStyleModel.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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 10 *
(...skipping 10 matching lines...) Expand all
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 /** 29 /**
30 * @constructor 30 * @constructor
31 * @extends {WebInspector.Object} 31 * @extends {WebInspector.TargetAwareObject}
32 * @param {!WebInspector.Target} target
32 * @implements {ProfilerAgent.Dispatcher} 33 * @implements {ProfilerAgent.Dispatcher}
33 */ 34 */
34 WebInspector.CPUProfilerModel = function() 35 WebInspector.CPUProfilerModel = function(target)
35 { 36 {
37 WebInspector.TargetAwareObject.call(this, target);
38
36 /** @type {?WebInspector.CPUProfilerModel.Delegate} */ 39 /** @type {?WebInspector.CPUProfilerModel.Delegate} */
37 this._delegate = null; 40 this._delegate = null;
38 this._isRecording = false; 41 this._isRecording = false;
39 InspectorBackend.registerProfilerDispatcher(this); 42 InspectorBackend.registerProfilerDispatcher(this);
40 ProfilerAgent.enable(); 43 ProfilerAgent.enable();
41 } 44 }
42 45
43 WebInspector.CPUProfilerModel.EventTypes = { 46 WebInspector.CPUProfilerModel.EventTypes = {
44 ProfileStarted: "profile-started", 47 ProfileStarted: "profile-started",
45 ProfileStopped: "profile-stopped" 48 ProfileStopped: "profile-stopped"
(...skipping 11 matching lines...) Expand all
57 /** 60 /**
58 * @param {string} id 61 * @param {string} id
59 * @param {!DebuggerAgent.Location} scriptLocation 62 * @param {!DebuggerAgent.Location} scriptLocation
60 * @param {!ProfilerAgent.CPUProfile} cpuProfile 63 * @param {!ProfilerAgent.CPUProfile} cpuProfile
61 * @param {string=} title 64 * @param {string=} title
62 */ 65 */
63 consoleProfileFinished: function(id, scriptLocation, cpuProfile, title) 66 consoleProfileFinished: function(id, scriptLocation, cpuProfile, title)
64 { 67 {
65 // Make sure ProfilesPanel is initialized and CPUProfileType is created. 68 // Make sure ProfilesPanel is initialized and CPUProfileType is created.
66 WebInspector.moduleManager.loadModule("profiles"); 69 WebInspector.moduleManager.loadModule("profiles");
67 this._delegate.consoleProfileFinished(id, scriptLocation, cpuProfile, ti tle); 70 this._delegate.consoleProfileFinished(id, WebInspector.DebuggerModel.Loc ation.fromPayload(this.target(), scriptLocation), cpuProfile, title);
68 }, 71 },
69 72
70 /** 73 /**
71 * @param {string} id 74 * @param {string} id
72 * @param {!DebuggerAgent.Location} scriptLocation 75 * @param {!DebuggerAgent.Location} scriptLocation
73 * @param {string=} title 76 * @param {string=} title
74 */ 77 */
75 consoleProfileStarted: function(id, scriptLocation, title) 78 consoleProfileStarted: function(id, scriptLocation, title)
76 { 79 {
77 // Make sure ProfilesPanel is initialized and CPUProfileType is created. 80 // Make sure ProfilesPanel is initialized and CPUProfileType is created.
78 WebInspector.moduleManager.loadModule("profiles"); 81 WebInspector.moduleManager.loadModule("profiles");
79 this._delegate.consoleProfileStarted(id, scriptLocation, title); 82 this._delegate.consoleProfileStarted(id, WebInspector.DebuggerModel.Loca tion.fromPayload(this.target(), scriptLocation), title);
80 }, 83 },
81 84
82 /** 85 /**
83 * @param {boolean} isRecording 86 * @param {boolean} isRecording
84 */ 87 */
85 setRecording: function(isRecording) 88 setRecording: function(isRecording)
86 { 89 {
87 this._isRecording = isRecording; 90 this._isRecording = isRecording;
88 this.dispatchEventToListeners(isRecording ? 91 this.dispatchEventToListeners(isRecording ?
89 WebInspector.CPUProfilerModel.EventTypes.ProfileStarted : 92 WebInspector.CPUProfilerModel.EventTypes.ProfileStarted :
90 WebInspector.CPUProfilerModel.EventTypes.ProfileStopped); 93 WebInspector.CPUProfilerModel.EventTypes.ProfileStopped);
91 }, 94 },
92 95
93 /** 96 /**
94 * @return {boolean} 97 * @return {boolean}
95 */ 98 */
96 isRecordingProfile: function() 99 isRecordingProfile: function()
97 { 100 {
98 return this._isRecording; 101 return this._isRecording;
99 }, 102 },
100 103
101 __proto__: WebInspector.Object.prototype 104 __proto__: WebInspector.TargetAwareObject.prototype
102 } 105 }
103 106
104 /** @interface */ 107 /** @interface */
105 WebInspector.CPUProfilerModel.Delegate = function() {}; 108 WebInspector.CPUProfilerModel.Delegate = function() {};
106 109
107 WebInspector.CPUProfilerModel.Delegate.prototype = { 110 WebInspector.CPUProfilerModel.Delegate.prototype = {
108 /** 111 /**
109 * @param {string} protocolId 112 * @param {string} protocolId
110 * @param {!DebuggerAgent.Location} scriptLocation 113 * @param {!WebInspector.DebuggerModel.Location} scriptLocation
111 * @param {string=} title 114 * @param {string=} title
112 */ 115 */
113 consoleProfileStarted: function(protocolId, scriptLocation, title) {}, 116 consoleProfileStarted: function(protocolId, scriptLocation, title) {},
114 117
115 /** 118 /**
116 * @param {string} protocolId 119 * @param {string} protocolId
117 * @param {!DebuggerAgent.Location} scriptLocation 120 * @param {!WebInspector.DebuggerModel.Location} scriptLocation
118 * @param {!ProfilerAgent.CPUProfile} cpuProfile 121 * @param {!ProfilerAgent.CPUProfile} cpuProfile
119 * @param {string=} title 122 * @param {string=} title
120 */ 123 */
121 consoleProfileFinished: function(protocolId, scriptLocation, cpuProfile, tit le) {} 124 consoleProfileFinished: function(protocolId, scriptLocation, cpuProfile, tit le) {}
122 } 125 }
123 126
124 /** 127 /**
125 * @type {!WebInspector.CPUProfilerModel} 128 * @type {!WebInspector.CPUProfilerModel}
126 */ 129 */
127 WebInspector.cpuProfilerModel; 130 WebInspector.cpuProfilerModel;
OLDNEW
« no previous file with comments | « Source/devtools/front_end/CPUProfileView.js ('k') | Source/devtools/front_end/CSSStyleModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698