2010-07-06 Ilya Tikhonovsky <loislo@chromium.org>
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Jul 2010 15:04:35 +0000 (15:04 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Jul 2010 15:04:35 +0000 (15:04 +0000)
        Reviewed by Yury Semikhatsky.

        WebInspector: generator part of the patch for bug 40675.
        On the way to Remote Debugging we want to support JSON serialization
        on both sides of WebInspector transport.
        As far as InspectorFrontend class is a simple proxy to WebInspector
        it would be better to generate it from an IDL file.
        We have generator infrastructure for binding and will reuse it for
        new generator.
        https://bugs.webkit.org/show_bug.cgi?id=41692

        * CMakeLists.txt:
        * DerivedSources.make:
        * GNUmakefile.am:
        * WebCore.gyp/WebCore.gyp:
        * WebCore.gyp/scripts/rule_binding.py:
        * WebCore.gypi:
        * WebCore.pri:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/scripts/CodeGenerator.pm:
        * bindings/scripts/IDLParser.pm:
        * bindings/scripts/generate-bindings.pl:
        * inspector/CodeGeneratorInspector.pm: Added.
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::connectFrontend):
        (WebCore::InspectorController::startTimelineProfiler):
        * inspector/InspectorController.h:
        * inspector/InspectorFrontend.cpp:
        * inspector/InspectorFrontend.h:
        * inspector/InspectorFrontend2.idl: Added.
        * inspector/InspectorTimelineAgent.cpp:
        (WebCore::InspectorTimelineAgent::InspectorTimelineAgent):
        (WebCore::InspectorTimelineAgent::resetFrontendProxyObject):
        (WebCore::InspectorTimelineAgent::addRecordToTimeline):
        * inspector/InspectorTimelineAgent.h:

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

23 files changed:
ChangeLog
GNUmakefile.am
WebCore/CMakeLists.txt
WebCore/ChangeLog
WebCore/DerivedSources.make
WebCore/GNUmakefile.am
WebCore/WebCore.gyp/WebCore.gyp
WebCore/WebCore.gyp/scripts/rule_binding.py
WebCore/WebCore.gypi
WebCore/WebCore.pri
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/scripts/CodeGenerator.pm
WebCore/bindings/scripts/IDLParser.pm
WebCore/bindings/scripts/generate-bindings.pl
WebCore/inspector/CodeGeneratorInspector.pm [new file with mode: 0644]
WebCore/inspector/InspectorController.cpp
WebCore/inspector/InspectorController.h
WebCore/inspector/InspectorFrontend.cpp
WebCore/inspector/InspectorFrontend.h
WebCore/inspector/InspectorFrontend2.idl [new file with mode: 0644]
WebCore/inspector/InspectorTimelineAgent.cpp
WebCore/inspector/InspectorTimelineAgent.h

index 276dcc9..35a41e2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2010-07-06  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        WebInspector: generator part of the patch for bug 40675.
+        On the way to Remote Debugging we want to support JSON serialization
+        on both sides of WebInspector transport.
+        As far as InspectorFrontend class is a simple proxy to WebInspector
+        it would be better to generate it from an IDL file.
+        We have generator infrastructure for binding and will reuse it for
+        new generator.
+        https://bugs.webkit.org/show_bug.cgi?id=41692
+
+        * GNUmakefile.am:
+
 2010-07-05  Antti Koivisto  <koivisto@iki.fi>
 
         Revert unplanned project file change.
index ccbe28f..414cb91 100644 (file)
@@ -57,6 +57,7 @@ noinst_HEADERS :=
 noinst_LTLIBRARIES :=
 lib_LTLIBRARIES :=
 IDL_BINDINGS :=
+INSPECTOR_INTERFACES :=
 TEST_PROGS :=
 POFILES :=
 MOFILES :=
index a2a8f79..feb31a0 100644 (file)
@@ -289,6 +289,7 @@ SET(WebCore_IDL_FILES
 
     inspector/InjectedScriptHost.idl
     inspector/InspectorBackend.idl
+    inspector/InspectorFrontend2.idl
     inspector/InspectorFrontendHost.idl
     inspector/JavaScriptCallFrame.idl
     inspector/ScriptProfile.idl
index bed1a7d..7ed5e75 100644 (file)
@@ -1,3 +1,43 @@
+2010-07-06  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        WebInspector: generator part of the patch for bug 40675.
+        On the way to Remote Debugging we want to support JSON serialization
+        on both sides of WebInspector transport.
+        As far as InspectorFrontend class is a simple proxy to WebInspector
+        it would be better to generate it from an IDL file.
+        We have generator infrastructure for binding and will reuse it for
+        new generator.
+        https://bugs.webkit.org/show_bug.cgi?id=41692
+
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * GNUmakefile.am:
+        * WebCore.gyp/WebCore.gyp:
+        * WebCore.gyp/scripts/rule_binding.py:
+        * WebCore.gypi:
+        * WebCore.pri:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/scripts/CodeGenerator.pm:
+        * bindings/scripts/IDLParser.pm:
+        * bindings/scripts/generate-bindings.pl:
+        * inspector/CodeGeneratorInspector.pm: Added.
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::connectFrontend):
+        (WebCore::InspectorController::startTimelineProfiler):
+        * inspector/InspectorController.h:
+        * inspector/InspectorFrontend.cpp:
+        * inspector/InspectorFrontend.h:
+        * inspector/InspectorFrontend2.idl: Added.
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::InspectorTimelineAgent):
+        (WebCore::InspectorTimelineAgent::resetFrontendProxyObject):
+        (WebCore::InspectorTimelineAgent::addRecordToTimeline):
+        * inspector/InspectorTimelineAgent.h:
+
 2010-07-06  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
 
         Rubber-stamped by Xan Lopez.
index 5e80f2e..af4083b 100644 (file)
@@ -470,9 +470,11 @@ DOM_CLASSES = \
     XSLTProcessor \
 #
 
+INSPECTOR_CLASSES = InspectorFrontend2
+
 .PHONY : all
 
-JS_DOM_HEADERS=$(filter-out JSEventListener.h JSEventTarget.h,$(DOM_CLASSES:%=JS%.h))
+JS_DOM_HEADERS=$(filter-out JSEventListener.h JSEventTarget.h,$(DOM_CLASSES:%=JS%.h) $(INSPECTOR_CLASSES:%=Remote%.h))
 
 all : \
     $(JS_DOM_HEADERS) \
@@ -820,20 +822,32 @@ endif
 
 # --------
 
-# JavaScript bindings
-
-GENERATE_BINDINGS = perl -I $(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl \
-    --include dom --include html --include css --include page --include notifications --include xml --include svg --write-dependencies --outputDir .
+# Common generator things
 
-GENERATE_BINDINGS_SCRIPTS = \
+GENERATE_SCRIPTS = \
     bindings/scripts/CodeGenerator.pm \
     bindings/scripts/IDLParser.pm \
     bindings/scripts/IDLStructure.pm \
-    bindings/scripts/generate-bindings.pl \
-#
+    bindings/scripts/generate-bindings.pl
+
+generator_script = perl $(addprefix -I $(WebCore)/, $(sort $(dir $(1)))) $(WebCore)/bindings/scripts/generate-bindings.pl
+
+# JS bindings generator
+
+IDL_INCLUDES = dom html css page notifications xml svg
+IDL_COMMON_ARGS = $(IDL_INCLUDES:%=--include %) --write-dependencies --outputDir .
+
+JS_BINDINGS_SCRIPTS = $(GENERATE_SCRIPTS) bindings/scripts/CodeGeneratorJS.pm
+
+JS%.h : %.idl $(JS_BINDINGS_SCRIPTS)
+       $(call generator_script, $(JS_BINDINGS_SCRIPTS)) $(IDL_COMMON_ARGS) --defines "$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS $<
+
+# Inspector interfaces generator
+
+INSPECTOR_GENERATOR_SCRIPTS = $(GENERATE_SCRIPTS) inspector/CodeGeneratorInspector.pm
 
-JS%.h : %.idl $(GENERATE_BINDINGS_SCRIPTS) bindings/scripts/CodeGeneratorJS.pm
-       $(GENERATE_BINDINGS) --defines "$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS $<
+Remote%.h : %.idl $(INSPECTOR_GENERATOR_SCRIPTS)
+       $(call generator_script, $(INSPECTOR_GENERATOR_SCRIPTS)) --outputDir .  --defines "LANGUAGE_JAVASCRIPT" --generator Inspector $<
 
 -include $(JS_DOM_HEADERS:.h=.dep)
 
@@ -938,8 +952,9 @@ WebCore.LP64.exp : WebCore.exp
 
 # Objective-C bindings
 
-DOM%.h : %.idl $(GENERATE_BINDINGS_SCRIPTS) bindings/scripts/CodeGeneratorObjC.pm bindings/objc/PublicDOMInterfaces.h
-       $(GENERATE_BINDINGS) --defines "$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_OBJECTIVE_C" --generator ObjC $<
+DOM_BINDINGS_SCRIPTS = $(GENERATE_BINDING_SCRIPTS) bindings/scripts/CodeGeneratorObjC.pm
+DOM%.h : %.idl $(DOM_BINDINGS_SCRIPTS) bindings/objc/PublicDOMInterfaces.h
+       $(call generator_script, $(DOM_BINDINGS_SCRIPTS)) $(IDL_COMMON_ARGS) --defines "$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_OBJECTIVE_C" --generator ObjC $<
 
 -include $(OBJC_DOM_HEADERS:.h=.dep)
 
index 2ded5e3..af92836 100644 (file)
@@ -333,6 +333,8 @@ IDL_BINDINGS += \
        WebCore/xml/XMLSerializer.idl \
        WebCore/xml/XSLTProcessor.idl
 
+INSPECTOR_INTERFACES += WebCore/inspector/InspectorFrontend2.idl
+
 webcoregtk_dom_sources = \
        WebCore/bindings/gobject/ConvertToUTF8String.cpp \
        WebCore/bindings/gobject/ConvertToUTF8String.h \
@@ -3993,10 +3995,15 @@ vpath %.idl = $(IDL_PATH)
 
 DerivedSources/WebCore/JS%.h: DerivedSources/WebCore/JS%.cpp;
 
+DerivedSources/WebCore/Remote%.h: DerivedSources/WebCore/Remote%.cpp;
+
 .SECONDARY:
 DerivedSources/WebCore/JS%.cpp: %.idl $(SCRIPTS_BINDINGS) $(WebCore)/bindings/scripts/CodeGeneratorJS.pm
        $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES_WEBCORE)" --defines "LANGUAGE_JAVASCRIPT=1 $(FEATURE_DEFINES)" --generator JS $<
 
+DerivedSources/WebCore/Remote%.cpp: %.idl $(SCRIPTS_BINDINGS) $(WebCore)/inspector/CodeGeneratorInspector.pm
+       $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts -I$(WebCore)/inspector $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES)" --defines "LANGUAGE_JAVASCRIPT=1 $(FEATURE_DEFINES)" --generator Inspector $<
+
 IDL_BINDINGS_JS_PURE := \
        WebCore/svg/ElementTimeControl.idl \
        WebCore/svg/SVGAnimatedPathData.idl \
@@ -4016,8 +4023,11 @@ IDL_BINDINGS_JS_PURE := \
 IDL_BINDINGS_JS := $(filter-out $(IDL_BINDINGS_JS_PURE),$(IDL_BINDINGS))
 
 webcore_built_nosources += $(patsubst %.idl,DerivedSources/WebCore/JS%.h,$(notdir $(IDL_BINDINGS)))
+webcore_built_nosources += $(patsubst %.idl,DerivedSources/WebCore/Remote%.h,$(notdir $(INSPECTOR_INTERFACES)))
 
-webcore_built_nosources += $(patsubst %.idl,DerivedSources/WebCore/JS%.cpp,$(notdir $(IDL_BINDINGS_JS)))
+webcore_built_cpp = $(patsubst %.idl,DerivedSources/WebCore/JS%.cpp,$(notdir $(IDL_BINDINGS_JS)))
+webcore_built_cpp += $(patsubst %.idl,DerivedSources/WebCore/Remote%.cpp,$(notdir $(INSPECTOR_INTERFACES)))
+webcore_built_nosources += $(webcore_built_cpp)
 
 webcore_built_objects = := $(patsubst %.cpp,%.lo,$(webcore_built_nosources))
 
@@ -4025,9 +4035,9 @@ $(webcore_built_objects): AM_CPPFLAGS+=$(corekit_cppflags)
 
 $(webcore_built_objects): AM_CXXFLAGS+=$(libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CXXFLAGS)
 
-libWebCoreJS_objects := $(patsubst %.idl,DerivedSources/WebCore/JS%.lo,$(notdir $(IDL_BINDINGS_JS)))
+libWebCoreJS_objects := $(patsubst %.cpp,%.lo,$(webcore_built_cpp))
 
-libWebCoreJS_depfiles := $(patsubst %.idl,DerivedSources/WebCore/$(DEPDIR)/JS%.Plo,$(notdir $(IDL_BINDINGS_JS)))
+libWebCoreJS_depfiles := $(patsubst %.cpp,DerivedSources/WebCore/$(DEPDIR)/%.Plo,$(notdir $(webcore_built_cpp)))
 
 # Older automake versions (1.7) place Plo files in a different place:
 libWebCoreJS_depfiles += $(patsubst %.lo,$(DEPDIR)/%.Plo,$(libWebCoreJS_objects))
index 1821ffc..edd8c8d 100644 (file)
           ],
         },
         {
+          'action_name': 'InspectorFrontend2',
+          'inputs': [
+            '../bindings/scripts/generate-bindings.pl',
+            '../bindings/scripts/CodeGenerator.pm',
+            '../bindings/scripts/IDLParser.pm',
+            '../bindings/scripts/IDLStructure.pm',
+            '../inspector/CodeGeneratorInspector.pm',
+            '../inspector/InspectorFrontend2.idl',
+          ],
+          'outputs': [
+            '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/RemoteInspectorFrontend2.cpp',
+            '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/RemoteInspectorFrontend2.h',
+          ],
+          'variables': {
+            'generator_include_dirs': [
+            ],
+          },
+          'action': [
+            'python',
+            'scripts/rule_binding.py',
+            '../inspector/InspectorFrontend2.idl',
+            '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings',
+            '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings',
+            '--',
+            '<@(_inputs)',
+            '--',
+            '--defines', 'LANGUAGE_JAVASCRIPT',
+            '--prefix', 'Remote',
+            '--generator', 'Inspector',
+            '<@(generator_include_dirs)'
+          ],
+          'message': 'Generating InspectorFrontend2 class from InspectorFrontend2.idl',
+        },
+        {
           'action_name': 'XMLNames',
           'inputs': [
             '../dom/make_names.pl',
         # Additional .cpp files from the webcore_bindings_sources rules.
         '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSGrammar.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/webkit/XPathGrammar.cpp',
+
+        # Additional .cpp files from the webcore_inspector_sources list.
+        '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/RemoteInspectorFrontend2.cpp',
       ],
       'conditions': [
         ['javascript_engine=="v8"', {
index 24d178f..f7f3ed1 100644 (file)
@@ -95,6 +95,14 @@ def main(args):
         if not includeDir in includeDirs:
             includeDirs.append(includeDir)
 
+    if '--prefix' in options:
+        prefixIndex = options.index('--prefix')
+    else:
+        prefixIndex = options.index('--generator')
+
+    if prefixIndex + 1 < len(options):
+        prefix = options[prefixIndex + 1]
+
     # The defines come in as one flat string. Split it up into distinct arguments.
     if '--defines' in options:
         definesIndex = options.index('--defines')
@@ -122,7 +130,7 @@ def main(args):
     if cppdir != hdir:
         inputBasename = os.path.basename(input)
         (root, ext) = os.path.splitext(inputBasename)
-        hname = 'V8%s.h' % root
+        hname = '%s%s.h' % (prefix, root)
         hsrc = os.path.join(cppdir, hname)
         hdst = os.path.join(hdir, hname)
         shutil.copyfile(hsrc, hdst)
index be6d29f..20dd805 100644 (file)
             'xml/XPathResult.idl',
             'xml/XSLTProcessor.idl',
         ],
+        'webcore_inspector_idl_files': [
+            'inspector/InspectorFrontend2.idl',
+        ],
         'webcore_svg_bindings_idl_files': [
             'svg/ElementTimeControl.idl',
             'svg/SVGAElement.idl',
index 623dbb6..6cc7aa3 100644 (file)
@@ -652,6 +652,8 @@ IDL_BINDINGS += \
     xml/XPathEvaluator.idl \
     xml/XSLTProcessor.idl
 
+INSPECTOR_INTERFACES = inspector/InspectorFrontend2.idl
+
 contains(DEFINES, ENABLE_MATHML=1) {
     mathmlnames.output = $${WC_GENERATED_SOURCES_DIR}/MathMLNames.cpp
     mathmlnames.input = MATHML_NAMES
@@ -717,6 +719,18 @@ idl.depends = $$PWD/bindings/scripts/CodeGenerator.pm \
               $$PWD/bindings/scripts/InFilesParser.pm
 addExtraCompiler(idl)
 
+# GENERATOR 2: inspector idl compiler
+inspectorIDL.output = $${WC_GENERATED_SOURCES_DIR}/Remote${QMAKE_FILE_BASE}.cpp
+inspectorIDL.input = INSPECTOR_INTERFACES
+inspectorIDL.wkScript = $$PWD/bindings/scripts/generate-bindings.pl
+inspectorIDL.commands = perl -I$$PWD/bindings/scripts -I$$PWD/inspector $$inspectorIDL.wkScript --defines \"$${FEATURE_DEFINES_JAVASCRIPT}\" --generator Inspector --outputDir $$WC_GENERATED_SOURCES_DIR --preprocessor \"$${QMAKE_MOC} -E\" ${QMAKE_FILE_NAME}
+inspectorIDL.depends = $$PWD/bindings/scripts/CodeGenerator.pm \
+              $$PWD/inspector/CodeGeneratorInspector.pm \
+              $$PWD/bindings/scripts/IDLParser.pm \
+              $$PWD/bindings/scripts/IDLStructure.pm \
+              $$PWD/bindings/scripts/InFilesParser.pm
+addExtraCompiler(inspectorIDL)
+
 # GENERATOR 3: tokenizer (flex)
 tokenizer.output = $${WC_GENERATED_SOURCES_DIR}/${QMAKE_FILE_BASE}.cpp
 tokenizer.input = TOKENIZER
index 5f62d2a..8cfa3d5 100644 (file)
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\RemoteInspectorFrontend2.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\RemoteInspectorFrontend2.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\WMLElementFactory.cpp"\r
                                >\r
                                <FileConfiguration\r
index e5817ea..e12cd5d 100644 (file)
                4F1534E011B533020021FD86 /* EditingBehaviorTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F1534DF11B533020021FD86 /* EditingBehaviorTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4F3289B511A42AAB005ABE7E /* InspectorValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4F3289B311A42AAB005ABE7E /* InspectorValues.cpp */; };
                4F3289B611A42AAB005ABE7E /* InspectorValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F3289B411A42AAB005ABE7E /* InspectorValues.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               4F4F5FFB11CBD2E100A186BF /* RemoteInspectorFrontend2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4F4F5FFA11CBD2D200A186BF /* RemoteInspectorFrontend2.cpp */; };
                4FD8D0F2119C718B002FA825 /* ScriptGCEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4FD8D0F0119C718B002FA825 /* ScriptGCEvent.cpp */; };
                4FD8D0F3119C718B002FA825 /* ScriptGCEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FD8D0F1119C718B002FA825 /* ScriptGCEvent.h */; };
                510184690B08602A004A825F /* CachedPage.h in Headers */ = {isa = PBXBuildFile; fileRef = 510184670B08602A004A825F /* CachedPage.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4F1534DF11B533020021FD86 /* EditingBehaviorTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingBehaviorTypes.h; sourceTree = "<group>"; };
                4F3289B311A42AAB005ABE7E /* InspectorValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorValues.cpp; sourceTree = "<group>"; };
                4F3289B411A42AAB005ABE7E /* InspectorValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorValues.h; sourceTree = "<group>"; };
+               4F4F5FFA11CBD2D200A186BF /* RemoteInspectorFrontend2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteInspectorFrontend2.cpp; sourceTree = "<group>"; };
+               4F4F5FFC11CBD30100A186BF /* RemoteInspectorFrontend2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteInspectorFrontend2.h; sourceTree = "<group>"; };
                4FD8D0F0119C718B002FA825 /* ScriptGCEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptGCEvent.cpp; sourceTree = "<group>"; };
                4FD8D0F1119C718B002FA825 /* ScriptGCEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptGCEvent.h; sourceTree = "<group>"; };
                510184670B08602A004A825F /* CachedPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedPage.h; sourceTree = "<group>"; };
                                9FA37EF71172FD9300C4CD55 /* JSScriptProfile.h */,
                                9FA37EF81172FD9300C4CD55 /* JSScriptProfileNode.cpp */,
                                9FA37EF91172FD9300C4CD55 /* JSScriptProfileNode.h */,
+                               4F4F5FFA11CBD2D200A186BF /* RemoteInspectorFrontend2.cpp */,
+                               4F4F5FFC11CBD30100A186BF /* RemoteInspectorFrontend2.h */,
                        );
                        name = Inspector;
                        sourceTree = "<group>";
                                E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
                                97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */,
                                B885E8D411E06DD2009FFBF4 /* InspectorApplicationCacheAgent.cpp in Sources */,
+                               4F4F5FFB11CBD2E100A186BF /* RemoteInspectorFrontend2.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index fbcee02..914cc46 100644 (file)
@@ -83,6 +83,7 @@ sub new
     $useLayerOnTop = shift;
     $preprocessor = shift;
     $writeDependencies = shift;
+    $verbose = shift;
 
     bless($reference, $object);
     return $reference;
@@ -103,10 +104,10 @@ sub ProcessDocument
     $defines = shift;
 
     my $ifaceName = "CodeGenerator" . $useGenerator;
+    require $ifaceName . ".pm";
 
     # Dynamically load external code generation perl module
-    require $ifaceName . ".pm";
-    $codeGenerator = $ifaceName->new($object, $useOutputDir, $useLayerOnTop, $preprocessor, $writeDependencies);
+    $codeGenerator = $ifaceName->new($object, $useOutputDir, $useLayerOnTop, $preprocessor, $writeDependencies, $verbose);
     unless (defined($codeGenerator)) {
         my $classes = $useDocument->classes;
         foreach my $class (@$classes) {
index 3df96ab..e250a4d 100644 (file)
@@ -259,7 +259,7 @@ sub ParseInterface
         my @interfaceMethods = split(/;/, $interfaceData);
 
         foreach my $line (@interfaceMethods) {
-            if ($line =~ /attribute/) {
+            if ($line =~ /\Wattribute\W/) {
                 $line =~ /$IDLStructure::interfaceAttributeSelector/;
 
                 my $attributeType = (defined($1) ? $1 : die("Parsing error!\nSource:\n$line\n)"));
index 44ed4d3..b293b3c 100755 (executable)
@@ -41,30 +41,36 @@ my @idlDirectories;
 my $outputDirectory;
 my $generator;
 my $defines;
+my $prefix;
 my $preprocessor;
 my $writeDependencies;
+my $verbose;
 
 GetOptions('include=s@' => \@idlDirectories,
            'outputDir=s' => \$outputDirectory,
            'generator=s' => \$generator,
            'defines=s' => \$defines,
+           'prefix=s' => \$prefix,
            'preprocessor=s' => \$preprocessor,
+           'verbose' => \$verbose,
            'write-dependencies' => \$writeDependencies);
 
 my $idlFile = $ARGV[0];
 
 die('Must specify input file.') unless defined($idlFile);
-die('Must specify IDL search path.') unless @idlDirectories;
 die('Must specify generator') unless defined($generator);
 die('Must specify output directory.') unless defined($outputDirectory);
 die('Must specify defines') unless defined($defines);
 
+if ($verbose) {
+    print "$generator: $idlFile\n";
+}
 $defines =~ s/^\s+|\s+$//g; # trim whitespace
 
 # Parse the given IDL file.
-my $parser = IDLParser->new(1);
+my $parser = IDLParser->new(!$verbose);
 my $document = $parser->Parse($idlFile, $defines, $preprocessor);
 
 # Generate desired output for given IDL file.
-my $codeGen = CodeGenerator->new(\@idlDirectories, $generator, $outputDirectory, 0, $preprocessor, $writeDependencies);
+my $codeGen = CodeGenerator->new(\@idlDirectories, $generator, $outputDirectory, 0, $preprocessor, $writeDependencies, $verbose);
 $codeGen->ProcessDocument($document, $defines);
diff --git a/WebCore/inspector/CodeGeneratorInspector.pm b/WebCore/inspector/CodeGeneratorInspector.pm
new file mode 100644 (file)
index 0000000..75cda59
--- /dev/null
@@ -0,0 +1,291 @@
+# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+package CodeGeneratorInspector;
+
+use strict;
+
+use File::stat;
+
+my %typeTransform;
+$typeTransform{"InspectorClient"} = {
+    "forward" => "InspectorClient",
+    "header" => "InspectorClient.h",
+};
+$typeTransform{"RefPtr"} = {
+    "forwardHeader" => "wtf/RefPtr.h",
+};
+$typeTransform{"Object"} = {
+    "param" => "const RefPtr<InspectorObject>&",
+    "retVal" => "PassRefPtr<InspectorObject>",
+    "forward" => "InspectorObject",
+    "header" => "InspectorValues.h",
+    "push" => "push"
+};
+$typeTransform{"Array"} = {
+    "param" => "const RefPtr<InspectorArray>&",
+    "retVal" => "PassRefPtr<InspectorArray>",
+    "forward" => "InspectorArray",
+    "header" => "InspectorValues.h",
+    "push" => "push"
+};
+$typeTransform{"Value"} = {
+    "param" => "const RefPtr<InspectorValue>&",
+    "retVal" => "PassRefPtr<InspectorValue>",
+    "forward" => "InspectorValue",
+    "header" => "InspectorValues.h",
+    "push" => "push"
+};
+$typeTransform{"String"} = {
+    "param" => "const String&",
+    "retVal" => "String",
+    "forward" => "String",
+    "header" => "PlatformString.h",
+    "push" => "pushString"
+};
+$typeTransform{"long"} = {
+    "param" => "long",
+    "retVal" => "long",
+    "forward" => "",
+    "header" => "",
+    "push" => "pushNumber"
+};
+$typeTransform{"unsigned long"} = {
+    "param" => "unsigned long",
+    "retVal" => "unsigned long",
+    "forward" => "",
+    "header" => "",
+    "push" => "pushNumber"
+};
+$typeTransform{"boolean"} = {
+    "param" => "bool",
+    "retVal"=> "bool",
+    "forward" => "",
+    "header" => "",
+    "push" => "pushBool"
+};
+$typeTransform{"void"} = {
+    "retVal" => "void",
+    "forward" => "",
+    "header" => ""
+};
+
+# Default License Templates
+
+my $licenseTemplate = << "EOF";
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+EOF
+
+my $codeGenerator;
+my $outputDir;
+my $writeDependencies;
+my $verbose;
+
+my $namespace;
+my $fileName;
+my %discoveredTypes;
+
+my @classDefinition;
+my @functionDefinitions;
+
+sub typeSpec
+{
+    my $param = shift;
+    my $retValue = shift;
+
+    my $type = $typeTransform{$param->type}->{$retValue ? "retVal" : "param"};
+    $discoveredTypes{$param->type} = 1;
+    $type or die "invalid type specification \"" . $param->type ."\"";
+    return $type;
+}
+
+# Default constructor
+sub new
+{
+    my $object = shift;
+    my $reference = { };
+
+    $codeGenerator = shift;
+    $outputDir = shift;
+    shift; # $useLayerOnTop
+    shift; # $preprocessor
+    $writeDependencies = shift;
+    $verbose = shift;
+
+    bless($reference, $object);
+    return $reference;
+}
+
+# Params: 'idlDocument' struct
+sub GenerateModule
+{
+    my $object = shift;
+    my $dataNode = shift;
+
+    $namespace = $dataNode->module;
+}
+
+# Params: 'idlDocument' struct
+sub GenerateInterface
+{
+    my $object = shift;
+    my $interface = shift;
+    my $defines = shift;
+
+    my $className = $interface->name;
+    $fileName = $className;
+
+    $discoveredTypes{"String"} = 1;
+    $discoveredTypes{"InspectorClient"} = 1;
+    $discoveredTypes{"RefPtr"} = 1;
+
+    push(@classDefinition, "class $className {");
+    push(@classDefinition, "public:");
+    push(@classDefinition, "    $className(InspectorClient* inspectorClient) : m_inspectorClient(inspectorClient) { }");
+    push(@classDefinition, "");
+    push(@classDefinition, generateFunctionsDeclarations($interface, $className));
+    push(@classDefinition, "");
+    push(@classDefinition, "private:");
+    push(@classDefinition, "    void sendSimpleMessageToFrontend(const String&);");
+    push(@classDefinition, "    InspectorClient* m_inspectorClient;");
+    push(@classDefinition, "};");
+
+    push(@functionDefinitions, "void ${className}::sendSimpleMessageToFrontend(const String& functionName)");
+    push(@functionDefinitions, "{");
+    push(@functionDefinitions, "    RefPtr<InspectorArray> arguments = InspectorArray::create();");
+    push(@functionDefinitions, "    arguments->pushString(functionName);");
+    push(@functionDefinitions, "    m_inspectorClient->sendMessageToFrontend(arguments->toJSONString());");
+    push(@functionDefinitions, "}");
+}
+
+sub generateFunctionsDeclarations
+{
+    my $interface = shift;
+    my $className = shift;
+
+    my @functionDeclarations;
+    foreach my $function (@{$interface->functions}) {
+        my $functionName = $function->signature->name;
+        my $abstract = $function->signature->extendedAttributes->{"abstract"};
+        my $arguments = "";
+        foreach my $parameter (@{$function->parameters}) {
+            $parameter->name or die "empty argument name specified for function ${className}::$functionName and argument type " . $parameter->type;
+            $arguments = $arguments . ", " if ($arguments);
+            $arguments = $arguments . typeSpec($parameter) . " " . $parameter->name;
+        }
+        my $signature = "    " . typeSpec($function->signature, 1) . " $functionName($arguments)";
+        push(@functionDeclarations, $abstract ? "$signature = 0;" : "$signature;");
+        push(@functionDefinitions, generateFunctionsImpl($className, $function, $arguments)) if !$abstract;
+    }
+    return @functionDeclarations;
+}
+
+sub generateHeader
+{
+    my @headerContent = split("\r", $licenseTemplate);
+    push(@headerContent, "#ifndef ${fileName}_h");
+    push(@headerContent, "#define ${fileName}_h");
+    push(@headerContent, "");
+
+    my @forwardHeaders;
+    foreach my $type (keys %discoveredTypes) {
+        push(@forwardHeaders, "#include <" . $typeTransform{$type}->{"forwardHeader"} . ">") if !$typeTransform{$type}->{"forwardHeader"} eq  "";
+    }
+    push(@headerContent, sort @forwardHeaders);
+    push(@headerContent, "");
+    push(@headerContent, "namespace $namespace {");
+    push(@headerContent, "");
+
+    my @forwardDeclarations;
+    foreach my $type (keys %discoveredTypes) {
+        push(@forwardDeclarations, "class " . $typeTransform{$type}->{"forward"} . ";") if !$typeTransform{$type}->{"forward"} eq  "";
+    }
+    push(@headerContent, sort @forwardDeclarations);
+
+    push(@headerContent, "");
+    push(@headerContent, @classDefinition);
+    push(@headerContent, "");
+    push(@headerContent, "} // namespace $namespace");
+    push(@headerContent, "");
+    push(@headerContent, "#endif // !defined(${fileName}_h)");
+    push(@headerContent, "");
+    return @headerContent;
+}
+
+sub generateSource
+{
+    my @sourceContent = split("\r", $licenseTemplate);
+    push(@sourceContent, "\n#include \"config.h\"");
+    push(@sourceContent, "#include \"Remote$fileName.h\"");
+    push(@sourceContent, "");
+    push(@sourceContent, "#if ENABLE(INSPECTOR)");
+    push(@sourceContent, "");
+
+    my %headers;
+    foreach my $type (keys %discoveredTypes) {
+        $headers{"#include \"" . $typeTransform{$type}->{"header"} . "\""} = 1 if !$typeTransform{$type}->{"header"} eq  "";
+    }
+    push(@sourceContent, sort keys %headers);
+    push(@sourceContent, "");
+    push(@sourceContent, "namespace $namespace {");
+    push(@sourceContent, "");
+    push(@sourceContent, @functionDefinitions);
+    push(@sourceContent, "");
+    push(@sourceContent, "} // namespace $namespace");
+    push(@sourceContent, "");
+    push(@sourceContent, "#endif // ENABLE(INSPECTOR)");
+    push(@sourceContent, "");
+    return @sourceContent;
+}
+
+sub generateFunctionsImpl
+{
+    my $className = shift;
+    my $function = shift;
+    my $arguments = shift;
+
+    my @func;
+
+    my $functionName = $function->signature->name;
+
+    push(@func, typeSpec($function->signature, 1) . " " . $className . "::" . $functionName . "(" . $arguments . ")");
+    push(@func, "{");
+
+    my $numParameters = @{$function->parameters};
+    if ($numParameters > 0) {
+        push(@func, "    RefPtr<InspectorArray> arguments = InspectorArray::create();");
+        push(@func, "    arguments->pushString(\"$functionName\");");
+        foreach my $parameter (@{$function->parameters}) {
+            my $pushCall =  $typeTransform{$parameter->type}->{"push"};
+            push(@func, "    arguments->$pushCall(" . $parameter->name . ");");
+        }
+        push(@func, "    m_inspectorClient->sendMessageToFrontend(arguments->toJSONString());");
+    } else {
+        push(@func, "    sendSimpleMessageToFrontend(\"$functionName\");");
+    }
+
+    push(@func, "}");
+    push(@func, "");
+    return @func;
+}
+
+sub finish
+{
+    my $object = shift;
+
+    open(my $SOURCE, ">$outputDir/Remote$fileName.cpp") || die "Couldn't open file $outputDir/Remote$fileName.cpp";
+    open(my $HEADER, ">$outputDir/Remote$fileName.h") || die "Couldn't open file $outputDir/Remote$fileName.h";
+
+    print $SOURCE join("\n", generateSource());
+    close($SOURCE);
+    undef($SOURCE);
+
+    print $HEADER join("\n", generateHeader());
+    close($HEADER);
+    undef($HEADER);
+}
+
+1;
index d417a6a..f20a3e9 100644 (file)
@@ -68,6 +68,7 @@
 #include "Page.h"
 #include "ProgressTracker.h"
 #include "Range.h"
+#include "RemoteInspectorFrontend2.h"
 #include "RenderInline.h"
 #include "ResourceRequest.h"
 #include "ResourceResponse.h"
@@ -485,9 +486,10 @@ void InspectorController::connectFrontend(const ScriptObject& webInspector)
     m_openingFrontend = false;
     releaseFrontendLifetimeAgents();
     m_frontend = new InspectorFrontend(webInspector, m_client);
+    m_frontend2 = new InspectorFrontend2(m_client);
     m_domAgent = InspectorDOMAgent::create(m_cssStore.get(), m_frontend.get());
     if (m_timelineAgent)
-        m_timelineAgent->resetFrontendProxyObject(m_frontend.get());
+        m_timelineAgent->resetFrontendProxyObject(m_frontend2.get());
 
     // Initialize Web Inspector title.
     m_frontend->inspectedURLChanged(m_inspectedPage->mainFrame()->loader()->url().string());
@@ -1161,7 +1163,7 @@ void InspectorController::startTimelineProfiler()
     if (m_timelineAgent)
         return;
 
-    m_timelineAgent = new InspectorTimelineAgent(m_frontend.get());
+    m_timelineAgent = new InspectorTimelineAgent(m_frontend2.get());
     if (m_frontend)
         m_frontend->timelineProfilerWasStarted();
     m_client->timelineProfilerWasStarted();
index 3cc3e3e..0e5e2cf 100644 (file)
@@ -69,6 +69,7 @@ class InspectorCSSStore;
 class InspectorDOMStorageResource;
 class InspectorDatabaseResource;
 class InspectorFrontend;
+class InspectorFrontend2;
 class InspectorFrontendClient;
 class InspectorResource;
 class InspectorTimelineAgent;
@@ -343,6 +344,7 @@ private:
     OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient;
     bool m_openingFrontend;
     OwnPtr<InspectorFrontend> m_frontend;
+    OwnPtr<InspectorFrontend2> m_frontend2;
     RefPtr<InspectorDOMAgent> m_domAgent;
     OwnPtr<InspectorCSSStore> m_cssStore;
     OwnPtr<InspectorTimelineAgent> m_timelineAgent;
index 6f323b9..d16e43f 100644 (file)
@@ -297,14 +297,6 @@ void InspectorFrontend::timelineProfilerWasStopped()
     callSimpleFunction("timelineProfilerWasStopped");
 }
 
-void InspectorFrontend::addRecordToTimeline(const RefPtr<InspectorObject>& record)
-{
-    RefPtr<InspectorArray> arguments = InspectorArray::create();
-    arguments->pushString("addRecordToTimeline");
-    arguments->push(record);
-    m_inspectorClient->sendMessageToFrontend(arguments->toJSONString());
-}
-
 #if ENABLE(JAVASCRIPT_DEBUGGER)
 void InspectorFrontend::attachDebuggerWhenShown()
 {
index c7b4b9b..67a93ce 100644 (file)
@@ -171,7 +171,6 @@ namespace WebCore {
 
         void timelineProfilerWasStarted();
         void timelineProfilerWasStopped();
-        void addRecordToTimeline(const RefPtr<InspectorObject>& record);
 
 #if ENABLE(WORKERS)
         void didCreateWorker(const InspectorWorkerResource&);
diff --git a/WebCore/inspector/InspectorFrontend2.idl b/WebCore/inspector/InspectorFrontend2.idl
new file mode 100644 (file)
index 0000000..619b3be
--- /dev/null
@@ -0,0 +1,10 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+module WebCore {
+
+    interface [Conditional=INSPECTOR, JS] InspectorFrontend2 {
+        void addRecordToTimeline(in Object record);
+    };
+}
index c7001c3..c1cc867 100644 (file)
@@ -34,8 +34,8 @@
 #if ENABLE(INSPECTOR)
 
 #include "Event.h"
-#include "InspectorFrontend.h"
 #include "IntRect.h"
+#include "RemoteInspectorFrontend2.h"
 #include "ResourceRequest.h"
 #include "ResourceResponse.h"
 #include "TimelineRecordFactory.h"
@@ -46,7 +46,7 @@ namespace WebCore {
 
 int InspectorTimelineAgent::s_instanceCount = 0;
 
-InspectorTimelineAgent::InspectorTimelineAgent(InspectorFrontend* frontend)
+InspectorTimelineAgent::InspectorTimelineAgent(InspectorFrontend2* frontend)
     : m_frontend(frontend)
 {
     ++s_instanceCount;
@@ -279,7 +279,7 @@ void InspectorTimelineAgent::reset()
     m_recordStack.clear();
 }
 
-void InspectorTimelineAgent::resetFrontendProxyObject(InspectorFrontend* frontend)
+void InspectorTimelineAgent::resetFrontendProxyObject(InspectorFrontend2* frontend)
 {
     ASSERT(frontend);
     reset();
index 0e9977a..10e8a65 100644 (file)
@@ -42,7 +42,7 @@
 
 namespace WebCore {
 class Event;
-class InspectorFrontend;
+class InspectorFrontend2;
 class IntRect;
 class ResourceRequest;
 class ResourceResponse;
@@ -74,11 +74,11 @@ enum TimelineRecordType {
 
 class InspectorTimelineAgent : ScriptGCEventListener, public Noncopyable {
 public:
-    InspectorTimelineAgent(InspectorFrontend* frontend);
+    InspectorTimelineAgent(InspectorFrontend2* frontend);
     ~InspectorTimelineAgent();
 
     void reset();
-    void resetFrontendProxyObject(InspectorFrontend*);
+    void resetFrontendProxyObject(InspectorFrontend2*);
 
     // Methods called from WebCore.
     void willCallFunction(const String& scriptName, int scriptLine);
@@ -152,7 +152,7 @@ private:
 
     void pushGCEventRecords();
 
-    InspectorFrontend* m_frontend;
+    InspectorFrontend2* m_frontend;
 
     Vector<TimelineRecordEntry> m_recordStack;
     static int s_instanceCount;