Changeset 86327 in webkit


Ignore:
Timestamp:
May 12, 2011 3:48:09 AM (13 years ago)
Author:
yurys@chromium.org
Message:

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.
Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86326 r86327  
     12011-05-06  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: move agents from InspectorAgent to InspectorController
     6        https://bugs.webkit.org/show_bug.cgi?id=60359
     7
     8        All inspector agents are now created and owned by InspectorController which
     9        in turned is owned by the inspected Page. InspectorInstrumentation gets access
     10        to the instrumenting agents by means of InspectorAgent::instrumentingAgents().
     11
     12        In addition to managing inspector agents lifetime InspectorController sets
     13        InspectorFronted on the agents when the front-end is connected.
     14
     15        * inspector/InspectorAgent.cpp:
     16        (WebCore::InspectorAgent::InspectorAgent):
     17        (WebCore::InspectorAgent::~InspectorAgent):
     18        (WebCore::InspectorAgent::inspectedPageDestroyed):
     19        (WebCore::InspectorAgent::restore):
     20        (WebCore::InspectorAgent::setFrontend):
     21        (WebCore::InspectorAgent::clearFrontend):
     22        * inspector/InspectorAgent.h: all accessors to other agents were removed along with
     23        the agents themselves from InspectorAgent. Every agent that depends on some other agents
     24        receives pointers to them explicitely in its constructor. All access to the agents
     25        from WebCore should go through InspectorInstrumentation which retrieves corresponding
     26        agents using InstrumentingAgents structure which represents the set of active agents.
     27        (WebCore::InspectorAgent::instrumentingAgents):
     28        * inspector/InspectorController.cpp:
     29        (WebCore::InspectorController::InspectorController):
     30        (WebCore::InspectorController::~InspectorController):
     31        (WebCore::InspectorController::inspectedPageDestroyed):
     32        (WebCore::InspectorController::startTimelineProfiler):
     33        (WebCore::InspectorController::stopTimelineProfiler):
     34        (WebCore::InspectorController::connectFrontend):
     35        (WebCore::InspectorController::disconnectFrontend):
     36        (WebCore::InspectorController::restoreInspectorStateFromCookie):
     37        (WebCore::InspectorController::drawNodeHighlight):
     38        (WebCore::InspectorController::inspect):
     39        (WebCore::InspectorController::timelineProfilerEnabled):
     40        (WebCore::InspectorController::hideHighlight):
     41        (WebCore::InspectorController::highlightedNode):
     42        (WebCore::InspectorController::enableProfiler):
     43        (WebCore::InspectorController::disableProfiler):
     44        (WebCore::InspectorController::profilerEnabled):
     45        (WebCore::InspectorController::debuggerEnabled):
     46        (WebCore::InspectorController::disableDebugger):
     47        (WebCore::InspectorController::startUserInitiatedProfiling):
     48        (WebCore::InspectorController::stopUserInitiatedProfiling):
     49        (WebCore::InspectorController::isRecordingUserInitiatedProfile):
     50        (WebCore::InspectorController::resume):
     51        * inspector/InspectorController.h:
     52        * inspector/InspectorInstrumentation.cpp:
     53        (WebCore::InspectorInstrumentation::didInsertDOMNodeImpl):
     54        (WebCore::InspectorInstrumentation::didRemoveDOMNodeImpl):
     55        (WebCore::InspectorInstrumentation::didModifyDOMAttrImpl):
     56        (WebCore::InspectorInstrumentation::didInvalidateStyleAttrImpl):
     57        (WebCore::InspectorInstrumentation::characterDataModifiedImpl):
     58        (WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl):
     59        (WebCore::InspectorInstrumentation::didFailLoadingImpl):
     60        (WebCore::InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl):
     61        (WebCore::InspectorInstrumentation::addMessageToConsoleImpl):
     62        (WebCore::InspectorInstrumentation::consoleCountImpl):
     63        (WebCore::InspectorInstrumentation::startConsoleTimingImpl):
     64        (WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
     65        (WebCore::InspectorInstrumentation::addStartProfilingMessageToConsoleImpl):
     66        (WebCore::InspectorInstrumentation::addProfileImpl):
     67        (WebCore::InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl):
     68        (WebCore::InspectorInstrumentation::profilerEnabledImpl):
     69        (WebCore::InspectorInstrumentation::cancelPauseOnNativeEvent):
     70        * page/Page.cpp:
     71        (WebCore::Page::~Page): we send two notifications when inspected Page is being
     72        destroyed: one to the inspector instrumentation and another one to the InspectorController
     73        which is owned by the Page.
     74
    1752011-05-12  Tony Gentilcore  <tonyg@chromium.org>
    276
  • trunk/Source/WebCore/inspector/InjectedScriptHost.h

    r86251 r86327  
    4747class InspectorFrontend;
    4848class InspectorObject;
     49class InspectorValue;
    4950class Node;
    5051class ScriptObject;
  • trunk/Source/WebCore/inspector/InspectorAgent.cpp

    r85850 r86327  
    4040#include "InjectedScriptHost.h"
    4141#include "InjectedScriptManager.h"
    42 #include "InspectorDOMDebuggerAgent.h"
    43 #include "InspectorCSSAgent.h"
    44 #include "InspectorClient.h"
    45 #include "InspectorConsoleAgent.h"
    4642#include "InspectorController.h"
    47 #include "InspectorDOMAgent.h"
    4843#include "InspectorFrontend.h"
    4944#include "InspectorInstrumentation.h"
    50 #include "InspectorPageAgent.h"
    51 #include "InspectorProfilerAgent.h"
    52 #include "InspectorResourceAgent.h"
    53 #include "InspectorRuntimeAgent.h"
    54 #include "InspectorState.h"
    55 #include "InspectorTimelineAgent.h"
    5645#include "InspectorValues.h"
    57 #include "InspectorWorkerAgent.h"
    5846#include "InspectorWorkerResource.h"
    5947#include "InstrumentingAgents.h"
    6048#include "Page.h"
    61 #include "PageDebuggerAgent.h"
    6249#include "ResourceRequest.h"
    6350#include "ScriptFunctionCall.h"
    6451#include "ScriptObject.h"
    65 #include "ScriptState.h"
    6652#include "Settings.h"
    67 
    68 #if ENABLE(DATABASE)
    69 #include "InspectorDatabaseAgent.h"
    70 #endif
    71 
    72 #if ENABLE(DOM_STORAGE)
    73 #include "InspectorDOMStorageAgent.h"
    74 #endif
    75 
    76 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
    77 #include "InspectorApplicationCacheAgent.h"
    78 #endif
     53#include <wtf/PassRefPtr.h>
     54#include <wtf/RefPtr.h>
    7955
    8056using namespace std;
    8157
    8258namespace WebCore {
    83 
    84 namespace InspectorAgentState {
    85 static const char timelineProfilerEnabled[] = "timelineProfilerEnabled";
    86 static const char debuggerEnabled[] = "debuggerEnabled";
    87 }
    8859
    8960static const char scriptsPanelName[] = "scripts";
     
    9162static const char profilesPanelName[] = "profiles";
    9263
    93 namespace {
    94 
    95 class PageRuntimeAgent : public InspectorRuntimeAgent {
    96 public:
    97     PageRuntimeAgent(InjectedScriptManager* injectedScriptManager, Page* page)
    98         : InspectorRuntimeAgent(injectedScriptManager)
    99         , m_inspectedPage(page) { }
    100     virtual ~PageRuntimeAgent() { }
    101 
    102 private:
    103     virtual ScriptState* getDefaultInspectedState() { return mainWorldScriptState(m_inspectedPage->mainFrame()); }
    104     Page* m_inspectedPage;
    105 };
    106 
    107 }
    108 
    109 InspectorAgent::InspectorAgent(Page* page, InspectorClient* client, InjectedScriptManager* injectedScriptManager)
     64InspectorAgent::InspectorAgent(Page* page, InjectedScriptManager* injectedScriptManager, InstrumentingAgents* instrumentingAgents)
    11065    : m_inspectedPage(page)
    111     , m_client(client)
    11266    , m_frontend(0)
    113     , m_instrumentingAgents(adoptPtr(new InstrumentingAgents))
     67    , m_instrumentingAgents(instrumentingAgents)
    11468    , m_injectedScriptManager(injectedScriptManager)
    115     , m_state(adoptPtr(new InspectorState(client)))
    116     , m_pageAgent(InspectorPageAgent::create(m_instrumentingAgents.get(), page, injectedScriptManager))
    117     , m_domAgent(InspectorDOMAgent::create(m_instrumentingAgents.get(), m_pageAgent.get(), m_client, m_state.get(), injectedScriptManager))
    118     , m_cssAgent(adoptPtr(new InspectorCSSAgent(m_instrumentingAgents.get(), m_domAgent.get())))
    119 #if ENABLE(DATABASE)
    120     , m_databaseAgent(InspectorDatabaseAgent::create(m_instrumentingAgents.get(), m_state.get()))
    121 #endif
    122 #if ENABLE(DOM_STORAGE)
    123     , m_domStorageAgent(InspectorDOMStorageAgent::create(m_instrumentingAgents.get(), m_state.get()))
    124 #endif
    125     , m_timelineAgent(InspectorTimelineAgent::create(m_instrumentingAgents.get(), m_state.get()))
    126 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
    127     , m_applicationCacheAgent(adoptPtr(new InspectorApplicationCacheAgent(m_instrumentingAgents.get(), page)))
    128 #endif
    129     , m_resourceAgent(InspectorResourceAgent::create(m_instrumentingAgents.get(), m_pageAgent.get(), m_state.get()))
    130     , m_runtimeAgent(adoptPtr(new PageRuntimeAgent(m_injectedScriptManager, page)))
    131     , m_consoleAgent(adoptPtr(new InspectorConsoleAgent(m_instrumentingAgents.get(), this, m_state.get(), injectedScriptManager, m_domAgent.get())))
    132 #if ENABLE(JAVASCRIPT_DEBUGGER)
    133     , m_debuggerAgent(PageDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), page, injectedScriptManager))
    134     , m_domDebuggerAgent(InspectorDOMDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), m_domAgent.get(), m_debuggerAgent.get(), this))
    135     , m_profilerAgent(InspectorProfilerAgent::create(m_instrumentingAgents.get(), m_consoleAgent.get(), page, m_state.get()))
    136 #endif
    137 #if ENABLE(WORKERS)
    138     , m_workerAgent(InspectorWorkerAgent::create(m_instrumentingAgents.get()))
    139 #endif
    14069    , m_canIssueEvaluateForTestInFrontend(false)
    14170{
    14271    ASSERT_ARG(page, page);
    143     ASSERT_ARG(client, client);
    14472    InspectorInstrumentation::bindInspectorAgent(m_inspectedPage, this);
    14573    m_instrumentingAgents->setInspectorAgent(this);
    146 
    147     m_injectedScriptManager->injectedScriptHost()->init(this
    148         , m_consoleAgent.get()
    149 #if ENABLE(DATABASE)
    150         , m_databaseAgent.get()
    151 #endif
    152 #if ENABLE(DOM_STORAGE)
    153         , m_domStorageAgent.get()
    154 #endif
    155     );
    15674}
    15775
     
    16179
    16280    // These should have been cleared in inspectedPageDestroyed().
    163     ASSERT(!m_client);
    16481    ASSERT(!m_inspectedPage);
    16582}
     
    16784void InspectorAgent::inspectedPageDestroyed()
    16885{
    169     if (m_frontend) {
     86    if (m_frontend)
    17087        m_frontend->inspector()->disconnectFromBackend();
    171         disconnectFrontend();
    172     }
    173 
    174 #if ENABLE(JAVASCRIPT_DEBUGGER)
    175     m_domDebuggerAgent.clear();
    176     m_debuggerAgent.clear();
    177 #endif
    178 
    17988    ASSERT(m_inspectedPage);
    18089    InspectorInstrumentation::unbindInspectorAgent(m_inspectedPage);
    18190    m_inspectedPage = 0;
    182 
    183     m_injectedScriptManager->disconnect();
    184 
    185     m_client->inspectorDestroyed();
    186     m_client = 0;
    187 }
    188 
    189 void InspectorAgent::restoreInspectorStateFromCookie(const String& inspectorStateCookie)
    190 {
    191     m_state->loadFromCookie(inspectorStateCookie);
    192 
     91}
     92
     93void InspectorAgent::restore()
     94{
    19395    m_frontend->inspector()->frontendReused();
    194 
    195     m_domAgent->restore();
    196     m_resourceAgent->restore();
    197     m_timelineAgent->restore();
    198 
    199 #if ENABLE(DATABASE)
    200     m_databaseAgent->restore();
    201 #endif
    202 
    203 #if ENABLE(DOM_STORAGE)
    204     m_domStorageAgent->restore();
    205 #endif
    206 
    207 #if ENABLE(JAVASCRIPT_DEBUGGER)
    208     m_debuggerAgent->restore();
    209     m_profilerAgent->restore();
    210 #endif
    21196}
    21297
     
    222107void InspectorAgent::setFrontend(InspectorFrontend* inspectorFrontend)
    223108{
    224     // We can reconnect to existing front-end -> unmute state.
    225     m_state->unmute();
    226 
    227109    m_frontend = inspectorFrontend;
    228 
    229 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
    230     m_applicationCacheAgent->setFrontend(m_frontend);
    231 #endif
    232     m_pageAgent->setFrontend(m_frontend);
    233     m_domAgent->setFrontend(m_frontend);
    234     m_consoleAgent->setFrontend(m_frontend);
    235     m_timelineAgent->setFrontend(m_frontend);
    236     m_resourceAgent->setFrontend(m_frontend);
    237 #if ENABLE(JAVASCRIPT_DEBUGGER)
    238     m_debuggerAgent->setFrontend(m_frontend);
    239     m_profilerAgent->setFrontend(m_frontend);
    240 #endif
    241 #if ENABLE(DATABASE)
    242     m_databaseAgent->setFrontend(m_frontend);
    243 #endif
    244 #if ENABLE(DOM_STORAGE)
    245     m_domStorageAgent->setFrontend(m_frontend);
    246 #endif
    247110
    248111    if (!m_showPanelAfterVisible.isEmpty()) {
     
    257120    }
    258121#endif
    259 #if ENABLE(WORKERS)
    260     m_workerAgent->setFrontend(m_frontend);
    261 #endif
    262122
    263123    // Dispatch pending frontend commands
     
    265125}
    266126
    267 void InspectorAgent::disconnectFrontend()
    268 {
    269     if (!m_frontend)
    270         return;
    271 
     127void InspectorAgent::clearFrontend()
     128{
    272129    m_canIssueEvaluateForTestInFrontend = false;
    273130    m_pendingEvaluateTestCommands.clear();
    274 
    275     // Destroying agents would change the state, but we don't want that.
    276     // Pre-disconnect state will be used to restore inspector agents.
    277     m_state->mute();
    278 
    279131    m_frontend = 0;
    280 
    281 #if ENABLE(JAVASCRIPT_DEBUGGER)
    282     m_debuggerAgent->clearFrontend();
    283     m_domDebuggerAgent->clearFrontend();
    284     m_profilerAgent->clearFrontend();
    285 #endif
    286 
    287 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
    288     m_applicationCacheAgent->clearFrontend();
    289 #endif
    290 
    291     m_consoleAgent->clearFrontend();
    292     m_domAgent->clearFrontend();
    293     m_timelineAgent->clearFrontend();
    294     m_resourceAgent->clearFrontend();
    295 #if ENABLE(DATABASE)
    296     m_databaseAgent->clearFrontend();
    297 #endif
    298 #if ENABLE(DOM_STORAGE)
    299     m_domStorageAgent->clearFrontend();
    300 #endif
    301     m_pageAgent->clearFrontend();
    302 #if ENABLE(WORKERS)
    303     m_workerAgent->clearFrontend();
    304 #endif
    305132}
    306133
  • trunk/Source/WebCore/inspector/InspectorAgent.h

    r86251 r86327  
    11/*
    22 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
     3 * Copyright (C) 2011 Google Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    3031#define InspectorAgent_h
    3132
    32 #include "CharacterData.h"
    33 #include "ConsoleTypes.h"
    34 #include "Page.h"
    3533#include "PlatformString.h"
     34#include <wtf/Forward.h>
    3635#include <wtf/HashMap.h>
    37 #include <wtf/RefCounted.h>
    3836#include <wtf/Vector.h>
    39 #include <wtf/text/StringHash.h>
    4037
    4138namespace WebCore {
    4239
    43 class CharacterData;
    44 class Database;
    4540class DOMWrapperWorld;
    46 class Document;
    4741class DocumentLoader;
    48 class FloatRect;
    49 class HTTPHeaderMap;
    50 class InjectedScript;
     42class Frame;
    5143class InjectedScriptManager;
    52 class InspectorArray;
    53 class InspectorDOMDebuggerAgent;
    54 class InspectorClient;
    55 class InspectorConsoleAgent;
    56 class InspectorCSSAgent;
    57 class InspectorDOMAgent;
    58 class InspectorDOMStorageAgent;
    59 class InspectorDatabaseAgent;
    60 class InspectorDatabaseResource;
    61 class InspectorDebuggerAgent;
    6244class InspectorFrontend;
    63 class InspectorFrontendClient;
    6445class InspectorObject;
    65 class InspectorPageAgent;
    66 class InspectorProfilerAgent;
    67 class InspectorResourceAgent;
    68 class InspectorRuntimeAgent;
    69 class InspectorState;
    70 class InspectorStorageAgent;
    71 class InspectorTimelineAgent;
    72 class InspectorValue;
    73 class InspectorWorkerAgent;
    7446class InspectorWorkerResource;
    7547class InstrumentingAgents;
    76 class IntRect;
    7748class KURL;
    78 class Node;
    7949class Page;
    80 class ResourceRequest;
    81 class ResourceResponse;
    82 class ResourceError;
    83 class ScriptArguments;
    84 class ScriptCallStack;
    85 class ScriptProfile;
    86 class SharedBuffer;
    87 class StorageArea;
    88 
    89 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
    90 class InspectorApplicationCacheAgent;
    91 #endif
    9250
    9351typedef String ErrorString;
     
    9755    WTF_MAKE_FAST_ALLOCATED;
    9856public:
    99     InspectorAgent(Page*, InspectorClient*, InjectedScriptManager*);
     57    InspectorAgent(Page*, InjectedScriptManager*, InstrumentingAgents*);
    10058    virtual ~InspectorAgent();
    101 
    102     InspectorClient* inspectorClient() { return m_client; }
    10359
    10460    void inspectedPageDestroyed();
     
    11268    void showConsole();
    11369
    114     void restoreInspectorStateFromCookie(const String& inspectorCookie);
    115 
    11670    void setFrontend(InspectorFrontend*);
    11771    InspectorFrontend* frontend() const { return m_frontend; }
    118     void disconnectFrontend();
     72    void clearFrontend();
     73    void restore();
    11974
    120     InstrumentingAgents* instrumentingAgents() const { return m_instrumentingAgents.get(); }
    121 
    122     InspectorPageAgent* pageAgent() { return m_pageAgent.get(); }
    123     InspectorConsoleAgent* consoleAgent() { return m_consoleAgent.get(); }
    124     InspectorCSSAgent* cssAgent() { return m_cssAgent.get(); }
    125     InspectorDOMAgent* domAgent() { return m_domAgent.get(); }
    126     InspectorRuntimeAgent* runtimeAgent() { return m_runtimeAgent.get(); }
    127     InspectorTimelineAgent* timelineAgent() { return m_timelineAgent.get(); }
    128     InspectorResourceAgent* resourceAgent() { return m_resourceAgent.get(); }
    129 #if ENABLE(DATABASE)
    130     InspectorDatabaseAgent* databaseAgent() { return m_databaseAgent.get(); }
    131 #endif
    132 #if ENABLE(DOM_STORAGE)
    133     InspectorDOMStorageAgent* domStorageAgent() { return m_domStorageAgent.get(); }
    134 #endif
    135 #if ENABLE(JAVASCRIPT_DEBUGGER)
    136     InspectorDOMDebuggerAgent* domDebuggerAgent() const { return m_domDebuggerAgent.get(); }
    137     InspectorDebuggerAgent* debuggerAgent() const { return m_debuggerAgent.get(); }
    138     InspectorProfilerAgent* profilerAgent() const { return m_profilerAgent.get(); }
    139 #endif
    140 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
    141     InspectorApplicationCacheAgent* applicationCacheAgent() { return m_applicationCacheAgent.get(); }
    142 #endif
    143 #if ENABLE(WORKERS)
    144     InspectorWorkerAgent* workerAgent() { return m_workerAgent.get(); }
    145 #endif
     75    InstrumentingAgents* instrumentingAgents() const { return m_instrumentingAgents; }
    14676
    14777    void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
     
    170100    void setInspectorExtensionAPI(const String& source);
    171101
    172     InspectorState* state() { return m_state.get(); }
    173 
    174102    // InspectorAgent API
    175103    void getInspectorState(RefPtr<InspectorObject>* state);
     
    188116
    189117    Page* m_inspectedPage;
    190     InspectorClient* m_client;
    191118    InspectorFrontend* m_frontend;
    192     OwnPtr<InstrumentingAgents> m_instrumentingAgents;
     119    InstrumentingAgents* m_instrumentingAgents;
    193120    InjectedScriptManager* m_injectedScriptManager;
    194     OwnPtr<InspectorState> m_state;
    195     OwnPtr<InspectorPageAgent> m_pageAgent;
    196     OwnPtr<InspectorDOMAgent> m_domAgent;
    197     OwnPtr<InspectorCSSAgent> m_cssAgent;
    198 
    199 #if ENABLE(DATABASE)
    200     OwnPtr<InspectorDatabaseAgent> m_databaseAgent;
    201 #endif
    202 
    203 #if ENABLE(DOM_STORAGE)
    204     OwnPtr<InspectorDOMStorageAgent> m_domStorageAgent;
    205 #endif
    206 
    207     OwnPtr<InspectorTimelineAgent> m_timelineAgent;
    208 
    209 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
    210     OwnPtr<InspectorApplicationCacheAgent> m_applicationCacheAgent;
    211 #endif
    212 
    213     RefPtr<InspectorResourceAgent> m_resourceAgent;
    214     OwnPtr<InspectorRuntimeAgent> m_runtimeAgent;
    215 
    216     OwnPtr<InspectorConsoleAgent> m_consoleAgent;
    217121
    218122    Vector<pair<long, String> > m_pendingEvaluateTestCommands;
    219123    String m_showPanelAfterVisible;
    220124    String m_inspectorExtensionAPI;
    221 #if ENABLE(JAVASCRIPT_DEBUGGER)
    222     OwnPtr<InspectorDebuggerAgent> m_debuggerAgent;
    223     OwnPtr<InspectorDOMDebuggerAgent> m_domDebuggerAgent;
    224     OwnPtr<InspectorProfilerAgent> m_profilerAgent;
    225 #endif
    226125#if ENABLE(WORKERS)
    227126    typedef HashMap<intptr_t, RefPtr<InspectorWorkerResource> > WorkersMap;
    228127    WorkersMap m_workers;
    229     OwnPtr<InspectorWorkerAgent> m_workerAgent;
    230128#endif
    231129    bool m_canIssueEvaluateForTestInFrontend;
  • trunk/Source/WebCore/inspector/InspectorController.cpp

    r85850 r86327  
    3939#include "InjectedScriptManager.h"
    4040#include "InspectorAgent.h"
     41#include "InspectorApplicationCacheAgent.h"
    4142#include "InspectorBackendDispatcher.h"
     43#include "InspectorCSSAgent.h"
     44#include "InspectorClient.h"
     45#include "InspectorConsoleAgent.h"
     46#include "InspectorDOMAgent.h"
     47#include "InspectorDOMDebuggerAgent.h"
     48#include "InspectorDOMStorageAgent.h"
     49#include "InspectorDatabaseAgent.h"
    4250#include "InspectorDebuggerAgent.h"
    43 #include "InspectorClient.h"
    44 #include "InspectorDOMAgent.h"
    4551#include "InspectorFrontend.h"
    4652#include "InspectorFrontendClient.h"
    4753#include "InspectorInstrumentation.h"
     54#include "InspectorPageAgent.h"
    4855#include "InspectorProfilerAgent.h"
     56#include "InspectorResourceAgent.h"
     57#include "InspectorRuntimeAgent.h"
     58#include "InspectorState.h"
    4959#include "InspectorTimelineAgent.h"
    5060#include "InspectorWorkerAgent.h"
     61#include "InstrumentingAgents.h"
     62#include "PageDebuggerAgent.h"
    5163#include "Page.h"
    5264#include "ScriptObject.h"
     
    5668namespace WebCore {
    5769
     70namespace {
     71
     72class PageRuntimeAgent : public InspectorRuntimeAgent {
     73public:
     74    PageRuntimeAgent(InjectedScriptManager* injectedScriptManager, Page* page)
     75        : InspectorRuntimeAgent(injectedScriptManager)
     76        , m_inspectedPage(page) { }
     77    virtual ~PageRuntimeAgent() { }
     78
     79private:
     80    virtual ScriptState* getDefaultInspectedState() { return mainWorldScriptState(m_inspectedPage->mainFrame()); }
     81    Page* m_inspectedPage;
     82};
     83
     84}
     85
    5886InspectorController::InspectorController(Page* page, InspectorClient* inspectorClient)
    59     : m_injectedScriptManager(InjectedScriptManager::createForPage())
    60     , m_inspectorAgent(adoptPtr(new InspectorAgent(page, inspectorClient, m_injectedScriptManager.get())))
     87    : m_instrumentingAgents(adoptPtr(new InstrumentingAgents()))
     88    , m_injectedScriptManager(InjectedScriptManager::createForPage())
     89    , m_state(adoptPtr(new InspectorState(inspectorClient)))
     90    , m_inspectorAgent(adoptPtr(new InspectorAgent(page, m_injectedScriptManager.get(), m_instrumentingAgents.get())))
     91    , m_pageAgent(InspectorPageAgent::create(m_instrumentingAgents.get(), page, m_injectedScriptManager.get()))
     92    , m_domAgent(InspectorDOMAgent::create(m_instrumentingAgents.get(), m_pageAgent.get(), inspectorClient, m_state.get(), m_injectedScriptManager.get()))
     93    , m_cssAgent(adoptPtr(new InspectorCSSAgent(m_instrumentingAgents.get(), m_domAgent.get())))
     94#if ENABLE(DATABASE)
     95    , m_databaseAgent(InspectorDatabaseAgent::create(m_instrumentingAgents.get(), m_state.get()))
     96#endif
     97#if ENABLE(DOM_STORAGE)
     98    , m_domStorageAgent(InspectorDOMStorageAgent::create(m_instrumentingAgents.get(), m_state.get()))
     99#endif
     100    , m_timelineAgent(InspectorTimelineAgent::create(m_instrumentingAgents.get(), m_state.get()))
     101#if ENABLE(OFFLINE_WEB_APPLICATIONS)
     102    , m_applicationCacheAgent(adoptPtr(new InspectorApplicationCacheAgent(m_instrumentingAgents.get(), page)))
     103#endif
     104    , m_resourceAgent(InspectorResourceAgent::create(m_instrumentingAgents.get(), m_pageAgent.get(), m_state.get()))
     105    , m_runtimeAgent(adoptPtr(new PageRuntimeAgent(m_injectedScriptManager.get(), page)))
     106    , m_consoleAgent(adoptPtr(new InspectorConsoleAgent(m_instrumentingAgents.get(), m_inspectorAgent.get(), m_state.get(), m_injectedScriptManager.get(), m_domAgent.get())))
     107#if ENABLE(JAVASCRIPT_DEBUGGER)
     108    , m_debuggerAgent(PageDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), page, m_injectedScriptManager.get()))
     109    , m_domDebuggerAgent(InspectorDOMDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), m_domAgent.get(), m_debuggerAgent.get(), m_inspectorAgent.get()))
     110    , m_profilerAgent(InspectorProfilerAgent::create(m_instrumentingAgents.get(), m_consoleAgent.get(), page, m_state.get()))
     111#endif
     112#if ENABLE(WORKERS)
     113    , m_workerAgent(InspectorWorkerAgent::create(m_instrumentingAgents.get()))
     114#endif
    61115    , m_inspectorClient(inspectorClient)
    62116    , m_openingFrontend(false)
    63117    , m_startUserInitiatedDebuggingWhenFrontedIsConnected(false)
    64118{
     119    ASSERT_ARG(inspectorClient, inspectorClient);
     120    m_injectedScriptManager->injectedScriptHost()->init(m_inspectorAgent.get()
     121        , m_consoleAgent.get()
     122#if ENABLE(DATABASE)
     123        , m_databaseAgent.get()
     124#endif
     125#if ENABLE(DOM_STORAGE)
     126        , m_domStorageAgent.get()
     127#endif
     128    );
    65129}
    66130
    67131InspectorController::~InspectorController()
    68132{
     133    ASSERT(!m_inspectorClient);
     134}
     135
     136void InspectorController::inspectedPageDestroyed()
     137{
     138    disconnectFrontend();
     139#if ENABLE(JAVASCRIPT_DEBUGGER)
     140    m_domDebuggerAgent.clear();
     141    m_debuggerAgent.clear();
     142#endif
     143    m_injectedScriptManager->disconnect();
     144    m_inspectorClient->inspectorDestroyed();
     145    m_inspectorClient = 0;
    69146}
    70147
     
    93170{
    94171    ErrorString error;
    95     m_inspectorAgent->timelineAgent()->start(&error);
     172    m_timelineAgent->start(&error);
    96173}
    97174
     
    99176{
    100177    ErrorString error;
    101     m_inspectorAgent->timelineAgent()->stop(&error);
     178    m_timelineAgent->stop(&error);
    102179}
    103180
     
    107184    m_inspectorFrontend = adoptPtr(new InspectorFrontend(m_inspectorClient));
    108185    m_injectedScriptManager->injectedScriptHost()->setFrontend(m_inspectorFrontend.get());
     186    // We can reconnect to existing front-end -> unmute state.
     187    m_state->unmute();
     188
     189#if ENABLE(OFFLINE_WEB_APPLICATIONS)
     190    m_applicationCacheAgent->setFrontend(m_inspectorFrontend.get());
     191#endif
     192    m_pageAgent->setFrontend(m_inspectorFrontend.get());
     193    m_domAgent->setFrontend(m_inspectorFrontend.get());
     194    m_consoleAgent->setFrontend(m_inspectorFrontend.get());
     195    m_timelineAgent->setFrontend(m_inspectorFrontend.get());
     196    m_resourceAgent->setFrontend(m_inspectorFrontend.get());
     197#if ENABLE(JAVASCRIPT_DEBUGGER)
     198    m_debuggerAgent->setFrontend(m_inspectorFrontend.get());
     199    m_profilerAgent->setFrontend(m_inspectorFrontend.get());
     200#endif
     201#if ENABLE(DATABASE)
     202    m_databaseAgent->setFrontend(m_inspectorFrontend.get());
     203#endif
     204#if ENABLE(DOM_STORAGE)
     205    m_domStorageAgent->setFrontend(m_inspectorFrontend.get());
     206#endif
     207#if ENABLE(WORKERS)
     208    m_workerAgent->setFrontend(m_inspectorFrontend.get());
     209#endif
    109210    m_inspectorAgent->setFrontend(m_inspectorFrontend.get());
    110211
     
    117218        m_inspectorClient,
    118219#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    119         m_inspectorAgent->applicationCacheAgent(),
    120 #endif
    121         m_inspectorAgent->cssAgent(),
    122         m_inspectorAgent->consoleAgent(),
    123         m_inspectorAgent->domAgent(),
    124 #if ENABLE(JAVASCRIPT_DEBUGGER)
    125         m_inspectorAgent->domDebuggerAgent(),
    126 #endif
    127 #if ENABLE(DOM_STORAGE)
    128         m_inspectorAgent->domStorageAgent(),
    129 #endif
    130 #if ENABLE(DATABASE)
    131         m_inspectorAgent->databaseAgent(),
    132 #endif
    133 #if ENABLE(JAVASCRIPT_DEBUGGER)
    134         m_inspectorAgent->debuggerAgent(),
    135 #endif
    136         m_inspectorAgent->resourceAgent(),
    137         m_inspectorAgent->pageAgent(),
    138 #if ENABLE(JAVASCRIPT_DEBUGGER)
    139         m_inspectorAgent->profilerAgent(),
    140 #endif
    141         m_inspectorAgent->runtimeAgent(),
    142         m_inspectorAgent->timelineAgent()
     220        m_applicationCacheAgent.get(),
     221#endif
     222        m_cssAgent.get(),
     223        m_consoleAgent.get(),
     224        m_domAgent.get(),
     225#if ENABLE(JAVASCRIPT_DEBUGGER)
     226        m_domDebuggerAgent.get(),
     227#endif
     228#if ENABLE(DOM_STORAGE)
     229        m_domStorageAgent.get(),
     230#endif
     231#if ENABLE(DATABASE)
     232        m_databaseAgent.get(),
     233#endif
     234#if ENABLE(JAVASCRIPT_DEBUGGER)
     235        m_debuggerAgent.get(),
     236#endif
     237        m_resourceAgent.get(),
     238        m_pageAgent.get(),
     239#if ENABLE(JAVASCRIPT_DEBUGGER)
     240        m_profilerAgent.get(),
     241#endif
     242        m_runtimeAgent.get(),
     243        m_timelineAgent.get()
    143244#if ENABLE(WORKERS)
    144         , m_inspectorAgent->workerAgent()
     245        , m_workerAgent.get()
    145246#endif
    146247    ));
     
    158259    m_inspectorBackendDispatcher.clear();
    159260
    160     m_inspectorAgent->disconnectFrontend();
     261    // Destroying agents would change the state, but we don't want that.
     262    // Pre-disconnect state will be used to restore inspector agents.
     263    m_state->mute();
     264
     265    m_inspectorAgent->clearFrontend();
     266#if ENABLE(JAVASCRIPT_DEBUGGER)
     267    m_debuggerAgent->clearFrontend();
     268    m_domDebuggerAgent->clearFrontend();
     269    m_profilerAgent->clearFrontend();
     270#endif
     271#if ENABLE(OFFLINE_WEB_APPLICATIONS)
     272    m_applicationCacheAgent->clearFrontend();
     273#endif
     274    m_consoleAgent->clearFrontend();
     275    m_domAgent->clearFrontend();
     276    m_timelineAgent->clearFrontend();
     277    m_resourceAgent->clearFrontend();
     278#if ENABLE(DATABASE)
     279    m_databaseAgent->clearFrontend();
     280#endif
     281#if ENABLE(DOM_STORAGE)
     282    m_domStorageAgent->clearFrontend();
     283#endif
     284    m_pageAgent->clearFrontend();
     285#if ENABLE(WORKERS)
     286    m_workerAgent->clearFrontend();
     287#endif
    161288    m_injectedScriptManager->injectedScriptHost()->clearFrontend();
    162289
     
    196323    ASSERT(!m_inspectorFrontend);
    197324    connectFrontend();
    198     m_inspectorAgent->restoreInspectorStateFromCookie(inspectorStateCookie);
     325    m_state->loadFromCookie(inspectorStateCookie);
     326
     327    m_domAgent->restore();
     328    m_resourceAgent->restore();
     329    m_timelineAgent->restore();
     330#if ENABLE(DATABASE)
     331    m_databaseAgent->restore();
     332#endif
     333#if ENABLE(DOM_STORAGE)
     334    m_domStorageAgent->restore();
     335#endif
     336#if ENABLE(JAVASCRIPT_DEBUGGER)
     337    m_debuggerAgent->restore();
     338    m_profilerAgent->restore();
     339#endif
     340    m_inspectorAgent->restore();
    199341}
    200342
     
    206348void InspectorController::drawNodeHighlight(GraphicsContext& context) const
    207349{
    208     m_inspectorAgent->domAgent()->drawNodeHighlight(context);
     350    m_domAgent->drawNodeHighlight(context);
    209351}
    210352
     
    224366    show();
    225367
    226     m_inspectorAgent->domAgent()->inspect(node);
     368    m_domAgent->inspect(node);
    227369}
    228370
     
    239381bool InspectorController::timelineProfilerEnabled()
    240382{
    241     return m_inspectorAgent->timelineAgent()->started();
     383    return m_timelineAgent->started();
    242384}
    243385
     
    256398{
    257399    ErrorString error;
    258     m_inspectorAgent->domAgent()->hideHighlight(&error);
     400    m_domAgent->hideHighlight(&error);
    259401}
    260402
    261403Node* InspectorController::highlightedNode() const
    262404{
    263     return m_inspectorAgent->domAgent()->highlightedNode();
     405    return m_domAgent->highlightedNode();
    264406}
    265407
     
    268410{
    269411    ErrorString error;
    270     m_inspectorAgent->profilerAgent()->enable(&error);
     412    m_profilerAgent->enable(&error);
    271413}
    272414
     
    274416{
    275417    ErrorString error;
    276     m_inspectorAgent->profilerAgent()->disable(&error);
     418    m_profilerAgent->disable(&error);
    277419}
    278420
    279421bool InspectorController::profilerEnabled()
    280422{
    281     return m_inspectorAgent->profilerAgent()->enabled();
     423    return m_profilerAgent->enabled();
    282424}
    283425
    284426bool InspectorController::debuggerEnabled()
    285427{
    286     return m_inspectorAgent->debuggerAgent()->enabled();
     428    return m_debuggerAgent->enabled();
    287429}
    288430
     
    301443void InspectorController::disableDebugger()
    302444{
    303     m_inspectorAgent->debuggerAgent()->disable();
     445    m_debuggerAgent->disable();
    304446}
    305447
    306448void InspectorController::startUserInitiatedProfiling()
    307449{
    308     m_inspectorAgent->profilerAgent()->startUserInitiatedProfiling();
     450    m_profilerAgent->startUserInitiatedProfiling();
    309451}
    310452
     
    314456        return;
    315457    show();
    316     m_inspectorAgent->profilerAgent()->stopUserInitiatedProfiling();
     458    m_profilerAgent->stopUserInitiatedProfiling();
    317459    m_inspectorAgent->showProfilesPanel();
    318460}
     
    320462bool InspectorController::isRecordingUserInitiatedProfile() const
    321463{
    322     return m_inspectorAgent->profilerAgent()->isRecordingUserInitiatedProfile();
     464    return m_profilerAgent->isRecordingUserInitiatedProfile();
    323465}
    324466
    325467void InspectorController::resume()
    326468{
    327     if (InspectorDebuggerAgent* debuggerAgent = m_inspectorAgent->debuggerAgent()) {
     469    if (m_debuggerAgent) {
    328470        ErrorString error;
    329         debuggerAgent->resume(&error);
     471        m_debuggerAgent->resume(&error);
    330472    }
    331473}
  • trunk/Source/WebCore/inspector/InspectorController.h

    r83892 r86327  
    4444class InjectedScriptManager;
    4545class InspectorAgent;
     46class InspectorApplicationCacheAgent;
    4647class InspectorBackendDispatcher;
     48class InspectorCSSAgent;
    4749class InspectorClient;
     50class InspectorConsoleAgent;
     51class InspectorDOMAgent;
     52class InspectorDOMDebuggerAgent;
     53class InspectorDOMStorageAgent;
     54class InspectorDatabaseAgent;
     55class InspectorDebuggerAgent;
    4856class InspectorFrontend;
    4957class InspectorFrontendClient;
     58class InspectorPageAgent;
     59class InspectorProfilerAgent;
     60class InspectorResourceAgent;
     61class InspectorRuntimeAgent;
     62class InspectorState;
     63class InspectorStorageAgent;
     64class InspectorTimelineAgent;
     65class InspectorWorkerAgent;
     66class InstrumentingAgents;
    5067class Page;
    5168class PostWorkerNotificationToFrontendTask;
     
    5875    InspectorController(Page*, InspectorClient*);
    5976    ~InspectorController();
     77    void inspectedPageDestroyed();
    6078
    6179    bool enabled() const;
     
    105123    friend class PostWorkerNotificationToFrontendTask;
    106124
     125    OwnPtr<InstrumentingAgents> m_instrumentingAgents;
    107126    OwnPtr<InjectedScriptManager> m_injectedScriptManager;
     127    OwnPtr<InspectorState> m_state;
    108128    OwnPtr<InspectorAgent> m_inspectorAgent;
     129
     130    OwnPtr<InspectorPageAgent> m_pageAgent;
     131    OwnPtr<InspectorDOMAgent> m_domAgent;
     132    OwnPtr<InspectorCSSAgent> m_cssAgent;
     133#if ENABLE(DATABASE)
     134    OwnPtr<InspectorDatabaseAgent> m_databaseAgent;
     135#endif
     136#if ENABLE(DOM_STORAGE)
     137    OwnPtr<InspectorDOMStorageAgent> m_domStorageAgent;
     138#endif
     139    OwnPtr<InspectorTimelineAgent> m_timelineAgent;
     140#if ENABLE(OFFLINE_WEB_APPLICATIONS)
     141    OwnPtr<InspectorApplicationCacheAgent> m_applicationCacheAgent;
     142#endif
     143    RefPtr<InspectorResourceAgent> m_resourceAgent;
     144    OwnPtr<InspectorRuntimeAgent> m_runtimeAgent;
     145    OwnPtr<InspectorConsoleAgent> m_consoleAgent;
     146#if ENABLE(JAVASCRIPT_DEBUGGER)
     147    OwnPtr<InspectorDebuggerAgent> m_debuggerAgent;
     148    OwnPtr<InspectorDOMDebuggerAgent> m_domDebuggerAgent;
     149    OwnPtr<InspectorProfilerAgent> m_profilerAgent;
     150#endif
     151#if ENABLE(WORKERS)
     152    OwnPtr<InspectorWorkerAgent> m_workerAgent;
     153#endif
     154
    109155    OwnPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
    110156    OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient;
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r86251 r86327  
    116116void InspectorInstrumentation::didInsertDOMNodeImpl(InspectorAgent* inspectorAgent, Node* node)
    117117{
    118     if (InspectorDOMAgent* domAgent = inspectorAgent->domAgent())
     118    if (InspectorDOMAgent* domAgent = inspectorAgent->instrumentingAgents()->inspectorDOMAgent())
    119119        domAgent->didInsertDOMNode(node);
    120120#if ENABLE(JAVASCRIPT_DEBUGGER)
     
    138138        domDebuggerAgent->didRemoveDOMNode(node);
    139139#endif
    140     if (InspectorDOMAgent* domAgent = inspectorAgent->domAgent())
     140    if (InspectorDOMAgent* domAgent = inspectorAgent->instrumentingAgents()->inspectorDOMAgent())
    141141        domAgent->didRemoveDOMNode(node);
    142142}
     
    152152void InspectorInstrumentation::didModifyDOMAttrImpl(InspectorAgent* inspectorAgent, Element* element)
    153153{
    154     if (InspectorDOMAgent* domAgent = inspectorAgent->domAgent())
     154    if (InspectorDOMAgent* domAgent = inspectorAgent->instrumentingAgents()->inspectorDOMAgent())
    155155        domAgent->didModifyDOMAttr(element);
    156156}
     
    158158void InspectorInstrumentation::didInvalidateStyleAttrImpl(InspectorAgent* inspectorAgent, Node* node)
    159159{
    160     if (InspectorDOMAgent* domAgent = inspectorAgent->domAgent())
     160    if (InspectorDOMAgent* domAgent = inspectorAgent->instrumentingAgents()->inspectorDOMAgent())
    161161        domAgent->didInvalidateStyleAttr(node);
    162162}
     
    177177void InspectorInstrumentation::characterDataModifiedImpl(InspectorAgent* inspectorAgent, CharacterData* characterData)
    178178{
    179     if (InspectorDOMAgent* domAgent = inspectorAgent->domAgent())
     179    if (InspectorDOMAgent* domAgent = inspectorAgent->instrumentingAgents()->inspectorDOMAgent())
    180180        domAgent->characterDataModified(characterData);
    181181}
     
    461461        if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(inspectorAgent))
    462462            resourceAgent->didReceiveResponse(identifier, loader, response);
    463         inspectorAgent->consoleAgent()->didReceiveResponse(identifier, response); // This should come AFTER resource notification, front-end relies on this.
     463        if (InspectorConsoleAgent* consoleAgent = inspectorAgent->instrumentingAgents()->inspectorConsoleAgent())
     464            consoleAgent->didReceiveResponse(identifier, response); // This should come AFTER resource notification, front-end relies on this.
    464465    }
    465466}
     
    506507    if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(inspectorAgent))
    507508        resourceAgent->didFailLoading(identifier, error);
    508     inspectorAgent->consoleAgent()->didFailLoading(identifier, error); // This should come AFTER resource notification, front-end relies on this.
     509    if (InspectorConsoleAgent* consoleAgent = inspectorAgent->instrumentingAgents()->inspectorConsoleAgent())
     510        consoleAgent->didFailLoading(identifier, error); // This should come AFTER resource notification, front-end relies on this.
    509511}
    510512
    511513void InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl(InspectorAgent* inspectorAgent, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
    512514{
    513     inspectorAgent->consoleAgent()->resourceRetrievedByXMLHttpRequest(url, sendURL, sendLineNumber);
     515    if (InspectorConsoleAgent* consoleAgent = inspectorAgent->instrumentingAgents()->inspectorConsoleAgent())
     516        consoleAgent->resourceRetrievedByXMLHttpRequest(url, sendURL, sendLineNumber);
    514517    if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(inspectorAgent))
    515518        resourceAgent->setInitialXHRContent(identifier, sourceString);
     
    629632void InspectorInstrumentation::addMessageToConsoleImpl(InspectorAgent* inspectorAgent, MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack)
    630633{
    631     inspectorAgent->consoleAgent()->addMessageToConsole(source, type, level, message, arguments, callStack);
     634    if (InspectorConsoleAgent* consoleAgent = inspectorAgent->instrumentingAgents()->inspectorConsoleAgent())
     635        consoleAgent->addMessageToConsole(source, type, level, message, arguments, callStack);
    632636}
    633637
    634638void InspectorInstrumentation::addMessageToConsoleImpl(InspectorAgent* inspectorAgent, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID)
    635639{
    636     inspectorAgent->consoleAgent()->addMessageToConsole(source, type, level, message, lineNumber, sourceID);
     640    if (InspectorConsoleAgent* consoleAgent = inspectorAgent->instrumentingAgents()->inspectorConsoleAgent())
     641        consoleAgent->addMessageToConsole(source, type, level, message, lineNumber, sourceID);
    637642}
    638643
    639644void InspectorInstrumentation::consoleCountImpl(InspectorAgent* inspectorAgent, PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> stack)
    640645{
    641     inspectorAgent->consoleAgent()->count(arguments, stack);
     646    if (InspectorConsoleAgent* consoleAgent = inspectorAgent->instrumentingAgents()->inspectorConsoleAgent())
     647        consoleAgent->count(arguments, stack);
    642648}
    643649
    644650void InspectorInstrumentation::startConsoleTimingImpl(InspectorAgent* inspectorAgent, const String& title)
    645651{
    646     inspectorAgent->consoleAgent()->startTiming(title);
     652    if (InspectorConsoleAgent* consoleAgent = inspectorAgent->instrumentingAgents()->inspectorConsoleAgent())
     653        consoleAgent->startTiming(title);
    647654}
    648655
    649656void InspectorInstrumentation::stopConsoleTimingImpl(InspectorAgent* inspectorAgent, const String& title, PassRefPtr<ScriptCallStack> stack)
    650657{
    651     inspectorAgent->consoleAgent()->stopTiming(title, stack);
     658    if (InspectorConsoleAgent* consoleAgent = inspectorAgent->instrumentingAgents()->inspectorConsoleAgent())
     659        consoleAgent->stopTiming(title, stack);
    652660}
    653661
     
    664672void InspectorInstrumentation::addStartProfilingMessageToConsoleImpl(InspectorAgent* inspectorAgent, const String& title, unsigned lineNumber, const String& sourceURL)
    665673{
    666     if (InspectorProfilerAgent* profilerAgent = inspectorAgent->profilerAgent())
     674    if (InspectorProfilerAgent* profilerAgent = inspectorAgent->instrumentingAgents()->inspectorProfilerAgent())
    667675        profilerAgent->addStartProfilingMessageToConsole(title, lineNumber, sourceURL);
    668676}
     
    670678void InspectorInstrumentation::addProfileImpl(InspectorAgent* inspectorAgent, RefPtr<ScriptProfile> profile, PassRefPtr<ScriptCallStack> callStack)
    671679{
    672     if (InspectorProfilerAgent* profilerAgent = inspectorAgent->profilerAgent()) {
     680    if (InspectorProfilerAgent* profilerAgent = inspectorAgent->instrumentingAgents()->inspectorProfilerAgent()) {
    673681        const ScriptCallFrame& lastCaller = callStack->at(0);
    674682        profilerAgent->addProfile(profile, lastCaller.lineNumber(), lastCaller.sourceURL());
     
    678686String InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl(InspectorAgent* inspectorAgent, bool incrementProfileNumber)
    679687{
    680     if (InspectorProfilerAgent* profilerAgent = inspectorAgent->profilerAgent())
     688    if (InspectorProfilerAgent* profilerAgent = inspectorAgent->instrumentingAgents()->inspectorProfilerAgent())
    681689        return profilerAgent->getCurrentUserInitiatedProfileName(incrementProfileNumber);
    682690    return "";
     
    685693bool InspectorInstrumentation::profilerEnabledImpl(InspectorAgent* inspectorAgent)
    686694{
    687     return inspectorAgent->instrumentingAgents()->inspectorProfilerAgent()->enabled();
     695    if (InspectorProfilerAgent* profilerAgent = inspectorAgent->instrumentingAgents()->inspectorProfilerAgent())
     696        return profilerAgent->enabled();
     697    return false;
    688698}
    689699#endif
     
    785795{
    786796#if ENABLE(JAVASCRIPT_DEBUGGER)
    787     if (InspectorDebuggerAgent* debuggerAgent = inspectorAgent->debuggerAgent())
     797    if (InspectorDebuggerAgent* debuggerAgent = inspectorAgent->instrumentingAgents()->inspectorDebuggerAgent())
    788798        debuggerAgent->cancelPauseOnNextStatement();
    789799#endif
  • trunk/Source/WebCore/page/Page.cpp

    r86047 r86327  
    205205
    206206    InspectorInstrumentation::inspectedPageDestroyed(this);
     207#if ENABLE(INSPECTOR)
     208    m_inspectorController->inspectedPageDestroyed();
     209#endif
    207210
    208211    backForward()->close();
Note: See TracChangeset for help on using the changeset viewer.