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

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

Issue 1777323005: Revert of [DevTools] Remove extra plumbing from InspectorWorkerAgent, prepare to multi-client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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.h
diff --git a/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.h b/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.h
index d489e3a72c4d2767a89614fc6bc1afddc97038d4..6ef9b4e2cdc7412024fae64260e67a0812b9dde1 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.h
+++ b/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.h
@@ -43,10 +43,7 @@
class KURL;
class WorkerInspectorProxy;
-class CORE_EXPORT InspectorWorkerAgent final
- : public InspectorBaseAgent<InspectorWorkerAgent, protocol::Frontend::Worker>
- , public protocol::Dispatcher::WorkerCommandHandler
- , public WorkerInspectorProxy::PageInspector {
+class CORE_EXPORT InspectorWorkerAgent final : public InspectorBaseAgent<InspectorWorkerAgent, protocol::Frontend::Worker>, public protocol::Dispatcher::WorkerCommandHandler {
WTF_MAKE_NONCOPYABLE(InspectorWorkerAgent);
public:
static PassOwnPtrWillBeRawPtr<InspectorWorkerAgent> create(InspectedFrames*, PageConsoleAgent*);
@@ -60,7 +57,7 @@
// Called from InspectorInstrumentation
bool shouldWaitForDebuggerOnWorkerStart();
- void didStartWorker(WorkerInspectorProxy*, bool waitingForDebugger);
+ void didStartWorker(WorkerInspectorProxy*, const KURL&, bool waitingForDebugger);
void workerTerminated(WorkerInspectorProxy*);
// Called from Dispatcher
@@ -70,21 +67,51 @@
void setTracingSessionId(const String&);
+ class WorkerAgentClient final : public WorkerInspectorProxy::PageInspector {
+ USING_FAST_MALLOC_WILL_BE_REMOVED(InspectorWorkerAgent::WorkerAgentClient);
+ public:
+ static PassOwnPtrWillBeRawPtr<WorkerAgentClient> create(protocol::Frontend::Worker*, WorkerInspectorProxy*, const String& id, PageConsoleAgent*);
+ WorkerAgentClient(protocol::Frontend::Worker*, WorkerInspectorProxy*, const String& id, PageConsoleAgent*);
+ ~WorkerAgentClient() override;
+ DECLARE_VIRTUAL_TRACE();
+
+ String id() const { return m_id; }
+ WorkerInspectorProxy* proxy() const { return m_proxy; }
+
+ void connectToWorker();
+ void dispose();
+
+ private:
+ // WorkerInspectorProxy::PageInspector implementation
+ void dispatchMessageFromWorker(const String& message) override;
+ void workerConsoleAgentEnabled(WorkerGlobalScopeProxy*) override;
+
+ protocol::Frontend::Worker* m_frontend;
+ RawPtrWillBeMember<WorkerInspectorProxy> m_proxy;
+ String m_id;
+ bool m_connected;
+ RawPtrWillBeMember<PageConsoleAgent> m_consoleAgent;
+ };
+
private:
InspectorWorkerAgent(InspectedFrames*, PageConsoleAgent*);
- bool enabled();
- void connectToAllProxies();
- void connectToProxy(WorkerInspectorProxy*, const String& id, bool waitingForDebugger);
+ void createWorkerAgentClientsForExistingWorkers();
+ void createWorkerAgentClient(WorkerInspectorProxy*, const String& url, const String& id, bool waitingForDebugger);
+ void destroyWorkerAgentClients();
- // WorkerInspectorProxy::PageInspector implementation.
- void dispatchMessageFromWorker(WorkerInspectorProxy*, const String& message) override;
- void workerConsoleAgentEnabled(WorkerInspectorProxy*) override;
+ class WorkerInfo {
+ public:
+ WorkerInfo() { }
+ WorkerInfo(const String& url, const String& id) : url(url), id(id) { }
+ String url;
+ String id;
+ };
RawPtrWillBeMember<InspectedFrames> m_inspectedFrames;
- using IdToProxyMap = WillBeHeapHashMap<String, RawPtrWillBeMember<WorkerInspectorProxy>>;
- IdToProxyMap m_idToProxy;
- using ProxyToIdMap = WillBeHeapHashMap<RawPtrWillBeMember<WorkerInspectorProxy>, String>;
- ProxyToIdMap m_proxyToId;
+ using WorkerClients = WillBeHeapHashMap<String, OwnPtrWillBeMember<WorkerAgentClient>>;
+ WorkerClients m_idToClient;
+ using WorkerInfos = WillBeHeapHashMap<RawPtrWillBeMember<WorkerInspectorProxy>, WorkerInfo>;
+ WorkerInfos m_workerInfos;
String m_tracingSessionId;
RawPtrWillBeMember<PageConsoleAgent> m_consoleAgent;
};

Powered by Google App Engine
This is Rietveld 408576698