Commit f542108b authored by keishi@chromium.org's avatar keishi@chromium.org

Oilpan: Prepare moving InspectorFrontendHost to Oilpan

BUG=340522

Review URL: https://codereview.chromium.org/415043003

git-svn-id: svn://svn.chromium.org/blink/trunk@179021 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent bd4c0570
......@@ -140,6 +140,7 @@ void InspectorController::trace(Visitor* visitor)
visitor->trace(m_resourceAgent);
visitor->trace(m_layerTreeAgent);
visitor->trace(m_tracingAgent);
visitor->trace(m_inspectorFrontendClient);
visitor->trace(m_page);
m_agents.trace(visitor);
}
......@@ -207,6 +208,8 @@ void InspectorController::willBeDestroyed()
m_page = nullptr;
m_instrumentingAgents->reset();
m_agents.discardAgents();
if (m_inspectorFrontendClient)
m_inspectorFrontendClient->dispose();
}
void InspectorController::registerModuleAgent(PassOwnPtrWillBeRawPtr<InspectorAgent> agent)
......@@ -214,7 +217,7 @@ void InspectorController::registerModuleAgent(PassOwnPtrWillBeRawPtr<InspectorAg
m_agents.append(agent);
}
void InspectorController::setInspectorFrontendClient(PassOwnPtr<InspectorFrontendClient> inspectorFrontendClient)
void InspectorController::setInspectorFrontendClient(PassOwnPtrWillBeRawPtr<InspectorFrontendClient> inspectorFrontendClient)
{
m_inspectorFrontendClient = inspectorFrontendClient;
}
......
......@@ -32,6 +32,7 @@
#define InspectorController_h
#include "core/inspector/InspectorBaseAgent.h"
#include "platform/heap/Handle.h"
#include "wtf/Forward.h"
#include "wtf/HashMap.h"
#include "wtf/Noncopyable.h"
......@@ -87,7 +88,7 @@ public:
void willBeDestroyed();
void registerModuleAgent(PassOwnPtrWillBeRawPtr<InspectorAgent>);
void setInspectorFrontendClient(PassOwnPtr<InspectorFrontendClient>);
void setInspectorFrontendClient(PassOwnPtrWillBeRawPtr<InspectorFrontendClient>);
void didClearDocumentOfWindowObject(LocalFrame*);
void setInjectedScriptForOrigin(const String& origin, const String& source);
void showContextMenu(float x, float y, PassRefPtr<ContextMenuProvider>);
......@@ -157,7 +158,7 @@ private:
RawPtrWillBeMember<InspectorTracingAgent> m_tracingAgent;
RefPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient;
OwnPtrWillBeMember<InspectorFrontendClient> m_inspectorFrontendClient;
OwnPtr<InspectorFrontend> m_inspectorFrontend;
RawPtrWillBeMember<Page> m_page;
InspectorClient* m_inspectorClient;
......
......@@ -31,15 +31,18 @@
#ifndef InspectorFrontendClient_h
#define InspectorFrontendClient_h
#include "platform/heap/Handle.h"
#include "wtf/Forward.h"
#include "wtf/Vector.h"
namespace blink {
class InspectorFrontendClient {
class InspectorFrontendClient : public NoBaseWillBeGarbageCollectedFinalized<InspectorFrontendClient> {
public:
virtual ~InspectorFrontendClient() { }
virtual void trace(Visitor*) { }
virtual void windowObjectCleared() = 0;
virtual void sendMessageToBackend(const String&) = 0;
......@@ -47,6 +50,8 @@ public:
virtual void sendMessageToEmbedder(const String&) = 0;
virtual bool isUnderTest() = 0;
virtual void dispose() = 0;
};
} // namespace blink
......
......@@ -131,12 +131,17 @@ InspectorFrontendHost::~InspectorFrontendHost()
ASSERT(!m_client);
}
void InspectorFrontendHost::trace(Visitor* visitor)
{
visitor->trace(m_frontendPage);
}
void InspectorFrontendHost::disconnectClient()
{
m_client = 0;
if (m_menuProvider)
m_menuProvider->disconnect();
m_frontendPage = 0;
m_frontendPage = nullptr;
}
void InspectorFrontendHost::setZoomFactor(float zoom)
......
......@@ -42,14 +42,15 @@ class FrontendMenuProvider;
class InspectorFrontendClient;
class Page;
class InspectorFrontendHost : public RefCounted<InspectorFrontendHost>, public ScriptWrappable {
class InspectorFrontendHost : public RefCountedWillBeGarbageCollectedFinalized<InspectorFrontendHost>, public ScriptWrappable {
public:
static PassRefPtr<InspectorFrontendHost> create(InspectorFrontendClient* client, Page* frontendPage)
static PassRefPtrWillBeRawPtr<InspectorFrontendHost> create(InspectorFrontendClient* client, Page* frontendPage)
{
return adoptRef(new InspectorFrontendHost(client, frontendPage));
return adoptRefWillBeNoop(new InspectorFrontendHost(client, frontendPage));
}
~InspectorFrontendHost();
void trace(Visitor*);
void disconnectClient();
void setZoomFactor(float);
......@@ -78,7 +79,7 @@ private:
InspectorFrontendHost(InspectorFrontendClient* client, Page* frontendPage);
InspectorFrontendClient* m_client;
Page* m_frontendPage;
RawPtrWillBeMember<Page> m_frontendPage;
FrontendMenuProvider* m_menuProvider;
};
......
......@@ -31,6 +31,7 @@
*/
[
WillBeGarbageCollected,
NoInterfaceObject
] interface InspectorFrontendHost {
// FIXME: setZoomFactor is here only for old frontends. Remove in M38.
......
......@@ -54,8 +54,22 @@ InspectorFrontendClientImpl::InspectorFrontendClientImpl(Page* frontendPage, Web
InspectorFrontendClientImpl::~InspectorFrontendClientImpl()
{
if (m_frontendHost)
ASSERT(!m_frontendHost);
}
void InspectorFrontendClientImpl::trace(Visitor* visitor)
{
visitor->trace(m_frontendPage);
visitor->trace(m_frontendHost);
InspectorFrontendClient::trace(visitor);
}
void InspectorFrontendClientImpl::dispose()
{
if (m_frontendHost) {
m_frontendHost->disconnectClient();
m_frontendHost = nullptr;
}
m_client = 0;
}
......
......@@ -49,6 +49,7 @@ class InspectorFrontendClientImpl FINAL : public blink::InspectorFrontendClient
public:
InspectorFrontendClientImpl(blink::Page*, WebDevToolsFrontendClient*, WebDevToolsFrontendImpl*);
virtual ~InspectorFrontendClientImpl();
virtual void trace(Visitor*) OVERRIDE;
// InspectorFrontendClient methods:
virtual void windowObjectCleared() OVERRIDE;
......@@ -59,10 +60,12 @@ public:
virtual bool isUnderTest() OVERRIDE;
virtual void dispose() OVERRIDE;
private:
blink::Page* m_frontendPage;
RawPtrWillBeMember<blink::Page> m_frontendPage;
WebDevToolsFrontendClient* m_client;
RefPtr<blink::InspectorFrontendHost> m_frontendHost;
RefPtrWillBeMember<blink::InspectorFrontendHost> m_frontendHost;
};
} // namespace blink
......
......@@ -97,7 +97,7 @@ WebDevToolsFrontendImpl::WebDevToolsFrontendImpl(
, m_applicationLocale(applicationLocale)
, m_inspectorFrontendDispatchTimer(this, &WebDevToolsFrontendImpl::maybeDispatch)
{
m_webViewImpl->page()->inspectorController().setInspectorFrontendClient(adoptPtr(new InspectorFrontendClientImpl(m_webViewImpl->page(), m_client, this)));
m_webViewImpl->page()->inspectorController().setInspectorFrontendClient(adoptPtrWillBeNoop(new InspectorFrontendClientImpl(m_webViewImpl->page(), m_client, this)));
}
WebDevToolsFrontendImpl::~WebDevToolsFrontendImpl()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment