Commit a5236926 authored by yurys@chromium.org's avatar yurys@chromium.org
Browse files

2011-05-06 Yury Semikhatsky <yurys@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: move agents from InspectorAgent to InspectorController
        https://bugs.webkit.org/show_bug.cgi?id=60359

        All inspector agents are now created and owned by InspectorController which
        in turned is owned by the inspected Page. InspectorInstrumentation gets access
        to the instrumenting agents by means of InspectorAgent::instrumentingAgents().

        In addition to managing inspector agents lifetime InspectorController sets
        InspectorFronted on the agents when the front-end is connected.

        * inspector/InspectorAgent.cpp:
        (WebCore::InspectorAgent::InspectorAgent):
        (WebCore::InspectorAgent::~InspectorAgent):
        (WebCore::InspectorAgent::inspectedPageDestroyed):
        (WebCore::InspectorAgent::restore):
        (WebCore::InspectorAgent::setFrontend):
        (WebCore::InspectorAgent::clearFrontend):
        * inspector/InspectorAgent.h: all accessors to other agents were removed along with
        the agents themselves from InspectorAgent. Every agent that depends on some other agents
        receives pointers to them explicitely in its constructor. All access to the agents
        from WebCore should go through InspectorInstrumentation which retrieves corresponding
        agents using InstrumentingAgents structure which represents the set of active agents.
        (WebCore::InspectorAgent::instrumentingAgents):
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::InspectorController):
        (WebCore::InspectorController::~InspectorController):
        (WebCore::InspectorController::inspectedPageDestroyed):
        (WebCore::InspectorController::startTimelineProfiler):
        (WebCore::InspectorController::stopTimelineProfiler):
        (WebCore::InspectorController::connectFrontend):
        (WebCore::InspectorController::disconnectFrontend):
        (WebCore::InspectorController::restoreInspectorStateFromCookie):
        (WebCore::InspectorController::drawNodeHighlight):
        (WebCore::InspectorController::inspect):
        (WebCore::InspectorController::timelineProfilerEnabled):
        (WebCore::InspectorController::hideHighlight):
        (WebCore::InspectorController::highlightedNode):
        (WebCore::InspectorController::enableProfiler):
        (WebCore::InspectorController::disableProfiler):
        (WebCore::InspectorController::profilerEnabled):
        (WebCore::InspectorController::debuggerEnabled):
        (WebCore::InspectorController::disableDebugger):
        (WebCore::InspectorController::startUserInitiatedProfiling):
        (WebCore::InspectorController::stopUserInitiatedProfiling):
        (WebCore::InspectorController::isRecordingUserInitiatedProfile):
        (WebCore::InspectorController::resume):
        * inspector/InspectorController.h:
        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::didInsertDOMNodeImpl):
        (WebCore::InspectorInstrumentation::didRemoveDOMNodeImpl):
        (WebCore::InspectorInstrumentation::didModifyDOMAttrImpl):
        (WebCore::InspectorInstrumentation::didInvalidateStyleAttrImpl):
        (WebCore::InspectorInstrumentation::characterDataModifiedImpl):
        (WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl):
        (WebCore::InspectorInstrumentation::didFailLoadingImpl):
        (WebCore::InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl):
        (WebCore::InspectorInstrumentation::addMessageToConsoleImpl):
        (WebCore::InspectorInstrumentation::consoleCountImpl):
        (WebCore::InspectorInstrumentation::startConsoleTimingImpl):
        (WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
        (WebCore::InspectorInstrumentation::addStartProfilingMessageToConsoleImpl):
        (WebCore::InspectorInstrumentation::addProfileImpl):
        (WebCore::InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl):
        (WebCore::InspectorInstrumentation::profilerEnabledImpl):
        (WebCore::InspectorInstrumentation::cancelPauseOnNativeEvent):
        * page/Page.cpp:
        (WebCore::Page::~Page): we send two notifications when inspected Page is being
        destroyed: one to the inspector instrumentation and another one to the InspectorController
        which is owned by the Page.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86327 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d9ed976e
2011-05-06 Yury Semikhatsky <yurys@chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: move agents from InspectorAgent to InspectorController
https://bugs.webkit.org/show_bug.cgi?id=60359
All inspector agents are now created and owned by InspectorController which
in turned is owned by the inspected Page. InspectorInstrumentation gets access
to the instrumenting agents by means of InspectorAgent::instrumentingAgents().
In addition to managing inspector agents lifetime InspectorController sets
InspectorFronted on the agents when the front-end is connected.
* inspector/InspectorAgent.cpp:
(WebCore::InspectorAgent::InspectorAgent):
(WebCore::InspectorAgent::~InspectorAgent):
(WebCore::InspectorAgent::inspectedPageDestroyed):
(WebCore::InspectorAgent::restore):
(WebCore::InspectorAgent::setFrontend):
(WebCore::InspectorAgent::clearFrontend):
* inspector/InspectorAgent.h: all accessors to other agents were removed along with
the agents themselves from InspectorAgent. Every agent that depends on some other agents
receives pointers to them explicitely in its constructor. All access to the agents
from WebCore should go through InspectorInstrumentation which retrieves corresponding
agents using InstrumentingAgents structure which represents the set of active agents.
(WebCore::InspectorAgent::instrumentingAgents):
* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
(WebCore::InspectorController::~InspectorController):
(WebCore::InspectorController::inspectedPageDestroyed):
(WebCore::InspectorController::startTimelineProfiler):
(WebCore::InspectorController::stopTimelineProfiler):
(WebCore::InspectorController::connectFrontend):
(WebCore::InspectorController::disconnectFrontend):
(WebCore::InspectorController::restoreInspectorStateFromCookie):
(WebCore::InspectorController::drawNodeHighlight):
(WebCore::InspectorController::inspect):
(WebCore::InspectorController::timelineProfilerEnabled):
(WebCore::InspectorController::hideHighlight):
(WebCore::InspectorController::highlightedNode):
(WebCore::InspectorController::enableProfiler):
(WebCore::InspectorController::disableProfiler):
(WebCore::InspectorController::profilerEnabled):
(WebCore::InspectorController::debuggerEnabled):
(WebCore::InspectorController::disableDebugger):
(WebCore::InspectorController::startUserInitiatedProfiling):
(WebCore::InspectorController::stopUserInitiatedProfiling):
(WebCore::InspectorController::isRecordingUserInitiatedProfile):
(WebCore::InspectorController::resume):
* inspector/InspectorController.h:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didInsertDOMNodeImpl):
(WebCore::InspectorInstrumentation::didRemoveDOMNodeImpl):
(WebCore::InspectorInstrumentation::didModifyDOMAttrImpl):
(WebCore::InspectorInstrumentation::didInvalidateStyleAttrImpl):
(WebCore::InspectorInstrumentation::characterDataModifiedImpl):
(WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl):
(WebCore::InspectorInstrumentation::didFailLoadingImpl):
(WebCore::InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl):
(WebCore::InspectorInstrumentation::addMessageToConsoleImpl):
(WebCore::InspectorInstrumentation::consoleCountImpl):
(WebCore::InspectorInstrumentation::startConsoleTimingImpl):
(WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
(WebCore::InspectorInstrumentation::addStartProfilingMessageToConsoleImpl):
(WebCore::InspectorInstrumentation::addProfileImpl):
(WebCore::InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl):
(WebCore::InspectorInstrumentation::profilerEnabledImpl):
(WebCore::InspectorInstrumentation::cancelPauseOnNativeEvent):
* page/Page.cpp:
(WebCore::Page::~Page): we send two notifications when inspected Page is being
destroyed: one to the inspector instrumentation and another one to the InspectorController
which is owned by the Page.
2011-05-12 Tony Gentilcore <tonyg@chromium.org>
 
Build fix: include ExceptionCode.h
......@@ -46,6 +46,7 @@ class InspectorDOMStorageAgent;
class InspectorDatabaseAgent;
class InspectorFrontend;
class InspectorObject;
class InspectorValue;
class Node;
class ScriptObject;
class ScriptValue;
......
......@@ -39,120 +39,38 @@
#include "GraphicsContext.h"
#include "InjectedScriptHost.h"
#include "InjectedScriptManager.h"
#include "InspectorDOMDebuggerAgent.h"
#include "InspectorCSSAgent.h"
#include "InspectorClient.h"
#include "InspectorConsoleAgent.h"
#include "InspectorController.h"
#include "InspectorDOMAgent.h"
#include "InspectorFrontend.h"
#include "InspectorInstrumentation.h"
#include "InspectorPageAgent.h"
#include "InspectorProfilerAgent.h"
#include "InspectorResourceAgent.h"
#include "InspectorRuntimeAgent.h"
#include "InspectorState.h"
#include "InspectorTimelineAgent.h"
#include "InspectorValues.h"
#include "InspectorWorkerAgent.h"
#include "InspectorWorkerResource.h"
#include "InstrumentingAgents.h"
#include "Page.h"
#include "PageDebuggerAgent.h"
#include "ResourceRequest.h"
#include "ScriptFunctionCall.h"
#include "ScriptObject.h"
#include "ScriptState.h"
#include "Settings.h"
#if ENABLE(DATABASE)
#include "InspectorDatabaseAgent.h"
#endif
#if ENABLE(DOM_STORAGE)
#include "InspectorDOMStorageAgent.h"
#endif
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
#include "InspectorApplicationCacheAgent.h"
#endif
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
using namespace std;
namespace WebCore {
namespace InspectorAgentState {
static const char timelineProfilerEnabled[] = "timelineProfilerEnabled";
static const char debuggerEnabled[] = "debuggerEnabled";
}
static const char scriptsPanelName[] = "scripts";
static const char consolePanelName[] = "console";
static const char profilesPanelName[] = "profiles";
namespace {
class PageRuntimeAgent : public InspectorRuntimeAgent {
public:
PageRuntimeAgent(InjectedScriptManager* injectedScriptManager, Page* page)
: InspectorRuntimeAgent(injectedScriptManager)
, m_inspectedPage(page) { }
virtual ~PageRuntimeAgent() { }
private:
virtual ScriptState* getDefaultInspectedState() { return mainWorldScriptState(m_inspectedPage->mainFrame()); }
Page* m_inspectedPage;
};
}
InspectorAgent::InspectorAgent(Page* page, InspectorClient* client, InjectedScriptManager* injectedScriptManager)
InspectorAgent::InspectorAgent(Page* page, InjectedScriptManager* injectedScriptManager, InstrumentingAgents* instrumentingAgents)
: m_inspectedPage(page)
, m_client(client)
, m_frontend(0)
, m_instrumentingAgents(adoptPtr(new InstrumentingAgents))
, m_instrumentingAgents(instrumentingAgents)
, m_injectedScriptManager(injectedScriptManager)
, m_state(adoptPtr(new InspectorState(client)))
, m_pageAgent(InspectorPageAgent::create(m_instrumentingAgents.get(), page, injectedScriptManager))
, m_domAgent(InspectorDOMAgent::create(m_instrumentingAgents.get(), m_pageAgent.get(), m_client, m_state.get(), injectedScriptManager))
, m_cssAgent(adoptPtr(new InspectorCSSAgent(m_instrumentingAgents.get(), m_domAgent.get())))
#if ENABLE(DATABASE)
, m_databaseAgent(InspectorDatabaseAgent::create(m_instrumentingAgents.get(), m_state.get()))
#endif
#if ENABLE(DOM_STORAGE)
, m_domStorageAgent(InspectorDOMStorageAgent::create(m_instrumentingAgents.get(), m_state.get()))
#endif
, m_timelineAgent(InspectorTimelineAgent::create(m_instrumentingAgents.get(), m_state.get()))
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
, m_applicationCacheAgent(adoptPtr(new InspectorApplicationCacheAgent(m_instrumentingAgents.get(), page)))
#endif
, m_resourceAgent(InspectorResourceAgent::create(m_instrumentingAgents.get(), m_pageAgent.get(), m_state.get()))
, m_runtimeAgent(adoptPtr(new PageRuntimeAgent(m_injectedScriptManager, page)))
, m_consoleAgent(adoptPtr(new InspectorConsoleAgent(m_instrumentingAgents.get(), this, m_state.get(), injectedScriptManager, m_domAgent.get())))
#if ENABLE(JAVASCRIPT_DEBUGGER)
, m_debuggerAgent(PageDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), page, injectedScriptManager))
, m_domDebuggerAgent(InspectorDOMDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), m_domAgent.get(), m_debuggerAgent.get(), this))
, m_profilerAgent(InspectorProfilerAgent::create(m_instrumentingAgents.get(), m_consoleAgent.get(), page, m_state.get()))
#endif
#if ENABLE(WORKERS)
, m_workerAgent(InspectorWorkerAgent::create(m_instrumentingAgents.get()))
#endif
, m_canIssueEvaluateForTestInFrontend(false)
{
ASSERT_ARG(page, page);
ASSERT_ARG(client, client);
InspectorInstrumentation::bindInspectorAgent(m_inspectedPage, this);
m_instrumentingAgents->setInspectorAgent(this);
m_injectedScriptManager->injectedScriptHost()->init(this
, m_consoleAgent.get()
#if ENABLE(DATABASE)
, m_databaseAgent.get()
#endif
#if ENABLE(DOM_STORAGE)
, m_domStorageAgent.get()
#endif
);
}
InspectorAgent::~InspectorAgent()
......@@ -160,54 +78,21 @@ InspectorAgent::~InspectorAgent()
m_instrumentingAgents->setInspectorAgent(0);
// These should have been cleared in inspectedPageDestroyed().
ASSERT(!m_client);
ASSERT(!m_inspectedPage);
}
void InspectorAgent::inspectedPageDestroyed()
{
if (m_frontend) {
if (m_frontend)
m_frontend->inspector()->disconnectFromBackend();
disconnectFrontend();
}
#if ENABLE(JAVASCRIPT_DEBUGGER)
m_domDebuggerAgent.clear();
m_debuggerAgent.clear();
#endif
ASSERT(m_inspectedPage);
InspectorInstrumentation::unbindInspectorAgent(m_inspectedPage);
m_inspectedPage = 0;
m_injectedScriptManager->disconnect();
m_client->inspectorDestroyed();
m_client = 0;
}
void InspectorAgent::restoreInspectorStateFromCookie(const String& inspectorStateCookie)
void InspectorAgent::restore()
{
m_state->loadFromCookie(inspectorStateCookie);
m_frontend->inspector()->frontendReused();
m_domAgent->restore();
m_resourceAgent->restore();
m_timelineAgent->restore();
#if ENABLE(DATABASE)
m_databaseAgent->restore();
#endif
#if ENABLE(DOM_STORAGE)
m_domStorageAgent->restore();
#endif
#if ENABLE(JAVASCRIPT_DEBUGGER)
m_debuggerAgent->restore();
m_profilerAgent->restore();
#endif
}
void InspectorAgent::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld* world)
......@@ -221,30 +106,8 @@ void InspectorAgent::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld*
void InspectorAgent::setFrontend(InspectorFrontend* inspectorFrontend)
{
// We can reconnect to existing front-end -> unmute state.
m_state->unmute();
m_frontend = inspectorFrontend;
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
m_applicationCacheAgent->setFrontend(m_frontend);
#endif
m_pageAgent->setFrontend(m_frontend);
m_domAgent->setFrontend(m_frontend);
m_consoleAgent->setFrontend(m_frontend);
m_timelineAgent->setFrontend(m_frontend);
m_resourceAgent->setFrontend(m_frontend);
#if ENABLE(JAVASCRIPT_DEBUGGER)
m_debuggerAgent->setFrontend(m_frontend);
m_profilerAgent->setFrontend(m_frontend);
#endif
#if ENABLE(DATABASE)
m_databaseAgent->setFrontend(m_frontend);
#endif
#if ENABLE(DOM_STORAGE)
m_domStorageAgent->setFrontend(m_frontend);
#endif
if (!m_showPanelAfterVisible.isEmpty()) {
m_frontend->inspector()->showPanel(m_showPanelAfterVisible);
m_showPanelAfterVisible = String();
......@@ -256,52 +119,16 @@ void InspectorAgent::setFrontend(InspectorFrontend* inspectorFrontend)
m_frontend->inspector()->didCreateWorker(worker->id(), worker->url(), worker->isSharedWorker());
}
#endif
#if ENABLE(WORKERS)
m_workerAgent->setFrontend(m_frontend);
#endif
// Dispatch pending frontend commands
issueEvaluateForTestCommands();
}
void InspectorAgent::disconnectFrontend()
void InspectorAgent::clearFrontend()
{
if (!m_frontend)
return;
m_canIssueEvaluateForTestInFrontend = false;
m_pendingEvaluateTestCommands.clear();
// Destroying agents would change the state, but we don't want that.
// Pre-disconnect state will be used to restore inspector agents.
m_state->mute();
m_frontend = 0;
#if ENABLE(JAVASCRIPT_DEBUGGER)
m_debuggerAgent->clearFrontend();
m_domDebuggerAgent->clearFrontend();
m_profilerAgent->clearFrontend();
#endif
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
m_applicationCacheAgent->clearFrontend();
#endif
m_consoleAgent->clearFrontend();
m_domAgent->clearFrontend();
m_timelineAgent->clearFrontend();
m_resourceAgent->clearFrontend();
#if ENABLE(DATABASE)
m_databaseAgent->clearFrontend();
#endif
#if ENABLE(DOM_STORAGE)
m_domStorageAgent->clearFrontend();
#endif
m_pageAgent->clearFrontend();
#if ENABLE(WORKERS)
m_workerAgent->clearFrontend();
#endif
}
void InspectorAgent::didCommitLoad()
......
/*
* Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -29,66 +30,23 @@
#ifndef InspectorAgent_h
#define InspectorAgent_h
#include "CharacterData.h"
#include "ConsoleTypes.h"
#include "Page.h"
#include "PlatformString.h"
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
#include <wtf/text/StringHash.h>
namespace WebCore {
class CharacterData;
class Database;
class DOMWrapperWorld;
class Document;
class DocumentLoader;
class FloatRect;
class HTTPHeaderMap;
class InjectedScript;
class Frame;
class InjectedScriptManager;
class InspectorArray;
class InspectorDOMDebuggerAgent;
class InspectorClient;
class InspectorConsoleAgent;
class InspectorCSSAgent;
class InspectorDOMAgent;
class InspectorDOMStorageAgent;
class InspectorDatabaseAgent;
class InspectorDatabaseResource;
class InspectorDebuggerAgent;
class InspectorFrontend;
class InspectorFrontendClient;
class InspectorObject;
class InspectorPageAgent;
class InspectorProfilerAgent;
class InspectorResourceAgent;
class InspectorRuntimeAgent;
class InspectorState;
class InspectorStorageAgent;
class InspectorTimelineAgent;
class InspectorValue;
class InspectorWorkerAgent;
class InspectorWorkerResource;
class InstrumentingAgents;
class IntRect;
class KURL;
class Node;
class Page;
class ResourceRequest;
class ResourceResponse;
class ResourceError;
class ScriptArguments;
class ScriptCallStack;
class ScriptProfile;
class SharedBuffer;
class StorageArea;
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
class InspectorApplicationCacheAgent;
#endif
typedef String ErrorString;
......@@ -96,11 +54,9 @@ class InspectorAgent {
WTF_MAKE_NONCOPYABLE(InspectorAgent);
WTF_MAKE_FAST_ALLOCATED;
public:
InspectorAgent(Page*, InspectorClient*, InjectedScriptManager*);
InspectorAgent(Page*, InjectedScriptManager*, InstrumentingAgents*);
virtual ~InspectorAgent();
InspectorClient* inspectorClient() { return m_client; }
void inspectedPageDestroyed();
bool enabled() const;
......@@ -111,38 +67,12 @@ public:
void reloadPage(ErrorString*, bool ignoreCache);
void showConsole();
void restoreInspectorStateFromCookie(const String& inspectorCookie);
void setFrontend(InspectorFrontend*);
InspectorFrontend* frontend() const { return m_frontend; }
void disconnectFrontend();
InstrumentingAgents* instrumentingAgents() const { return m_instrumentingAgents.get(); }
InspectorPageAgent* pageAgent() { return m_pageAgent.get(); }
InspectorConsoleAgent* consoleAgent() { return m_consoleAgent.get(); }
InspectorCSSAgent* cssAgent() { return m_cssAgent.get(); }
InspectorDOMAgent* domAgent() { return m_domAgent.get(); }
InspectorRuntimeAgent* runtimeAgent() { return m_runtimeAgent.get(); }
InspectorTimelineAgent* timelineAgent() { return m_timelineAgent.get(); }
InspectorResourceAgent* resourceAgent() { return m_resourceAgent.get(); }
#if ENABLE(DATABASE)
InspectorDatabaseAgent* databaseAgent() { return m_databaseAgent.get(); }
#endif
#if ENABLE(DOM_STORAGE)
InspectorDOMStorageAgent* domStorageAgent() { return m_domStorageAgent.get(); }
#endif
#if ENABLE(JAVASCRIPT_DEBUGGER)
InspectorDOMDebuggerAgent* domDebuggerAgent() const { return m_domDebuggerAgent.get(); }
InspectorDebuggerAgent* debuggerAgent() const { return m_debuggerAgent.get(); }
InspectorProfilerAgent* profilerAgent() const { return m_profilerAgent.get(); }
#endif
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
InspectorApplicationCacheAgent* applicationCacheAgent() { return m_applicationCacheAgent.get(); }
#endif
#if ENABLE(WORKERS)
InspectorWorkerAgent* workerAgent() { return m_workerAgent.get(); }
#endif
void clearFrontend();
void restore();
InstrumentingAgents* instrumentingAgents() const { return m_instrumentingAgents; }
void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
......@@ -169,8 +99,6 @@ public:
void setInspectorExtensionAPI(const String& source);
InspectorState* state() { return m_state.get(); }
// InspectorAgent API
void getInspectorState(RefPtr<InspectorObject>* state);
void setMonitoringXHREnabled(bool enabled, bool* newState);
......@@ -187,46 +115,16 @@ private:
void issueEvaluateForTestCommands();
Page* m_inspectedPage;
InspectorClient* m_client;
InspectorFrontend* m_frontend;
OwnPtr<InstrumentingAgents> m_instrumentingAgents;
InstrumentingAgents* m_instrumentingAgents;
InjectedScriptManager* m_injectedScriptManager;
OwnPtr<InspectorState> m_state;
OwnPtr<InspectorPageAgent> m_pageAgent;
OwnPtr<InspectorDOMAgent> m_domAgent;
OwnPtr<InspectorCSSAgent> m_cssAgent;
#if ENABLE(DATABASE)
OwnPtr<InspectorDatabaseAgent> m_databaseAgent;
#endif
#if ENABLE(DOM_STORAGE)
OwnPtr<InspectorDOMStorageAgent> m_domStorageAgent;
#endif
OwnPtr<InspectorTimelineAgent> m_timelineAgent;
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
OwnPtr<InspectorApplicationCacheAgent> m_applicationCacheAgent;
#endif
RefPtr<InspectorResourceAgent> m_resourceAgent;
OwnPtr<InspectorRuntimeAgent> m_runtimeAgent;
OwnPtr<InspectorConsoleAgent> m_consoleAgent;
Vector<pair<long, String> > m_pendingEvaluateTestCommands;
String m_showPanelAfterVisible;
String m_inspectorExtensionAPI;
#if ENABLE(JAVASCRIPT_DEBUGGER)
OwnPtr<InspectorDebuggerAgent> m_debuggerAgent;
OwnPtr<InspectorDOMDebuggerAgent> m_domDebuggerAgent;
OwnPtr<InspectorProfilerAgent> m_profilerAgent;
#endif
#if ENABLE(WORKERS)
typedef HashMap<intptr_t, RefPtr<InspectorWorkerResource> > WorkersMap;
WorkersMap m_workers;
OwnPtr<InspectorWorkerAgent> m_workerAgent;
#endif
bool m_canIssueEvaluateForTestInFrontend;
};
......
......@@ -38,16 +38,28 @@
#include "InjectedScriptHost.h"
#include "InjectedScriptManager.h"
#include "InspectorAgent.h"
#include "InspectorApplicationCacheAgent.h"
#include "InspectorBackendDispatcher.h"
#include "InspectorDebuggerAgent.h"
#include "InspectorCSSAgent.h"
#include "InspectorClient.h"
#include "InspectorConsoleAgent.h"
#include "InspectorDOMAgent.h"
#include "InspectorDOMDebuggerAgent.h"
#include "InspectorDOMStorageAgent.h"
#include "InspectorDatabaseAgent.h"
#include "InspectorDebuggerAgent.h"
#include "InspectorFrontend.h"
#include "InspectorFrontendClient.h"
#include "InspectorInstrumentation.h"
#include "InspectorPageAgent.h"
#include "InspectorProfilerAgent.h"
#include "InspectorResourceAgent.h"
#include "InspectorRuntimeAgent.h"
#include "InspectorState.h"
#include "InspectorTimelineAgent.h"
#include "InspectorWorkerAgent.h"
#include "InstrumentingAgents.h"
#include "PageDebuggerAgent.h"
#include "Page.h"
#include "ScriptObject.h"
#include "Settings.h"
......@@ -55,17 +67,82 @@
namespace WebCore {
namespace {
class PageRuntimeAgent : public InspectorRuntimeAgent {
public:
PageRuntimeAgent(InjectedScriptManager* injectedScriptManager, Page* page)
: InspectorRuntimeAgent(injectedScriptManager)
, m_inspectedPage(page) { }
virtual ~PageRuntimeAgent() { }
private:
virtual ScriptState* getDefaultInspectedState() { return mainWorldScriptState(m_inspectedPage->mainFrame()); }
Page* m_inspectedPage;
};
}
InspectorController::InspectorController(Page* page, InspectorClient* inspectorClient)
: m_injectedScriptManager(InjectedScriptManager::createForPage())
, m_inspectorAgent(adoptPtr(new InspectorAgent(page, inspectorClient, m_injectedScriptManager.get())))
: m_instrumentingAgents(adoptPtr(new InstrumentingAgents()))
, m_injectedScriptManager(InjectedScriptManager::createForPage())
, m_state(adoptPtr(new InspectorState(inspectorClient)))
, m_inspectorAgent(adoptPtr(new InspectorAgent(page, m_injectedScriptManager.get(), m_instrumentingAgents.get())))
, m_pageAgent(InspectorPageAgent::create(m_instrumentingAgents.get(), page, m_injectedScriptManager.get()))
, m_domAgent(InspectorDOMAgent::create(m_instrumentingAgents.get(), m_pageAgent.get(), inspectorClient, m_state.get(), m_injectedScriptManager.get()))
, m_cssAgent(adoptPtr(new InspectorCSSAgent(m_instrumentingAgents.get(), m_domAgent.get())))
#if ENABLE(DATABASE)
, m_databaseAgent(InspectorDatabaseAgent::create(m_instrumentingAgents.get(), m_state.get()))
#endif
#if ENABLE(DOM_STORAGE)
, m_domStorageAgent(InspectorDOMStorageAgent::create(m_instrumentingAgents.get(), m_state.get()))
#endif
, m_timelineAgent(InspectorTimelineAgent::create(m_instrumentingAgents.get(), m_state.get()))
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
, m_applicationCacheAgent(adoptPtr(new InspectorApplicationCacheAgent(m_instrumentingAgents.get(), page)))
#endif
, m_resourceAgent(InspectorResourceAgent::create(m_instrumentingAgents.get(), m_pageAgent.get(), m_state.get()))
, m_runtimeAgent(adoptPtr(new PageRuntimeAgent(m_injectedScriptManager.get(), page)))