Unreviewed, rolling out r138436.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Dec 2012 16:45:04 +0000 (16:45 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Dec 2012 16:45:04 +0000 (16:45 +0000)
http://trac.webkit.org/changeset/138436
https://bugs.webkit.org/show_bug.cgi?id=105723

Asserts on state restoration in debug builds (Requested by
apavlov on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-12-24

* inspector/InspectorAgent.cpp:
(InspectorAgentState):
(WebCore::InspectorAgent::enable):
(WebCore::InspectorAgent::disable):
(WebCore::InspectorAgent::evaluateForTestInFrontend):
(WebCore::InspectorAgent::inspect):
* inspector/InspectorApplicationCacheAgent.cpp:
(ApplicationCacheAgentState):
(WebCore::InspectorApplicationCacheAgent::restore):
(WebCore::InspectorApplicationCacheAgent::enable):
* inspector/InspectorCSSAgent.cpp:
(CSSAgentState):
(WebCore::InspectorCSSAgent::restore):
(WebCore::InspectorCSSAgent::enable):
(WebCore::InspectorCSSAgent::disable):
* inspector/InspectorCanvasAgent.cpp:
(CanvasAgentState):
(WebCore::InspectorCanvasAgent::restore):
(WebCore::InspectorCanvasAgent::enable):
(WebCore::InspectorCanvasAgent::disable):
* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
* inspector/InspectorController.h:
(WebCore):
(InspectorController):
* inspector/InspectorDOMStorageAgent.cpp:
(DOMStorageAgentState):
(WebCore::InspectorDOMStorageAgent::restore):
(WebCore::InspectorDOMStorageAgent::enable):
(WebCore::InspectorDOMStorageAgent::disable):
* inspector/InspectorDatabaseAgent.cpp:
(DatabaseAgentState):
(WebCore):
(WebCore::InspectorDatabaseAgent::enable):
(WebCore::InspectorDatabaseAgent::disable):
(WebCore::InspectorDatabaseAgent::restore):
* inspector/InspectorDebuggerAgent.cpp:
(WebCore::InspectorDebuggerAgent::disable):
* inspector/InspectorFileSystemAgent.cpp:
(FileSystemAgentState):
(WebCore):
(WebCore::InspectorFileSystemAgent::enable):
(WebCore::InspectorFileSystemAgent::disable):
(WebCore::InspectorFileSystemAgent::clearFrontend):
(WebCore::InspectorFileSystemAgent::restore):
* inspector/InspectorIndexedDBAgent.cpp:
(IndexedDBAgentState):
(WebCore):
(WebCore::InspectorIndexedDBAgent::restore):
(WebCore::InspectorIndexedDBAgent::enable):
(WebCore::InspectorIndexedDBAgent::disable):
* inspector/InspectorLayerTreeAgent.cpp:
(LayerTreeAgentState):
(WebCore::InspectorLayerTreeAgent::restore):
(WebCore::InspectorLayerTreeAgent::enable):
(WebCore::InspectorLayerTreeAgent::disable):
* inspector/InspectorPageAgent.cpp:
(PageAgentState):
(WebCore::InspectorPageAgent::restore):
(WebCore::InspectorPageAgent::webViewResized):
(WebCore::InspectorPageAgent::enable):
(WebCore::InspectorPageAgent::disable):
(WebCore::InspectorPageAgent::addScriptToEvaluateOnLoad):
(WebCore::InspectorPageAgent::removeScriptToEvaluateOnLoad):
(WebCore::InspectorPageAgent::setDeviceMetricsOverride):
(WebCore::InspectorPageAgent::setShowPaintRects):
(WebCore::InspectorPageAgent::setShowFPSCounter):
(WebCore::InspectorPageAgent::setScriptExecutionDisabled):
(WebCore::InspectorPageAgent::didClearWindowObjectInWorld):
(WebCore::InspectorPageAgent::applyScreenWidthOverride):
(WebCore::InspectorPageAgent::applyScreenHeightOverride):
(WebCore::InspectorPageAgent::didPaint):
(WebCore::InspectorPageAgent::didLayout):
(WebCore::InspectorPageAgent::setEmulatedMedia):
(WebCore::InspectorPageAgent::applyEmulatedMedia):
* inspector/InspectorResourceAgent.cpp:
(ResourceAgentState):
(WebCore::InspectorResourceAgent::restore):
(WebCore::InspectorResourceAgent::~InspectorResourceAgent):
(WebCore::InspectorResourceAgent::enable):
(WebCore::InspectorResourceAgent::disable):
* inspector/InspectorState.cpp:
(WebCore::InspectorState::InspectorState):
(WebCore::InspectorState::loadFromCookie):
(WebCore):
(WebCore::InspectorState::mute):
(WebCore::InspectorState::unmute):
(WebCore::InspectorState::updateCookie):
(WebCore::InspectorState::remove):
* inspector/InspectorState.h:
(WebCore):
(InspectorState):
(WebCore::InspectorState::setLong):
* inspector/InspectorTimelineAgent.cpp:
(TimelineAgentState):
(WebCore::InspectorTimelineAgent::restore):
(WebCore::InspectorTimelineAgent::start):
(WebCore::InspectorTimelineAgent::stop):
* inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::WorkerInspectorController):
* inspector/WorkerInspectorController.h:
(WebCore):
(WorkerInspectorController):

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

20 files changed:
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorAgent.cpp
Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp
Source/WebCore/inspector/InspectorCSSAgent.cpp
Source/WebCore/inspector/InspectorCanvasAgent.cpp
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorController.h
Source/WebCore/inspector/InspectorDOMStorageAgent.cpp
Source/WebCore/inspector/InspectorDatabaseAgent.cpp
Source/WebCore/inspector/InspectorDebuggerAgent.cpp
Source/WebCore/inspector/InspectorFileSystemAgent.cpp
Source/WebCore/inspector/InspectorIndexedDBAgent.cpp
Source/WebCore/inspector/InspectorLayerTreeAgent.cpp
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/inspector/InspectorResourceAgent.cpp
Source/WebCore/inspector/InspectorState.cpp
Source/WebCore/inspector/InspectorState.h
Source/WebCore/inspector/InspectorTimelineAgent.cpp
Source/WebCore/inspector/WorkerInspectorController.cpp
Source/WebCore/inspector/WorkerInspectorController.h

index 72b5d15..ea600f2 100644 (file)
@@ -1,3 +1,116 @@
+2012-12-24  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r138436.
+        http://trac.webkit.org/changeset/138436
+        https://bugs.webkit.org/show_bug.cgi?id=105723
+
+        Asserts on state restoration in debug builds (Requested by
+        apavlov on #webkit).
+
+        * inspector/InspectorAgent.cpp:
+        (InspectorAgentState):
+        (WebCore::InspectorAgent::enable):
+        (WebCore::InspectorAgent::disable):
+        (WebCore::InspectorAgent::evaluateForTestInFrontend):
+        (WebCore::InspectorAgent::inspect):
+        * inspector/InspectorApplicationCacheAgent.cpp:
+        (ApplicationCacheAgentState):
+        (WebCore::InspectorApplicationCacheAgent::restore):
+        (WebCore::InspectorApplicationCacheAgent::enable):
+        * inspector/InspectorCSSAgent.cpp:
+        (CSSAgentState):
+        (WebCore::InspectorCSSAgent::restore):
+        (WebCore::InspectorCSSAgent::enable):
+        (WebCore::InspectorCSSAgent::disable):
+        * inspector/InspectorCanvasAgent.cpp:
+        (CanvasAgentState):
+        (WebCore::InspectorCanvasAgent::restore):
+        (WebCore::InspectorCanvasAgent::enable):
+        (WebCore::InspectorCanvasAgent::disable):
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::InspectorController):
+        * inspector/InspectorController.h:
+        (WebCore):
+        (InspectorController):
+        * inspector/InspectorDOMStorageAgent.cpp:
+        (DOMStorageAgentState):
+        (WebCore::InspectorDOMStorageAgent::restore):
+        (WebCore::InspectorDOMStorageAgent::enable):
+        (WebCore::InspectorDOMStorageAgent::disable):
+        * inspector/InspectorDatabaseAgent.cpp:
+        (DatabaseAgentState):
+        (WebCore):
+        (WebCore::InspectorDatabaseAgent::enable):
+        (WebCore::InspectorDatabaseAgent::disable):
+        (WebCore::InspectorDatabaseAgent::restore):
+        * inspector/InspectorDebuggerAgent.cpp:
+        (WebCore::InspectorDebuggerAgent::disable):
+        * inspector/InspectorFileSystemAgent.cpp:
+        (FileSystemAgentState):
+        (WebCore):
+        (WebCore::InspectorFileSystemAgent::enable):
+        (WebCore::InspectorFileSystemAgent::disable):
+        (WebCore::InspectorFileSystemAgent::clearFrontend):
+        (WebCore::InspectorFileSystemAgent::restore):
+        * inspector/InspectorIndexedDBAgent.cpp:
+        (IndexedDBAgentState):
+        (WebCore):
+        (WebCore::InspectorIndexedDBAgent::restore):
+        (WebCore::InspectorIndexedDBAgent::enable):
+        (WebCore::InspectorIndexedDBAgent::disable):
+        * inspector/InspectorLayerTreeAgent.cpp:
+        (LayerTreeAgentState):
+        (WebCore::InspectorLayerTreeAgent::restore):
+        (WebCore::InspectorLayerTreeAgent::enable):
+        (WebCore::InspectorLayerTreeAgent::disable):
+        * inspector/InspectorPageAgent.cpp:
+        (PageAgentState):
+        (WebCore::InspectorPageAgent::restore):
+        (WebCore::InspectorPageAgent::webViewResized):
+        (WebCore::InspectorPageAgent::enable):
+        (WebCore::InspectorPageAgent::disable):
+        (WebCore::InspectorPageAgent::addScriptToEvaluateOnLoad):
+        (WebCore::InspectorPageAgent::removeScriptToEvaluateOnLoad):
+        (WebCore::InspectorPageAgent::setDeviceMetricsOverride):
+        (WebCore::InspectorPageAgent::setShowPaintRects):
+        (WebCore::InspectorPageAgent::setShowFPSCounter):
+        (WebCore::InspectorPageAgent::setScriptExecutionDisabled):
+        (WebCore::InspectorPageAgent::didClearWindowObjectInWorld):
+        (WebCore::InspectorPageAgent::applyScreenWidthOverride):
+        (WebCore::InspectorPageAgent::applyScreenHeightOverride):
+        (WebCore::InspectorPageAgent::didPaint):
+        (WebCore::InspectorPageAgent::didLayout):
+        (WebCore::InspectorPageAgent::setEmulatedMedia):
+        (WebCore::InspectorPageAgent::applyEmulatedMedia):
+        * inspector/InspectorResourceAgent.cpp:
+        (ResourceAgentState):
+        (WebCore::InspectorResourceAgent::restore):
+        (WebCore::InspectorResourceAgent::~InspectorResourceAgent):
+        (WebCore::InspectorResourceAgent::enable):
+        (WebCore::InspectorResourceAgent::disable):
+        * inspector/InspectorState.cpp:
+        (WebCore::InspectorState::InspectorState):
+        (WebCore::InspectorState::loadFromCookie):
+        (WebCore):
+        (WebCore::InspectorState::mute):
+        (WebCore::InspectorState::unmute):
+        (WebCore::InspectorState::updateCookie):
+        (WebCore::InspectorState::remove):
+        * inspector/InspectorState.h:
+        (WebCore):
+        (InspectorState):
+        (WebCore::InspectorState::setLong):
+        * inspector/InspectorTimelineAgent.cpp:
+        (TimelineAgentState):
+        (WebCore::InspectorTimelineAgent::restore):
+        (WebCore::InspectorTimelineAgent::start):
+        (WebCore::InspectorTimelineAgent::stop):
+        * inspector/WorkerInspectorController.cpp:
+        (WebCore::WorkerInspectorController::WorkerInspectorController):
+        * inspector/WorkerInspectorController.h:
+        (WebCore):
+        (WorkerInspectorController):
+
 2012-12-24  Peter Rybin  <prybin@chromium.org>
 
         Web Inspector: Keep LiveEdit API disabled when idle
index a6f8444..01baeb8 100644 (file)
@@ -60,7 +60,7 @@ using namespace std;
 namespace WebCore {
 
 namespace InspectorAgentState {
-static const char enabled[] = "enabled";
+static const char inspectorAgentEnabled[] = "inspectorAgentEnabled";
 }
 
 InspectorAgent::InspectorAgent(Page* page, InjectedScriptManager* injectedScriptManager, InstrumentingAgents* instrumentingAgents, InspectorState* state)
@@ -113,7 +113,7 @@ void InspectorAgent::didCommitLoad()
 
 void InspectorAgent::enable(ErrorString*)
 {
-    m_state->setBoolean(InspectorAgentState::enabled, true);
+    m_state->setBoolean(InspectorAgentState::inspectorAgentEnabled, true);
 
     if (m_pendingInspectData.first)
         inspect(m_pendingInspectData.first, m_pendingInspectData.second);
@@ -125,7 +125,7 @@ void InspectorAgent::enable(ErrorString*)
 
 void InspectorAgent::disable(ErrorString*)
 {
-    m_state->setBoolean(InspectorAgentState::enabled, false);
+    m_state->setBoolean(InspectorAgentState::inspectorAgentEnabled, false);
 }
 
 void InspectorAgent::domContentLoadedEventFired()
@@ -140,7 +140,7 @@ bool InspectorAgent::isMainResourceLoader(DocumentLoader* loader, const KURL& re
 
 void InspectorAgent::evaluateForTestInFrontend(long callId, const String& script)
 {
-    if (m_state->getBoolean(InspectorAgentState::enabled))
+    if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled))
         m_frontend->inspector()->evaluateForTestInFrontend(static_cast<int>(callId), script);
     else
         m_pendingEvaluateTestCommands.append(pair<long, String>(callId, script));
@@ -153,7 +153,7 @@ void InspectorAgent::setInjectedScriptForOrigin(const String& origin, const Stri
 
 void InspectorAgent::inspect(PassRefPtr<TypeBuilder::Runtime::RemoteObject> objectToInspect, PassRefPtr<InspectorObject> hints)
 {
-    if (m_state->getBoolean(InspectorAgentState::enabled) && m_frontend) {
+    if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled) && m_frontend) {
         m_frontend->inspector()->inspect(objectToInspect, hints);
         m_pendingInspectData.first = 0;
         m_pendingInspectData.second = 0;
index 590f163..2e7c7d9 100644 (file)
@@ -46,7 +46,7 @@
 namespace WebCore {
 
 namespace ApplicationCacheAgentState {
-static const char enabled[] = "enabled";
+static const char applicationCacheAgentEnabled[] = "applicationCacheAgentEnabled";
 }
 
 InspectorApplicationCacheAgent::InspectorApplicationCacheAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, InspectorPageAgent* pageAgent)
@@ -69,7 +69,7 @@ void InspectorApplicationCacheAgent::clearFrontend()
 
 void InspectorApplicationCacheAgent::restore()
 {
-    if (m_state->getBoolean(ApplicationCacheAgentState::enabled)) {
+    if (m_state->getBoolean(ApplicationCacheAgentState::applicationCacheAgentEnabled)) {
         ErrorString error;
         enable(&error);
     }
@@ -77,7 +77,7 @@ void InspectorApplicationCacheAgent::restore()
 
 void InspectorApplicationCacheAgent::enable(ErrorString*)
 {
-    m_state->setBoolean(ApplicationCacheAgentState::enabled, true);
+    m_state->setBoolean(ApplicationCacheAgentState::applicationCacheAgentEnabled, true);
     m_instrumentingAgents->setInspectorApplicationCacheAgent(this);
 
     // We need to pass initial navigator.onOnline.
index 6264091..d525e6d 100644 (file)
@@ -63,7 +63,7 @@
 #include <wtf/text/StringConcatenate.h>
 
 namespace CSSAgentState {
-static const char enabled[] = "enabled";
+static const char cssAgentEnabled[] = "cssAgentEnabled";
 static const char isSelectorProfiling[] = "isSelectorProfiling";
 }
 
@@ -561,7 +561,7 @@ void InspectorCSSAgent::discardAgent()
 
 void InspectorCSSAgent::restore()
 {
-    if (m_state->getBoolean(CSSAgentState::enabled)) {
+    if (m_state->getBoolean(CSSAgentState::cssAgentEnabled)) {
         ErrorString error;
         enable(&error);
     }
@@ -590,14 +590,14 @@ void InspectorCSSAgent::resetNonPersistentData()
 
 void InspectorCSSAgent::enable(ErrorString*)
 {
-    m_state->setBoolean(CSSAgentState::enabled, true);
+    m_state->setBoolean(CSSAgentState::cssAgentEnabled, true);
     m_instrumentingAgents->setInspectorCSSAgent(this);
 }
 
 void InspectorCSSAgent::disable(ErrorString*)
 {
     m_instrumentingAgents->setInspectorCSSAgent(0);
-    m_state->setBoolean(CSSAgentState::enabled, false);
+    m_state->setBoolean(CSSAgentState::cssAgentEnabled, false);
 }
 
 void InspectorCSSAgent::mediaQueryResultChanged()
index 39dca25..04feb32 100644 (file)
@@ -47,7 +47,7 @@
 namespace WebCore {
 
 namespace CanvasAgentState {
-static const char enabled[] = "enabled";
+static const char canvasAgentEnabled[] = "canvasAgentEnabled";
 };
 
 InspectorCanvasAgent::InspectorCanvasAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, Page* page, InjectedScriptManager* injectedScriptManager)
@@ -76,7 +76,7 @@ void InspectorCanvasAgent::clearFrontend()
 
 void InspectorCanvasAgent::restore()
 {
-    if (m_state->getBoolean(CanvasAgentState::enabled)) {
+    if (m_state->getBoolean(CanvasAgentState::canvasAgentEnabled)) {
         ErrorString error;
         enable(&error);
     }
@@ -84,14 +84,14 @@ void InspectorCanvasAgent::restore()
 
 void InspectorCanvasAgent::enable(ErrorString*)
 {
-    m_state->setBoolean(CanvasAgentState::enabled, true);
+    m_state->setBoolean(CanvasAgentState::canvasAgentEnabled, true);
     m_instrumentingAgents->setInspectorCanvasAgent(this);
 }
 
 void InspectorCanvasAgent::disable(ErrorString*)
 {
     m_instrumentingAgents->setInspectorCanvasAgent(0);
-    m_state->setBoolean(CanvasAgentState::enabled, false);
+    m_state->setBoolean(CanvasAgentState::canvasAgentEnabled, false);
 }
 
 void InspectorCanvasAgent::dropTraceLog(ErrorString* errorString, const String& traceLogId)
index c323fe4..3e4dc93 100644 (file)
@@ -82,81 +82,81 @@ namespace WebCore {
 InspectorController::InspectorController(Page* page, InspectorClient* inspectorClient)
     : m_instrumentingAgents(adoptPtr(new InstrumentingAgents()))
     , m_injectedScriptManager(InjectedScriptManager::createForPage())
-    , m_state(adoptPtr(new InspectorCompositeState(inspectorClient)))
+    , m_state(adoptPtr(new InspectorState(inspectorClient)))
     , m_overlay(InspectorOverlay::create(page, inspectorClient))
     , m_page(page)
     , m_inspectorClient(inspectorClient)
 {
-    OwnPtr<InspectorAgent> inspectorAgentPtr(InspectorAgent::create(page, m_injectedScriptManager.get(), m_instrumentingAgents.get(), m_state->createAgentState()));
+    OwnPtr<InspectorAgent> inspectorAgentPtr(InspectorAgent::create(page, m_injectedScriptManager.get(), m_instrumentingAgents.get(), m_state.get()));
     m_inspectorAgent = inspectorAgentPtr.get();
     m_agents.append(inspectorAgentPtr.release());
 
-    OwnPtr<InspectorPageAgent> pageAgentPtr(InspectorPageAgent::create(m_instrumentingAgents.get(), page, m_inspectorAgent, m_state->createAgentState(), m_injectedScriptManager.get(), inspectorClient, m_overlay.get()));
+    OwnPtr<InspectorPageAgent> pageAgentPtr(InspectorPageAgent::create(m_instrumentingAgents.get(), page, m_inspectorAgent, m_state.get(), m_injectedScriptManager.get(), inspectorClient, m_overlay.get()));
     InspectorPageAgent* pageAgent = pageAgentPtr.get();
     m_pageAgent = pageAgentPtr.get();
     m_agents.append(pageAgentPtr.release());
 
-    OwnPtr<InspectorDOMAgent> domAgentPtr(InspectorDOMAgent::create(m_instrumentingAgents.get(), pageAgent, m_state->createAgentState(), m_injectedScriptManager.get(), m_overlay.get()));
+    OwnPtr<InspectorDOMAgent> domAgentPtr(InspectorDOMAgent::create(m_instrumentingAgents.get(), pageAgent, m_state.get(), m_injectedScriptManager.get(), m_overlay.get()));
     m_domAgent = domAgentPtr.get();
     m_agents.append(domAgentPtr.release());
 
-    m_agents.append(InspectorCSSAgent::create(m_instrumentingAgents.get(), m_state->createAgentState(), m_domAgent));
+    m_agents.append(InspectorCSSAgent::create(m_instrumentingAgents.get(), m_state.get(), m_domAgent));
 
 #if ENABLE(SQL_DATABASE)
-    OwnPtr<InspectorDatabaseAgent> databaseAgentPtr(InspectorDatabaseAgent::create(m_instrumentingAgents.get(), m_state->createAgentState()));
+    OwnPtr<InspectorDatabaseAgent> databaseAgentPtr(InspectorDatabaseAgent::create(m_instrumentingAgents.get(), m_state.get()));
     InspectorDatabaseAgent* databaseAgent = databaseAgentPtr.get();
     m_agents.append(databaseAgentPtr.release());
 #endif
 
 #if ENABLE(INDEXED_DATABASE)
-    m_agents.append(InspectorIndexedDBAgent::create(m_instrumentingAgents.get(), m_state->createAgentState(), m_injectedScriptManager.get(), pageAgent));
+    m_agents.append(InspectorIndexedDBAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get(), pageAgent));
 #endif
 
 #if ENABLE(FILE_SYSTEM)
-    m_agents.append(InspectorFileSystemAgent::create(m_instrumentingAgents.get(), pageAgent, m_state->createAgentState()));
+    m_agents.append(InspectorFileSystemAgent::create(m_instrumentingAgents.get(), pageAgent, m_state.get()));
 #endif
-    OwnPtr<InspectorDOMStorageAgent> domStorageAgentPtr(InspectorDOMStorageAgent::create(m_instrumentingAgents.get(), m_state->createAgentState()));
+    OwnPtr<InspectorDOMStorageAgent> domStorageAgentPtr(InspectorDOMStorageAgent::create(m_instrumentingAgents.get(), m_state.get()));
     InspectorDOMStorageAgent* domStorageAgent = domStorageAgentPtr.get();
     m_agents.append(domStorageAgentPtr.release());
-    m_agents.append(InspectorMemoryAgent::create(m_instrumentingAgents.get(), inspectorClient, m_state->createAgentState(), m_page));
-    m_agents.append(InspectorTimelineAgent::create(m_instrumentingAgents.get(), pageAgent, m_state->createAgentState(), InspectorTimelineAgent::PageInspector,
+    m_agents.append(InspectorMemoryAgent::create(m_instrumentingAgents.get(), inspectorClient, m_state.get(), m_page));
+    m_agents.append(InspectorTimelineAgent::create(m_instrumentingAgents.get(), pageAgent, m_state.get(), InspectorTimelineAgent::PageInspector,
        inspectorClient));
-    m_agents.append(InspectorApplicationCacheAgent::create(m_instrumentingAgents.get(), m_state->createAgentState(), pageAgent));
+    m_agents.append(InspectorApplicationCacheAgent::create(m_instrumentingAgents.get(), m_state.get(), pageAgent));
 
-    OwnPtr<InspectorResourceAgent> resourceAgentPtr(InspectorResourceAgent::create(m_instrumentingAgents.get(), pageAgent, inspectorClient, m_state->createAgentState()));
+    OwnPtr<InspectorResourceAgent> resourceAgentPtr(InspectorResourceAgent::create(m_instrumentingAgents.get(), pageAgent, inspectorClient, m_state.get()));
     m_resourceAgent = resourceAgentPtr.get();
     m_agents.append(resourceAgentPtr.release());
 
-    OwnPtr<InspectorRuntimeAgent> runtimeAgentPtr(PageRuntimeAgent::create(m_instrumentingAgents.get(), m_state->createAgentState(), m_injectedScriptManager.get(), page, pageAgent));
+    OwnPtr<InspectorRuntimeAgent> runtimeAgentPtr(PageRuntimeAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get(), page, pageAgent));
     InspectorRuntimeAgent* runtimeAgent = runtimeAgentPtr.get();
     m_agents.append(runtimeAgentPtr.release());
 
-    OwnPtr<InspectorConsoleAgent> consoleAgentPtr(PageConsoleAgent::create(m_instrumentingAgents.get(), m_inspectorAgent, m_state->createAgentState(), m_injectedScriptManager.get(), m_domAgent));
+    OwnPtr<InspectorConsoleAgent> consoleAgentPtr(PageConsoleAgent::create(m_instrumentingAgents.get(), m_inspectorAgent, m_state.get(), m_injectedScriptManager.get(), m_domAgent));
     InspectorConsoleAgent* consoleAgent = consoleAgentPtr.get();
     m_agents.append(consoleAgentPtr.release());
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    OwnPtr<InspectorDebuggerAgent> debuggerAgentPtr(PageDebuggerAgent::create(m_instrumentingAgents.get(), m_state->createAgentState(), pageAgent, m_injectedScriptManager.get(), m_overlay.get()));
+    OwnPtr<InspectorDebuggerAgent> debuggerAgentPtr(PageDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), pageAgent, m_injectedScriptManager.get(), m_overlay.get()));
     m_debuggerAgent = debuggerAgentPtr.get();
     m_agents.append(debuggerAgentPtr.release());
 
-    m_agents.append(InspectorDOMDebuggerAgent::create(m_instrumentingAgents.get(), m_state->createAgentState(), m_domAgent, m_debuggerAgent, m_inspectorAgent));
+    m_agents.append(InspectorDOMDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), m_domAgent, m_debuggerAgent, m_inspectorAgent));
 
-    OwnPtr<InspectorProfilerAgent> profilerAgentPtr(InspectorProfilerAgent::create(m_instrumentingAgents.get(), consoleAgent, page, m_state->createAgentState(), m_injectedScriptManager.get()));
+    OwnPtr<InspectorProfilerAgent> profilerAgentPtr(InspectorProfilerAgent::create(m_instrumentingAgents.get(), consoleAgent, page, m_state.get(), m_injectedScriptManager.get()));
     m_profilerAgent = profilerAgentPtr.get();
     m_agents.append(profilerAgentPtr.release());
 #endif
 
 #if ENABLE(WORKERS)
-    m_agents.append(InspectorWorkerAgent::create(m_instrumentingAgents.get(), m_state->createAgentState()));
+    m_agents.append(InspectorWorkerAgent::create(m_instrumentingAgents.get(), m_state.get()));
 #endif
 
-    m_agents.append(InspectorCanvasAgent::create(m_instrumentingAgents.get(), m_state->createAgentState(), page, m_injectedScriptManager.get()));
+    m_agents.append(InspectorCanvasAgent::create(m_instrumentingAgents.get(), m_state.get(), page, m_injectedScriptManager.get()));
 
-    m_agents.append(InspectorInputAgent::create(m_instrumentingAgents.get(), m_state->createAgentState(), page));
+    m_agents.append(InspectorInputAgent::create(m_instrumentingAgents.get(), m_state.get(), page));
 
 #if USE(ACCELERATED_COMPOSITING)
-    m_agents.append(InspectorLayerTreeAgent::create(m_instrumentingAgents.get(), m_state->createAgentState(), page));
+    m_agents.append(InspectorLayerTreeAgent::create(m_instrumentingAgents.get(), m_state.get(), page));
 #endif
 
     ASSERT_ARG(inspectorClient, inspectorClient);
index 4a2c88d..e69fb75 100644 (file)
@@ -59,7 +59,7 @@ class InspectorOverlay;
 class InspectorPageAgent;
 class InspectorProfilerAgent;
 class InspectorResourceAgent;
-class InspectorCompositeState;
+class InspectorState;
 class InstrumentingAgents;
 class IntSize;
 class Page;
@@ -130,7 +130,7 @@ private:
 
     OwnPtr<InstrumentingAgents> m_instrumentingAgents;
     OwnPtr<InjectedScriptManager> m_injectedScriptManager;
-    OwnPtr<InspectorCompositeState> m_state;
+    OwnPtr<InspectorState> m_state;
     OwnPtr<InspectorOverlay> m_overlay;
 
     InspectorAgent* m_inspectorAgent;
index 23cf6d4..410adec 100644 (file)
@@ -53,7 +53,7 @@
 namespace WebCore {
 
 namespace DOMStorageAgentState {
-static const char enabled[] = "enabled";
+static const char domStorageAgentEnabled[] = "domStorageAgentEnabled";
 };
 
 InspectorDOMStorageAgent::InspectorDOMStorageAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state)
@@ -86,7 +86,7 @@ void InspectorDOMStorageAgent::clearFrontend()
 
 void InspectorDOMStorageAgent::restore()
 {
-    m_enabled =  m_state->getBoolean(DOMStorageAgentState::enabled);
+    m_enabled =  m_state->getBoolean(DOMStorageAgentState::domStorageAgentEnabled);
 }
 
 void InspectorDOMStorageAgent::enable(ErrorString*)
@@ -94,7 +94,7 @@ void InspectorDOMStorageAgent::enable(ErrorString*)
     if (m_enabled)
         return;
     m_enabled = true;
-    m_state->setBoolean(DOMStorageAgentState::enabled, m_enabled);
+    m_state->setBoolean(DOMStorageAgentState::domStorageAgentEnabled, m_enabled);
 
     DOMStorageResourcesMap::iterator resourcesEnd = m_resources.end();
     for (DOMStorageResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it)
@@ -106,7 +106,7 @@ void InspectorDOMStorageAgent::disable(ErrorString*)
     if (!m_enabled)
         return;
     m_enabled = false;
-    m_state->setBoolean(DOMStorageAgentState::enabled, m_enabled);
+    m_state->setBoolean(DOMStorageAgentState::domStorageAgentEnabled, m_enabled);
 }
 
 void InspectorDOMStorageAgent::getDOMStorageEntries(ErrorString*, const String& storageId, RefPtr<TypeBuilder::Array<TypeBuilder::Array<String> > >& entries)
index 2e7e9d2..0c20a3c 100644 (file)
@@ -56,7 +56,7 @@ typedef WebCore::InspectorBackendDispatcher::DatabaseCommandHandler::ExecuteSQLC
 namespace WebCore {
 
 namespace DatabaseAgentState {
-static const char enabled[] = "enabled";
+static const char databaseAgentEnabled[] = "databaseAgentEnabled";
 };
 
 namespace {
@@ -241,7 +241,7 @@ void InspectorDatabaseAgent::enable(ErrorString*)
     if (m_enabled)
         return;
     m_enabled = true;
-    m_state->setBoolean(DatabaseAgentState::enabled, m_enabled);
+    m_state->setBoolean(DatabaseAgentState::databaseAgentEnabled, m_enabled);
 
     DatabaseResourcesMap::iterator databasesEnd = m_resources.end();
     for (DatabaseResourcesMap::iterator it = m_resources.begin(); it != databasesEnd; ++it)
@@ -253,12 +253,12 @@ void InspectorDatabaseAgent::disable(ErrorString*)
     if (!m_enabled)
         return;
     m_enabled = false;
-    m_state->setBoolean(DatabaseAgentState::enabled, m_enabled);
+    m_state->setBoolean(DatabaseAgentState::databaseAgentEnabled, m_enabled);
 }
 
 void InspectorDatabaseAgent::restore()
 {
-    m_enabled = m_state->getBoolean(DatabaseAgentState::enabled);
+    m_enabled = m_state->getBoolean(DatabaseAgentState::databaseAgentEnabled);
 }
 
 void InspectorDatabaseAgent::getDatabaseTableNames(ErrorString* error, const String& databaseId, RefPtr<TypeBuilder::Array<String> >& names)
index a61b214..9cf8d01 100644 (file)
@@ -94,7 +94,7 @@ void InspectorDebuggerAgent::enable()
 
 void InspectorDebuggerAgent::disable()
 {
-    m_state->remove(DebuggerAgentState::javaScriptBreakpoints);
+    m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, InspectorObject::create());
     m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, ScriptDebugServer::DontPauseOnExceptions);
     m_instrumentingAgents->setInspectorDebuggerAgent(0);
 
index f534678..c2722fe 100644 (file)
@@ -77,7 +77,7 @@ typedef WebCore::InspectorBackendDispatcher::FileSystemCommandHandler::DeleteEnt
 namespace WebCore {
 
 namespace FileSystemAgentState {
-static const char enabled[] = "enabled";
+static const char fileSystemAgentEnabled[] = "fileSystemAgentEnabled";
 }
 
 namespace {
@@ -620,7 +620,7 @@ void InspectorFileSystemAgent::enable(ErrorString*)
     if (m_enabled)
         return;
     m_enabled = true;
-    m_state->setBoolean(FileSystemAgentState::enabled, m_enabled);
+    m_state->setBoolean(FileSystemAgentState::fileSystemAgentEnabled, m_enabled);
 }
 
 void InspectorFileSystemAgent::disable(ErrorString*)
@@ -628,7 +628,7 @@ void InspectorFileSystemAgent::disable(ErrorString*)
     if (!m_enabled)
         return;
     m_enabled = false;
-    m_state->setBoolean(FileSystemAgentState::enabled, m_enabled);
+    m_state->setBoolean(FileSystemAgentState::fileSystemAgentEnabled, m_enabled);
 }
 
 void InspectorFileSystemAgent::requestFileSystemRoot(ErrorString* error, const String& origin, const String& type, PassRefPtr<RequestFileSystemRootCallback> requestCallback)
@@ -698,12 +698,12 @@ void InspectorFileSystemAgent::deleteEntry(ErrorString* error, const String& url
 void InspectorFileSystemAgent::clearFrontend()
 {
     m_enabled = false;
-    m_state->setBoolean(FileSystemAgentState::enabled, m_enabled);
+    m_state->setBoolean(FileSystemAgentState::fileSystemAgentEnabled, m_enabled);
 }
 
 void InspectorFileSystemAgent::restore()
 {
-    m_enabled = m_state->getBoolean(FileSystemAgentState::enabled);
+    m_enabled = m_state->getBoolean(FileSystemAgentState::fileSystemAgentEnabled);
 }
 
 InspectorFileSystemAgent::InspectorFileSystemAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorState* state)
index 5a17df5..4a283fa 100644 (file)
@@ -85,7 +85,7 @@ typedef WebCore::InspectorBackendDispatcher::CallbackBase RequestCallback;
 namespace WebCore {
 
 namespace IndexedDBAgentState {
-static const char enabled[] = "enabled";
+static const char indexedDBAgentEnabled[] = "indexedDBAgentEnabled";
 };
 
 namespace {
@@ -574,7 +574,7 @@ void InspectorIndexedDBAgent::clearFrontend()
 
 void InspectorIndexedDBAgent::restore()
 {
-    if (m_state->getBoolean(IndexedDBAgentState::enabled)) {
+    if (m_state->getBoolean(IndexedDBAgentState::indexedDBAgentEnabled)) {
         ErrorString error;
         enable(&error);
     }
@@ -582,12 +582,12 @@ void InspectorIndexedDBAgent::restore()
 
 void InspectorIndexedDBAgent::enable(ErrorString*)
 {
-    m_state->setBoolean(IndexedDBAgentState::enabled, true);
+    m_state->setBoolean(IndexedDBAgentState::indexedDBAgentEnabled, true);
 }
 
 void InspectorIndexedDBAgent::disable(ErrorString*)
 {
-    m_state->setBoolean(IndexedDBAgentState::enabled, false);
+    m_state->setBoolean(IndexedDBAgentState::indexedDBAgentEnabled, false);
 }
 
 static Frame* assertFrame(ErrorString* errorString, const String& frameId, InspectorPageAgent* pageAgent)
index facca63..680ee2f 100644 (file)
@@ -50,7 +50,7 @@
 namespace WebCore {
 
 namespace LayerTreeAgentState {
-static const char enabled[] = "enabled";
+static const char layerTreeAgentEnabled[] = "layerTreeAgentEnabled";
 };
 
 InspectorLayerTreeAgent::InspectorLayerTreeAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, Page* page)
@@ -78,7 +78,7 @@ void InspectorLayerTreeAgent::clearFrontend()
 
 void InspectorLayerTreeAgent::restore()
 {
-    if (m_state->getBoolean(LayerTreeAgentState::enabled))
+    if (m_state->getBoolean(LayerTreeAgentState::layerTreeAgentEnabled))
         enable(0);
 }
 
@@ -90,15 +90,15 @@ void InspectorLayerTreeAgent::reset()
 
 void InspectorLayerTreeAgent::enable(ErrorString*)
 {
-    m_state->setBoolean(LayerTreeAgentState::enabled, true);
+    m_state->setBoolean(LayerTreeAgentState::layerTreeAgentEnabled, true);
     m_instrumentingAgents->setInspectorLayerTreeAgent(this);
 }
 
 void InspectorLayerTreeAgent::disable(ErrorString*)
 {
-    if (!m_state->getBoolean(LayerTreeAgentState::enabled))
+    if (!m_state->getBoolean(LayerTreeAgentState::layerTreeAgentEnabled))
         return;
-    m_state->setBoolean(LayerTreeAgentState::enabled, false);
+    m_state->setBoolean(LayerTreeAgentState::layerTreeAgentEnabled, false);
     m_instrumentingAgents->setInspectorLayerTreeAgent(0);
 }
 
index 6475267..f752a56 100644 (file)
@@ -85,19 +85,19 @@ using namespace std;
 namespace WebCore {
 
 namespace PageAgentState {
-static const char enabled[] = "enabled";
-static const char scriptExecutionDisabled[] = "scriptExecutionDisabled";
-static const char scriptsToEvaluateOnLoad[] = "scriptsToEvaluateOnLoad";
-static const char screenWidthOverride[] = "screenWidthOverride";
-static const char screenHeightOverride[] = "screenHeightOverride";
-static const char fontScaleFactorOverride[] = "fontScaleFactorOverride";
-static const char fitWindow[] = "fitWindow";
-static const char showFPSCounter[] = "showFPSCounter";
-static const char showPaintRects[] = "showPaintRects";
+static const char pageAgentEnabled[] = "pageAgentEnabled";
+static const char pageAgentScriptExecutionDisabled[] = "pageAgentScriptExecutionDisabled";
+static const char pageAgentScriptsToEvaluateOnLoad[] = "pageAgentScriptsToEvaluateOnLoad";
+static const char pageAgentScreenWidthOverride[] = "pageAgentScreenWidthOverride";
+static const char pageAgentScreenHeightOverride[] = "pageAgentScreenHeightOverride";
+static const char pageAgentFontScaleFactorOverride[] = "pageAgentFontScaleFactorOverride";
+static const char pageAgentFitWindow[] = "pageAgentFitWindow";
+static const char pageAgentShowFPSCounter[] = "pageAgentShowFPSCounter";
+static const char pageAgentShowPaintRects[] = "pageAgentShowPaintRects";
 #if ENABLE(TOUCH_EVENTS)
 static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled";
 #endif
-static const char emulatedMedia[] = "emulatedMedia";
+static const char pageAgentEmulatedMedia[] = "pageAgentEmulatedMedia";
 }
 
 static bool decodeBuffer(const char* buffer, unsigned size, const String& textEncodingName, String* result)
@@ -355,22 +355,22 @@ void InspectorPageAgent::clearFrontend()
 
 void InspectorPageAgent::restore()
 {
-    if (m_state->getBoolean(PageAgentState::enabled)) {
+    if (m_state->getBoolean(PageAgentState::pageAgentEnabled)) {
         ErrorString error;
         enable(&error);
-        bool scriptExecutionDisabled = m_state->getBoolean(PageAgentState::scriptExecutionDisabled);
+        bool scriptExecutionDisabled = m_state->getBoolean(PageAgentState::pageAgentScriptExecutionDisabled);
         setScriptExecutionDisabled(0, scriptExecutionDisabled);
-        bool showPaintRects = m_state->getBoolean(PageAgentState::showPaintRects);
+        bool showPaintRects = m_state->getBoolean(PageAgentState::pageAgentShowPaintRects);
         setShowPaintRects(0, showPaintRects);
-        bool showFPSCounter = m_state->getBoolean(PageAgentState::showFPSCounter);
+        bool showFPSCounter = m_state->getBoolean(PageAgentState::pageAgentShowFPSCounter);
         setShowFPSCounter(0, showFPSCounter);
-        String emulatedMedia = m_state->getString(PageAgentState::emulatedMedia);
+        String emulatedMedia = m_state->getString(PageAgentState::pageAgentEmulatedMedia);
         setEmulatedMedia(0, emulatedMedia);
 
-        int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::screenWidthOverride));
-        int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::screenHeightOverride));
-        double currentFontScaleFactor = m_state->getDouble(PageAgentState::fontScaleFactorOverride);
-        bool currentFitWindow = m_state->getBoolean(PageAgentState::fitWindow);
+        int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenWidthOverride));
+        int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenHeightOverride));
+        double currentFontScaleFactor = m_state->getDouble(PageAgentState::pageAgentFontScaleFactorOverride);
+        bool currentFitWindow = m_state->getBoolean(PageAgentState::pageAgentFitWindow);
         updateViewMetrics(currentWidth, currentHeight, currentFontScaleFactor, currentFitWindow);
 #if ENABLE(TOUCH_EVENTS)
         updateTouchEventEmulationInPage(m_state->getBoolean(PageAgentState::touchEventEmulationEnabled));
@@ -380,21 +380,21 @@ void InspectorPageAgent::restore()
 
 void InspectorPageAgent::webViewResized(const IntSize& size)
 {
-    int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::screenWidthOverride));
+    int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenWidthOverride));
     m_overlay->resize(currentWidth ? size : IntSize());
 }
 
 void InspectorPageAgent::enable(ErrorString*)
 {
     m_enabled = true;
-    m_state->setBoolean(PageAgentState::enabled, true);
+    m_state->setBoolean(PageAgentState::pageAgentEnabled, true);
     m_instrumentingAgents->setInspectorPageAgent(this);
 }
 
 void InspectorPageAgent::disable(ErrorString*)
 {
     m_enabled = false;
-    m_state->setBoolean(PageAgentState::enabled, false);
+    m_state->setBoolean(PageAgentState::pageAgentEnabled, false);
     m_instrumentingAgents->setInspectorPageAgent(0);
 
     setScriptExecutionDisabled(0, false);
@@ -403,19 +403,22 @@ void InspectorPageAgent::disable(ErrorString*)
     setEmulatedMedia(0, "");
 
     // When disabling the agent, reset the override values.
-    m_state->remove(PageAgentState::screenWidthOverride);
-    m_state->remove(PageAgentState::screenHeightOverride);
-    m_state->remove(PageAgentState::fontScaleFactorOverride);
-    m_state->remove(PageAgentState::fitWindow);
-    m_state->remove(PageAgentState::scriptsToEvaluateOnLoad);
+    m_state->setLong(PageAgentState::pageAgentScreenWidthOverride, 0);
+    m_state->setLong(PageAgentState::pageAgentScreenHeightOverride, 0);
+    m_state->setDouble(PageAgentState::pageAgentFontScaleFactorOverride, 1);
+    m_state->setBoolean(PageAgentState::pageAgentFitWindow, false);
+    m_state->remove(PageAgentState::pageAgentScriptsToEvaluateOnLoad);
     updateViewMetrics(0, 0, 1, false);
 }
 
 void InspectorPageAgent::addScriptToEvaluateOnLoad(ErrorString*, const String& source, String* identifier)
 {
-    RefPtr<InspectorObject> scripts = m_state->getObject(PageAgentState::scriptsToEvaluateOnLoad);
-
-    // Make sure we don't override existing ids -- m_lastScriptIdentifier could get out of sync WRT actual
+    RefPtr<InspectorObject> scripts = m_state->getObject(PageAgentState::pageAgentScriptsToEvaluateOnLoad);
+    if (!scripts) {
+        scripts = InspectorObject::create();
+        m_state->setObject(PageAgentState::pageAgentScriptsToEvaluateOnLoad, scripts);
+    }
+    // Assure we don't override existing ids -- m_lastScriptIdentifier could get out of sync WRT actual
     // scripts once we restored the scripts from the cookie during navigation.
     do {
         *identifier = String::number(++m_lastScriptIdentifier);
@@ -425,7 +428,7 @@ void InspectorPageAgent::addScriptToEvaluateOnLoad(ErrorString*, const String& s
 
 void InspectorPageAgent::removeScriptToEvaluateOnLoad(ErrorString* error, const String& identifier)
 {
-    RefPtr<InspectorObject> scripts = m_state->getObject(PageAgentState::scriptsToEvaluateOnLoad);
+    RefPtr<InspectorObject> scripts = m_state->getObject(PageAgentState::pageAgentScriptsToEvaluateOnLoad);
     if (!scripts || scripts->find(identifier) == scripts->end()) {
         *error = "Script not found";
         return;
@@ -713,25 +716,25 @@ void InspectorPageAgent::setDeviceMetricsOverride(ErrorString* errorString, int
     }
 
     // These two always fit an int.
-    int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::screenWidthOverride));
-    int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::screenHeightOverride));
-    double currentFontScaleFactor = m_state->getDouble(PageAgentState::fontScaleFactorOverride);
-    bool currentFitWindow = m_state->getBoolean(PageAgentState::fitWindow);
+    int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenWidthOverride));
+    int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenHeightOverride));
+    double currentFontScaleFactor = m_state->getDouble(PageAgentState::pageAgentFontScaleFactorOverride);
+    bool currentFitWindow = m_state->getBoolean(PageAgentState::pageAgentFitWindow);
 
     if (width == currentWidth && height == currentHeight && fontScaleFactor == currentFontScaleFactor && fitWindow == currentFitWindow)
         return;
 
-    m_state->setLong(PageAgentState::screenWidthOverride, width);
-    m_state->setLong(PageAgentState::screenHeightOverride, height);
-    m_state->setDouble(PageAgentState::fontScaleFactorOverride, fontScaleFactor);
-    m_state->setBoolean(PageAgentState::fitWindow, fitWindow);
+    m_state->setLong(PageAgentState::pageAgentScreenWidthOverride, width);
+    m_state->setLong(PageAgentState::pageAgentScreenHeightOverride, height);
+    m_state->setDouble(PageAgentState::pageAgentFontScaleFactorOverride, fontScaleFactor);
+    m_state->setBoolean(PageAgentState::pageAgentFitWindow, fitWindow);
 
     updateViewMetrics(width, height, fontScaleFactor, fitWindow);
 }
 
 void InspectorPageAgent::setShowPaintRects(ErrorString*, bool show)
 {
-    m_state->setBoolean(PageAgentState::showPaintRects, show);
+    m_state->setBoolean(PageAgentState::pageAgentShowPaintRects, show);
     m_client->setShowPaintRects(show);
 
     if (!show && mainFrame() && mainFrame()->view())
@@ -745,7 +748,7 @@ void InspectorPageAgent::canShowFPSCounter(ErrorString*, bool* outParam)
 
 void InspectorPageAgent::setShowFPSCounter(ErrorString*, bool show)
 {
-    m_state->setBoolean(PageAgentState::showFPSCounter, show);
+    m_state->setBoolean(PageAgentState::pageAgentShowFPSCounter, show);
     m_client->setShowFPSCounter(show);
 
     if (mainFrame() && mainFrame()->view())
@@ -776,7 +779,7 @@ void InspectorPageAgent::getScriptExecutionStatus(ErrorString*, PageCommandHandl
 
 void InspectorPageAgent::setScriptExecutionDisabled(ErrorString*, bool value)
 {
-    m_state->setBoolean(PageAgentState::scriptExecutionDisabled, value);
+    m_state->setBoolean(PageAgentState::pageAgentScriptExecutionDisabled, value);
     if (!mainFrame())
         return;
 
@@ -796,7 +799,7 @@ void InspectorPageAgent::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWor
     if (!m_frontend)
         return;
 
-    RefPtr<InspectorObject> scripts = m_state->getObject(PageAgentState::scriptsToEvaluateOnLoad);
+    RefPtr<InspectorObject> scripts = m_state->getObject(PageAgentState::pageAgentScriptsToEvaluateOnLoad);
     if (scripts) {
         InspectorObject::const_iterator end = scripts->end();
         for (InspectorObject::const_iterator it = scripts->begin(); it != end; ++it) {
@@ -905,21 +908,21 @@ void InspectorPageAgent::loaderDetachedFromFrame(DocumentLoader* loader)
 
 void InspectorPageAgent::applyScreenWidthOverride(long* width)
 {
-    long widthOverride = m_state->getLong(PageAgentState::screenWidthOverride);
+    long widthOverride = m_state->getLong(PageAgentState::pageAgentScreenWidthOverride);
     if (widthOverride)
         *width = widthOverride;
 }
 
 void InspectorPageAgent::applyScreenHeightOverride(long* height)
 {
-    long heightOverride = m_state->getLong(PageAgentState::screenHeightOverride);
+    long heightOverride = m_state->getLong(PageAgentState::pageAgentScreenHeightOverride);
     if (heightOverride)
         *height = heightOverride;
 }
 
 void InspectorPageAgent::didPaint(GraphicsContext* context, const LayoutRect& rect)
 {
-    if (!m_enabled || m_client->overridesShowPaintRects() || !m_state->getBoolean(PageAgentState::showPaintRects))
+    if (!m_enabled || m_client->overridesShowPaintRects() || !m_state->getBoolean(PageAgentState::pageAgentShowPaintRects))
         return;
 
     static int colorSelector = 0;
@@ -944,8 +947,8 @@ void InspectorPageAgent::didLayout()
         return;
 
     if (isFirstLayout) {
-        int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::screenWidthOverride));
-        int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::screenHeightOverride));
+        int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenWidthOverride));
+        int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenHeightOverride));
 
         if (currentWidth && currentHeight)
             m_client->autoZoomPageToFitWidth();
@@ -1154,11 +1157,11 @@ void InspectorPageAgent::setTouchEmulationEnabled(ErrorString* error, bool enabl
 
 void InspectorPageAgent::setEmulatedMedia(ErrorString*, const String& media)
 {
-    String currentMedia = m_state->getString(PageAgentState::emulatedMedia);
+    String currentMedia = m_state->getString(PageAgentState::pageAgentEmulatedMedia);
     if (media == currentMedia)
         return;
 
-    m_state->setString(PageAgentState::emulatedMedia, media);
+    m_state->setString(PageAgentState::pageAgentEmulatedMedia, media);
     Document* document = 0;
     if (m_page->mainFrame())
         document = m_page->mainFrame()->document();
@@ -1170,7 +1173,7 @@ void InspectorPageAgent::setEmulatedMedia(ErrorString*, const String& media)
 
 void InspectorPageAgent::applyEmulatedMedia(String* media)
 {
-    String emulatedMedia = m_state->getString(PageAgentState::emulatedMedia);
+    String emulatedMedia = m_state->getString(PageAgentState::pageAgentEmulatedMedia);
     if (!emulatedMedia.isEmpty())
         *media = emulatedMedia;
 }
index 1812222..a3aec9a 100644 (file)
@@ -78,7 +78,7 @@
 namespace WebCore {
 
 namespace ResourceAgentState {
-static const char enabled[] = "enabled";
+static const char resourceAgentEnabled[] = "resourceAgentEnabled";
 static const char extraRequestHeaders[] = "extraRequestHeaders";
 static const char cacheDisabled[] = "cacheDisabled";
 static const char userAgentOverride[] = "userAgentOverride";
@@ -98,7 +98,7 @@ void InspectorResourceAgent::clearFrontend()
 
 void InspectorResourceAgent::restore()
 {
-    if (m_state->getBoolean(ResourceAgentState::enabled))
+    if (m_state->getBoolean(ResourceAgentState::resourceAgentEnabled))
         enable();
 }
 
@@ -200,7 +200,7 @@ static PassRefPtr<TypeBuilder::Network::CachedResource> buildObjectForCachedReso
 
 InspectorResourceAgent::~InspectorResourceAgent()
 {
-    if (m_state->getBoolean(ResourceAgentState::enabled)) {
+    if (m_state->getBoolean(ResourceAgentState::resourceAgentEnabled)) {
         ErrorString error;
         disable(&error);
     }
@@ -561,14 +561,14 @@ void InspectorResourceAgent::enable()
 {
     if (!m_frontend)
         return;
-    m_state->setBoolean(ResourceAgentState::enabled, true);
+    m_state->setBoolean(ResourceAgentState::resourceAgentEnabled, true);
     m_instrumentingAgents->setInspectorResourceAgent(this);
 }
 
 void InspectorResourceAgent::disable(ErrorString*)
 {
-    m_state->setBoolean(ResourceAgentState::enabled, false);
-    m_state->remove(ResourceAgentState::userAgentOverride);
+    m_state->setBoolean(ResourceAgentState::resourceAgentEnabled, false);
+    m_state->setString(ResourceAgentState::userAgentOverride, "");
     m_instrumentingAgents->setInspectorResourceAgent(0);
     m_resourcesData->clear();
 }
index b98de57..675d499 100644 (file)
 
 namespace WebCore {
 
-InspectorState::InspectorState(InspectorStateUpdateListener* listener, PassRefPtr<InspectorObject> properties)
-    : m_listener(listener)
-    , m_properties(properties)
+InspectorState::InspectorState(InspectorStateClient* client)
+    : m_client(client)
+    , m_properties(InspectorObject::create())
+    , m_isOnMute(false)
 {
 }
 
-void InspectorState::updateCookie()
+void InspectorState::loadFromCookie(const String& inspectorStateCookie)
+{
+    m_properties.clear();
+    RefPtr<InspectorValue> cookie = InspectorValue::parseJSON(inspectorStateCookie);
+    if (cookie)
+        m_properties = cookie->asObject();
+    if (!m_properties)
+        m_properties = InspectorObject::create();
+}
+
+void InspectorState::mute()
 {
-    if (m_listener)
-        m_listener->inspectorStateUpdated();
+    m_isOnMute = true;
 }
 
-void InspectorState::setFromCookie(PassRefPtr<InspectorObject> properties)
+void InspectorState::unmute()
 {
-    m_properties = properties;
+    m_isOnMute = false;
+}
+
+void InspectorState::updateCookie()
+{
+    if (m_client && !m_isOnMute && m_client->supportsInspectorStateUpdates())
+        m_client->updateInspectorStateCookie(m_properties->toJSONString());
 }
 
 void InspectorState::setValue(const String& propertyName, PassRefPtr<InspectorValue> value)
@@ -62,7 +78,6 @@ void InspectorState::setValue(const String& propertyName, PassRefPtr<InspectorVa
 void InspectorState::remove(const String& propertyName)
 {
     m_properties->remove(propertyName);
-    updateCookie();
 }
 
 bool InspectorState::getBoolean(const String& propertyName)
@@ -111,51 +126,6 @@ PassRefPtr<InspectorObject> InspectorState::getObject(const String& propertyName
     return it->value->asObject();
 }
 
-InspectorState* InspectorCompositeState::createAgentState()
-{
-    RefPtr<InspectorObject> stateProperties = InspectorObject::create();
-    m_stateArray->pushObject(stateProperties);
-    m_states.append(adoptPtr(new InspectorState(this, stateProperties)));
-    return m_states.last().get();
-}
-
-void InspectorCompositeState::loadFromCookie(const String& inspectorCompositeStateCookie)
-{
-    RefPtr<InspectorValue> cookie = InspectorValue::parseJSON(inspectorCompositeStateCookie);
-    if (cookie)
-        m_stateArray = cookie->asArray();
-    if (!m_stateArray) {
-        m_stateArray = InspectorArray::create();
-        for (size_t i = 0, size = m_states.size(); i < size; ++i) {
-            RefPtr<InspectorObject> stateObject = InspectorObject::create();
-            m_stateArray->pushObject(stateObject);
-        }
-    }
-
-    ASSERT(m_stateArray);
-    ASSERT(m_stateArray->length() == m_states.size());
-    for (size_t i = 0, size = m_states.size(); i < size; ++i) {
-        RefPtr<InspectorValue> stateObject = m_stateArray->get(i);
-        m_states.at(i)->setFromCookie(stateObject->asObject());
-    }
-}
-
-void InspectorCompositeState::mute()
-{
-    m_isMuted = true;
-}
-
-void InspectorCompositeState::unmute()
-{
-    m_isMuted = false;
-}
-
-void InspectorCompositeState::inspectorStateUpdated()
-{
-    if (m_client && !m_isMuted && m_client->supportsInspectorStateUpdates())
-        m_client->updateInspectorStateCookie(m_stateArray->toJSONString());
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)
index 7fe3be1..3dc090a 100644 (file)
 #include "InspectorValues.h"
 #include <wtf/HashMap.h>
 #include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
 class InspectorStateClient;
 
-class InspectorStateUpdateListener {
-public:
-    virtual ~InspectorStateUpdateListener() { }
-    virtual void inspectorStateUpdated() = 0;
-};
-
 class InspectorState {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    InspectorState(InspectorStateUpdateListener*, PassRefPtr<InspectorObject>);
+    InspectorState(InspectorStateClient*);
     virtual ~InspectorState() {}
 
+    void loadFromCookie(const String& inspectorStateCookie);
+
+    void mute();
+    void unmute();
+
     bool getBoolean(const String& propertyName);
     String getString(const String& propertyName);
     long getLong(const String& propertyName);
@@ -63,50 +61,18 @@ public:
 
     void setBoolean(const String& propertyName, bool value) { setValue(propertyName, InspectorBasicValue::create(value)); }
     void setString(const String& propertyName, const String& value) { setValue(propertyName, InspectorString::create(value)); }
-    void setLong(const String& propertyName, long value) { setValue(propertyName, InspectorBasicValue::create(static_cast<double>(value))); }
+    void setLong(const String& propertyName, long value) { setValue(propertyName, InspectorBasicValue::create((double)value)); }
     void setDouble(const String& propertyName, double value) { setValue(propertyName, InspectorBasicValue::create(value)); }
     void setObject(const String& propertyName, PassRefPtr<InspectorObject> value) { setValue(propertyName, value); }
 
     void remove(const String&);
-
 private:
     void updateCookie();
     void setValue(const String& propertyName, PassRefPtr<InspectorValue>);
 
-    // This gets called from InspectorCompositeState::loadFromCookie().
-    void setFromCookie(PassRefPtr<InspectorObject>);
-
-    friend class InspectorCompositeState;
-
-    InspectorStateUpdateListener* m_listener;
-    RefPtr<InspectorObject> m_properties;
-};
-
-class InspectorCompositeState : public InspectorStateUpdateListener {
-public:
-    InspectorCompositeState(InspectorStateClient* inspectorClient)
-        : m_client(inspectorClient)
-        , m_stateArray(InspectorArray::create())
-        , m_isMuted(false)
-    {
-    }
-    virtual ~InspectorCompositeState() { }
-
-    void mute();
-    void unmute();
-
-    InspectorState* createAgentState();
-    void loadFromCookie(const String&);
-
-private:
-    typedef Vector<OwnPtr<InspectorState> > InspectorStateVector;
-
-    virtual void inspectorStateUpdated();
-
     InspectorStateClient* m_client;
-    RefPtr<InspectorArray> m_stateArray;
-    bool m_isMuted;
-    InspectorStateVector m_states;
+    RefPtr<InspectorObject> m_properties;
+    bool m_isOnMute;
 };
 
 } // namespace WebCore
index e605493..f9f9d17 100644 (file)
@@ -57,7 +57,7 @@
 namespace WebCore {
 
 namespace TimelineAgentState {
-static const char enabled[] = "enabled";
+static const char timelineAgentEnabled[] = "timelineAgentEnabled";
 static const char timelineMaxCallStackDepth[] = "timelineMaxCallStackDepth";
 static const char includeMemoryDetails[] = "includeMemoryDetails";
 }
@@ -149,7 +149,7 @@ void InspectorTimelineAgent::clearFrontend()
 
 void InspectorTimelineAgent::restore()
 {
-    if (m_state->getBoolean(TimelineAgentState::enabled)) {
+    if (m_state->getBoolean(TimelineAgentState::timelineAgentEnabled)) {
         m_maxCallStackDepth = m_state->getLong(TimelineAgentState::timelineMaxCallStackDepth);
         ErrorString error;
         start(&error, &m_maxCallStackDepth);
@@ -170,12 +170,12 @@ void InspectorTimelineAgent::start(ErrorString*, const int* maxCallStackDepth)
 
     m_instrumentingAgents->setInspectorTimelineAgent(this);
     ScriptGCEvent::addEventListener(this);
-    m_state->setBoolean(TimelineAgentState::enabled, true);
+    m_state->setBoolean(TimelineAgentState::timelineAgentEnabled, true);
 }
 
 void InspectorTimelineAgent::stop(ErrorString*)
 {
-    if (!m_state->getBoolean(TimelineAgentState::enabled))
+    if (!m_state->getBoolean(TimelineAgentState::timelineAgentEnabled))
         return;
 
     m_instrumentingAgents->setInspectorTimelineAgent(0);
@@ -184,7 +184,7 @@ void InspectorTimelineAgent::stop(ErrorString*)
     clearRecordStack();
     m_gcEvents.clear();
 
-    m_state->setBoolean(TimelineAgentState::enabled, false);
+    m_state->setBoolean(TimelineAgentState::timelineAgentEnabled, false);
 }
 
 void InspectorTimelineAgent::setIncludeMemoryDetails(ErrorString*, bool value)
index 0c90695..d9b390f 100644 (file)
@@ -93,25 +93,25 @@ private:
 WorkerInspectorController::WorkerInspectorController(WorkerContext* workerContext)
     : m_workerContext(workerContext)
     , m_stateClient(adoptPtr(new WorkerStateClient(workerContext)))
-    , m_state(adoptPtr(new InspectorCompositeState(m_stateClient.get())))
+    , m_state(adoptPtr(new InspectorState(m_stateClient.get())))
     , m_instrumentingAgents(adoptPtr(new InstrumentingAgents()))
     , m_injectedScriptManager(InjectedScriptManager::createForWorker())
     , m_runtimeAgent(0)
 {
-    OwnPtr<InspectorRuntimeAgent> runtimeAgent = WorkerRuntimeAgent::create(m_instrumentingAgents.get(), m_state->createAgentState(), m_injectedScriptManager.get(), workerContext);
+    OwnPtr<InspectorRuntimeAgent> runtimeAgent = WorkerRuntimeAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get(), workerContext);
     m_runtimeAgent = runtimeAgent.get();
     m_agents.append(runtimeAgent.release());
 
-    OwnPtr<InspectorConsoleAgent> consoleAgent = WorkerConsoleAgent::create(m_instrumentingAgents.get(), m_state->createAgentState(), m_injectedScriptManager.get());
+    OwnPtr<InspectorConsoleAgent> consoleAgent = WorkerConsoleAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get());
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    OwnPtr<InspectorDebuggerAgent> debuggerAgent = WorkerDebuggerAgent::create(m_instrumentingAgents.get(), m_state->createAgentState(), workerContext, m_injectedScriptManager.get());
+    OwnPtr<InspectorDebuggerAgent> debuggerAgent = WorkerDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), workerContext, m_injectedScriptManager.get());
     InspectorDebuggerAgent* debuggerAgentPtr = debuggerAgent.get();
     m_runtimeAgent->setScriptDebugServer(&debuggerAgent->scriptDebugServer());
     m_agents.append(debuggerAgent.release());
 
-    m_agents.append(InspectorProfilerAgent::create(m_instrumentingAgents.get(), consoleAgent.get(), workerContext, m_state->createAgentState(), m_injectedScriptManager.get()));
+    m_agents.append(InspectorProfilerAgent::create(m_instrumentingAgents.get(), consoleAgent.get(), workerContext, m_state.get(), m_injectedScriptManager.get()));
 #endif
-    m_agents.append(InspectorTimelineAgent::create(m_instrumentingAgents.get(), 0, m_state->createAgentState(), InspectorTimelineAgent::WorkerInspector, 0));
+    m_agents.append(InspectorTimelineAgent::create(m_instrumentingAgents.get(), 0, m_state.get(), InspectorTimelineAgent::WorkerInspector, 0));
     m_agents.append(consoleAgent.release());
 
     m_injectedScriptManager->injectedScriptHost()->init(0
index 187328c..21dc723 100644 (file)
@@ -48,7 +48,7 @@ class InspectorFrontend;
 class InspectorFrontendChannel;
 class InspectorInstrumentation;
 class InspectorRuntimeAgent;
-class InspectorCompositeState;
+class InspectorState;
 class InspectorStateClient;
 class InstrumentingAgents;
 class WorkerContext;
@@ -74,7 +74,7 @@ private:
 
     WorkerContext* m_workerContext;
     OwnPtr<InspectorStateClient> m_stateClient;
-    OwnPtr<InspectorCompositeState> m_state;
+    OwnPtr<InspectorState> m_state;
     OwnPtr<InstrumentingAgents> m_instrumentingAgents;
     OwnPtr<InjectedScriptManager> m_injectedScriptManager;
     InspectorRuntimeAgent* m_runtimeAgent;