Commit a167d475 authored by loislo@chromium.org's avatar loislo@chromium.org

2011-01-20 Ilya Tikhonovsky <loislo@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: cleanup InspectorController's friends list.
        We have a plan to extract InspectorAgent from InspectorController.
        InspectorAgent will be accessible only from InspectorController.
        As result we can simply made some methods public and remove long
        friends list.

        https://bugs.webkit.org/show_bug.cgi?id=52806

        * inspector/InjectedScriptHost.cpp:
        (WebCore::InjectedScriptHost::databaseForId):
        (WebCore::InjectedScriptHost::selectDatabase):
        (WebCore::InjectedScriptHost::selectDOMStorage):
        (WebCore::InjectedScriptHost::inspectorDOMAgent):
        (WebCore::InjectedScriptHost::frontend):
        * inspector/InspectorBrowserDebuggerAgent.cpp:
        (WebCore::InspectorBrowserDebuggerAgent::setDOMBreakpoint):
        (WebCore::InspectorBrowserDebuggerAgent::removeDOMBreakpoint):
        (WebCore::InspectorBrowserDebuggerAgent::willInsertDOMNode):
        (WebCore::InspectorBrowserDebuggerAgent::willRemoveDOMNode):
        (WebCore::InspectorBrowserDebuggerAgent::willModifyDOMAttr):
        (WebCore::InspectorBrowserDebuggerAgent::descriptionForDOMEvent):
        (WebCore::InspectorBrowserDebuggerAgent::pauseOnNativeEventIfNeeded):
        (WebCore::InspectorBrowserDebuggerAgent::willSendXMLHttpRequest):
        * inspector/InspectorController.h:
        (WebCore::InspectorController::frontend):
        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::willInsertDOMNodeImpl):
        (WebCore::InspectorInstrumentation::didInsertDOMNodeImpl):
        (WebCore::InspectorInstrumentation::willRemoveDOMNodeImpl):
        (WebCore::InspectorInstrumentation::didRemoveDOMNodeImpl):
        (WebCore::InspectorInstrumentation::willModifyDOMAttrImpl):
        (WebCore::InspectorInstrumentation::didModifyDOMAttrImpl):
        (WebCore::InspectorInstrumentation::characterDataModifiedImpl):
        (WebCore::InspectorInstrumentation::willSendXMLHttpRequestImpl):
        (WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl):
        (WebCore::InspectorInstrumentation::didFailLoadingImpl):
        (WebCore::InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl):
        (WebCore::InspectorInstrumentation::addStartProfilingMessageToConsoleImpl):
        (WebCore::InspectorInstrumentation::pauseOnNativeEventIfNeeded):
        (WebCore::InspectorInstrumentation::cancelPauseOnNativeEvent):
        (WebCore::InspectorInstrumentation::retrieveTimelineAgent):
        (WebCore::InspectorInstrumentation::retrieveResourceAgent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76240 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 48a73855
2011-01-20 Ilya Tikhonovsky <loislo@chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: cleanup InspectorController's friends list.
We have a plan to extract InspectorAgent from InspectorController.
InspectorAgent will be accessible only from InspectorController.
As result we can simply made some methods public and remove long
friends list.
https://bugs.webkit.org/show_bug.cgi?id=52806
* inspector/InjectedScriptHost.cpp:
(WebCore::InjectedScriptHost::databaseForId):
(WebCore::InjectedScriptHost::selectDatabase):
(WebCore::InjectedScriptHost::selectDOMStorage):
(WebCore::InjectedScriptHost::inspectorDOMAgent):
(WebCore::InjectedScriptHost::frontend):
* inspector/InspectorBrowserDebuggerAgent.cpp:
(WebCore::InspectorBrowserDebuggerAgent::setDOMBreakpoint):
(WebCore::InspectorBrowserDebuggerAgent::removeDOMBreakpoint):
(WebCore::InspectorBrowserDebuggerAgent::willInsertDOMNode):
(WebCore::InspectorBrowserDebuggerAgent::willRemoveDOMNode):
(WebCore::InspectorBrowserDebuggerAgent::willModifyDOMAttr):
(WebCore::InspectorBrowserDebuggerAgent::descriptionForDOMEvent):
(WebCore::InspectorBrowserDebuggerAgent::pauseOnNativeEventIfNeeded):
(WebCore::InspectorBrowserDebuggerAgent::willSendXMLHttpRequest):
* inspector/InspectorController.h:
(WebCore::InspectorController::frontend):
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::willInsertDOMNodeImpl):
(WebCore::InspectorInstrumentation::didInsertDOMNodeImpl):
(WebCore::InspectorInstrumentation::willRemoveDOMNodeImpl):
(WebCore::InspectorInstrumentation::didRemoveDOMNodeImpl):
(WebCore::InspectorInstrumentation::willModifyDOMAttrImpl):
(WebCore::InspectorInstrumentation::didModifyDOMAttrImpl):
(WebCore::InspectorInstrumentation::characterDataModifiedImpl):
(WebCore::InspectorInstrumentation::willSendXMLHttpRequestImpl):
(WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl):
(WebCore::InspectorInstrumentation::didFailLoadingImpl):
(WebCore::InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl):
(WebCore::InspectorInstrumentation::addStartProfilingMessageToConsoleImpl):
(WebCore::InspectorInstrumentation::pauseOnNativeEventIfNeeded):
(WebCore::InspectorInstrumentation::cancelPauseOnNativeEvent):
(WebCore::InspectorInstrumentation::retrieveTimelineAgent):
(WebCore::InspectorInstrumentation::retrieveResourceAgent):
2011-01-19 Pavel Podivilov <podivilov@chromium.org>
Reviewed by Yury Semikhatsky.
......@@ -130,23 +130,23 @@ long InjectedScriptHost::inspectedNode(unsigned long num)
#if ENABLE(DATABASE)
Database* InjectedScriptHost::databaseForId(long databaseId)
{
if (m_inspectorController && m_inspectorController->m_databaseAgent)
return m_inspectorController->m_databaseAgent->databaseForId(databaseId);
if (m_inspectorController && m_inspectorController->databaseAgent())
return m_inspectorController->databaseAgent()->databaseForId(databaseId);
return 0;
}
void InjectedScriptHost::selectDatabase(Database* database)
{
if (m_inspectorController && m_inspectorController->m_databaseAgent)
m_inspectorController->m_databaseAgent->selectDatabase(database);
if (m_inspectorController && m_inspectorController->databaseAgent())
m_inspectorController->databaseAgent()->selectDatabase(database);
}
#endif
#if ENABLE(DOM_STORAGE)
void InjectedScriptHost::selectDOMStorage(Storage* storage)
{
if (m_inspectorController && m_inspectorController->m_domStorageAgent)
m_inspectorController->m_domStorageAgent->selectDOMStorage(storage);
if (m_inspectorController && m_inspectorController->domStorageAgent())
m_inspectorController->domStorageAgent()->selectDOMStorage(storage);
}
#endif
......@@ -194,14 +194,14 @@ InspectorDOMAgent* InjectedScriptHost::inspectorDOMAgent()
{
if (!m_inspectorController)
return 0;
return m_inspectorController->m_domAgent.get();
return m_inspectorController->domAgent();
}
InspectorFrontend* InjectedScriptHost::frontend()
{
if (!m_inspectorController)
return 0;
return m_inspectorController->m_frontend.get();
return m_inspectorController->frontend();
}
String InjectedScriptHost::injectedScriptSource()
......
......@@ -116,7 +116,7 @@ void InspectorBrowserDebuggerAgent::didRemoveDOMNode(Node* node)
void InspectorBrowserDebuggerAgent::setDOMBreakpoint(long nodeId, long type)
{
Node* node = m_inspectorController->m_domAgent->nodeForId(nodeId);
Node* node = m_inspectorController->domAgent()->nodeForId(nodeId);
if (!node)
return;
......@@ -130,7 +130,7 @@ void InspectorBrowserDebuggerAgent::setDOMBreakpoint(long nodeId, long type)
void InspectorBrowserDebuggerAgent::removeDOMBreakpoint(long nodeId, long type)
{
Node* node = m_inspectorController->m_domAgent->nodeForId(nodeId);
Node* node = m_inspectorController->domAgent()->nodeForId(nodeId);
if (!node)
return;
......@@ -149,7 +149,7 @@ void InspectorBrowserDebuggerAgent::removeDOMBreakpoint(long nodeId, long type)
void InspectorBrowserDebuggerAgent::willInsertDOMNode(Node*, Node* parent)
{
InspectorDebuggerAgent* debuggerAgent = m_inspectorController->m_debuggerAgent.get();
InspectorDebuggerAgent* debuggerAgent = m_inspectorController->debuggerAgent();
if (!debuggerAgent)
return;
......@@ -163,7 +163,7 @@ void InspectorBrowserDebuggerAgent::willInsertDOMNode(Node*, Node* parent)
void InspectorBrowserDebuggerAgent::willRemoveDOMNode(Node* node)
{
InspectorDebuggerAgent* debuggerAgent = m_inspectorController->m_debuggerAgent.get();
InspectorDebuggerAgent* debuggerAgent = m_inspectorController->debuggerAgent();
if (!debuggerAgent)
return;
......@@ -182,7 +182,7 @@ void InspectorBrowserDebuggerAgent::willRemoveDOMNode(Node* node)
void InspectorBrowserDebuggerAgent::willModifyDOMAttr(Element* element)
{
InspectorDebuggerAgent* debuggerAgent = m_inspectorController->m_debuggerAgent.get();
InspectorDebuggerAgent* debuggerAgent = m_inspectorController->debuggerAgent();
if (!debuggerAgent)
return;
......@@ -202,7 +202,7 @@ void InspectorBrowserDebuggerAgent::descriptionForDOMEvent(Node* target, long br
if ((1 << breakpointType) & inheritableDOMBreakpointTypesMask) {
// For inheritable breakpoint types, target node isn't always the same as the node that owns a breakpoint.
// Target node may be unknown to frontend, so we need to push it first.
long targetNodeId = m_inspectorController->m_domAgent->pushNodePathToFrontend(target);
long targetNodeId = m_inspectorController->domAgent()->pushNodePathToFrontend(target);
ASSERT(targetNodeId);
description->setNumber("targetNodeId", targetNodeId);
......@@ -219,7 +219,7 @@ void InspectorBrowserDebuggerAgent::descriptionForDOMEvent(Node* target, long br
description->setBoolean("insertion", insertion);
}
long breakpointOwnerNodeId = m_inspectorController->m_domAgent->pushNodePathToFrontend(breakpointOwner);
long breakpointOwnerNodeId = m_inspectorController->domAgent()->pushNodePathToFrontend(breakpointOwner);
ASSERT(breakpointOwnerNodeId);
description->setNumber("nodeId", breakpointOwnerNodeId);
description->setNumber("type", breakpointType);
......@@ -252,7 +252,7 @@ void InspectorBrowserDebuggerAgent::updateSubtreeBreakpoints(Node* node, uint32_
void InspectorBrowserDebuggerAgent::pauseOnNativeEventIfNeeded(const String& categoryType, const String& eventName, bool synchronous)
{
InspectorDebuggerAgent* debuggerAgent = m_inspectorController->m_debuggerAgent.get();
InspectorDebuggerAgent* debuggerAgent = m_inspectorController->debuggerAgent();
if (!debuggerAgent)
return;
......@@ -287,7 +287,7 @@ void InspectorBrowserDebuggerAgent::removeXHRBreakpoint(const String& url)
void InspectorBrowserDebuggerAgent::willSendXMLHttpRequest(const String& url)
{
InspectorDebuggerAgent* debuggerAgent = m_inspectorController->m_debuggerAgent.get();
InspectorDebuggerAgent* debuggerAgent = m_inspectorController->debuggerAgent();
if (!debuggerAgent)
return;
......
......@@ -144,6 +144,7 @@ public:
void connectFrontend();
void reuseFrontend();
void disconnectFrontend();
InspectorFrontend* frontend() const { return m_frontend.get(); }
InspectorController* inspectorAgent() { return this; }
InspectorConsoleAgent* consoleAgent() const { return m_consoleAgent.get(); }
......@@ -259,18 +260,19 @@ public:
InspectorState* state() { return m_state.get(); }
InspectorSettings* settings() { return m_settings.get(); }
private:
friend class InspectorBackend;
friend class InspectorBackendDispatcher;
friend class InspectorBrowserDebuggerAgent;
friend class InspectorInstrumentation;
friend class InjectedScriptHost;
void willSendRequest(ResourceRequest&);
// InspectorAgent API
void getInspectorState(RefPtr<InspectorObject>* state);
void setMonitoringXHREnabled(bool enabled, bool* newState);
void populateScriptObjects();
// Following are used from InspectorBackend and internally.
void setSearchingForNode(bool enabled, bool* newState);
void didEvaluateForTestInFrontend(long callId, const String& jsonResult);
// InspectorInstrumentation API
void ensureSettingsLoaded();
void willSendRequest(ResourceRequest&);
void populateScriptObjects();
private:
void pushDataCollectedOffline();
void restoreDebugger();
enum ProfilerRestoreAction {
......@@ -281,9 +283,6 @@ private:
void unbindAllResources();
void setSearchingForNode(bool enabled);
// Following are used from InspectorBackend and internally.
void setSearchingForNode(bool enabled, bool* newState);
void releaseFrontendLifetimeAgents();
#if ENABLE(JAVASCRIPT_DEBUGGER)
......@@ -297,7 +296,6 @@ private:
void focusNode();
bool isMainResourceLoader(DocumentLoader* loader, const KURL& requestUrl);
void didEvaluateForTestInFrontend(long callId, const String& jsonResult);
Page* m_inspectedPage;
InspectorClient* m_client;
......
......@@ -93,17 +93,17 @@ void InspectorInstrumentation::inspectedPageDestroyedImpl(InspectorController* i
void InspectorInstrumentation::willInsertDOMNodeImpl(InspectorController* inspectorController, Node* node, Node* parent)
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->m_browserDebuggerAgent.get())
if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent())
browserDebuggerAgent->willInsertDOMNode(node, parent);
#endif
}
void InspectorInstrumentation::didInsertDOMNodeImpl(InspectorController* inspectorController, Node* node)
{
if (InspectorDOMAgent* domAgent = inspectorController->m_domAgent.get())
if (InspectorDOMAgent* domAgent = inspectorController->domAgent())
domAgent->didInsertDOMNode(node);
#if ENABLE(JAVASCRIPT_DEBUGGER)
if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->m_browserDebuggerAgent.get())
if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent())
browserDebuggerAgent->didInsertDOMNode(node);
#endif
}
......@@ -111,7 +111,7 @@ void InspectorInstrumentation::didInsertDOMNodeImpl(InspectorController* inspect
void InspectorInstrumentation::willRemoveDOMNodeImpl(InspectorController* inspectorController, Node* node)
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->m_browserDebuggerAgent.get())
if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent())
browserDebuggerAgent->willRemoveDOMNode(node);
#endif
}
......@@ -119,24 +119,24 @@ void InspectorInstrumentation::willRemoveDOMNodeImpl(InspectorController* inspec
void InspectorInstrumentation::didRemoveDOMNodeImpl(InspectorController* inspectorController, Node* node)
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->m_browserDebuggerAgent.get())
if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent())
browserDebuggerAgent->didRemoveDOMNode(node);
#endif
if (InspectorDOMAgent* domAgent = inspectorController->m_domAgent.get())
if (InspectorDOMAgent* domAgent = inspectorController->domAgent())
domAgent->didRemoveDOMNode(node);
}
void InspectorInstrumentation::willModifyDOMAttrImpl(InspectorController* inspectorController, Element* element)
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->m_browserDebuggerAgent.get())
if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent())
browserDebuggerAgent->willModifyDOMAttr(element);
#endif
}
void InspectorInstrumentation::didModifyDOMAttrImpl(InspectorController* inspectorController, Element* element)
{
if (InspectorDOMAgent* domAgent = inspectorController->m_domAgent.get())
if (InspectorDOMAgent* domAgent = inspectorController->domAgent())
domAgent->didModifyDOMAttr(element);
}
......@@ -152,14 +152,14 @@ bool InspectorInstrumentation::handleMousePressImpl(InspectorController* inspect
void InspectorInstrumentation::characterDataModifiedImpl(InspectorController* inspectorController, CharacterData* characterData)
{
if (InspectorDOMAgent* domAgent = inspectorController->m_domAgent.get())
if (InspectorDOMAgent* domAgent = inspectorController->domAgent())
domAgent->characterDataModified(characterData);
}
void InspectorInstrumentation::willSendXMLHttpRequestImpl(InspectorController* inspectorController, const String& url)
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->m_browserDebuggerAgent.get())
if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent())
browserDebuggerAgent->willSendXMLHttpRequest(url);
#endif
}
......@@ -433,7 +433,7 @@ void InspectorInstrumentation::didReceiveResourceResponseImpl(const InspectorIns
InspectorController* ic = cookie.first;
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
resourceAgent->didReceiveResponse(identifier, loader, response);
ic->m_consoleAgent->didReceiveResponse(identifier, response);
ic->consoleAgent()->didReceiveResponse(identifier, response);
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
timelineAgent->didReceiveResourceResponse();
}
......@@ -454,7 +454,7 @@ void InspectorInstrumentation::didFinishLoadingImpl(InspectorController* ic, uns
void InspectorInstrumentation::didFailLoadingImpl(InspectorController* ic, unsigned long identifier, const ResourceError& error)
{
ic->m_consoleAgent->didFailLoading(identifier, error);
ic->consoleAgent()->didFailLoading(identifier, error);
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(ic))
timelineAgent->didFinishLoadingResource(identifier, true, 0);
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
......@@ -463,7 +463,7 @@ void InspectorInstrumentation::didFailLoadingImpl(InspectorController* ic, unsig
void InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl(InspectorController* ic, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
{
ic->m_consoleAgent->resourceRetrievedByXMLHttpRequest(url, sendURL, sendLineNumber);
ic->consoleAgent()->resourceRetrievedByXMLHttpRequest(url, sendURL, sendLineNumber);
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
resourceAgent->setInitialContent(identifier, sourceString, "XHR");
}
......@@ -549,7 +549,7 @@ void InspectorInstrumentation::consoleMarkTimelineImpl(InspectorController* insp
#if ENABLE(JAVASCRIPT_DEBUGGER)
void InspectorInstrumentation::addStartProfilingMessageToConsoleImpl(InspectorController* inspectorController, const String& title, unsigned lineNumber, const String& sourceURL)
{
if (InspectorProfilerAgent* profilerAgent = inspectorController->m_profilerAgent.get())
if (InspectorProfilerAgent* profilerAgent = inspectorController->profilerAgent())
profilerAgent->addStartProfilingMessageToConsole(title, lineNumber, sourceURL);
}
#endif
......@@ -624,7 +624,7 @@ bool InspectorInstrumentation::hasFrontend(InspectorController* inspectorControl
void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InspectorController* inspectorController, const String& categoryType, const String& eventName, bool synchronous)
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->m_browserDebuggerAgent.get())
if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent())
browserDebuggerAgent->pauseOnNativeEventIfNeeded(categoryType, eventName, synchronous);
#endif
}
......@@ -632,14 +632,14 @@ void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InspectorController* i
void InspectorInstrumentation::cancelPauseOnNativeEvent(InspectorController* inspectorController)
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
if (InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get())
if (InspectorDebuggerAgent* debuggerAgent = inspectorController->debuggerAgent())
debuggerAgent->cancelPauseOnNextStatement();
#endif
}
InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(InspectorController* inspectorController)
{
return inspectorController->m_timelineAgent.get();
return inspectorController->timelineAgent();
}
InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const InspectorInstrumentationCookie& cookie)
......@@ -652,7 +652,7 @@ InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const In
InspectorResourceAgent* InspectorInstrumentation::retrieveResourceAgent(InspectorController* ic)
{
return ic->m_resourceAgent.get();
return ic->resourceAgent();
}
} // namespace WebCore
......
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