2011-04-18 Ilya Tikhonovsky <loislo@chromium.org>
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Apr 2011 12:25:43 +0000 (12:25 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Apr 2011 12:25:43 +0000 (12:25 +0000)
        Reviewed by Yury Semikhatsky.

        Web Inspector: Database agent stops to propagate it's events after navigation.
        https://bugs.webkit.org/show_bug.cgi?id=58776

        * inspector/InspectorAgent.cpp:
        (WebCore::InspectorAgent::InspectorAgent):
        (WebCore::InspectorAgent::restoreInspectorStateFromCookie):
        * inspector/InspectorDatabaseAgent.cpp:
        (WebCore::InspectorDatabaseAgent::InspectorDatabaseAgent):
        (WebCore::InspectorDatabaseAgent::clearFrontend):
        (WebCore::InspectorDatabaseAgent::enable):
        (WebCore::InspectorDatabaseAgent::disable):
        (WebCore::InspectorDatabaseAgent::restore):
        * inspector/InspectorDatabaseAgent.h:
        (WebCore::InspectorDatabaseAgent::create):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84134 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorAgent.cpp
Source/WebCore/inspector/InspectorDatabaseAgent.cpp
Source/WebCore/inspector/InspectorDatabaseAgent.h

index 26dda6fd01c6b78b5a3f5dea2e201bd98fa3e633..fe5a5cb17c0bdb1a707975b59fd48aaea6710427 100644 (file)
@@ -1,3 +1,22 @@
+2011-04-18  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: Database agent stops to propagate it's events after navigation.
+        https://bugs.webkit.org/show_bug.cgi?id=58776
+
+        * inspector/InspectorAgent.cpp:
+        (WebCore::InspectorAgent::InspectorAgent):
+        (WebCore::InspectorAgent::restoreInspectorStateFromCookie):
+        * inspector/InspectorDatabaseAgent.cpp:
+        (WebCore::InspectorDatabaseAgent::InspectorDatabaseAgent):
+        (WebCore::InspectorDatabaseAgent::clearFrontend):
+        (WebCore::InspectorDatabaseAgent::enable):
+        (WebCore::InspectorDatabaseAgent::disable):
+        (WebCore::InspectorDatabaseAgent::restore):
+        * inspector/InspectorDatabaseAgent.h:
+        (WebCore::InspectorDatabaseAgent::create):
+
 2011-04-18  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r83968.
index 7838363736a2e96d2f0342b4ee17514e64bb98f9..0cfc5d28a4204d0d06cf2e2513a49b7d0fb120ea 100644 (file)
@@ -116,7 +116,7 @@ InspectorAgent::InspectorAgent(Page* page, InspectorClient* client, InjectedScri
     , m_domAgent(InspectorDOMAgent::create(m_instrumentingAgents.get(), page, m_client, m_state.get(), injectedScriptManager))
     , m_cssAgent(new InspectorCSSAgent(m_instrumentingAgents.get(), m_domAgent.get()))
 #if ENABLE(DATABASE)
-    , m_databaseAgent(InspectorDatabaseAgent::create(m_instrumentingAgents.get()))
+    , m_databaseAgent(InspectorDatabaseAgent::create(m_instrumentingAgents.get(), m_state.get()))
 #endif
 #if ENABLE(DOM_STORAGE)
     , m_domStorageAgent(InspectorDOMStorageAgent::create(m_instrumentingAgents.get()))
@@ -196,6 +196,10 @@ void InspectorAgent::restoreInspectorStateFromCookie(const String& inspectorStat
     m_resourceAgent->restore();
     m_timelineAgent->restore();
 
+#if ENABLE(DATABASE)
+    m_databaseAgent->restore();
+#endif
+
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     m_debuggerAgent->restore();
     m_profilerAgent->restore();
index 2be6c52a3ed389be591e45272d5db615c326bd56..03d84826a6a8f886c36ec283eba177c44fdad433 100644 (file)
@@ -36,6 +36,7 @@
 #include "ExceptionCode.h"
 #include "InspectorDatabaseResource.h"
 #include "InspectorFrontend.h"
+#include "InspectorState.h"
 #include "InspectorValues.h"
 #include "InstrumentingAgents.h"
 #include "SQLError.h"
 
 namespace WebCore {
 
+namespace DatabaseAgentState {
+static const char databaseAgentEnabled[] = "databaseAgentEnabled";
+};
+
 class InspectorDatabaseAgent::FrontendProvider : public RefCounted<InspectorDatabaseAgent::FrontendProvider> {
 public:
     static PassRefPtr<FrontendProvider> create(InspectorFrontend* inspectorFrontend)
@@ -237,8 +242,9 @@ void InspectorDatabaseAgent::clearResources()
     m_resources.clear();
 }
 
-InspectorDatabaseAgent::InspectorDatabaseAgent(InstrumentingAgents* instrumentingAgents)
+InspectorDatabaseAgent::InspectorDatabaseAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state)
     : m_instrumentingAgents(instrumentingAgents)
+    , m_inspectorState(state)
     , m_enabled(false)
 {
     m_instrumentingAgents->setInspectorDatabaseAgent(this);
@@ -258,7 +264,7 @@ void InspectorDatabaseAgent::clearFrontend()
 {
     m_frontendProvider->clearFrontend();
     m_frontendProvider.clear();
-    m_enabled = false;
+    disable(0);
 }
 
 void InspectorDatabaseAgent::enable(ErrorString*)
@@ -266,6 +272,7 @@ void InspectorDatabaseAgent::enable(ErrorString*)
     if (m_enabled)
         return;
     m_enabled = true;
+    m_inspectorState->setBoolean(DatabaseAgentState::databaseAgentEnabled, m_enabled);
 
     DatabaseResourcesMap::iterator databasesEnd = m_resources.end();
     for (DatabaseResourcesMap::iterator it = m_resources.begin(); it != databasesEnd; ++it)
@@ -277,6 +284,12 @@ void InspectorDatabaseAgent::disable(ErrorString*)
     if (!m_enabled)
         return;
     m_enabled = false;
+    m_inspectorState->setBoolean(DatabaseAgentState::databaseAgentEnabled, m_enabled);
+}
+
+void InspectorDatabaseAgent::restore()
+{
+    m_enabled =  m_inspectorState->getBoolean(DatabaseAgentState::databaseAgentEnabled);
 }
 
 void InspectorDatabaseAgent::getDatabaseTableNames(ErrorString* error, int databaseId, RefPtr<InspectorArray>* names)
index 6fce09b038df921228ab86a6a460378672f62c80..354a6cdeb32d5d14443047c107646d3b9a340e95 100644 (file)
@@ -39,6 +39,7 @@ class Database;
 class InspectorArray;
 class InspectorDatabaseResource;
 class InspectorFrontend;
+class InspectorState;
 class InstrumentingAgents;
 
 typedef String ErrorString;
@@ -47,9 +48,9 @@ class InspectorDatabaseAgent {
 public:
     class FrontendProvider;
 
-    static PassOwnPtr<InspectorDatabaseAgent> create(InstrumentingAgents* instrumentingAgents)
+    static PassOwnPtr<InspectorDatabaseAgent> create(InstrumentingAgents* instrumentingAgents, InspectorState* state)
     {
-        return adoptPtr(new InspectorDatabaseAgent(instrumentingAgents));
+        return adoptPtr(new InspectorDatabaseAgent(instrumentingAgents, state));
     }
     ~InspectorDatabaseAgent();
 
@@ -57,6 +58,7 @@ public:
     void clearFrontend();
 
     void clearResources();
+    void restore();
 
     // Called from the front-end.
     void enable(ErrorString*);
@@ -69,12 +71,13 @@ public:
 
     void didOpenDatabase(PassRefPtr<Database>, const String& domain, const String& name, const String& version);
 private:
-    explicit InspectorDatabaseAgent(InstrumentingAgents*);
+    explicit InspectorDatabaseAgent(InstrumentingAgents*, InspectorState*);
 
     Database* databaseForId(int databaseId);
     InspectorDatabaseResource* findByFileName(const String& fileName);
 
     InstrumentingAgents* m_instrumentingAgents;
+    InspectorState* m_inspectorState;
     typedef HashMap<int, RefPtr<InspectorDatabaseResource> > DatabaseResourcesMap;
     DatabaseResourcesMap m_resources;
     RefPtr<FrontendProvider> m_frontendProvider;