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

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

Issue 1253293002: Oilpan: Remove raw pointer to ExecutionContext from WorkerInspectorProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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: Source/core/inspector/InspectorWorkerAgent.cpp
diff --git a/Source/core/inspector/InspectorWorkerAgent.cpp b/Source/core/inspector/InspectorWorkerAgent.cpp
index b70864e2ccce00494c71feea4a2de4872614c7d7..5cc7a326be476ead9ea933fb46de4992b9dfaeb7 100644
--- a/Source/core/inspector/InspectorWorkerAgent.cpp
+++ b/Source/core/inspector/InspectorWorkerAgent.cpp
@@ -51,8 +51,13 @@ static const char autoconnectToWorkers[] = "autoconnectToWorkers";
};
class InspectorWorkerAgent::WorkerAgentClient final : public WorkerInspectorProxy::PageInspector {
- WTF_MAKE_FAST_ALLOCATED(InspectorWorkerAgent::WorkerAgentClient);
+ WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(InspectorWorkerAgent::WorkerAgentClient);
public:
+ static PassOwnPtrWillBeRawPtr<WorkerAgentClient> create(InspectorFrontend::Worker* frontend, WorkerInspectorProxy* proxy, const String& id, PageConsoleAgent* consoleAgent)
+ {
+ return adoptPtrWillBeNoop(new WorkerAgentClient(frontend, proxy, id, consoleAgent));
+ }
+
WorkerAgentClient(InspectorFrontend::Worker* frontend, WorkerInspectorProxy* proxy, const String& id, PageConsoleAgent* consoleAgent)
: m_frontend(frontend)
, m_proxy(proxy)
@@ -64,7 +69,12 @@ public:
}
~WorkerAgentClient() override
{
- disconnectFromWorker();
+ }
+ DEFINE_INLINE_VIRTUAL_TRACE()
+ {
+ visitor->trace(m_proxy);
+ visitor->trace(m_consoleAgent);
+ WorkerInspectorProxy::PageInspector::trace(visitor);
}
String id() const { return m_id; }
@@ -99,10 +109,10 @@ private:
}
InspectorFrontend::Worker* m_frontend;
haraken 2015/07/30 07:47:31 Are you sure that this pointer doesn't become stal
keishi 2015/08/03 09:35:56 When FrontEnd is destroyed InspectorBaseAgent::cle
- WorkerInspectorProxy* m_proxy;
+ RawPtrWillBeMember<WorkerInspectorProxy> m_proxy;
String m_id;
bool m_connected;
- PageConsoleAgent* m_consoleAgent;
+ RawPtrWillBeMember<PageConsoleAgent> m_consoleAgent;
};
PassOwnPtrWillBeRawPtr<InspectorWorkerAgent> InspectorWorkerAgent::create(PageConsoleAgent* consoleAgent)
@@ -209,7 +219,7 @@ void InspectorWorkerAgent::workerTerminated(WorkerInspectorProxy* proxy)
for (WorkerClients::iterator it = m_idToClient.begin(); it != m_idToClient.end(); ++it) {
if (proxy == it->value->proxy()) {
frontend()->workerTerminated(it->key);
- delete it->value;
+ it->value->disconnectFromWorker();
m_idToClient.remove(it);
return;
}
@@ -226,15 +236,13 @@ void InspectorWorkerAgent::destroyWorkerAgentClients()
{
for (auto& client : m_idToClient) {
yurys 2015/07/30 09:01:39 style nit: drop {}
keishi 2015/08/03 09:35:56 Done.
client.value->disconnectFromWorker();
- delete client.value;
}
m_idToClient.clear();
}
void InspectorWorkerAgent::createWorkerAgentClient(WorkerInspectorProxy* workerInspectorProxy, const String& url, const String& id)
{
- WorkerAgentClient* client = new WorkerAgentClient(frontend(), workerInspectorProxy, id, m_consoleAgent);
- m_idToClient.set(id, client);
+ WorkerAgentClient* client = m_idToClient.set(id, WorkerAgentClient::create(frontend(), workerInspectorProxy, id, m_consoleAgent)).storedValue->value.get();
yurys 2015/07/30 09:01:39 Please extract client creation on a separate line
keishi 2015/08/03 09:35:56 Done.
ASSERT(frontend());
bool autoconnectToWorkers = m_state->getBoolean(WorkerAgentState::autoconnectToWorkers);
@@ -243,4 +251,12 @@ void InspectorWorkerAgent::createWorkerAgentClient(WorkerInspectorProxy* workerI
frontend()->workerCreated(id, url, autoconnectToWorkers);
}
+DEFINE_TRACE(InspectorWorkerAgent)
+{
+#if ENABLE(OILPAN)
+ visitor->trace(m_idToClient);
+#endif
+ InspectorBaseAgent<InspectorWorkerAgent, InspectorFrontend::Worker>::trace(visitor);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698