2010-12-29 Pavel Feldman <pfeldman@chromium.org>
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Dec 2010 22:22:10 +0000 (22:22 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Dec 2010 22:22:10 +0000 (22:22 +0000)
        Not reviewed: revert r74755 and 74757.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@74761 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 [new file with mode: 0644]
WebCore/inspector/InspectorBackend.h [new file with mode: 0644]
WebCore/inspector/InspectorController.cpp
WebCore/inspector/InspectorController.h
WebCore/inspector/InspectorDOMStorageAgent.cpp [deleted file]
WebCore/inspector/InspectorDOMStorageAgent.h [deleted file]
WebCore/inspector/InspectorStorageAgent.cpp [moved from WebCore/inspector/InspectorDatabaseAgent.cpp with 73% similarity]
WebCore/inspector/InspectorStorageAgent.h [moved from WebCore/inspector/InspectorDatabaseAgent.h with 63% similarity]
WebCore/inspector/front-end/ScriptsPanel.js
WebKit/chromium/src/WebDevToolsFrontendImpl.cpp

index 8856ae7..a5d8dfc 100644 (file)
@@ -44,7 +44,7 @@ Tests that InspectorBackendDispatcher is catching incorrect messages.
 }
 {
     seq : 2
-    domain : "Network"
+    domain : "Resources"
     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 : "Network"
+    domain : "Resources"
     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 : "Network"
+    domain : "Resources"
     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 : "Network"
+    domain : "Resources"
     success : false
     errors : {
         0 : "Protocol Error: Argument 'frameId' with type 'Number' was not found."
index 1876b36..02d87b7 100644 (file)
@@ -1153,13 +1153,12 @@ 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
@@ -1171,6 +1170,7 @@ 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 4990394..36aaa17 100644 (file)
@@ -1,3 +1,7 @@
+2010-12-29  Pavel Feldman  <pfeldman@chromium.org>
+
+        Not reviewed: revert r74755 and 74757.
+
 2010-12-29  Martin Robinson  <mrobinson@igalia.com>
 
         Reviewed by Sam Weinig.
index b0dbe65..f108f86 100644 (file)
@@ -1945,22 +1945,20 @@ 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 \
@@ -1978,6 +1976,8 @@ 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 ca94101..f62d883 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 0c5c01c..aac760a 100644 (file)
@@ -1039,14 +1039,13 @@ 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 \
@@ -1055,6 +1054,7 @@ SOURCES += \
     inspector/InspectorProfilerAgent.cpp \
     inspector/InspectorResourceAgent.cpp \
     inspector/InspectorState.cpp \
+    inspector/InspectorStorageAgent.cpp \
     inspector/InspectorStyleSheet.cpp \
     inspector/InspectorTimelineAgent.cpp \
     inspector/InspectorValues.cpp \
@@ -1930,12 +1930,11 @@ 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 \
@@ -1945,6 +1944,7 @@ HEADERS += \
     inspector/InspectorProfilerAgent.h \
     inspector/InspectorResourceAgent.h \
     inspector/InspectorState.h \
+    inspector/InspectorStorageAgent.h \
     inspector/InspectorStyleSheet.h \
     inspector/InspectorTimelineAgent.h \
     inspector/ScriptGCEventListener.h \
index c5d26db..ede14b2 100755 (executable)
                                >
                        </File>
                        <File
-                               RelativePath="..\inspector\InspectorClient.cpp"
+                               RelativePath="..\inspector\InspectorBackend.cpp"
                                >
                        </File>
                        <File
-                               RelativePath="..\inspector\InspectorClient.h"
+                               RelativePath="..\inspector\InspectorBackend.h"
                                >
                        </File>
                        <File
-                               RelativePath="..\inspector\InspectorController.cpp"
+                               RelativePath="..\inspector\InspectorClient.cpp"
                                >
                        </File>
                        <File
-                               RelativePath="..\inspector\InspectorController.h"
+                               RelativePath="..\inspector\InspectorClient.h"
                                >
                        </File>
                        <File
-                               RelativePath="..\inspector\InspectorCSSAgent.cpp"
+                               RelativePath="..\inspector\InspectorController.cpp"
                                >
                        </File>
                        <File
-                               RelativePath="..\inspector\InspectorCSSAgent.h"
+                               RelativePath="..\inspector\InspectorController.h"
                                >
                        </File>
                        <File
-                               RelativePath="..\inspector\InspectorDatabaseAgent.cpp"
+                               RelativePath="..\inspector\InspectorCSSAgent.cpp"
                                >
                        </File>
                        <File
-                               RelativePath="..\inspector\InspectorDatabaseAgent.h"
+                               RelativePath="..\inspector\InspectorCSSAgent.h"
                                >
                        </File>
                        <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 82415f7..11d6f67 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 /* InspectorDOMStorageAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A74ECB8101839A500BF939E /* InspectorDOMStorageAgent.cpp */; };
-               7A74ECBB101839A600BF939E /* InspectorDOMStorageAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A74ECB9101839A600BF939E /* InspectorDOMStorageAgent.h */; };
+               7A74ECBA101839A600BF939E /* InspectorBackend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A74ECB8101839A500BF939E /* InspectorBackend.cpp */; };
+               7A74ECBB101839A600BF939E /* InspectorBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A74ECB9101839A600BF939E /* InspectorBackend.h */; };
                7A74ECBD101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */; };
-               7AB0B1C01211A62200A76940 /* InspectorDatabaseAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AB0B1BE1211A62200A76940 /* InspectorDatabaseAgent.cpp */; };
-               7AB0B1C11211A62200A76940 /* InspectorDatabaseAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AB0B1BF1211A62200A76940 /* InspectorDatabaseAgent.h */; };
+               7AB0B1C01211A62200A76940 /* InspectorStorageAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AB0B1BE1211A62200A76940 /* InspectorStorageAgent.cpp */; };
+               7AB0B1C11211A62200A76940 /* InspectorStorageAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AB0B1BF1211A62200A76940 /* InspectorStorageAgent.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 /* 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>"; };
+               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>"; };
                7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInspectorFrontendHostCustom.cpp; 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>"; };
+               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>"; };
                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 b8aea0e..95f7e8f 100644 (file)
@@ -10,64 +10,72 @@ use Class::Struct;
 use File::stat;
 
 my %typeTransform;
-$typeTransform{"ApplicationCache"} = {
-    "forward" => "InspectorApplicationCacheAgent",
-    "header" => "InspectorApplicationCacheAgent.h",
-    "domainAccessor" => "m_inspectorController->m_applicationCacheAgent",
+$typeTransform{"InspectorClient"} = {
+    "forward" => "InspectorClient",
+    "header" => "InspectorClient.h",
 };
-$typeTransform{"CSS"} = {
-    "forward" => "InspectorCSSAgent",
-    "header" => "InspectorCSSAgent.h",
-    "domainAccessor" => "m_inspectorController->m_cssAgent",
+$typeTransform{"Backend"} = {
+    "forward" => "InspectorBackend",
+    "header" => "InspectorBackend.h",
+    "domainAccessor" => "m_inspectorController->inspectorBackend()",
+};
+$typeTransform{"Inspector"} = {
+    "forwardHeader" => "InspectorController.h",
+    "domainAccessor" => "m_inspectorController",
 };
 $typeTransform{"Debugger"} = {
     "forward" => "InspectorDebuggerAgent",
     "header" => "InspectorDebuggerAgent.h",
-    "domainAccessor" => "m_inspectorController->m_debuggerAgent",
+    "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",
 };
 $typeTransform{"Database"} = {
-    "forward" => "InspectorDatabaseAgent",
-    "header" => "InspectorDatabaseAgent.h",
-    "domainAccessor" => "m_inspectorController->m_databaseAgent",
+    "forward" => "InspectorBackend",
+    "header" => "InspectorBackend.h",
+    "domainAccessor" => "m_inspectorController->inspectorBackend()",
 };
 $typeTransform{"DOM"} = {
     "forward" => "InspectorDOMAgent",
     "header" => "InspectorDOMAgent.h",
-    "domainAccessor" => "m_inspectorController->m_domAgent",
+    "domainAccessor" => "m_inspectorController->domAgent()",
 };
-$typeTransform{"DOMStorage"} = {
-    "forward" => "InspectorDOMStorageAgent",
-    "header" => "InspectorDOMStorageAgent.h",
-    "domainAccessor" => "m_inspectorController->m_domStorageAgent",
+$typeTransform{"CSS"} = {
+    "forward" => "InspectorCSSAgent",
+    "header" => "InspectorCSSAgent.h",
+    "domainAccessor" => "m_inspectorController->cssAgent()",
+};
+$typeTransform{"ApplicationCache"} = {
+    "forward" => "InspectorApplicationCacheAgent",
+    "header" => "InspectorApplicationCacheAgent.h",
+    "domainAccessor" => "m_inspectorController->applicationCacheAgent()",
 };
 $typeTransform{"FileSystem"} = {
     "forward" => "InspectorFileSystemAgent",
     "header" => "InspectorFileSystemAgent.h",
-    "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",
+    "domainAccessor" => "m_inspectorController->fileSystemAgent()",
 };
 $typeTransform{"Profiler"} = {
     "forward" => "InspectorProfilerAgent",
     "header" => "InspectorProfilerAgent.h",
-    "domainAccessor" => "m_inspectorController->m_profilerAgent",
+    "domainAccessor" => "m_inspectorController->profilerAgent()",
 };
-
 $typeTransform{"Frontend"} = {
     "forward" => "InspectorFrontend",
     "header" => "InspectorFrontend.h",
 };
-$typeTransform{"InspectorClient"} = {
-    "forward" => "InspectorClient",
-    "header" => "InspectorClient.h",
-};
 $typeTransform{"PassRefPtr"} = {
     "forwardHeader" => "wtf/PassRefPtr.h",
 };
index a4a0c6f..415a2e5 100644 (file)
@@ -30,8 +30,6 @@
 
 #include "config.h"
 #include "InjectedScriptHost.h"
-#include "InspectorDatabaseAgent.h"
-#include "InspectorDOMStorageAgent.h"
 
 #if ENABLE(INSPECTOR)
 
@@ -122,23 +120,23 @@ long InjectedScriptHost::inspectedNode(unsigned long num)
 #if ENABLE(DATABASE)
 Database* InjectedScriptHost::databaseForId(long databaseId)
 {
-    if (m_inspectorController && m_inspectorController->m_databaseAgent)
-        return m_inspectorController->m_databaseAgent->databaseForId(databaseId);
+    if (m_inspectorController)
+        return m_inspectorController->databaseForId(databaseId);
     return 0;
 }
 
 void InjectedScriptHost::selectDatabase(Database* database)
 {
-    if (m_inspectorController && m_inspectorController->m_databaseAgent)
-        m_inspectorController->m_databaseAgent->selectDatabase(database);
+    if (m_inspectorController)
+        m_inspectorController->selectDatabase(database);
 }
 #endif
 
 #if ENABLE(DOM_STORAGE)
 void InjectedScriptHost::selectDOMStorage(Storage* storage)
 {
-    if (m_inspectorController && m_inspectorController->m_domStorageAgent)
-        m_inspectorController->m_domStorageAgent->selectDOMStorage(storage);
+    if (m_inspectorController)
+        m_inspectorController->selectDOMStorage(storage);
 }
 #endif
 
@@ -172,7 +170,7 @@ InspectorDOMAgent* InjectedScriptHost::inspectorDOMAgent()
 {
     if (!m_inspectorController)
         return 0;
-    return m_inspectorController->m_domAgent.get();
+    return m_inspectorController->domAgent();
 }
 
 InspectorFrontend* InjectedScriptHost::frontend()
index 7b2d7e2..56feb01 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=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=Backend] 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=Inspector] void releaseWrapperObjectGroup(in long injectedScriptId, in String objectGroup);
+        [domain=Backend] 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,9 +69,6 @@ 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
         ///////////////////////////////////////////////////////////////////////
@@ -87,10 +84,6 @@ 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);
@@ -106,12 +99,18 @@ 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
-
         ///////////////////////////////////////////////////////////////////////
-        // Database API
+        // Resources 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);
@@ -119,13 +118,7 @@ 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);
@@ -133,24 +126,12 @@ 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);
 
@@ -222,8 +203,8 @@ module core {
         // Debugger API
         ///////////////////////////////////////////////////////////////////////
 
-        [domain=Inspector] void enableDebuggerFromFrontend(in boolean always);
-        [domain=Inspector] void disableDebugger(in boolean always);
+        [domain=Backend] void enableDebugger(in boolean always);
+        [domain=Inspector] void disableDebugger(in boolean always); // FIXME: should be on the same domain as enableDebugger.
         [notify, domain=Debugger] void debuggerWasEnabled();
         [notify, domain=Debugger] void debuggerWasDisabled();
 
diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp
new file mode 100644 (file)
index 0000000..eb4c0e7
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * 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
new file mode 100644 (file)
index 0000000..1fcec96
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * 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 7248dc9..8b08598 100644 (file)
@@ -57,6 +57,7 @@
 #include "HitTestResult.h"
 #include "InjectedScript.h"
 #include "InjectedScriptHost.h"
+#include "InspectorBackend.h"
 #include "InspectorBackendDispatcher.h"
 #include "InspectorCSSAgent.h"
 #include "InspectorClient.h"
@@ -70,6 +71,7 @@
 #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,6 +144,7 @@ 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)
@@ -166,6 +167,7 @@ InspectorController::~InspectorController()
 
     releaseFrontendLifetimeAgents();
 
+    m_inspectorBackend->disconnectController();
     m_injectedScriptHost->disconnectController();
 }
 
@@ -474,11 +476,7 @@ void InspectorController::connectFrontend()
     m_cssAgent->setDOMAgent(m_domAgent.get());
 
 #if ENABLE(DATABASE)
-    m_databaseAgent = InspectorDatabaseAgent::create(&m_databaseResources, m_frontend.get());
-#endif
-
-#if ENABLE(DOM_STORAGE)
-    m_domStorageAgent = InspectorDOMStorageAgent::create(&m_domStorageResources, m_frontend.get());
+    m_storageAgent = InspectorStorageAgent::create(m_frontend.get());
 #endif
 
     if (m_timelineAgent)
@@ -594,13 +592,9 @@ void InspectorController::releaseFrontendLifetimeAgents()
     m_domAgent.clear();
 
 #if ENABLE(DATABASE)
-    if (m_databaseAgent)
-        m_databaseAgent->clearFrontend();
-    m_databaseAgent.clear();
-#endif
-
-#if ENABLE(DOM_STORAGE)
-    m_domStorageAgent.clear();
+    if (m_storageAgent)
+        m_storageAgent->clearFrontend();
+    m_storageAgent.clear();
 #endif
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
@@ -1041,6 +1035,27 @@ 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())
@@ -1160,6 +1175,71 @@ 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)
@@ -1427,36 +1507,6 @@ 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 481344d..e570c98 100644 (file)
@@ -56,13 +56,12 @@ 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;
@@ -86,6 +85,7 @@ class ScriptArguments;
 class ScriptCallStack;
 class ScriptProfile;
 class SharedBuffer;
+class Storage;
 class StorageArea;
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
@@ -103,6 +103,9 @@ 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;
@@ -111,6 +114,7 @@ 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(); }
@@ -185,6 +189,10 @@ 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&);
 
@@ -199,11 +207,13 @@ 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&);
@@ -240,10 +250,12 @@ 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);
@@ -255,12 +267,6 @@ 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);
@@ -300,6 +306,8 @@ 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)
@@ -308,6 +316,13 @@ 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>&);
@@ -327,15 +342,7 @@ private:
     OwnPtr<InspectorFrontend> m_frontend;
     OwnPtr<InspectorCSSAgent> m_cssAgent;
     RefPtr<InspectorDOMAgent> m_domAgent;
-
-#if ENABLE(DATABASE)
-    RefPtr<InspectorDatabaseAgent> m_databaseAgent;
-#endif
-
-#if ENABLE(DOM_STORAGE)
-    RefPtr<InspectorDOMStorageAgent> m_domStorageAgent;
-#endif
-
+    RefPtr<InspectorStorageAgent> m_storageAgent;
     OwnPtr<InspectorTimelineAgent> m_timelineAgent;
     OwnPtr<InspectorState> m_state;
 
@@ -354,20 +361,17 @@ 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
deleted file mode 100644 (file)
index 2241a16..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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
deleted file mode 100644 (file)
index bdfd7cb..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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/InspectorDatabaseAgent.cpp
rename to WebCore/inspector/InspectorStorageAgent.cpp
index 88db3ae..1f565fa 100644 (file)
 
 #include "config.h"
 
-#include "InspectorDatabaseAgent.h"
+#include "InspectorStorageAgent.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"
@@ -56,7 +54,7 @@ namespace {
 
 long lastTransactionId = 0;
 
-void reportTransactionFailed(InspectorDatabaseAgent* agent, long transactionId, SQLError* error)
+void reportTransactionFailed(InspectorStorageAgent* agent, long transactionId, SQLError* error)
 {
     if (!agent->frontend())
         return;
@@ -68,7 +66,7 @@ void reportTransactionFailed(InspectorDatabaseAgent* agent, long transactionId,
 
 class StatementCallback : public SQLStatementCallback {
 public:
-    static PassRefPtr<StatementCallback> create(long transactionId, PassRefPtr<InspectorDatabaseAgent> agent)
+    static PassRefPtr<StatementCallback> create(long transactionId, PassRefPtr<InspectorStorageAgent> agent)
     {
         return adoptRef(new StatementCallback(transactionId, agent));
     }
@@ -102,16 +100,16 @@ public:
     }
 
 private:
-    StatementCallback(long transactionId, PassRefPtr<InspectorDatabaseAgent> agent)
+    StatementCallback(long transactionId, PassRefPtr<InspectorStorageAgent> agent)
         : m_transactionId(transactionId)
         , m_agent(agent) { }
     long m_transactionId;
-    RefPtr<InspectorDatabaseAgent> m_agent;
+    RefPtr<InspectorStorageAgent> m_agent;
 };
 
 class StatementErrorCallback : public SQLStatementErrorCallback {
 public:
-    static PassRefPtr<StatementErrorCallback> create(long transactionId, PassRefPtr<InspectorDatabaseAgent> agent)
+    static PassRefPtr<StatementErrorCallback> create(long transactionId, PassRefPtr<InspectorStorageAgent> agent)
     {
         return adoptRef(new StatementErrorCallback(transactionId, agent));
     }
@@ -125,16 +123,16 @@ public:
     }
 
 private:
-    StatementErrorCallback(long transactionId, RefPtr<InspectorDatabaseAgent> agent)
+    StatementErrorCallback(long transactionId, RefPtr<InspectorStorageAgent> agent)
         : m_transactionId(transactionId)
         , m_agent(agent) { }
     long m_transactionId;
-    RefPtr<InspectorDatabaseAgent> m_agent;
+    RefPtr<InspectorStorageAgent> m_agent;
 };
 
 class TransactionCallback : public SQLTransactionCallback {
 public:
-    static PassRefPtr<TransactionCallback> create(const String& sqlStatement, long transactionId, PassRefPtr<InspectorDatabaseAgent> agent)
+    static PassRefPtr<TransactionCallback> create(const String& sqlStatement, long transactionId, PassRefPtr<InspectorStorageAgent> agent)
     {
         return adoptRef(new TransactionCallback(sqlStatement, transactionId, agent));
     }
@@ -154,18 +152,18 @@ public:
         return true;
     }
 private:
-    TransactionCallback(const String& sqlStatement, long transactionId, PassRefPtr<InspectorDatabaseAgent> agent)
+    TransactionCallback(const String& sqlStatement, long transactionId, PassRefPtr<InspectorStorageAgent> agent)
         : m_sqlStatement(sqlStatement)
         , m_transactionId(transactionId)
         , m_agent(agent) { }
     String m_sqlStatement;
     long m_transactionId;
-    RefPtr<InspectorDatabaseAgent> m_agent;
+    RefPtr<InspectorStorageAgent> m_agent;
 };
 
 class TransactionErrorCallback : public SQLTransactionErrorCallback {
 public:
-    static PassRefPtr<TransactionErrorCallback> create(long transactionId, PassRefPtr<InspectorDatabaseAgent> agent)
+    static PassRefPtr<TransactionErrorCallback> create(long transactionId, PassRefPtr<InspectorStorageAgent> agent)
     {
         return adoptRef(new TransactionErrorCallback(transactionId, agent));
     }
@@ -178,11 +176,11 @@ public:
         return true;
     }
 private:
-    TransactionErrorCallback(long transactionId, PassRefPtr<InspectorDatabaseAgent> agent)
+    TransactionErrorCallback(long transactionId, PassRefPtr<InspectorStorageAgent> agent)
         : m_transactionId(transactionId)
         , m_agent(agent) { }
     long m_transactionId;
-    RefPtr<InspectorDatabaseAgent> m_agent;
+    RefPtr<InspectorStorageAgent> m_agent;
 };
 
 class TransactionSuccessCallback : public VoidCallback {
@@ -202,69 +200,30 @@ private:
 
 } // namespace
 
-InspectorDatabaseAgent::~InspectorDatabaseAgent()
+InspectorStorageAgent::InspectorStorageAgent(InspectorFrontend* frontend)
+    : m_frontend(frontend)
 {
 }
 
-void InspectorDatabaseAgent::getDatabaseTableNames(long databaseId, RefPtr<InspectorArray>* names)
+InspectorStorageAgent::~InspectorStorageAgent()
 {
-    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]);
-    }
 }
 
-void InspectorDatabaseAgent::executeSQL(long databaseId, const String& query, bool* success, long* transactionId)
+long InspectorStorageAgent::executeSQL(Database* database, const String& query)
 {
-    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));
+    long 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());
-    *success = true;
+    return transactionId;
 }
 
-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()
+void InspectorStorageAgent::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/InspectorDatabaseAgent.h
rename to WebCore/inspector/InspectorStorageAgent.h
index c73d3c8..b1ceee4 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef InspectorDatabaseAgent_h
-#define InspectorDatabaseAgent_h
+#ifndef InspectorStorageAgent_h
+#define InspectorStorageAgent_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 InspectorDatabaseAgent : public RefCounted<InspectorDatabaseAgent> {
+class InspectorStorageAgent : public RefCounted<InspectorStorageAgent> {
 public:
-    typedef HashMap<int, RefPtr<InspectorDatabaseResource> > DatabaseResourcesMap;
-
-    static PassRefPtr<InspectorDatabaseAgent> create(DatabaseResourcesMap* databaseResources, InspectorFrontend* frontend)
+    static PassRefPtr<InspectorStorageAgent> create(InspectorFrontend* frontend)
     {
-        return adoptRef(new InspectorDatabaseAgent(databaseResources, frontend));
+        return adoptRef(new InspectorStorageAgent(frontend));
     }
 
-    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);
+    virtual ~InspectorStorageAgent();
 
-    // Called from the injected script.
-    Database* databaseForId(long databaseId);
-    void selectDatabase(Database* database);
+    long executeSQL(Database*, const String& query);
 
     InspectorFrontend* frontend() { return m_frontend; }
     void clearFrontend();
 
 private:
-    InspectorDatabaseAgent(DatabaseResourcesMap*, InspectorFrontend*);
+    InspectorStorageAgent(InspectorFrontend*);
 
-    DatabaseResourcesMap* m_databaseResources;
     InspectorFrontend* m_frontend;
 };
 
 } // namespace WebCore
 
-#endif // !defined(InspectorDatabaseAgent_h)
+#endif // !defined(InspectorStorageAgent_h)
index 7d7e129..fd44404 100644 (file)
@@ -220,7 +220,7 @@ WebInspector.ScriptsPanel.prototype = {
             this.visibleView.show(this.viewsContainerElement);
 
         if (this._attachDebuggerWhenShown) {
-            InspectorBackend.enableDebuggerFromFrontend(false);
+            InspectorBackend.enableDebugger(false);
             delete this._attachDebuggerWhenShown;
         }
     },
index caeffb6..345e43e 100644 (file)
@@ -38,6 +38,7 @@
 #include "Document.h"
 #include "Event.h"
 #include "Frame.h"
+#include "InspectorBackend.h"
 #include "InspectorController.h"
 #include "InspectorFrontendClientImpl.h"
 #include "InspectorFrontendHost.h"