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

Side by Side Diff: Source/devtools/front_end/sdk/WorkerTargetManager.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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 /** 6 /**
7 * @constructor 7 * @constructor
8 * @param {!WebInspector.Target} mainTarget 8 * @param {!WebInspector.Target} mainTarget
9 * @param {!WebInspector.TargetManager} targetManager 9 * @param {!WebInspector.TargetManager} targetManager
10 */ 10 */
11 WebInspector.WorkerTargetManager = function(mainTarget, targetManager) 11 WebInspector.WorkerTargetManager = function(mainTarget, targetManager)
12 { 12 {
13 this._mainTarget = mainTarget; 13 this._mainTarget = mainTarget;
14 this._targetManager = targetManager; 14 this._targetManager = targetManager;
15 mainTarget.workerManager.addEventListener(WebInspector.WorkerManager.Events. WorkerAdded, this._onWorkerAdded, this); 15 mainTarget.workerManager.addEventListener(WebInspector.WorkerManager.Events. WorkerAdded, this._onWorkerAdded, this);
16 WebInspector.profilingLock.addEventListener(WebInspector.Lock.Events.StateCh anged, this._onProfilingStateChanged, this); 16 mainTarget.profilingLock.addEventListener(WebInspector.Lock.Events.StateChan ged, this._onProfilingStateChanged, this);
17 this._onProfilingStateChanged(); 17 this._onProfilingStateChanged();
18 } 18 }
19 19
20 WebInspector.WorkerTargetManager.prototype = { 20 WebInspector.WorkerTargetManager.prototype = {
21 _onProfilingStateChanged: function() 21 _onProfilingStateChanged: function()
22 { 22 {
23 var acquired = WebInspector.profilingLock.isAcquired(); 23 var acquired = this._mainTarget.profilingLock.isAcquired();
24 this._mainTarget.workerAgent().setAutoconnectToWorkers(!acquired); 24 this._mainTarget.workerAgent().setAutoconnectToWorkers(!acquired);
25 }, 25 },
26 26
27 /** 27 /**
28 * @param {!WebInspector.Event} event 28 * @param {!WebInspector.Event} event
29 */ 29 */
30 _onWorkerAdded: function(event) 30 _onWorkerAdded: function(event)
31 { 31 {
32 var data = /** @type {{workerId: number, url: string, inspectorConnected : boolean}} */ (event.data); 32 var data = /** @type {{workerId: number, url: string, inspectorConnected : boolean}} */ (event.data);
33 new WebInspector.WorkerConnection(this._mainTarget, data.workerId, data. inspectorConnected, onConnectionReady.bind(this)); 33 new WebInspector.WorkerConnection(this._mainTarget, data.workerId, data. inspectorConnected, onConnectionReady.bind(this));
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 _close: function() 110 _close: function()
111 { 111 {
112 this._target.workerManager.removeEventListener(WebInspector.WorkerManage r.Events.MessageFromWorker, this._dispatchMessageFromWorker, this); 112 this._target.workerManager.removeEventListener(WebInspector.WorkerManage r.Events.MessageFromWorker, this._dispatchMessageFromWorker, this);
113 this._target.workerManager.removeEventListener(WebInspector.WorkerManage r.Events.WorkerRemoved, this._onWorkerRemoved, this); 113 this._target.workerManager.removeEventListener(WebInspector.WorkerManage r.Events.WorkerRemoved, this._onWorkerRemoved, this);
114 this._target.workerManager.removeEventListener(WebInspector.WorkerManage r.Events.WorkersCleared, this._close, this); 114 this._target.workerManager.removeEventListener(WebInspector.WorkerManage r.Events.WorkersCleared, this._close, this);
115 this.connectionClosed("worker_terminated"); 115 this.connectionClosed("worker_terminated");
116 }, 116 },
117 117
118 __proto__: InspectorBackendClass.Connection.prototype 118 __proto__: InspectorBackendClass.Connection.prototype
119 } 119 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sdk/TracingModel.js ('k') | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698