2010-12-29 Pavel Feldman <pfeldman@chromium.org>
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Dec 2010 07:41:53 +0000 (07:41 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Dec 2010 07:41:53 +0000 (07:41 +0000)
        Reviewed by Yury Semikhatsky.

        Web Inspector: extract Database & DOM Storage agents; remove InspectorBackend.
        https://bugs.webkit.org/show_bug.cgi?id=51707

        This change brushes up storage agents + removes redundant InspectorBackend class.

        * CMakeLists.txt:
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * inspector/CodeGeneratorInspector.pm:
        * inspector/InjectedScriptHost.cpp:
        (WebCore::InjectedScriptHost::databaseForId):
        (WebCore::InjectedScriptHost::selectDatabase):
        (WebCore::InjectedScriptHost::selectDOMStorage):
        (WebCore::InjectedScriptHost::inspectorDOMAgent):
        * inspector/Inspector.idl:
        * inspector/InspectorBackend.cpp: Removed.
        * inspector/InspectorBackend.h: Removed.
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::InspectorController):
        (WebCore::InspectorController::~InspectorController):
        (WebCore::InspectorController::connectFrontend):
        (WebCore::InspectorController::releaseFrontendLifetimeAgents):
        (WebCore::InspectorController::didUseDOMStorage):
        (WebCore::InspectorController::setInjectedScriptSource):
        (WebCore::InspectorController::dispatchOnInjectedScript):
        (WebCore::InspectorController::releaseWrapperObjectGroup):
        * inspector/InspectorController.h:
        * inspector/InspectorDOMStorageAgent.cpp: Added.
        (WebCore::InspectorDOMStorageAgent::~InspectorDOMStorageAgent):
        (WebCore::InspectorDOMStorageAgent::getDOMStorageEntries):
        (WebCore::InspectorDOMStorageAgent::setDOMStorageItem):
        (WebCore::InspectorDOMStorageAgent::removeDOMStorageItem):
        (WebCore::InspectorDOMStorageAgent::selectDOMStorage):
        (WebCore::InspectorDOMStorageAgent::InspectorDOMStorageAgent):
        (WebCore::InspectorDOMStorageAgent::getDOMStorageResourceForId):
        * inspector/InspectorDOMStorageAgent.h: Copied from WebCore/inspector/InspectorStorageAgent.h.
        (WebCore::InspectorDOMStorageAgent::create):
        (WebCore::InspectorDOMStorageAgent::frontend):
        * inspector/InspectorDatabaseAgent.cpp: Renamed from WebCore/inspector/InspectorStorageAgent.cpp.
        (WebCore::InspectorDatabaseAgent::~InspectorDatabaseAgent):
        (WebCore::InspectorDatabaseAgent::getDatabaseTableNames):
        (WebCore::InspectorDatabaseAgent::executeSQL):
        (WebCore::InspectorDatabaseAgent::databaseForId):
        (WebCore::InspectorDatabaseAgent::selectDatabase):
        (WebCore::InspectorDatabaseAgent::clearFrontend):
        (WebCore::InspectorDatabaseAgent::InspectorDatabaseAgent):
        * inspector/InspectorDatabaseAgent.h: Renamed from WebCore/inspector/InspectorStorageAgent.h.
        (WebCore::InspectorDatabaseAgent::create):
        (WebCore::InspectorDatabaseAgent::frontend):
        * inspector/front-end/ScriptsPanel.js:
        (WebInspector.ScriptsPanel.prototype.show):
        (WebInspector.ScriptsPanel.prototype.attachDebuggerWhenShown):
        (WebInspector.ScriptsPanel.prototype._toggleDebugging):

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

21 files changed:
LayoutTests/inspector/report-protocol-errors-expected.txt
WebCore/CMakeLists.txt
WebCore/ChangeLog
WebCore/GNUmakefile.am
WebCore/WebCore.gypi
WebCore/WebCore.pro
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/inspector/CodeGeneratorInspector.pm
WebCore/inspector/InjectedScriptHost.cpp
WebCore/inspector/Inspector.idl
WebCore/inspector/InspectorBackend.cpp [deleted file]
WebCore/inspector/InspectorBackend.h [deleted file]
WebCore/inspector/InspectorController.cpp
WebCore/inspector/InspectorController.h
WebCore/inspector/InspectorDOMStorageAgent.cpp [new file with mode: 0644]
WebCore/inspector/InspectorDOMStorageAgent.h [new file with mode: 0644]
WebCore/inspector/InspectorDatabaseAgent.cpp [moved from WebCore/inspector/InspectorStorageAgent.cpp with 73% similarity]
WebCore/inspector/InspectorDatabaseAgent.h [moved from WebCore/inspector/InspectorStorageAgent.h with 63% similarity]
WebCore/inspector/front-end/ScriptsPanel.js
WebKit/chromium/src/WebDevToolsFrontendImpl.cpp

index a5d8dfc..8856ae7 100644 (file)
@@ -44,7 +44,7 @@ Tests that InspectorBackendDispatcher is catching incorrect messages.
 }
 {
     seq : 2
-    domain : "Resources"
+    domain : "Network"
     success : false
     errors : {
         0 : "Protocol Error: 'arguments' property with type 'object' was not found."
@@ -52,7 +52,7 @@ Tests that InspectorBackendDispatcher is catching incorrect messages.
 }
 {
     seq : 3
-    domain : "Resources"
+    domain : "Network"
     success : false
     errors : {
         0 : "Protocol Error: 'arguments' property with type 'object' was not found."
@@ -60,7 +60,7 @@ Tests that InspectorBackendDispatcher is catching incorrect messages.
 }
 {
     seq : 4
-    domain : "Resources"
+    domain : "Network"
     success : false
     errors : {
         0 : "Protocol Error: Argument 'frameId' with type 'Number' was not found."
@@ -70,7 +70,7 @@ Tests that InspectorBackendDispatcher is catching incorrect messages.
 }
 {
     seq : 5
-    domain : "Resources"
+    domain : "Network"
     success : false
     errors : {
         0 : "Protocol Error: Argument 'frameId' with type 'Number' was not found."
index 02d87b7..1876b36 100644 (file)
@@ -1153,12 +1153,13 @@ SET(WebCore_SOURCES
     inspector/InjectedScript.cpp
     inspector/InjectedScriptHost.cpp
     inspector/InspectorApplicationCacheAgent.cpp
-    inspector/InspectorBackend.cpp
     inspector/InspectorCSSAgent.cpp
     inspector/InspectorClient.cpp
     inspector/InspectorController.cpp
     inspector/InspectorDOMAgent.cpp
+    inspector/InspectorDOMStorageAgent.cpp
     inspector/InspectorDOMStorageResource.cpp
+    inspector/InspectorDatabaseAgent.cpp
     inspector/InspectorDatabaseResource.cpp
     inspector/InspectorDebuggerAgent.cpp
     inspector/InspectorFileSystemAgent.cpp
@@ -1170,7 +1171,6 @@ SET(WebCore_SOURCES
     inspector/InspectorStyleSheet.cpp
     inspector/InspectorValues.cpp
     inspector/InspectorState.cpp
-    inspector/InspectorStorageAgent.cpp
     inspector/InspectorTimelineAgent.cpp
     inspector/ScriptArguments.cpp
     inspector/ScriptBreakpoint.cpp
index cb3c72f..95302be 100644 (file)
@@ -1,3 +1,64 @@
+2010-12-29  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: extract Database & DOM Storage agents; remove InspectorBackend.
+        https://bugs.webkit.org/show_bug.cgi?id=51707
+
+        This change brushes up storage agents + removes redundant InspectorBackend class.
+
+        * CMakeLists.txt:
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * inspector/CodeGeneratorInspector.pm:
+        * inspector/InjectedScriptHost.cpp:
+        (WebCore::InjectedScriptHost::databaseForId):
+        (WebCore::InjectedScriptHost::selectDatabase):
+        (WebCore::InjectedScriptHost::selectDOMStorage):
+        (WebCore::InjectedScriptHost::inspectorDOMAgent):
+        * inspector/Inspector.idl:
+        * inspector/InspectorBackend.cpp: Removed.
+        * inspector/InspectorBackend.h: Removed.
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::InspectorController):
+        (WebCore::InspectorController::~InspectorController):
+        (WebCore::InspectorController::connectFrontend):
+        (WebCore::InspectorController::releaseFrontendLifetimeAgents):
+        (WebCore::InspectorController::didUseDOMStorage):
+        (WebCore::InspectorController::setInjectedScriptSource):
+        (WebCore::InspectorController::dispatchOnInjectedScript):
+        (WebCore::InspectorController::releaseWrapperObjectGroup):
+        * inspector/InspectorController.h:
+        * inspector/InspectorDOMStorageAgent.cpp: Added.
+        (WebCore::InspectorDOMStorageAgent::~InspectorDOMStorageAgent):
+        (WebCore::InspectorDOMStorageAgent::getDOMStorageEntries):
+        (WebCore::InspectorDOMStorageAgent::setDOMStorageItem):
+        (WebCore::InspectorDOMStorageAgent::removeDOMStorageItem):
+        (WebCore::InspectorDOMStorageAgent::selectDOMStorage):
+        (WebCore::InspectorDOMStorageAgent::InspectorDOMStorageAgent):
+        (WebCore::InspectorDOMStorageAgent::getDOMStorageResourceForId):
+        * inspector/InspectorDOMStorageAgent.h: Copied from WebCore/inspector/InspectorStorageAgent.h.
+        (WebCore::InspectorDOMStorageAgent::create):
+        (WebCore::InspectorDOMStorageAgent::frontend):
+        * inspector/InspectorDatabaseAgent.cpp: Renamed from WebCore/inspector/InspectorStorageAgent.cpp.
+        (WebCore::InspectorDatabaseAgent::~InspectorDatabaseAgent):
+        (WebCore::InspectorDatabaseAgent::getDatabaseTableNames):
+        (WebCore::InspectorDatabaseAgent::executeSQL):
+        (WebCore::InspectorDatabaseAgent::databaseForId):
+        (WebCore::InspectorDatabaseAgent::selectDatabase):
+        (WebCore::InspectorDatabaseAgent::clearFrontend):
+        (WebCore::InspectorDatabaseAgent::InspectorDatabaseAgent):
+        * inspector/InspectorDatabaseAgent.h: Renamed from WebCore/inspector/InspectorStorageAgent.h.
+        (WebCore::InspectorDatabaseAgent::create):
+        (WebCore::InspectorDatabaseAgent::frontend):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype.show):
+        (WebInspector.ScriptsPanel.prototype.attachDebuggerWhenShown):
+        (WebInspector.ScriptsPanel.prototype._toggleDebugging):
+
 2010-12-29  Dirk Schulze  <krit@webkit.org>
 
         Reviewed by Darin Adler.
index 3808ca1..1c5a3d6 100644 (file)
@@ -1930,20 +1930,22 @@ webcore_sources += \
        WebCore/inspector/InjectedScriptHost.h \
        WebCore/inspector/InspectorApplicationCacheAgent.cpp \
        WebCore/inspector/InspectorApplicationCacheAgent.h \
-       WebCore/inspector/InspectorBackend.cpp \
-       WebCore/inspector/InspectorBackend.h \
        WebCore/inspector/InspectorClient.cpp \
        WebCore/inspector/InspectorClient.h \
        WebCore/inspector/InspectorController.cpp \
        WebCore/inspector/InspectorController.h \
        WebCore/inspector/InspectorCSSAgent.cpp \
        WebCore/inspector/InspectorCSSAgent.h \
+       WebCore/inspector/InspectorDatabaseAgent.cpp \
+       WebCore/inspector/InspectorDatabaseAgent.h \
        WebCore/inspector/InspectorDatabaseResource.cpp \
        WebCore/inspector/InspectorDatabaseResource.h \
        WebCore/inspector/InspectorDebuggerAgent.cpp \
        WebCore/inspector/InspectorDebuggerAgent.h \
        WebCore/inspector/InspectorDOMAgent.cpp \
        WebCore/inspector/InspectorDOMAgent.h \
+       WebCore/inspector/InspectorDOMStorageAgent.cpp \
+       WebCore/inspector/InspectorDOMStorageAgent.h \
        WebCore/inspector/InspectorDOMStorageResource.cpp \
        WebCore/inspector/InspectorDOMStorageResource.h \
        WebCore/inspector/InspectorFileSystemAgent.cpp \
@@ -1961,8 +1963,6 @@ webcore_sources += \
        WebCore/inspector/InspectorResourceAgent.h \
        WebCore/inspector/InspectorState.cpp \
        WebCore/inspector/InspectorState.h \
-       WebCore/inspector/InspectorStorageAgent.cpp \
-       WebCore/inspector/InspectorStorageAgent.h \
        WebCore/inspector/InspectorStyleSheet.cpp \
        WebCore/inspector/InspectorStyleSheet.h \
        WebCore/inspector/InspectorTimelineAgent.cpp \
index f62d883..ca94101 100644 (file)
             'inspector/InjectedScriptHost.h',
             'inspector/InspectorApplicationCacheAgent.cpp',
             'inspector/InspectorApplicationCacheAgent.h',
-            'inspector/InspectorBackend.cpp',
-            'inspector/InspectorBackend.h',
             'inspector/InspectorClient.cpp',
             'inspector/InspectorClient.h',
             'inspector/InspectorController.cpp',
             'inspector/InspectorController.h',
             'inspector/InspectorCSSAgent.cpp',
             'inspector/InspectorCSSAgent.h',
+            'inspector/InspectorDatabaseAgent.cpp',
+            'inspector/InspectorDatabaseAgent.h',
             'inspector/InspectorDatabaseResource.cpp',
             'inspector/InspectorDatabaseResource.h',
             'inspector/InspectorDebuggerAgent.cpp',
             'inspector/InspectorDebuggerAgent.h',
             'inspector/InspectorDOMAgent.cpp',
             'inspector/InspectorDOMAgent.h',
+            'inspector/InspectorDOMStorageAgent.cpp',
+            'inspector/InspectorDOMStorageAgent.h',
             'inspector/InspectorDOMStorageResource.cpp',
             'inspector/InspectorDOMStorageResource.h',
             'inspector/InspectorFileSystemAgent.cpp',
             'inspector/InspectorResourceAgent.h',
             'inspector/InspectorState.cpp',
             'inspector/InspectorState.h',
-            'inspector/InspectorStorageAgent.cpp',
-            'inspector/InspectorStorageAgent.h',
             'inspector/InspectorStyleSheet.cpp',
             'inspector/InspectorStyleSheet.h',
             'inspector/InspectorTimelineAgent.cpp',
index aac760a..0c5c01c 100644 (file)
@@ -1039,13 +1039,14 @@ SOURCES += \
     inspector/InjectedScript.cpp \
     inspector/InjectedScriptHost.cpp \
     inspector/InspectorApplicationCacheAgent.cpp \
-    inspector/InspectorBackend.cpp \
     inspector/InspectorCSSAgent.cpp \
     inspector/InspectorClient.cpp \
     inspector/InspectorController.cpp \
+    inspector/InspectorDatabaseAgent.cpp \
     inspector/InspectorDatabaseResource.cpp \
     inspector/InspectorDebuggerAgent.cpp \
     inspector/InspectorDOMAgent.cpp \
+    inspector/InspectorDOMStorageAgent.cpp \
     inspector/InspectorDOMStorageResource.cpp \
     inspector/InspectorFileSystemAgent.cpp \
     inspector/InspectorFrontendClientLocal.cpp \
@@ -1054,7 +1055,6 @@ SOURCES += \
     inspector/InspectorProfilerAgent.cpp \
     inspector/InspectorResourceAgent.cpp \
     inspector/InspectorState.cpp \
-    inspector/InspectorStorageAgent.cpp \
     inspector/InspectorStyleSheet.cpp \
     inspector/InspectorTimelineAgent.cpp \
     inspector/InspectorValues.cpp \
@@ -1930,11 +1930,12 @@ HEADERS += \
     inspector/InjectedScript.h \
     inspector/InjectedScriptHost.h \
     inspector/InspectorApplicationCacheAgent.h \
-    inspector/InspectorBackend.h \
     inspector/InspectorController.h \
     inspector/InspectorCSSAgent.h \
+    inspector/InspectorDatabaseAgent.h \
     inspector/InspectorDatabaseResource.h \
     inspector/InspectorDebuggerAgent.h \
+    inspector/InspectorDOMStorageAgent.h \
     inspector/InspectorDOMStorageResource.h \
     inspector/InspectorFileSystemAgent.h \
     inspector/InspectorFrontendClient.h \
@@ -1944,7 +1945,6 @@ HEADERS += \
     inspector/InspectorProfilerAgent.h \
     inspector/InspectorResourceAgent.h \
     inspector/InspectorState.h \
-    inspector/InspectorStorageAgent.h \
     inspector/InspectorStyleSheet.h \
     inspector/InspectorTimelineAgent.h \
     inspector/ScriptGCEventListener.h \
index ede14b2..c5d26db 100755 (executable)
                                >
                        </File>
                        <File
-                               RelativePath="..\inspector\InspectorBackend.cpp"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\inspector\InspectorBackend.h"
-                               >
-                       </File>
-                       <File
                                RelativePath="..\inspector\InspectorClient.cpp"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath="..\inspector\InspectorDatabaseAgent.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\inspector\InspectorDatabaseAgent.h"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\inspector\InspectorDatabaseResource.cpp"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath="..\inspector\InspectorDOMStorageAgent.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\inspector\InspectorDOMStorageAgent.h"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\inspector\InspectorDOMStorageResource.cpp"
                                >
                        </File>
                                >
                        </File>
                        <File
-                               RelativePath="..\inspector\InspectorStorageAgent.cpp"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\inspector\InspectorStorageAgent.h"
-                               >
-                       </File>
-                       <File
                                RelativePath="..\inspector\InspectorStyleSheet.cpp"
                                >
                        </File>
index d4e2124..aa2ed82 100644 (file)
                7A24587C1021EAF4000A00AA /* InspectorDOMAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A24587A1021EAF4000A00AA /* InspectorDOMAgent.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7A674BDB0F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A674BD90F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp */; };
                7A674BDC0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A674BDA0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h */; };
-               7A74ECBA101839A600BF939E /* InspectorBackend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A74ECB8101839A500BF939E /* InspectorBackend.cpp */; };
-               7A74ECBB101839A600BF939E /* InspectorBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A74ECB9101839A600BF939E /* InspectorBackend.h */; };
+               7A74ECBA101839A600BF939E /* InspectorDOMStorageAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A74ECB8101839A500BF939E /* InspectorDOMStorageAgent.cpp */; };
+               7A74ECBB101839A600BF939E /* InspectorDOMStorageAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A74ECB9101839A600BF939E /* InspectorDOMStorageAgent.h */; };
                7A74ECBD101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */; };
-               7AB0B1C01211A62200A76940 /* InspectorStorageAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AB0B1BE1211A62200A76940 /* InspectorStorageAgent.cpp */; };
-               7AB0B1C11211A62200A76940 /* InspectorStorageAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AB0B1BF1211A62200A76940 /* InspectorStorageAgent.h */; };
+               7AB0B1C01211A62200A76940 /* InspectorDatabaseAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AB0B1BE1211A62200A76940 /* InspectorDatabaseAgent.cpp */; };
+               7AB0B1C11211A62200A76940 /* InspectorDatabaseAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AB0B1BF1211A62200A76940 /* InspectorDatabaseAgent.h */; };
                7ADE722610CBBB9B006B3B3A /* ContextMenuProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ADE722510CBBB9B006B3B3A /* ContextMenuProvider.h */; };
                7AFD4A8B1131C2760035B883 /* ScriptBreakpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7AFD4FF4113277B60035B883 /* ScriptDebugListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFD4FF3113277B60035B883 /* ScriptDebugListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7A24587A1021EAF4000A00AA /* InspectorDOMAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDOMAgent.h; sourceTree = "<group>"; };
                7A674BD90F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageGroupLoadDeferrer.cpp; sourceTree = "<group>"; };
                7A674BDA0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageGroupLoadDeferrer.h; sourceTree = "<group>"; };
-               7A74ECB8101839A500BF939E /* InspectorBackend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorBackend.cpp; sourceTree = "<group>"; };
-               7A74ECB9101839A600BF939E /* InspectorBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorBackend.h; sourceTree = "<group>"; };
+               7A74ECB8101839A500BF939E /* InspectorDOMStorageAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDOMStorageAgent.cpp; sourceTree = "<group>"; };
+               7A74ECB9101839A600BF939E /* InspectorDOMStorageAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDOMStorageAgent.h; sourceTree = "<group>"; };
                7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInspectorFrontendHostCustom.cpp; sourceTree = "<group>"; };
-               7AB0B1BE1211A62200A76940 /* InspectorStorageAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorStorageAgent.cpp; sourceTree = "<group>"; };
-               7AB0B1BF1211A62200A76940 /* InspectorStorageAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorStorageAgent.h; sourceTree = "<group>"; };
+               7AB0B1BE1211A62200A76940 /* InspectorDatabaseAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDatabaseAgent.cpp; sourceTree = "<group>"; };
+               7AB0B1BF1211A62200A76940 /* InspectorDatabaseAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDatabaseAgent.h; sourceTree = "<group>"; };
                7ADE722510CBBB9B006B3B3A /* ContextMenuProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextMenuProvider.h; sourceTree = "<group>"; };
                7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptBreakpoint.h; sourceTree = "<group>"; };
                7AFD4FF3113277B60035B883 /* ScriptDebugListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptDebugListener.h; sourceTree = "<group>"; };
                                7A0E76F810BF08ED00A0276E /* InjectedScriptHost.idl */,
                                B885E8D211E06DD2009FFBF4 /* InspectorApplicationCacheAgent.cpp */,
                                B885E8D311E06DD2009FFBF4 /* InspectorApplicationCacheAgent.h */,
-                               7A74ECB8101839A500BF939E /* InspectorBackend.cpp */,
-                               7A74ECB9101839A600BF939E /* InspectorBackend.h */,
                                7A1F2B51126C61B20006A7E6 /* InspectorClient.cpp */,
                                1C81B9580E97330800266E07 /* InspectorClient.h */,
                                1C81B9570E97330800266E07 /* InspectorController.cpp */,
                                1C81B9560E97330800266E07 /* InspectorController.h */,
                                82AB1741124B99EC00C5069D /* InspectorCSSAgent.cpp */,
                                82AB1742124B99EC00C5069D /* InspectorCSSAgent.h */,
+                               7AB0B1BE1211A62200A76940 /* InspectorDatabaseAgent.cpp */,
+                               7AB0B1BF1211A62200A76940 /* InspectorDatabaseAgent.h */,
                                41F062130F5F192600A07EAC /* InspectorDatabaseResource.cpp */,
                                41F062120F5F192600A07EAC /* InspectorDatabaseResource.h */,
                                F33F053B120B0DA500E5743A /* InspectorDebuggerAgent.cpp */,
                                F33F053C120B0DA500E5743A /* InspectorDebuggerAgent.h */,
                                7A2458791021EAF4000A00AA /* InspectorDOMAgent.cpp */,
                                7A24587A1021EAF4000A00AA /* InspectorDOMAgent.h */,
+                               7A74ECB8101839A500BF939E /* InspectorDOMStorageAgent.cpp */,
+                               7A74ECB9101839A600BF939E /* InspectorDOMStorageAgent.h */,
                                41F061730F5F00AC00A07EAC /* InspectorDOMStorageResource.cpp */,
                                41F061720F5F00AC00A07EAC /* InspectorDOMStorageResource.h */,
                                3888F6EC128C9889000CA8E0 /* InspectorFileSystemAgent.cpp */,
                                82AB1772125C826700C5069D /* InspectorResourceAgent.h */,
                                4FA3B908125CD12100300BAD /* InspectorState.cpp */,
                                4FA3B909125CD12200300BAD /* InspectorState.h */,
-                               7AB0B1BE1211A62200A76940 /* InspectorStorageAgent.cpp */,
-                               7AB0B1BF1211A62200A76940 /* InspectorStorageAgent.h */,
                                82AB176F125C826700C5069D /* InspectorStyleSheet.cpp */,
                                82AB1770125C826700C5069D /* InspectorStyleSheet.h */,
                                754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */,
                                93309DF0099E64920056E581 /* InsertParagraphSeparatorCommand.h in Headers */,
                                93309DF2099E64920056E581 /* InsertTextCommand.h in Headers */,
                                B885E8D511E06DD2009FFBF4 /* InspectorApplicationCacheAgent.h in Headers */,
-                               7A74ECBB101839A600BF939E /* InspectorBackend.h in Headers */,
                                4F707A9A11EF679400ACDA69 /* InspectorBackendDispatcher.h in Headers */,
                                1C81B95C0E97330800266E07 /* InspectorClient.h in Headers */,
                                1C81B95A0E97330800266E07 /* InspectorController.h in Headers */,
                                82AB1744124B99EC00C5069D /* InspectorCSSAgent.h in Headers */,
+                               7AB0B1C11211A62200A76940 /* InspectorDatabaseAgent.h in Headers */,
                                41F062140F5F192600A07EAC /* InspectorDatabaseResource.h in Headers */,
                                F33F053E120B0DA500E5743A /* InspectorDebuggerAgent.h in Headers */,
                                7A24587C1021EAF4000A00AA /* InspectorDOMAgent.h in Headers */,
+                               7A74ECBB101839A600BF939E /* InspectorDOMStorageAgent.h in Headers */,
                                41F061740F5F00AC00A07EAC /* InspectorDOMStorageResource.h in Headers */,
                                3888F6EF128C9889000CA8E0 /* InspectorFileSystemAgent.h in Headers */,
                                F344C7141125B82C00F26EEE /* InspectorFrontendClient.h in Headers */,
                                9F0D6B2F121BFEBA006C0288 /* InspectorProfilerAgent.h in Headers */,
                                82AB1776125C826700C5069D /* InspectorResourceAgent.h in Headers */,
                                4FA3B90B125CD12200300BAD /* InspectorState.h in Headers */,
-                               7AB0B1C11211A62200A76940 /* InspectorStorageAgent.h in Headers */,
                                82AB1774125C826700C5069D /* InspectorStyleSheet.h in Headers */,
                                754133A8102E00E800075D00 /* InspectorTimelineAgent.h in Headers */,
                                4F3289B611A42AAB005ABE7E /* InspectorValues.h in Headers */,
                                93309DEF099E64920056E581 /* InsertParagraphSeparatorCommand.cpp in Sources */,
                                93309DF1099E64920056E581 /* InsertTextCommand.cpp in Sources */,
                                B885E8D411E06DD2009FFBF4 /* InspectorApplicationCacheAgent.cpp in Sources */,
-                               7A74ECBA101839A600BF939E /* InspectorBackend.cpp in Sources */,
                                4F707A9911EF679400ACDA69 /* InspectorBackendDispatcher.cpp in Sources */,
                                7A1F2B52126C61B20006A7E6 /* InspectorClient.cpp in Sources */,
                                1C81B95B0E97330800266E07 /* InspectorController.cpp in Sources */,
                                82AB1743124B99EC00C5069D /* InspectorCSSAgent.cpp in Sources */,
+                               7AB0B1C01211A62200A76940 /* InspectorDatabaseAgent.cpp in Sources */,
                                41F062150F5F192600A07EAC /* InspectorDatabaseResource.cpp in Sources */,
                                F33F053D120B0DA500E5743A /* InspectorDebuggerAgent.cpp in Sources */,
                                7A24587B1021EAF4000A00AA /* InspectorDOMAgent.cpp in Sources */,
+                               7A74ECBA101839A600BF939E /* InspectorDOMStorageAgent.cpp in Sources */,
                                41F061750F5F00AC00A07EAC /* InspectorDOMStorageResource.cpp in Sources */,
                                3888F6EE128C9889000CA8E0 /* InspectorFileSystemAgent.cpp in Sources */,
                                4F4F5FFB11CBD2E100A186BF /* InspectorFrontend.cpp in Sources */,
                                9F0D6B2E121BFEBA006C0288 /* InspectorProfilerAgent.cpp in Sources */,
                                82AB1775125C826700C5069D /* InspectorResourceAgent.cpp in Sources */,
                                4FA3B90A125CD12200300BAD /* InspectorState.cpp in Sources */,
-                               7AB0B1C01211A62200A76940 /* InspectorStorageAgent.cpp in Sources */,
                                82AB1773125C826700C5069D /* InspectorStyleSheet.cpp in Sources */,
                                754133AA102E00F400075D00 /* InspectorTimelineAgent.cpp in Sources */,
                                4F3289B511A42AAB005ABE7E /* InspectorValues.cpp in Sources */,
index 95f7e8f..b8aea0e 100644 (file)
@@ -10,72 +10,64 @@ use Class::Struct;
 use File::stat;
 
 my %typeTransform;
-$typeTransform{"InspectorClient"} = {
-    "forward" => "InspectorClient",
-    "header" => "InspectorClient.h",
-};
-$typeTransform{"Backend"} = {
-    "forward" => "InspectorBackend",
-    "header" => "InspectorBackend.h",
-    "domainAccessor" => "m_inspectorController->inspectorBackend()",
+$typeTransform{"ApplicationCache"} = {
+    "forward" => "InspectorApplicationCacheAgent",
+    "header" => "InspectorApplicationCacheAgent.h",
+    "domainAccessor" => "m_inspectorController->m_applicationCacheAgent",
 };
-$typeTransform{"Inspector"} = {
-    "forwardHeader" => "InspectorController.h",
-    "domainAccessor" => "m_inspectorController",
+$typeTransform{"CSS"} = {
+    "forward" => "InspectorCSSAgent",
+    "header" => "InspectorCSSAgent.h",
+    "domainAccessor" => "m_inspectorController->m_cssAgent",
 };
 $typeTransform{"Debugger"} = {
     "forward" => "InspectorDebuggerAgent",
     "header" => "InspectorDebuggerAgent.h",
-    "domainAccessor" => "m_inspectorController->debuggerAgent()",
-};
-$typeTransform{"Resources"} = {
-    "forward" => "InspectorResourceAgent",
-    "header" => "InspectorResourceAgent.h",
-    "domainAccessor" => "m_inspectorController->m_resourceAgent",
-};
-$typeTransform{"Network"} = {
-    "forward" => "InspectorResourceAgent",
-    "header" => "InspectorResourceAgent.h",
-    "domainAccessor" => "m_inspectorController->m_resourceAgent",
-};
-$typeTransform{"DOMStorage"} = {
-    "forwardHeader" => "InspectorController.h",
-    "domainAccessor" => "m_inspectorController",
+    "domainAccessor" => "m_inspectorController->m_debuggerAgent",
 };
 $typeTransform{"Database"} = {
-    "forward" => "InspectorBackend",
-    "header" => "InspectorBackend.h",
-    "domainAccessor" => "m_inspectorController->inspectorBackend()",
+    "forward" => "InspectorDatabaseAgent",
+    "header" => "InspectorDatabaseAgent.h",
+    "domainAccessor" => "m_inspectorController->m_databaseAgent",
 };
 $typeTransform{"DOM"} = {
     "forward" => "InspectorDOMAgent",
     "header" => "InspectorDOMAgent.h",
-    "domainAccessor" => "m_inspectorController->domAgent()",
-};
-$typeTransform{"CSS"} = {
-    "forward" => "InspectorCSSAgent",
-    "header" => "InspectorCSSAgent.h",
-    "domainAccessor" => "m_inspectorController->cssAgent()",
+    "domainAccessor" => "m_inspectorController->m_domAgent",
 };
-$typeTransform{"ApplicationCache"} = {
-    "forward" => "InspectorApplicationCacheAgent",
-    "header" => "InspectorApplicationCacheAgent.h",
-    "domainAccessor" => "m_inspectorController->applicationCacheAgent()",
+$typeTransform{"DOMStorage"} = {
+    "forward" => "InspectorDOMStorageAgent",
+    "header" => "InspectorDOMStorageAgent.h",
+    "domainAccessor" => "m_inspectorController->m_domStorageAgent",
 };
 $typeTransform{"FileSystem"} = {
     "forward" => "InspectorFileSystemAgent",
     "header" => "InspectorFileSystemAgent.h",
-    "domainAccessor" => "m_inspectorController->fileSystemAgent()",
+    "domainAccessor" => "m_inspectorController->m_fileSystemAgent",
+};
+$typeTransform{"Inspector"} = {
+    "forwardHeader" => "InspectorController.h",
+    "domainAccessor" => "m_inspectorController",
+};
+$typeTransform{"Network"} = {
+    "forward" => "InspectorResourceAgent",
+    "header" => "InspectorResourceAgent.h",
+    "domainAccessor" => "m_inspectorController->m_resourceAgent",
 };
 $typeTransform{"Profiler"} = {
     "forward" => "InspectorProfilerAgent",
     "header" => "InspectorProfilerAgent.h",
-    "domainAccessor" => "m_inspectorController->profilerAgent()",
+    "domainAccessor" => "m_inspectorController->m_profilerAgent",
 };
+
 $typeTransform{"Frontend"} = {
     "forward" => "InspectorFrontend",
     "header" => "InspectorFrontend.h",
 };
+$typeTransform{"InspectorClient"} = {
+    "forward" => "InspectorClient",
+    "header" => "InspectorClient.h",
+};
 $typeTransform{"PassRefPtr"} = {
     "forwardHeader" => "wtf/PassRefPtr.h",
 };
index 415a2e5..a4a0c6f 100644 (file)
@@ -30,6 +30,8 @@
 
 #include "config.h"
 #include "InjectedScriptHost.h"
+#include "InspectorDatabaseAgent.h"
+#include "InspectorDOMStorageAgent.h"
 
 #if ENABLE(INSPECTOR)
 
@@ -120,23 +122,23 @@ long InjectedScriptHost::inspectedNode(unsigned long num)
 #if ENABLE(DATABASE)
 Database* InjectedScriptHost::databaseForId(long databaseId)
 {
-    if (m_inspectorController)
-        return m_inspectorController->databaseForId(databaseId);
+    if (m_inspectorController && m_inspectorController->m_databaseAgent)
+        return m_inspectorController->m_databaseAgent->databaseForId(databaseId);
     return 0;
 }
 
 void InjectedScriptHost::selectDatabase(Database* database)
 {
-    if (m_inspectorController)
-        m_inspectorController->selectDatabase(database);
+    if (m_inspectorController && m_inspectorController->m_databaseAgent)
+        m_inspectorController->m_databaseAgent->selectDatabase(database);
 }
 #endif
 
 #if ENABLE(DOM_STORAGE)
 void InjectedScriptHost::selectDOMStorage(Storage* storage)
 {
-    if (m_inspectorController)
-        m_inspectorController->selectDOMStorage(storage);
+    if (m_inspectorController && m_inspectorController->m_domStorageAgent)
+        m_inspectorController->m_domStorageAgent->selectDOMStorage(storage);
 }
 #endif
 
@@ -170,7 +172,7 @@ InspectorDOMAgent* InjectedScriptHost::inspectorDOMAgent()
 {
     if (!m_inspectorController)
         return 0;
-    return m_inspectorController->domAgent();
+    return m_inspectorController->m_domAgent.get();
 }
 
 InspectorFrontend* InjectedScriptHost::frontend()
index 56feb01..7b2d7e2 100644 (file)
@@ -36,12 +36,12 @@ module core {
         // generic Inspector's methods
         ///////////////////////////////////////////////////////////////////////
 
-        [domain=Backend] void setInjectedScriptSource(in String scriptSource);
         // HUGE FIXME: we need to expose InjectedScript methods here. Or document InjectedScript capabilities.
-        [domain=Backend] void dispatchOnInjectedScript(in long injectedScriptId, in String methodName, in String arguments, out Value result, out boolean isException);
+        [domain=Inspector] void setInjectedScriptSource(in String scriptSource);
+        [domain=Inspector] void dispatchOnInjectedScript(in long injectedScriptId, in String methodName, in String arguments, out Value result, out boolean isException);
         [domain=Inspector] void addScriptToEvaluateOnLoad(in String scriptSource);
         [domain=Inspector] void removeAllScriptsToEvaluateOnLoad();
-        [domain=Backend] void releaseWrapperObjectGroup(in long injectedScriptId, in String objectGroup);
+        [domain=Inspector] void releaseWrapperObjectGroup(in long injectedScriptId, in String objectGroup);
         [domain=Inspector] void getInspectorState(out Object state);
         [domain=Inspector] void setMonitoringXHREnabled(in boolean enable, out boolean newState);
         [domain=Inspector] void reloadPage();
@@ -69,6 +69,9 @@ module core {
 
         [domain=Inspector] void setExtraHeaders(in Object headers);
 
+        [domain=Inspector] void getCookies(out Array cookies, out String cookiesString);
+        [domain=Inspector] void deleteCookie(in String cookieName, in String domain);
+
         ///////////////////////////////////////////////////////////////////////
         // Console API
         ///////////////////////////////////////////////////////////////////////
@@ -84,6 +87,10 @@ module core {
         // Network API
         ///////////////////////////////////////////////////////////////////////
 
+        [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 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);
@@ -99,18 +106,12 @@ module core {
         [notify, domain=Network] void didReceiveWebSocketHandshakeResponse(out unsigned long identifier, out double time, out Object response);
         [notify, domain=Network] void didCloseWebSocket(out unsigned long identifier, out double time);
 
+#if defined(ENABLE_DATABASE) && ENABLE_DATABASE
+
         ///////////////////////////////////////////////////////////////////////
-        // Resources API
+        // Database API
         ///////////////////////////////////////////////////////////////////////
 
-        [domain=Resources] void cachedResources(out Object resources);
-        [domain=Resources] void resourceContent(in unsigned long frameId, in String url, in boolean base64Encode, out String content);
-        [notify, domain=Resources] void frameDetachedFromParent(out unsigned long frameId);
-
-        // FIXME: Introduce new StorageDomain.
-        [domain=Inspector] void getCookies(out Array cookies, out String cookiesString);
-        [domain=Inspector] void deleteCookie(in String cookieName, in String domain);
-#if defined(ENABLE_DATABASE) && ENABLE_DATABASE
         [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);
@@ -118,7 +119,13 @@ module core {
         [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
+
 #if defined(ENABLE_DOM_STORAGE) && ENABLE_DOM_STORAGE
+
+        ///////////////////////////////////////////////////////////////////////
+        // DOM Storage API
+        ///////////////////////////////////////////////////////////////////////
+
         [domain=DOMStorage] void getDOMStorageEntries(in long storageId, out Array entries);
         [domain=DOMStorage] void setDOMStorageItem(in long storageId, in String key, in String value, out boolean success);
         [domain=DOMStorage] void removeDOMStorageItem(in long storageId, in String key, out boolean success);
@@ -126,12 +133,24 @@ module core {
         [notify, domain=DOMStorage] void updateDOMStorage(out int storageId);
         [notify, domain=DOMStorage] void selectDOMStorage(out int storageId);
 #endif
+
 #if defined(ENABLE_OFFLINE_WEB_APPLICATIONS) && ENABLE_OFFLINE_WEB_APPLICATIONS
+
+        ///////////////////////////////////////////////////////////////////////
+        // AppCache API
+        ///////////////////////////////////////////////////////////////////////
+
         [domain=ApplicationCache] void getApplicationCaches(out Value applicationCaches);
         [notify, domain=ApplicationCache] void updateApplicationCacheStatus(out int status);
         [notify, domain=ApplicationCache] void updateNetworkState(out boolean isNowOnline);
 #endif
+
 #if defined(ENABLE_FILE_SYSTEM) && ENABLE_FILE_SYSTEM
+
+        ///////////////////////////////////////////////////////////////////////
+        // Filesystem API
+        ///////////////////////////////////////////////////////////////////////
+
         [domain=FileSystem] void getFileSystemPathAsync(in unsigned int type, in String origin);
         [domain=FileSystem] void revealFolderInOS(in String path);
 
@@ -203,8 +222,8 @@ module core {
         // Debugger API
         ///////////////////////////////////////////////////////////////////////
 
-        [domain=Backend] void enableDebugger(in boolean always);
-        [domain=Inspector] void disableDebugger(in boolean always); // FIXME: should be on the same domain as enableDebugger.
+        [domain=Inspector] void enableDebuggerFromFrontend(in boolean always);
+        [domain=Inspector] void disableDebugger(in boolean always);
         [notify, domain=Debugger] void debuggerWasEnabled();
         [notify, domain=Debugger] void debuggerWasDisabled();
 
diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp
deleted file mode 100644 (file)
index eb4c0e7..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "InspectorBackend.h"
-
-#if ENABLE(INSPECTOR)
-
-#if ENABLE(DATABASE)
-#include "Database.h"
-#endif
-
-#include "InjectedScript.h"
-#include "InjectedScriptHost.h"
-#include "InspectorController.h"
-#include "InspectorDOMAgent.h"
-#include "InspectorFrontend.h"
-#include "InspectorStorageAgent.h"
-#include "ScriptProfiler.h"
-#include "SerializedScriptValue.h"
-
-using namespace std;
-
-namespace WebCore {
-
-InspectorBackend::InspectorBackend(InspectorController* inspectorController)
-    : m_inspectorController(inspectorController)
-{
-}
-
-InspectorBackend::~InspectorBackend()
-{
-}
-
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-
-void InspectorBackend::enableDebugger(bool always)
-{
-    if (m_inspectorController)
-        m_inspectorController->enableDebuggerFromFrontend(always);
-}
-
-#endif
-
-void InspectorBackend::setInjectedScriptSource(const String& source)
-{
-     m_inspectorController->injectedScriptHost()->setInjectedScriptSource(source);
-}
-
-void InspectorBackend::dispatchOnInjectedScript(long injectedScriptId, const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException)
-{
-    if (!frontend())
-        return;
-
-    // FIXME: explicitly pass injectedScriptId along with node id to the frontend.
-    bool injectedScriptIdIsNodeId = injectedScriptId <= 0;
-
-    InjectedScript injectedScript;
-    if (injectedScriptIdIsNodeId)
-        injectedScript = m_inspectorController->injectedScriptForNodeId(-injectedScriptId);
-    else
-        injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptForId(injectedScriptId);
-
-    if (injectedScript.hasNoValue())
-        return;
-
-    injectedScript.dispatch(methodName, arguments, result, hadException);
-}
-
-void InspectorBackend::releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup)
-{
-    m_inspectorController->injectedScriptHost()->releaseWrapperObjectGroup(injectedScriptId, objectGroup);
-}
-
-#if ENABLE(DATABASE)
-void InspectorBackend::getDatabaseTableNames(long databaseId, RefPtr<InspectorArray>* names)
-{
-    Database* database = m_inspectorController->databaseForId(databaseId);
-    if (database) {
-        Vector<String> tableNames = database->tableNames();
-        unsigned length = tableNames.size();
-        for (unsigned i = 0; i < length; ++i)
-            (*names)->pushString(tableNames[i]);
-    }
-}
-
-void InspectorBackend::executeSQL(long databaseId, const String& query, bool* success, long* transactionId)
-{
-    Database* database = m_inspectorController->databaseForId(databaseId);
-    if (!m_inspectorController->m_storageAgent || !database) {
-        *success = false;
-        return;
-    }
-
-    *transactionId = m_inspectorController->m_storageAgent->executeSQL(database, query);
-    *success = true;
-}
-
-#endif
-
-InspectorFrontend* InspectorBackend::frontend()
-{
-    return m_inspectorController->m_frontend.get();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(INSPECTOR)
diff --git a/WebCore/inspector/InspectorBackend.h b/WebCore/inspector/InspectorBackend.h
deleted file mode 100644 (file)
index 1fcec96..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef InspectorBackend_h
-#define InspectorBackend_h
-
-#include "Console.h"
-#include "InspectorController.h"
-#include "PlatformString.h"
-
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
-class InspectorApplicationCacheAgent;
-class InspectorDOMAgent;
-class InspectorFrontend;
-
-class InspectorBackend : public RefCounted<InspectorBackend>
-{
-public:
-    static PassRefPtr<InspectorBackend> create(InspectorController* inspectorController)
-    {
-        return adoptRef(new InspectorBackend(inspectorController));
-    }
-
-    ~InspectorBackend();
-
-    InspectorController* inspectorController() { return m_inspectorController; }
-    InspectorDOMAgent* inspectorDOMAgent() { return m_inspectorController->domAgent(); }
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-    InspectorApplicationCacheAgent* inspectorApplicationCacheAgent() { return m_inspectorController->applicationCacheAgent(); }
-#endif
-    void disconnectController() { m_inspectorController = 0; }
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-    void enableDebugger(bool always);
-#endif
-
-    void setInjectedScriptSource(const String& source);
-    void dispatchOnInjectedScript(long injectedScriptId, const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException);
-
-    // Generic code called from custom implementations.
-    void releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup);
-
-#if ENABLE(DATABASE)
-    void getDatabaseTableNames(long databaseId, RefPtr<InspectorArray>* names);
-    void executeSQL(long databaseId, const String& query, bool* success, long* transactionId);
-#endif
-
-private:
-    InspectorBackend(InspectorController* inspectorController);
-    InspectorFrontend* frontend();
-
-    InspectorController* m_inspectorController;
-};
-
-} // namespace WebCore
-
-#endif // !defined(InspectorBackend_h)
index 8b08598..7248dc9 100644 (file)
@@ -57,7 +57,6 @@
 #include "HitTestResult.h"
 #include "InjectedScript.h"
 #include "InjectedScriptHost.h"
-#include "InspectorBackend.h"
 #include "InspectorBackendDispatcher.h"
 #include "InspectorCSSAgent.h"
 #include "InspectorClient.h"
@@ -71,7 +70,6 @@
 #include "InspectorProfilerAgent.h"
 #include "InspectorResourceAgent.h"
 #include "InspectorState.h"
-#include "InspectorStorageAgent.h"
 #include "InspectorTimelineAgent.h"
 #include "InspectorValues.h"
 #include "InspectorWorkerResource.h"
 
 #if ENABLE(DATABASE)
 #include "Database.h"
+#include "InspectorDatabaseAgent.h"
+#endif
+
+#if ENABLE(DOM_STORAGE)
+#include "InspectorDOMStorageAgent.h"
+#include "Storage.h"
+#include "StorageArea.h"
 #endif
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
 #include "InspectorFileSystemAgent.h"
 #endif
 
-#if ENABLE(DOM_STORAGE)
-#include "Storage.h"
-#include "StorageArea.h"
-#endif
-
 using namespace std;
 
 namespace WebCore {
@@ -144,7 +144,6 @@ InspectorController::InspectorController(Page* page, InspectorClient* client)
     , m_expiredConsoleMessageCount(0)
     , m_previousMessage(0)
     , m_settingsLoaded(false)
-    , m_inspectorBackend(InspectorBackend::create(this))
     , m_inspectorBackendDispatcher(new InspectorBackendDispatcher(this))
     , m_injectedScriptHost(InjectedScriptHost::create(this))
 #if ENABLE(JAVASCRIPT_DEBUGGER)
@@ -167,7 +166,6 @@ InspectorController::~InspectorController()
 
     releaseFrontendLifetimeAgents();
 
-    m_inspectorBackend->disconnectController();
     m_injectedScriptHost->disconnectController();
 }
 
@@ -476,7 +474,11 @@ void InspectorController::connectFrontend()
     m_cssAgent->setDOMAgent(m_domAgent.get());
 
 #if ENABLE(DATABASE)
-    m_storageAgent = InspectorStorageAgent::create(m_frontend.get());
+    m_databaseAgent = InspectorDatabaseAgent::create(&m_databaseResources, m_frontend.get());
+#endif
+
+#if ENABLE(DOM_STORAGE)
+    m_domStorageAgent = InspectorDOMStorageAgent::create(&m_domStorageResources, m_frontend.get());
 #endif
 
     if (m_timelineAgent)
@@ -592,9 +594,13 @@ void InspectorController::releaseFrontendLifetimeAgents()
     m_domAgent.clear();
 
 #if ENABLE(DATABASE)
-    if (m_storageAgent)
-        m_storageAgent->clearFrontend();
-    m_storageAgent.clear();
+    if (m_databaseAgent)
+        m_databaseAgent->clearFrontend();
+    m_databaseAgent.clear();
+#endif
+
+#if ENABLE(DOM_STORAGE)
+    m_domStorageAgent.clear();
 #endif
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
@@ -1035,27 +1041,6 @@ void InspectorController::didDestroyWorker(intptr_t id)
 #endif // ENABLE(WORKERS)
 
 #if ENABLE(DATABASE)
-void InspectorController::selectDatabase(Database* database)
-{
-    if (!m_frontend)
-        return;
-
-    for (DatabaseResourcesMap::iterator it = m_databaseResources.begin(); it != m_databaseResources.end(); ++it) {
-        if (it->second->database() == database) {
-            m_frontend->selectDatabase(it->first);
-            break;
-        }
-    }
-}
-
-Database* InspectorController::databaseForId(long databaseId)
-{
-    DatabaseResourcesMap::iterator it = m_databaseResources.find(databaseId);
-    if (it == m_databaseResources.end())
-        return 0;
-    return it->second->database();
-}
-
 void InspectorController::didOpenDatabase(PassRefPtr<Database> database, const String& domain, const String& name, const String& version)
 {
     if (!enabled())
@@ -1175,71 +1160,6 @@ void InspectorController::didUseDOMStorage(StorageArea* storageArea, bool isLoca
     if (m_frontend)
         resource->bind(m_frontend.get());
 }
-
-void InspectorController::selectDOMStorage(Storage* storage)
-{
-    ASSERT(storage);
-    if (!m_frontend)
-        return;
-
-    Frame* frame = storage->frame();
-    ExceptionCode ec = 0;
-    bool isLocalStorage = (frame->domWindow()->localStorage(ec) == storage && !ec);
-    long storageResourceId = 0;
-    DOMStorageResourcesMap::iterator domStorageEnd = m_domStorageResources.end();
-    for (DOMStorageResourcesMap::iterator it = m_domStorageResources.begin(); it != domStorageEnd; ++it) {
-        if (it->second->isSameHostAndType(frame, isLocalStorage)) {
-            storageResourceId = it->first;
-            break;
-        }
-    }
-    if (storageResourceId)
-        m_frontend->selectDOMStorage(storageResourceId);
-}
-
-void InspectorController::getDOMStorageEntries(long storageId, RefPtr<InspectorArray>* entries)
-{
-    InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
-    if (storageResource) {
-        storageResource->startReportingChangesToFrontend();
-        Storage* domStorage = storageResource->domStorage();
-        for (unsigned i = 0; i < domStorage->length(); ++i) {
-            String name(domStorage->key(i));
-            String value(domStorage->getItem(name));
-            RefPtr<InspectorArray> entry = InspectorArray::create();
-            entry->pushString(name);
-            entry->pushString(value);
-            (*entries)->pushArray(entry);
-        }
-    }
-}
-
-void InspectorController::setDOMStorageItem(long storageId, const String& key, const String& value, bool* success)
-{
-    InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
-    if (storageResource) {
-        ExceptionCode exception = 0;
-        storageResource->domStorage()->setItem(key, value, exception);
-        *success = !exception;
-    }
-}
-
-void InspectorController::removeDOMStorageItem(long storageId, const String& key, bool* success)
-{
-    InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
-    if (storageResource) {
-        storageResource->domStorage()->removeItem(key);
-        *success = true;
-    }
-}
-
-InspectorDOMStorageResource* InspectorController::getDOMStorageResourceForId(long storageId)
-{
-    DOMStorageResourcesMap::iterator it = m_domStorageResources.find(storageId);
-    if (it == m_domStorageResources.end())
-        return 0;
-    return it->second.get();
-}
 #endif
 
 #if ENABLE(WEB_SOCKETS)
@@ -1507,6 +1427,36 @@ bool InspectorController::hasXHRBreakpoint(const String& url, String* breakpoint
 
 #endif
 
+void InspectorController::setInjectedScriptSource(const String& source)
+{
+     injectedScriptHost()->setInjectedScriptSource(source);
+}
+
+void InspectorController::dispatchOnInjectedScript(long injectedScriptId, const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException)
+{
+    if (!m_frontend)
+        return;
+
+    // FIXME: explicitly pass injectedScriptId along with node id to the frontend.
+    bool injectedScriptIdIsNodeId = injectedScriptId <= 0;
+
+    InjectedScript injectedScript;
+    if (injectedScriptIdIsNodeId)
+        injectedScript = injectedScriptForNodeId(-injectedScriptId);
+    else
+        injectedScript = injectedScriptHost()->injectedScriptForId(injectedScriptId);
+
+    if (injectedScript.hasNoValue())
+        return;
+
+    injectedScript.dispatch(methodName, arguments, result, hadException);
+}
+
+void InspectorController::releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup)
+{
+    injectedScriptHost()->releaseWrapperObjectGroup(injectedScriptId, objectGroup);
+}
+
 void InspectorController::evaluateForTestInFrontend(long callId, const String& script)
 {
     if (m_frontend)
index e570c98..481344d 100644 (file)
@@ -56,12 +56,13 @@ class HitTestResult;
 class InjectedScript;
 class InjectedScriptHost;
 class InspectorArray;
-class InspectorBackend;
 class InspectorBackendDispatcher;
 class InspectorClient;
 class InspectorCSSAgent;
 class InspectorDOMAgent;
+class InspectorDOMStorageAgent;
 class InspectorDOMStorageResource;
+class InspectorDatabaseAgent;
 class InspectorDatabaseResource;
 class InspectorDebuggerAgent;
 class InspectorFrontend;
@@ -85,7 +86,6 @@ class ScriptArguments;
 class ScriptCallStack;
 class ScriptProfile;
 class SharedBuffer;
-class Storage;
 class StorageArea;
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
@@ -103,9 +103,6 @@ class WebSocketHandshakeResponse;
 
 class InspectorController : public Noncopyable {
 public:
-    typedef HashMap<int, RefPtr<InspectorDatabaseResource> > DatabaseResourcesMap;
-    typedef HashMap<int, RefPtr<InspectorDOMStorageResource> > DOMStorageResourcesMap;
-
     static const char* const ConsolePanel;
     static const char* const ElementsPanel;
     static const char* const ProfilesPanel;
@@ -114,7 +111,6 @@ public:
     InspectorController(Page*, InspectorClient*);
     ~InspectorController();
 
-    InspectorBackend* inspectorBackend() { return m_inspectorBackend.get(); }
     InspectorBackendDispatcher* inspectorBackendDispatcher() { return m_inspectorBackendDispatcher.get(); }
     InspectorClient* inspectorClient() { return m_client; }
     InjectedScriptHost* injectedScriptHost() { return m_injectedScriptHost.get(); }
@@ -189,10 +185,6 @@ public:
     InspectorApplicationCacheAgent* applicationCacheAgent() { return m_applicationCacheAgent.get(); }
 #endif
 
-#if ENABLE(FILE_SYSTEM)
-    InspectorFileSystemAgent* fileSystemAgent() { return m_fileSystemAgent.get(); }
-#endif 
-
     void mainResourceFiredLoadEvent(DocumentLoader*, const KURL&);
     void mainResourceFiredDOMContentEvent(DocumentLoader*, const KURL&);
 
@@ -207,13 +199,11 @@ public:
 #if ENABLE(DATABASE)
     void didOpenDatabase(PassRefPtr<Database>, const String& domain, const String& name, const String& version);
 #endif
+
 #if ENABLE(DOM_STORAGE)
     void didUseDOMStorage(StorageArea* storageArea, bool isLocalStorage, Frame* frame);
-    void selectDOMStorage(Storage* storage);
-    void getDOMStorageEntries(long storageId, RefPtr<InspectorArray>* entries);
-    void setDOMStorageItem(long storageId, const String& key, const String& value, bool* success);
-    void removeDOMStorageItem(long storageId, const String& key, bool* success);
 #endif
+
 #if ENABLE(WEB_SOCKETS)
     void didCreateWebSocket(unsigned long identifier, const KURL& requestURL, const KURL& documentURL);
     void willSendWebSocketHandshakeRequest(unsigned long identifier, const WebSocketHandshakeRequest&);
@@ -250,12 +240,10 @@ public:
     void enableProfiler(bool always = false, bool skipRecompile = false);
     void disableProfiler(bool always = false);
     bool profilerEnabled() const;
-    InspectorProfilerAgent* profilerAgent() const { return m_profilerAgent.get(); }
 
     void enableDebugger();
     void disableDebugger(bool always = false);
     bool debuggerEnabled() const { return m_debuggerAgent; }
-    InspectorDebuggerAgent* debuggerAgent() const { return m_debuggerAgent.get(); }
     void resume();
 
     void setStickyBreakpoints(PassRefPtr<InspectorObject> breakpoints);
@@ -267,6 +255,12 @@ public:
     bool hasXHRBreakpoint(const String& url, String* breakpointURL);
 #endif
 
+    void setInjectedScriptSource(const String& source);
+    void dispatchOnInjectedScript(long injectedScriptId, const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException);
+
+    // Generic code called from custom implementations.
+    void releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup);
+
     void evaluateForTestInFrontend(long testCallId, const String& script);
 
     InjectedScript injectedScriptForNodeId(long id);
@@ -306,8 +300,6 @@ private:
     void setSearchingForNode(bool enabled, bool* newState);
 
     void setMonitoringXHREnabled(bool enabled, bool* newState);
-    InspectorCSSAgent* cssAgent() { return m_cssAgent.get(); }
-    InspectorDOMAgent* domAgent() { return m_domAgent.get(); }
     void releaseFrontendLifetimeAgents();
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
@@ -316,13 +308,6 @@ private:
     void restoreStickyBreakpoints();
     void restoreStickyBreakpoint(PassRefPtr<InspectorObject> breakpoint);
 #endif
-#if ENABLE(DATABASE)
-    void selectDatabase(Database* database);
-    Database* databaseForId(long databaseId);
-#endif
-#if ENABLE(DOM_STORAGE)
-    InspectorDOMStorageResource* getDOMStorageResourceForId(long storageId);
-#endif
 
     PassRefPtr<InspectorObject> buildObjectForCookie(const Cookie&);
     PassRefPtr<InspectorArray> buildArrayForCookies(ListHashSet<Cookie>&);
@@ -342,7 +327,15 @@ private:
     OwnPtr<InspectorFrontend> m_frontend;
     OwnPtr<InspectorCSSAgent> m_cssAgent;
     RefPtr<InspectorDOMAgent> m_domAgent;
-    RefPtr<InspectorStorageAgent> m_storageAgent;
+
+#if ENABLE(DATABASE)
+    RefPtr<InspectorDatabaseAgent> m_databaseAgent;
+#endif
+
+#if ENABLE(DOM_STORAGE)
+    RefPtr<InspectorDOMStorageAgent> m_domStorageAgent;
+#endif
+
     OwnPtr<InspectorTimelineAgent> m_timelineAgent;
     OwnPtr<InspectorState> m_state;
 
@@ -361,17 +354,20 @@ private:
     unsigned m_expiredConsoleMessageCount;
     HashMap<String, double> m_times;
     HashMap<String, unsigned> m_counts;
+
 #if ENABLE(DATABASE)
+    typedef HashMap<int, RefPtr<InspectorDatabaseResource> > DatabaseResourcesMap;
     DatabaseResourcesMap m_databaseResources;
 #endif
 #if ENABLE(DOM_STORAGE)
+    typedef HashMap<int, RefPtr<InspectorDOMStorageResource> > DOMStorageResourcesMap;
     DOMStorageResourcesMap m_domStorageResources;
 #endif
+
     String m_showAfterVisible;
     RefPtr<Node> m_highlightedNode;
     ConsoleMessage* m_previousMessage;
     bool m_settingsLoaded;
-    RefPtr<InspectorBackend> m_inspectorBackend;
     OwnPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
     RefPtr<InjectedScriptHost> m_injectedScriptHost;
 
diff --git a/WebCore/inspector/InspectorDOMStorageAgent.cpp b/WebCore/inspector/InspectorDOMStorageAgent.cpp
new file mode 100644 (file)
index 0000000..2241a16
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "InspectorDOMStorageAgent.h"
+
+#if ENABLE(INSPECTOR) && ENABLE(DOM_STORAGE)
+
+#include "Database.h"
+#include "DOMWindow.h"
+#include "ExceptionCode.h"
+#include "Frame.h"
+#include "InspectorDOMStorageResource.h"
+#include "InspectorFrontend.h"
+#include "InspectorValues.h"
+#include "Storage.h"
+#include "VoidCallback.h"
+
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+InspectorDOMStorageAgent::~InspectorDOMStorageAgent()
+{
+}
+
+void InspectorDOMStorageAgent::getDOMStorageEntries(long storageId, RefPtr<InspectorArray>* entries)
+{
+    InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
+    if (storageResource) {
+        storageResource->startReportingChangesToFrontend();
+        Storage* domStorage = storageResource->domStorage();
+        for (unsigned i = 0; i < domStorage->length(); ++i) {
+            String name(domStorage->key(i));
+            String value(domStorage->getItem(name));
+            RefPtr<InspectorArray> entry = InspectorArray::create();
+            entry->pushString(name);
+            entry->pushString(value);
+            (*entries)->pushArray(entry);
+        }
+    }
+}
+
+void InspectorDOMStorageAgent::setDOMStorageItem(long storageId, const String& key, const String& value, bool* success)
+{
+    InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
+    if (storageResource) {
+        ExceptionCode exception = 0;
+        storageResource->domStorage()->setItem(key, value, exception);
+        *success = !exception;
+    }
+}
+
+void InspectorDOMStorageAgent::removeDOMStorageItem(long storageId, const String& key, bool* success)
+{
+    InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
+    if (storageResource) {
+        storageResource->domStorage()->removeItem(key);
+        *success = true;
+    }
+}
+
+void InspectorDOMStorageAgent::selectDOMStorage(Storage* storage)
+{
+    ASSERT(storage);
+    if (!m_frontend)
+        return;
+
+    Frame* frame = storage->frame();
+    ExceptionCode ec = 0;
+    bool isLocalStorage = (frame->domWindow()->localStorage(ec) == storage && !ec);
+    long storageResourceId = 0;
+    DOMStorageResourcesMap::iterator domStorageEnd = m_domStorageResources->end();
+    for (DOMStorageResourcesMap::iterator it = m_domStorageResources->begin(); it != domStorageEnd; ++it) {
+        if (it->second->isSameHostAndType(frame, isLocalStorage)) {
+            storageResourceId = it->first;
+            break;
+        }
+    }
+    if (storageResourceId)
+        m_frontend->selectDOMStorage(storageResourceId);
+}
+
+InspectorDOMStorageAgent::InspectorDOMStorageAgent(DOMStorageResourcesMap* domStorageResources, InspectorFrontend* frontend)
+    : m_domStorageResources(domStorageResources)
+    , m_frontend(frontend)
+{
+}
+
+InspectorDOMStorageResource* InspectorDOMStorageAgent::getDOMStorageResourceForId(long storageId)
+{
+    DOMStorageResourcesMap::iterator it = m_domStorageResources->find(storageId);
+    if (it == m_domStorageResources->end())
+        return 0;
+    return it->second.get();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR) && ENABLE(DOM_STORE)
diff --git a/WebCore/inspector/InspectorDOMStorageAgent.h b/WebCore/inspector/InspectorDOMStorageAgent.h
new file mode 100644 (file)
index 0000000..bdfd7cb
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InspectorDOMStorageAgent_h
+#define InspectorDOMStorageAgent_h
+
+#include "PlatformString.h"
+#include "wtf/HashMap.h"
+#include "wtf/PassRefPtr.h"
+
+namespace WebCore {
+
+class InspectorArray;
+class InspectorController;
+class InspectorDOMStorageResource;
+class InspectorFrontend;
+class Storage;
+
+class InspectorDOMStorageAgent : public RefCounted<InspectorDOMStorageAgent> {
+public:
+    typedef HashMap<int, RefPtr<InspectorDOMStorageResource> > DOMStorageResourcesMap;
+
+    static PassRefPtr<InspectorDOMStorageAgent> create(DOMStorageResourcesMap* domStorageResources, InspectorFrontend* frontend)
+    {
+        return adoptRef(new InspectorDOMStorageAgent(domStorageResources, frontend));
+    }
+
+    virtual ~InspectorDOMStorageAgent();
+
+    // Called from the front-end.
+    void getDOMStorageEntries(long storageId, RefPtr<InspectorArray>* entries);
+    void setDOMStorageItem(long storageId, const String& key, const String& value, bool* success);
+    void removeDOMStorageItem(long storageId, const String& key, bool* success);
+
+    // Called from the injected script.
+    void selectDOMStorage(Storage* storage);
+
+    InspectorFrontend* frontend() { return m_frontend; }
+
+private:
+    InspectorDOMStorageAgent(DOMStorageResourcesMap*, InspectorFrontend*);
+
+    InspectorDOMStorageResource* getDOMStorageResourceForId(long storageId);
+
+    DOMStorageResourcesMap* m_domStorageResources;
+    InspectorFrontend* m_frontend;
+};
+
+} // namespace WebCore
+
+#endif // !defined(InspectorDOMStorageAgent_h)
similarity index 73%
rename from WebCore/inspector/InspectorStorageAgent.cpp
rename to WebCore/inspector/InspectorDatabaseAgent.cpp
index 1f565fa..88db3ae 100644 (file)
 
 #include "config.h"
 
-#include "InspectorStorageAgent.h"
+#include "InspectorDatabaseAgent.h"
 
 #if ENABLE(INSPECTOR) && ENABLE(DATABASE)
 
 #include "Database.h"
 #include "ExceptionCode.h"
 #include "InspectorFrontend.h"
+#include "InspectorController.h"
+#include "InspectorDatabaseResource.h"
 #include "InspectorValues.h"
 #include "SQLError.h"
 #include "SQLStatementCallback.h"
@@ -54,7 +56,7 @@ namespace {
 
 long lastTransactionId = 0;
 
-void reportTransactionFailed(InspectorStorageAgent* agent, long transactionId, SQLError* error)
+void reportTransactionFailed(InspectorDatabaseAgent* agent, long transactionId, SQLError* error)
 {
     if (!agent->frontend())
         return;
@@ -66,7 +68,7 @@ void reportTransactionFailed(InspectorStorageAgent* agent, long transactionId, S
 
 class StatementCallback : public SQLStatementCallback {
 public:
-    static PassRefPtr<StatementCallback> create(long transactionId, PassRefPtr<InspectorStorageAgent> agent)
+    static PassRefPtr<StatementCallback> create(long transactionId, PassRefPtr<InspectorDatabaseAgent> agent)
     {
         return adoptRef(new StatementCallback(transactionId, agent));
     }
@@ -100,16 +102,16 @@ public:
     }
 
 private:
-    StatementCallback(long transactionId, PassRefPtr<InspectorStorageAgent> agent)
+    StatementCallback(long transactionId, PassRefPtr<InspectorDatabaseAgent> agent)
         : m_transactionId(transactionId)
         , m_agent(agent) { }
     long m_transactionId;
-    RefPtr<InspectorStorageAgent> m_agent;
+    RefPtr<InspectorDatabaseAgent> m_agent;
 };
 
 class StatementErrorCallback : public SQLStatementErrorCallback {
 public:
-    static PassRefPtr<StatementErrorCallback> create(long transactionId, PassRefPtr<InspectorStorageAgent> agent)
+    static PassRefPtr<StatementErrorCallback> create(long transactionId, PassRefPtr<InspectorDatabaseAgent> agent)
     {
         return adoptRef(new StatementErrorCallback(transactionId, agent));
     }
@@ -123,16 +125,16 @@ public:
     }
 
 private:
-    StatementErrorCallback(long transactionId, RefPtr<InspectorStorageAgent> agent)
+    StatementErrorCallback(long transactionId, RefPtr<InspectorDatabaseAgent> agent)
         : m_transactionId(transactionId)
         , m_agent(agent) { }
     long m_transactionId;
-    RefPtr<InspectorStorageAgent> m_agent;
+    RefPtr<InspectorDatabaseAgent> m_agent;
 };
 
 class TransactionCallback : public SQLTransactionCallback {
 public:
-    static PassRefPtr<TransactionCallback> create(const String& sqlStatement, long transactionId, PassRefPtr<InspectorStorageAgent> agent)
+    static PassRefPtr<TransactionCallback> create(const String& sqlStatement, long transactionId, PassRefPtr<InspectorDatabaseAgent> agent)
     {
         return adoptRef(new TransactionCallback(sqlStatement, transactionId, agent));
     }
@@ -152,18 +154,18 @@ public:
         return true;
     }
 private:
-    TransactionCallback(const String& sqlStatement, long transactionId, PassRefPtr<InspectorStorageAgent> agent)
+    TransactionCallback(const String& sqlStatement, long transactionId, PassRefPtr<InspectorDatabaseAgent> agent)
         : m_sqlStatement(sqlStatement)
         , m_transactionId(transactionId)
         , m_agent(agent) { }
     String m_sqlStatement;
     long m_transactionId;
-    RefPtr<InspectorStorageAgent> m_agent;
+    RefPtr<InspectorDatabaseAgent> m_agent;
 };
 
 class TransactionErrorCallback : public SQLTransactionErrorCallback {
 public:
-    static PassRefPtr<TransactionErrorCallback> create(long transactionId, PassRefPtr<InspectorStorageAgent> agent)
+    static PassRefPtr<TransactionErrorCallback> create(long transactionId, PassRefPtr<InspectorDatabaseAgent> agent)
     {
         return adoptRef(new TransactionErrorCallback(transactionId, agent));
     }
@@ -176,11 +178,11 @@ public:
         return true;
     }
 private:
-    TransactionErrorCallback(long transactionId, PassRefPtr<InspectorStorageAgent> agent)
+    TransactionErrorCallback(long transactionId, PassRefPtr<InspectorDatabaseAgent> agent)
         : m_transactionId(transactionId)
         , m_agent(agent) { }
     long m_transactionId;
-    RefPtr<InspectorStorageAgent> m_agent;
+    RefPtr<InspectorDatabaseAgent> m_agent;
 };
 
 class TransactionSuccessCallback : public VoidCallback {
@@ -200,30 +202,69 @@ private:
 
 } // namespace
 
-InspectorStorageAgent::InspectorStorageAgent(InspectorFrontend* frontend)
-    : m_frontend(frontend)
+InspectorDatabaseAgent::~InspectorDatabaseAgent()
 {
 }
 
-InspectorStorageAgent::~InspectorStorageAgent()
+void InspectorDatabaseAgent::getDatabaseTableNames(long databaseId, RefPtr<InspectorArray>* names)
 {
+    Database* database = databaseForId(databaseId);
+    if (database) {
+        Vector<String> tableNames = database->tableNames();
+        unsigned length = tableNames.size();
+        for (unsigned i = 0; i < length; ++i)
+            (*names)->pushString(tableNames[i]);
+    }
 }
 
-long InspectorStorageAgent::executeSQL(Database* database, const String& query)
+void InspectorDatabaseAgent::executeSQL(long databaseId, const String& query, bool* success, long* transactionId)
 {
-    long transactionId = ++lastTransactionId;
-    RefPtr<SQLTransactionCallback> callback(TransactionCallback::create(query, transactionId, this));
-    RefPtr<SQLTransactionErrorCallback> errorCallback(TransactionErrorCallback::create(transactionId, this));
+    Database* database = databaseForId(databaseId);
+    if (!database) {
+        *success = false;
+        return;
+    }
+
+    *transactionId = ++lastTransactionId;
+    RefPtr<SQLTransactionCallback> callback(TransactionCallback::create(query, *transactionId, this));
+    RefPtr<SQLTransactionErrorCallback> errorCallback(TransactionErrorCallback::create(*transactionId, this));
     RefPtr<VoidCallback> successCallback(TransactionSuccessCallback::create());
     database->transaction(callback.release(), errorCallback.release(), successCallback.release());
-    return transactionId;
+    *success = true;
 }
 
-void InspectorStorageAgent::clearFrontend()
+Database* InspectorDatabaseAgent::databaseForId(long databaseId)
+{
+    DatabaseResourcesMap::iterator it = m_databaseResources->find(databaseId);
+    if (it == m_databaseResources->end())
+        return 0;
+    return it->second->database();
+}
+
+void InspectorDatabaseAgent::selectDatabase(Database* database)
+{
+    if (!m_frontend)
+        return;
+
+    for (DatabaseResourcesMap::iterator it = m_databaseResources->begin(); it != m_databaseResources->end(); ++it) {
+        if (it->second->database() == database) {
+            m_frontend->selectDatabase(it->first);
+            break;
+        }
+    }
+}
+
+void InspectorDatabaseAgent::clearFrontend()
 {
     m_frontend = 0;
 }
 
+InspectorDatabaseAgent::InspectorDatabaseAgent(DatabaseResourcesMap* databaseResources, InspectorFrontend* frontend)
+    : m_databaseResources(databaseResources)
+    , m_frontend(frontend)
+{
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR) && ENABLE(DATABASE)
similarity index 63%
rename from WebCore/inspector/InspectorStorageAgent.h
rename to WebCore/inspector/InspectorDatabaseAgent.h
index b1ceee4..c73d3c8 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef InspectorStorageAgent_h
-#define InspectorStorageAgent_h
+#ifndef InspectorDatabaseAgent_h
+#define InspectorDatabaseAgent_h
 
 #include "PlatformString.h"
+#include "wtf/HashMap.h"
 #include "wtf/PassRefPtr.h"
 
 namespace WebCore {
 
 class Database;
+class InspectorArray;
+class InspectorController;
+class InspectorDatabaseResource;
 class InspectorFrontend;
 
-class InspectorStorageAgent : public RefCounted<InspectorStorageAgent> {
+class InspectorDatabaseAgent : public RefCounted<InspectorDatabaseAgent> {
 public:
-    static PassRefPtr<InspectorStorageAgent> create(InspectorFrontend* frontend)
+    typedef HashMap<int, RefPtr<InspectorDatabaseResource> > DatabaseResourcesMap;
+
+    static PassRefPtr<InspectorDatabaseAgent> create(DatabaseResourcesMap* databaseResources, InspectorFrontend* frontend)
     {
-        return adoptRef(new InspectorStorageAgent(frontend));
+        return adoptRef(new InspectorDatabaseAgent(databaseResources, frontend));
     }
 
-    virtual ~InspectorStorageAgent();
+    virtual ~InspectorDatabaseAgent();
+
+    // Called from the front-end.
+    void getDatabaseTableNames(long databaseId, RefPtr<InspectorArray>* names);
+    void executeSQL(long databaseId, const String& query, bool* success, long* transactionId);
 
-    long executeSQL(Database*, const String& query);
+    // Called from the injected script.
+    Database* databaseForId(long databaseId);
+    void selectDatabase(Database* database);
 
     InspectorFrontend* frontend() { return m_frontend; }
     void clearFrontend();
 
 private:
-    InspectorStorageAgent(InspectorFrontend*);
+    InspectorDatabaseAgent(DatabaseResourcesMap*, InspectorFrontend*);
 
+    DatabaseResourcesMap* m_databaseResources;
     InspectorFrontend* m_frontend;
 };
 
 } // namespace WebCore
 
-#endif // !defined(InspectorStorageAgent_h)
+#endif // !defined(InspectorDatabaseAgent_h)
index fd44404..138bbda 100644 (file)
@@ -220,7 +220,7 @@ WebInspector.ScriptsPanel.prototype = {
             this.visibleView.show(this.viewsContainerElement);
 
         if (this._attachDebuggerWhenShown) {
-            InspectorBackend.enableDebugger(false);
+            InspectorBackend.enableDebuggerFromFrontend(false);
             delete this._attachDebuggerWhenShown;
         }
     },
@@ -392,7 +392,7 @@ WebInspector.ScriptsPanel.prototype = {
     attachDebuggerWhenShown: function()
     {
         if (this.element.parentElement) {
-            InspectorBackend.enableDebugger(false);
+            InspectorBackend.enableDebuggerFromFrontend(false);
         } else {
             this._attachDebuggerWhenShown = true;
         }
@@ -862,7 +862,7 @@ WebInspector.ScriptsPanel.prototype = {
         if (this._debuggerEnabled)
             InspectorBackend.disableDebugger(true);
         else
-            InspectorBackend.enableDebugger(!!optionalAlways);
+            InspectorBackend.enableDebuggerFromFrontend(!!optionalAlways);
     },
 
     _togglePauseOnExceptions: function()
index 345e43e..caeffb6 100644 (file)
@@ -38,7 +38,6 @@
 #include "Document.h"
 #include "Event.h"
 #include "Frame.h"
-#include "InspectorBackend.h"
 #include "InspectorController.h"
 #include "InspectorFrontendClientImpl.h"
 #include "InspectorFrontendHost.h"