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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp

Issue 1692813002: Revert of [DevTools] Remove isRunRequired, replace autoConnectToWorkers with setWaitForDebuggerOnStart. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/core/inspector/InspectorWorkerAgent.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp
index 7395ed4e2c9cab927c1f99ecaf1d0729184c9134..835bc2f2566197d8ca392b94bc14451ca3eb55e6 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp
@@ -43,7 +43,7 @@
namespace WorkerAgentState {
static const char workerInspectionEnabled[] = "workerInspectionEnabled";
-static const char waitForDebuggerOnStart[] = "waitForDebuggerOnStart";
+static const char autoconnectToWorkers[] = "autoconnectToWorkers";
};
PassOwnPtrWillBeRawPtr<InspectorWorkerAgent> InspectorWorkerAgent::create(PageConsoleAgent* consoleAgent)
@@ -60,7 +60,7 @@
InspectorWorkerAgent::~InspectorWorkerAgent()
{
#if !ENABLE(OILPAN)
- m_instrumentingAgents->setInspectorWorkerAgent(nullptr);
+ m_instrumentingAgents->setInspectorWorkerAgent(0);
#endif
}
@@ -84,8 +84,26 @@
void InspectorWorkerAgent::disable(ErrorString*)
{
m_state->setBoolean(WorkerAgentState::workerInspectionEnabled, false);
- m_state->setBoolean(WorkerAgentState::waitForDebuggerOnStart, false);
+ m_state->setBoolean(WorkerAgentState::autoconnectToWorkers, false);
destroyWorkerAgentClients();
+}
+
+void InspectorWorkerAgent::connectToWorker(ErrorString* error, const String& workerId)
+{
+ WorkerAgentClient* client = m_idToClient.get(workerId);
+ if (client)
+ client->connectToWorker();
+ else
+ *error = "Worker is gone";
+}
+
+void InspectorWorkerAgent::disconnectFromWorker(ErrorString* error, const String& workerId)
+{
+ WorkerAgentClient* client = m_idToClient.get(workerId);
+ if (client)
+ client->dispose();
+ else
+ *error = "Worker is gone";
}
void InspectorWorkerAgent::sendMessageToWorker(ErrorString* error, const String& workerId, const String& message)
@@ -97,9 +115,9 @@
*error = "Worker is gone";
}
-void InspectorWorkerAgent::setWaitForDebuggerOnStart(ErrorString*, bool value)
-{
- m_state->setBoolean(WorkerAgentState::waitForDebuggerOnStart, value);
+void InspectorWorkerAgent::setAutoconnectToWorkers(ErrorString*, bool value)
+{
+ m_state->setBoolean(WorkerAgentState::autoconnectToWorkers, value);
}
void InspectorWorkerAgent::setTracingSessionId(const String& sessionId)
@@ -111,17 +129,17 @@
info.key->writeTimelineStartedEvent(sessionId, info.value.id);
}
-bool InspectorWorkerAgent::shouldWaitForDebuggerOnWorkerStart()
-{
- return m_state->booleanProperty(WorkerAgentState::workerInspectionEnabled, false) && m_state->booleanProperty(WorkerAgentState::waitForDebuggerOnStart, false);
-}
-
-void InspectorWorkerAgent::didStartWorker(WorkerInspectorProxy* workerInspectorProxy, const KURL& url, bool waitingForDebugger)
+bool InspectorWorkerAgent::shouldPauseDedicatedWorkerOnStart()
+{
+ return m_state->booleanProperty(WorkerAgentState::autoconnectToWorkers, false);
+}
+
+void InspectorWorkerAgent::didStartWorker(WorkerInspectorProxy* workerInspectorProxy, const KURL& url)
{
String id = "dedicated:" + IdentifiersFactory::createIdentifier();
m_workerInfos.set(workerInspectorProxy, WorkerInfo(url.string(), id));
if (frontend() && m_state->booleanProperty(WorkerAgentState::workerInspectionEnabled, false))
- createWorkerAgentClient(workerInspectorProxy, url.string(), id, waitingForDebugger);
+ createWorkerAgentClient(workerInspectorProxy, url.string(), id);
if (!m_tracingSessionId.isEmpty())
workerInspectorProxy->writeTimelineStartedEvent(m_tracingSessionId, id);
}
@@ -142,7 +160,7 @@
void InspectorWorkerAgent::createWorkerAgentClientsForExistingWorkers()
{
for (auto& info : m_workerInfos)
- createWorkerAgentClient(info.key, info.value.url, info.value.id, false);
+ createWorkerAgentClient(info.key, info.value.url, info.value.id);
}
void InspectorWorkerAgent::destroyWorkerAgentClients()
@@ -152,15 +170,17 @@
m_idToClient.clear();
}
-void InspectorWorkerAgent::createWorkerAgentClient(WorkerInspectorProxy* workerInspectorProxy, const String& url, const String& id, bool waitingForDebugger)
+void InspectorWorkerAgent::createWorkerAgentClient(WorkerInspectorProxy* workerInspectorProxy, const String& url, const String& id)
{
OwnPtrWillBeRawPtr<WorkerAgentClient> client = WorkerAgentClient::create(frontend(), workerInspectorProxy, id, m_consoleAgent);
WorkerAgentClient* rawClient = client.get();
m_idToClient.set(id, client.release());
- rawClient->connectToWorker();
ASSERT(frontend());
- frontend()->workerCreated(id, url, waitingForDebugger);
+ bool autoconnectToWorkers = m_state->booleanProperty(WorkerAgentState::autoconnectToWorkers, false);
+ if (autoconnectToWorkers)
+ rawClient->connectToWorker();
+ frontend()->workerCreated(id, url, autoconnectToWorkers);
}
DEFINE_TRACE(InspectorWorkerAgent)

Powered by Google App Engine
This is Rietveld 408576698