Commit 0d1b5034 authored by pfeldman@chromium.org's avatar pfeldman@chromium.org
Browse files

2011-01-20 Pavel Feldman <pfeldman@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: enable resource agent upon request.
        https://bugs.webkit.org/show_bug.cgi?id=52815

        We should not send network-related notifications unless front-end
        is interested.

        * inspector/Inspector.idl:
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::restoreInspectorStateFromCookie):
        (WebCore::InspectorController::connectFrontend):
        (WebCore::InspectorController::resourceAgent):
        * inspector/InspectorController.h:
        (WebCore::InspectorController::consoleAgent):
        (WebCore::InspectorController::cssAgent):
        (WebCore::InspectorController::domAgent):
        (WebCore::InspectorController::injectedScriptAgent):
        (WebCore::InspectorController::runtimeAgent):
        (WebCore::InspectorController::databaseAgent):
        (WebCore::InspectorController::domStorageAgent):
        (WebCore::InspectorController::fileSystemAgent):
        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::retrieveResourceAgent):
        * inspector/InspectorResourceAgent.cpp:
        (WebCore::InspectorResourceAgent::restore):
        (WebCore::InspectorResourceAgent::~InspectorResourceAgent):
        (WebCore::InspectorResourceAgent::InspectorResourceAgent):
        * inspector/InspectorResourceAgent.h:
        (WebCore::InspectorResourceAgent::create):
        * inspector/InspectorState.cpp:
        (WebCore::InspectorState::InspectorState):
        * inspector/InspectorState.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76249 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 95c1bc42
2011-01-20 Pavel Feldman <pfeldman@chromium.org>
Reviewed by Yury Semikhatsky.
Web Inspector: enable resource agent upon request.
https://bugs.webkit.org/show_bug.cgi?id=52815
We should not send network-related notifications unless front-end
is interested.
* inspector/Inspector.idl:
* inspector/InspectorController.cpp:
(WebCore::InspectorController::restoreInspectorStateFromCookie):
(WebCore::InspectorController::connectFrontend):
(WebCore::InspectorController::resourceAgent):
* inspector/InspectorController.h:
(WebCore::InspectorController::consoleAgent):
(WebCore::InspectorController::cssAgent):
(WebCore::InspectorController::domAgent):
(WebCore::InspectorController::injectedScriptAgent):
(WebCore::InspectorController::runtimeAgent):
(WebCore::InspectorController::databaseAgent):
(WebCore::InspectorController::domStorageAgent):
(WebCore::InspectorController::fileSystemAgent):
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::retrieveResourceAgent):
* inspector/InspectorResourceAgent.cpp:
(WebCore::InspectorResourceAgent::restore):
(WebCore::InspectorResourceAgent::~InspectorResourceAgent):
(WebCore::InspectorResourceAgent::InspectorResourceAgent):
* inspector/InspectorResourceAgent.h:
(WebCore::InspectorResourceAgent::create):
* inspector/InspectorState.cpp:
(WebCore::InspectorState::InspectorState):
* inspector/InspectorState.h:
2011-01-20 Zoltan Horvath <zoltan@webkit.org>
 
Reviewed by Csaba Osztrogonác.
......@@ -102,8 +102,8 @@ module core {
[domain=Network] void cachedResources(out Object resources);
[domain=Network] void resourceContent(in unsigned long frameId, in String url, in boolean base64Encode, out String content);
[notify, domain=Network] void frameDetachedFromParent(out unsigned long frameId);
[notify, domain=Network] void frameDetachedFromParent(out unsigned long frameId);
[notify, domain=Network] void identifierForInitialRequest(out long identifier, out String url, out Object loader, out Value callStack);
[notify, domain=Network] void willSendRequest(out long identifier, out double time, out Object request, out Object redirectResponse);
[notify, domain=Network] void markResourceAsCached(out long identifier);
......@@ -125,10 +125,11 @@ module core {
// Database API
///////////////////////////////////////////////////////////////////////
[notify, domain=Database] void addDatabase(out Object database);
[notify, domain=Database] void selectDatabase(out int databaseId);
[domain=Database] void getDatabaseTableNames(in long databaseId, out Array tableNames);
[domain=Database] void executeSQL(in long databaseId, in String query, out boolean success, out long transactionId);
[notify, domain=Database] void addDatabase(out Object database);
[notify, domain=Database] void selectDatabase(out int databaseId);
[notify, domain=Database] void sqlTransactionSucceeded(out long transactionId, out Value columnNames, out Value values);
[notify, domain=Database] void sqlTransactionFailed(out long transactionId, out Value sqlError);
#endif
......
......@@ -227,6 +227,8 @@ void InspectorController::restoreInspectorStateFromCookie(const String& inspecto
pushDataCollectedOffline();
}
m_resourceAgent = InspectorResourceAgent::restore(m_inspectedPage, m_state.get(), m_frontend.get());
if (m_state->getBoolean(InspectorState::timelineProfilerEnabled))
startTimelineProfiler();
......@@ -380,9 +382,7 @@ void InspectorController::connectFrontend()
releaseFrontendLifetimeAgents();
m_frontend = new InspectorFrontend(m_client);
m_domAgent = InspectorDOMAgent::create(m_injectedScriptHost.get(), m_frontend.get());
m_resourceAgent = InspectorResourceAgent::create(m_inspectedPage, m_frontend.get());
m_runtimeAgent = InspectorRuntimeAgent::create(m_injectedScriptHost.get());
m_cssAgent->setDOMAgent(m_domAgent.get());
#if ENABLE(DATABASE)
......@@ -488,6 +488,13 @@ void InspectorController::disconnectFrontend()
m_extraHeaders.clear();
}
InspectorResourceAgent* InspectorController::resourceAgent()
{
if (!m_resourceAgent && m_frontend)
m_resourceAgent = InspectorResourceAgent::create(m_inspectedPage, m_state.get(), m_frontend.get());
return m_resourceAgent.get();
}
void InspectorController::releaseFrontendLifetimeAgents()
{
m_resourceAgent.clear();
......
......@@ -147,22 +147,23 @@ public:
void disconnectFrontend();
InspectorFrontend* frontend() const { return m_frontend.get(); }
InspectorResourceAgent* resourceAgent();
InspectorController* inspectorAgent() { return this; }
InspectorConsoleAgent* consoleAgent() const { return m_consoleAgent.get(); }
InspectorCSSAgent* cssAgent() const { return m_cssAgent.get(); }
InspectorDOMAgent* domAgent() const { return m_domAgent.get(); }
InjectedScriptHost* injectedScriptAgent() const { return m_injectedScriptHost.get(); }
InspectorResourceAgent* resourceAgent() const { return m_resourceAgent.get(); }
InspectorRuntimeAgent* runtimeAgent() const { return m_runtimeAgent.get(); }
InspectorConsoleAgent* consoleAgent() { return m_consoleAgent.get(); }
InspectorCSSAgent* cssAgent() { return m_cssAgent.get(); }
InspectorDOMAgent* domAgent() { return m_domAgent.get(); }
InjectedScriptHost* injectedScriptAgent() { return m_injectedScriptHost.get(); }
InspectorRuntimeAgent* runtimeAgent() { return m_runtimeAgent.get(); }
InspectorTimelineAgent* timelineAgent() { return m_timelineAgent.get(); }
#if ENABLE(DATABASE)
InspectorDatabaseAgent* databaseAgent() const { return m_databaseAgent.get(); }
InspectorDatabaseAgent* databaseAgent() { return m_databaseAgent.get(); }
#endif
#if ENABLE(DOM_STORAGE)
InspectorDOMStorageAgent* domStorageAgent() const { return m_domStorageAgent.get(); }
InspectorDOMStorageAgent* domStorageAgent() { return m_domStorageAgent.get(); }
#endif
#if ENABLE(FILE_SYSTEM)
InspectorFileSystemAgent* fileSystemAgent() const { return m_fileSystemAgent.get(); }
InspectorFileSystemAgent* fileSystemAgent() { return m_fileSystemAgent.get(); }
#endif
#if ENABLE(JAVASCRIPT_DEBUGGER)
InspectorBrowserDebuggerAgent* browserDebuggerAgent() const { return m_browserDebuggerAgent.get(); }
......
......@@ -45,6 +45,7 @@
#include "HTMLNames.h"
#include "HTTPHeaderMap.h"
#include "InspectorFrontend.h"
#include "InspectorState.h"
#include "InspectorValues.h"
#include "KURL.h"
#include "Page.h"
......@@ -66,6 +67,13 @@
namespace WebCore {
PassRefPtr<InspectorResourceAgent> InspectorResourceAgent::restore(Page* page, InspectorState* state, InspectorFrontend* frontend)
{
if (state->getBoolean(InspectorState::resourceAgentEnabled))
return create(page, state, frontend);
return 0;
}
bool InspectorResourceAgent::resourceContent(Frame* frame, const KURL& url, String* result)
{
if (!frame)
......@@ -281,6 +289,7 @@ static void populateObjectWithFrameResources(Frame* frame, PassRefPtr<InspectorO
InspectorResourceAgent::~InspectorResourceAgent()
{
m_state->setBoolean(InspectorState::resourceAgentEnabled, false);
}
void InspectorResourceAgent::identifierForInitialRequest(unsigned long identifier, const KURL& url, DocumentLoader* loader)
......@@ -476,10 +485,12 @@ void InspectorResourceAgent::resourceContent(unsigned long id, const String& url
}
}
InspectorResourceAgent::InspectorResourceAgent(Page* page, InspectorFrontend* frontend)
InspectorResourceAgent::InspectorResourceAgent(Page* page, InspectorState* state, InspectorFrontend* frontend)
: m_page(page)
, m_state(state)
, m_frontend(frontend)
{
m_state->setBoolean(InspectorState::resourceAgentEnabled, true);
}
} // namespace WebCore
......
......@@ -49,8 +49,9 @@ class Document;
class DocumentLoader;
class Frame;
class InspectorArray;
class InspectorObject;
class InspectorFrontend;
class InspectorObject;
class InspectorState;
class KURL;
class Page;
class ResourceError;
......@@ -65,11 +66,13 @@ class WebSocketHandshakeResponse;
class InspectorResourceAgent : public RefCounted<InspectorResourceAgent> {
public:
static PassRefPtr<InspectorResourceAgent> create(Page* page, InspectorFrontend* frontend)
static PassRefPtr<InspectorResourceAgent> create(Page* page, InspectorState* state, InspectorFrontend* frontend)
{
return adoptRef(new InspectorResourceAgent(page, frontend));
return adoptRef(new InspectorResourceAgent(page, state, frontend));
}
static PassRefPtr<InspectorResourceAgent> restore(Page*, InspectorState*, InspectorFrontend*);
static bool resourceContent(Frame*, const KURL&, String* result);
static bool resourceContentBase64(Frame*, const KURL&, String* result);
static PassRefPtr<SharedBuffer> resourceData(Frame*, const KURL&, String* textEncodingName);
......@@ -103,9 +106,10 @@ public:
void resourceContent(unsigned long frameID, const String& url, bool base64Encode, String* content);
private:
InspectorResourceAgent(Page* page, InspectorFrontend* frontend);
InspectorResourceAgent(Page* page, InspectorState*, InspectorFrontend* frontend);
Page* m_page;
InspectorState* m_state;
InspectorFrontend* m_frontend;
};
......
......@@ -45,6 +45,7 @@ InspectorState::InspectorState(InspectorClient* client)
registerObject(stickyBreakpoints);
registerBoolean(consoleMessagesEnabled, false);
registerBoolean(monitoringXHR, false);
registerBoolean(resourceAgentEnabled, false);
}
void InspectorState::restoreFromInspectorCookie(const String& json)
......
......@@ -50,6 +50,7 @@ public:
consoleMessagesEnabled,
userInitiatedProfiling,
stickyBreakpoints,
resourceAgentEnabled,
lastPropertyId
};
......
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