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

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

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

Powered by Google App Engine
This is Rietveld 408576698