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

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

Issue 389563002: DevTools: make paint profiler target-aware (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed a test and a stray line Created 6 years, 5 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
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 {Protocol.Agents} 9 * @extends {Protocol.Agents}
10 * @param {string} name 10 * @param {string} name
11 * @param {!InspectorBackendClass.Connection} connection 11 * @param {!InspectorBackendClass.Connection} connection
12 * @param {function(!WebInspector.Target)=} callback 12 * @param {function(!WebInspector.Target)=} callback
13 */ 13 */
14 WebInspector.Target = function(name, connection, callback) 14 WebInspector.Target = function(name, connection, callback)
15 { 15 {
16 Protocol.Agents.call(this, connection.agentsMap()); 16 Protocol.Agents.call(this, connection.agentsMap());
17 /** @type {!WeakReference.<!WebInspector.Target>} */
18 this._weakReference = new WeakReference(this);
17 this._name = name; 19 this._name = name;
18 this._connection = connection; 20 this._connection = connection;
19 /** @type {boolean} */ 21 /** @type {boolean} */
20 this.isMainFrontend = false; 22 this.isMainFrontend = false;
21 this._id = WebInspector.Target._nextId++; 23 this._id = WebInspector.Target._nextId++;
22 /** @type {boolean} */ 24 /** @type {boolean} */
23 this.canScreencast = false; 25 this.canScreencast = false;
24 this.pageAgent().canScreencast(this._initializeCapability.bind(this, "canScr eencast", null)); 26 this.pageAgent().canScreencast(this._initializeCapability.bind(this, "canScr eencast", null));
25 27
26 /** @type {boolean} */ 28 /** @type {boolean} */
(...skipping 24 matching lines...) Expand all
51 /** 53 /**
52 * 54 *
53 * @return {string} 55 * @return {string}
54 */ 56 */
55 name: function() 57 name: function()
56 { 58 {
57 return this._name; 59 return this._name;
58 }, 60 },
59 61
60 /** 62 /**
63 * @return {!WeakReference.<!WebInspector.Target>}
64 */
65 weakReference: function()
66 {
67 return this._weakReference;
68 },
69
70 /**
61 * @param {string} name 71 * @param {string} name
62 * @param {function()|null} callback 72 * @param {function()|null} callback
63 * @param {?Protocol.Error} error 73 * @param {?Protocol.Error} error
64 * @param {*} result 74 * @param {*} result
65 */ 75 */
66 _initializeCapability: function(name, callback, error, result) 76 _initializeCapability: function(name, callback, error, result)
67 { 77 {
68 this[name] = result; 78 this[name] = result;
69 if (!Capabilities[name]) 79 if (!Capabilities[name])
70 Capabilities[name] = result; 80 Capabilities[name] = result;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 * @return {boolean} 185 * @return {boolean}
176 */ 186 */
177 isMobile: function() 187 isMobile: function()
178 { 188 {
179 // FIXME: either add a separate capability or rename canScreencast to is Mobile. 189 // FIXME: either add a separate capability or rename canScreencast to is Mobile.
180 return this.canScreencast; 190 return this.canScreencast;
181 }, 191 },
182 192
183 dispose: function() 193 dispose: function()
184 { 194 {
195 this._weakReference.clear();
185 this.debuggerModel.dispose(); 196 this.debuggerModel.dispose();
186 this.networkManager.dispose(); 197 this.networkManager.dispose();
187 this.cpuProfilerModel.dispose(); 198 this.cpuProfilerModel.dispose();
188 }, 199 },
189 200
190 __proto__: Protocol.Agents.prototype 201 __proto__: Protocol.Agents.prototype
191 } 202 }
192 203
193 /** 204 /**
194 * @constructor 205 * @constructor
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 target: function() 369 target: function()
359 { 370 {
360 return this._target; 371 return this._target;
361 } 372 }
362 } 373 }
363 374
364 /** 375 /**
365 * @type {!WebInspector.TargetManager} 376 * @type {!WebInspector.TargetManager}
366 */ 377 */
367 WebInspector.targetManager = new WebInspector.TargetManager(); 378 WebInspector.targetManager = new WebInspector.TargetManager();
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sdk/PaintProfiler.js ('k') | Source/devtools/front_end/timeline/TimelineFrameModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698