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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/WorkerManager.js

Issue 1679133002: [DevTools] Remove isRunRequired, replace autoConnectToWorkers with setWaitForDebuggerOnStart. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/sdk/WorkerManager.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/WorkerManager.js b/third_party/WebKit/Source/devtools/front_end/sdk/WorkerManager.js
index cf198b92baa65f8e1dd725eb938ab766f5749176..9ebf30746d3319d655b4e4369bc77d44a5bb4ae5 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/WorkerManager.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/WorkerManager.js
@@ -86,48 +86,30 @@ WebInspector.WorkerManager.prototype = {
_onSuspendStateChanged: function()
{
var suspended = WebInspector.targetManager.allTargetsSuspended();
- this.target().workerAgent().setAutoconnectToWorkers(!suspended);
+ this.target().workerAgent().setWaitForDebuggerOnStart(!suspended);
},
/**
* @param {string} workerId
* @param {string} url
- * @param {boolean} inspectorConnected
+ * @param {boolean} waitingForDebugger
*/
- _workerCreated: function(workerId, url, inspectorConnected)
+ _workerCreated: function(workerId, url, waitingForDebugger)
{
- var connection = new WebInspector.WorkerConnection(this, workerId, inspectorConnected, onConnectionReady.bind(this));
+ var connection = new WebInspector.WorkerConnection(this, workerId);
this._connections.set(workerId, connection);
- /**
- * @param {!InspectorBackendClass.Connection} connection
- * @this {WebInspector.WorkerManager}
- */
- function onConnectionReady(connection)
- {
- var parsedURL = url.asParsedURL();
- var workerName = parsedURL ? parsedURL.lastPathComponentWithFragment() : "#" + (++this._lastAnonymousTargetId);
- var target = WebInspector.targetManager.createTarget(workerName, WebInspector.Target.Type.DedicatedWorker, connection, this.target());
- this._targetsByWorkerId.set(workerId, target);
-
- if (inspectorConnected)
- target.runtimeAgent().isRunRequired(pauseInDebuggerAndRunIfRequired.bind(null, target));
- }
-
- /**
- * @param {!WebInspector.Target} target
- * @param {?Protocol.Error} error
- * @param {boolean} required
- */
- function pauseInDebuggerAndRunIfRequired(target, error, required)
- {
- // Only pause new worker if debugging SW - we are going through the
- // pause on start checkbox.
- var mainIsServiceWorker = WebInspector.targetManager.mainTarget().isServiceWorker();
- if (mainIsServiceWorker && required)
- target.debuggerAgent().pause();
- target.runtimeAgent().run();
- }
+ var parsedURL = url.asParsedURL();
+ var workerName = parsedURL ? parsedURL.lastPathComponentWithFragment() : "#" + (++this._lastAnonymousTargetId);
+ var target = WebInspector.targetManager.createTarget(workerName, WebInspector.Target.Type.DedicatedWorker, connection, this.target());
+ this._targetsByWorkerId.set(workerId, target);
+
+ // Only pause new worker if debugging SW - we are going through the
+ // pause on start checkbox.
+ var mainIsServiceWorker = WebInspector.targetManager.mainTarget().isServiceWorker();
+ if (mainIsServiceWorker && waitingForDebugger)
+ target.debuggerAgent().pause();
+ target.runtimeAgent().run();
},
/**
@@ -187,11 +169,11 @@ WebInspector.WorkerDispatcher.prototype = {
* @override
* @param {string} workerId
* @param {string} url
- * @param {boolean} inspectorConnected
+ * @param {boolean} waitingForDebugger
*/
- workerCreated: function(workerId, url, inspectorConnected)
+ workerCreated: function(workerId, url, waitingForDebugger)
{
- this._workerManager._workerCreated(workerId, url, inspectorConnected);
+ this._workerManager._workerCreated(workerId, url, waitingForDebugger);
},
/**
@@ -219,22 +201,14 @@ WebInspector.WorkerDispatcher.prototype = {
* @extends {InspectorBackendClass.Connection}
* @param {!WebInspector.WorkerManager} workerManager
* @param {string} workerId
- * @param {boolean} inspectorConnected
- * @param {function(!InspectorBackendClass.Connection)} onConnectionReady
*/
-WebInspector.WorkerConnection = function(workerManager, workerId, inspectorConnected, onConnectionReady)
+WebInspector.WorkerConnection = function(workerManager, workerId)
{
InspectorBackendClass.Connection.call(this);
//FIXME: remove resourceTreeModel and others from worker targets
this.suppressErrorsForDomains(["Worker", "Page", "CSS", "DOM", "DOMStorage", "Database", "Network", "IndexedDB"]);
this._agent = workerManager.target().workerAgent();
this._workerId = workerId;
-
-
- if (!inspectorConnected)
- this._agent.connectToWorker(workerId, onConnectionReady.bind(null, this));
- else
- onConnectionReady.call(null, this);
}
WebInspector.WorkerConnection.prototype = {
« no previous file with comments | « third_party/WebKit/Source/core/workers/WorkerMessagingProxy.cpp ('k') | third_party/WebKit/Source/devtools/protocol.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698