Changeset 64124 in webkit


Ignore:
Timestamp:
Jul 27, 2010 6:41:20 AM (14 years ago)
Author:
loislo@chromium.org
Message:

2010-07-27 Ilya Tikhonovsky <loislo@chromium.org>

Reviewed by Pavel Feldman.

WebInspector: Current implementation of message based inspector
transport generated by CodeGeneratorInspector should be upstreamed
from WebKit/chromium to WebCore.
https://bugs.webkit.org/show_bug.cgi?id=42983

  • Android.derived.v8bindings.mk:
  • CMakeLists.txt:
  • DerivedSources.cpp:
  • DerivedSources.make:
  • GNUmakefile.am:
  • WebCore.exp.in:
  • WebCore.gypi:
  • WebCore.pri:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/ScriptObject.cpp:
  • bindings/js/ScriptObject.h:
  • bindings/v8/ScriptObject.cpp:
  • bindings/v8/ScriptObject.h:
  • inspector/CodeGeneratorInspector.pm:
  • inspector/InspectorBackend.idl: Removed.
  • inspector/InspectorFrontendClient.h:
  • inspector/InspectorFrontendClientLocal.cpp: (WebCore::InspectorFrontendClientLocal::windowObjectCleared): (WebCore::InspectorFrontendClientLocal::sendMessageToBackend):
  • inspector/InspectorFrontendClientLocal.h:
  • inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::sendMessageToBackend):
  • inspector/InspectorFrontendHost.h:
  • inspector/InspectorFrontendHost.idl:
  • inspector/front-end/InspectorBackendStub.js: (.WebInspector.InspectorBackendStub): (.WebInspector.InspectorBackendStub.prototype._registerDelegate): (.WebInspector.InspectorBackendStub.prototype.sendMessageToBackend):

2010-07-27 Ilya Tikhonovsky <loislo@chromium.org>

Reviewed by Pavel Feldman.

WebInspector: Current implementation of message based inspector
transport generated by CodeGeneratorInspector should be upstreamed
from WebKit/chromium to WebCore.
https://bugs.webkit.org/show_bug.cgi?id=42983

  • WebKit.gypi:
  • src/InspectorFrontendClientImpl.cpp: (WebKit::InspectorFrontendClientImpl::sendMessageToBackend):
  • src/InspectorFrontendClientImpl.h:
  • src/ToolsAgent.h:
  • src/WebDevToolsAgentImpl.cpp: (WebKit::WebDevToolsAgentImpl::dispatchOnInspectorController): (WebKit::WebDevToolsAgentImpl::initDevToolsAgentHost):
  • src/WebDevToolsAgentImpl.h:
  • src/js/InspectorControllerImpl.js: Removed.
Location:
trunk
Files:
2 deleted
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/Android.derived.v8bindings.mk

    r63064 r64124  
    572572GEN := \
    573573    $(intermediates)/bindings/V8InjectedScriptHost.h \
    574     $(intermediates)/bindings/V8InspectorBackend.h \
    575574    $(intermediates)/bindings/V8InspectorFrontendHost.h
    576575
  • trunk/WebCore/CMakeLists.txt

    r63975 r64124  
    294294
    295295    inspector/InjectedScriptHost.idl
    296     inspector/InspectorBackend.idl
    297296    inspector/InspectorFrontendHost.idl
    298297    inspector/JavaScriptCallFrame.idl
  • trunk/WebCore/ChangeLog

    r64111 r64124  
     12010-07-27  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        WebInspector: Current implementation of message based inspector
     6        transport generated by CodeGeneratorInspector should be upstreamed
     7        from WebKit/chromium to WebCore.
     8        https://bugs.webkit.org/show_bug.cgi?id=42983
     9
     10        * Android.derived.v8bindings.mk:
     11        * CMakeLists.txt:
     12        * DerivedSources.cpp:
     13        * DerivedSources.make:
     14        * GNUmakefile.am:
     15        * WebCore.exp.in:
     16        * WebCore.gypi:
     17        * WebCore.pri:
     18        * WebCore.vcproj/WebCore.vcproj:
     19        * WebCore.xcodeproj/project.pbxproj:
     20        * bindings/js/ScriptObject.cpp:
     21        * bindings/js/ScriptObject.h:
     22        * bindings/v8/ScriptObject.cpp:
     23        * bindings/v8/ScriptObject.h:
     24        * inspector/CodeGeneratorInspector.pm:
     25        * inspector/InspectorBackend.idl: Removed.
     26        * inspector/InspectorFrontendClient.h:
     27        * inspector/InspectorFrontendClientLocal.cpp:
     28        (WebCore::InspectorFrontendClientLocal::windowObjectCleared):
     29        (WebCore::InspectorFrontendClientLocal::sendMessageToBackend):
     30        * inspector/InspectorFrontendClientLocal.h:
     31        * inspector/InspectorFrontendHost.cpp:
     32        (WebCore::InspectorFrontendHost::sendMessageToBackend):
     33        * inspector/InspectorFrontendHost.h:
     34        * inspector/InspectorFrontendHost.idl:
     35        * inspector/front-end/InspectorBackendStub.js:
     36        (.WebInspector.InspectorBackendStub):
     37        (.WebInspector.InspectorBackendStub.prototype._registerDelegate):
     38        (.WebInspector.InspectorBackendStub.prototype.sendMessageToBackend):
     39
    1402010-07-27  Satish Sampath  <satish@chromium.org>
    241
  • trunk/WebCore/DerivedSources.cpp

    r63064 r64124  
    191191#include "JSIndexedDatabaseRequest.cpp"
    192192#include "JSInjectedScriptHost.cpp"
    193 #include "JSInspectorBackend.cpp"
    194193#include "JSInspectorFrontendHost.cpp"
    195194#include "JSJavaScriptCallFrame.cpp"
  • trunk/WebCore/DerivedSources.make

    r63198 r64124  
    234234    IndexedDatabaseRequest \
    235235    InjectedScriptHost \
    236     InspectorBackend \
    237236    InspectorFrontendHost \
    238237    KeyboardEvent \
  • trunk/WebCore/GNUmakefile.am

    r64111 r64124  
    393393        DerivedSources/WebCore/JSInjectedScriptHost.cpp \
    394394        DerivedSources/WebCore/JSInjectedScriptHost.h \
    395         DerivedSources/WebCore/JSInspectorBackend.cpp \
    396         DerivedSources/WebCore/JSInspectorBackend.h \
    397395        DerivedSources/WebCore/JSInspectorFrontendHost.cpp \
    398396        DerivedSources/WebCore/JSInspectorFrontendHost.h \
  • trunk/WebCore/WebCore.exp.in

    r64086 r64124  
    11961196__ZN7WebCore28InspectorFrontendClientLocal19requestDetachWindowEv
    11971197__ZN7WebCore28InspectorFrontendClientLocal19windowObjectClearedEv
     1198__ZN7WebCore28InspectorFrontendClientLocal20sendMessageToBackendERKNS_6StringE
    11981199__ZN7WebCore28InspectorFrontendClientLocal26changeAttachedWindowHeightEj
    11991200__ZN7WebCore28InspectorFrontendClientLocal27restoreAttachedWindowHeightEv
  • trunk/WebCore/WebCore.gypi

    r64111 r64124  
    197197            'html/VoidCallback.idl',
    198198            'inspector/InjectedScriptHost.idl',
    199             'inspector/InspectorBackend.idl',
    200199            'inspector/InspectorFrontendHost.idl',
    201200            'inspector/JavaScriptCallFrame.idl',
  • trunk/WebCore/WebCore.pri

    r63952 r64124  
    449449    html/VoidCallback.idl \
    450450    inspector/InjectedScriptHost.idl \
    451     inspector/InspectorBackend.idl \
    452451    inspector/InspectorFrontendHost.idl \
    453452    inspector/JavaScriptCallFrame.idl \
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r64111 r64124  
    87828782                        </File>
    87838783                        <File
    8784                                 RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSInspectorBackend.cpp"
    8785                                 >
    8786                                 <FileConfiguration
    8787                                         Name="Debug|Win32"
    8788                                         ExcludedFromBuild="true"
    8789                                         >
    8790                                         <Tool
    8791                                                 Name="VCCLCompilerTool"
    8792                                         />
    8793                                 </FileConfiguration>
    8794                                 <FileConfiguration
    8795                                         Name="Release|Win32"
    8796                                         ExcludedFromBuild="true"
    8797                                         >
    8798                                         <Tool
    8799                                                 Name="VCCLCompilerTool"
    8800                                         />
    8801                                 </FileConfiguration>
    8802                                 <FileConfiguration
    8803                                         Name="Debug_Internal|Win32"
    8804                                         ExcludedFromBuild="true"
    8805                                         >
    8806                                         <Tool
    8807                                                 Name="VCCLCompilerTool"
    8808                                         />
    8809                                 </FileConfiguration>
    8810                                 <FileConfiguration
    8811                                         Name="Debug_Cairo|Win32"
    8812                                         ExcludedFromBuild="true"
    8813                                         >
    8814                                         <Tool
    8815                                                 Name="VCCLCompilerTool"
    8816                                         />
    8817                                 </FileConfiguration>
    8818                                 <FileConfiguration
    8819                                         Name="Release_Cairo|Win32"
    8820                                         ExcludedFromBuild="true"
    8821                                         >
    8822                                         <Tool
    8823                                                 Name="VCCLCompilerTool"
    8824                                         />
    8825                                 </FileConfiguration>
    8826                                 <FileConfiguration
    8827                                         Name="Debug_All|Win32"
    8828                                         ExcludedFromBuild="true"
    8829                                         >
    8830                                         <Tool
    8831                                                 Name="VCCLCompilerTool"
    8832                                         />
    8833                                 </FileConfiguration>
    8834                         </File>
    8835                         <File
    8836                                 RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSInspectorBackend.h"
    8837                                 >
    8838                         </File>
    8839                         <File
    88408784                                RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSInspectorFrontendHost.cpp"
    88418785                                >
     
    2074220686                        </File>
    2074320687                        <File
    20744                                 RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\InspectorBackendDispatcher.h"
     20688                                RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\InspectorBackendDispatcher.cpp"
    2074520689                                >
    2074620690                        </File>
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r64111 r64124  
    833833                41E1B1D30FF5986900576B3B /* SharedWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41E1B1CD0FF5986900576B3B /* SharedWorker.cpp */; };
    834834                41E1B1D40FF5986900576B3B /* SharedWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = 41E1B1CE0FF5986900576B3B /* SharedWorker.h */; };
    835                 41F060CD0F5EEB2B00A07EAC /* JSInspectorBackend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F060CB0F5EEB2B00A07EAC /* JSInspectorBackend.cpp */; };
    836                 41F060CE0F5EEB2B00A07EAC /* JSInspectorBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F060CC0F5EEB2B00A07EAC /* JSInspectorBackend.h */; };
    837835                41F061740F5F00AC00A07EAC /* InspectorDOMStorageResource.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F061720F5F00AC00A07EAC /* InspectorDOMStorageResource.h */; };
    838836                41F061750F5F00AC00A07EAC /* InspectorDOMStorageResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F061730F5F00AC00A07EAC /* InspectorDOMStorageResource.cpp */; };
     
    65416539                41E1B1CE0FF5986900576B3B /* SharedWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SharedWorker.h; path = workers/SharedWorker.h; sourceTree = "<group>"; };
    65426540                41E1B1CF0FF5986900576B3B /* SharedWorker.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = SharedWorker.idl; path = workers/SharedWorker.idl; sourceTree = "<group>"; };
    6543                 41F060CB0F5EEB2B00A07EAC /* JSInspectorBackend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInspectorBackend.cpp; sourceTree = "<group>"; };
    6544                 41F060CC0F5EEB2B00A07EAC /* JSInspectorBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInspectorBackend.h; sourceTree = "<group>"; };
    65456541                41F061720F5F00AC00A07EAC /* InspectorDOMStorageResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDOMStorageResource.h; sourceTree = "<group>"; };
    65466542                41F061730F5F00AC00A07EAC /* InspectorDOMStorageResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDOMStorageResource.cpp; sourceTree = "<group>"; };
     
    71727168                7A674BD90F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageGroupLoadDeferrer.cpp; sourceTree = "<group>"; };
    71737169                7A674BDA0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageGroupLoadDeferrer.h; sourceTree = "<group>"; };
    7174                 7A74ECB61018399A00BF939E /* InspectorBackend.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = InspectorBackend.idl; sourceTree = "<group>"; };
    71757170                7A74ECB8101839A500BF939E /* InspectorBackend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorBackend.cpp; sourceTree = "<group>"; };
    71767171                7A74ECB9101839A600BF939E /* InspectorBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorBackend.h; sourceTree = "<group>"; };
     
    1143611431                                7A0E76D810BF059800A0276E /* JSInjectedScriptHost.cpp */,
    1143711432                                7A0E76D910BF059800A0276E /* JSInjectedScriptHost.h */,
    11438                                 41F060CB0F5EEB2B00A07EAC /* JSInspectorBackend.cpp */,
    11439                                 41F060CC0F5EEB2B00A07EAC /* JSInspectorBackend.h */,
    1144011433                                7A0E771C10C00DB100A0276E /* JSInspectorFrontendHost.cpp */,
    1144111434                                7A0E771D10C00DB100A0276E /* JSInspectorFrontendHost.h */,
     
    1146711460                                7A74ECB8101839A500BF939E /* InspectorBackend.cpp */,
    1146811461                                7A74ECB9101839A600BF939E /* InspectorBackend.h */,
    11469                                 7A74ECB61018399A00BF939E /* InspectorBackend.idl */,
    1147011462                                1C81B9580E97330800266E07 /* InspectorClient.h */,
    1147111463                                1C81B9570E97330800266E07 /* InspectorController.cpp */,
     
    1873918731                                C585A69711D4FB13004C3E4B /* JSIndexedDatabaseRequest.h in Headers */,
    1874018732                                7A0E76DB10BF059800A0276E /* JSInjectedScriptHost.h in Headers */,
    18741                                 41F060CE0F5EEB2B00A07EAC /* JSInspectorBackend.h in Headers */,
    1874218733                                7A0E771F10C00DB100A0276E /* JSInspectorFrontendHost.h in Headers */,
    1874318734                                49EECF07105070C400099FAB /* JSInt16Array.h in Headers */,
     
    2120321194                                7A0E76DA10BF059800A0276E /* JSInjectedScriptHost.cpp in Sources */,
    2120421195                                7A0E76D510BF050700A0276E /* JSInjectedScriptHostCustom.cpp in Sources */,
    21205                                 41F060CD0F5EEB2B00A07EAC /* JSInspectorBackend.cpp in Sources */,
    2120621196                                7A0E771E10C00DB100A0276E /* JSInspectorFrontendHost.cpp in Sources */,
    2120721197                                7A74ECBD101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp in Sources */,
  • trunk/WebCore/bindings/js/ScriptObject.cpp

    r57738 r64124  
    3838#if ENABLE(INSPECTOR)
    3939#include "JSInjectedScriptHost.h"
    40 #include "JSInspectorBackend.h"
    4140#include "JSInspectorFrontendHost.h"
    4241#endif
     
    159158
    160159#if ENABLE(INSPECTOR)
    161 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InspectorBackend* value)
    162 {
    163     JSLock lock(SilenceAssertionsOnly);
    164     JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
    165     globalObject->putDirect(Identifier(scriptState, name), toJS(scriptState, globalObject, value));
    166     return handleException(scriptState);
    167 }
    168 
    169160bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InspectorFrontendHost* value)
    170161{
  • trunk/WebCore/bindings/js/ScriptObject.h

    r53766 r64124  
    4040namespace WebCore {
    4141    class InjectedScriptHost;
    42     class InspectorBackend;
    4342    class InspectorFrontendHost;
    4443
     
    7170        static bool set(ScriptState*, const char* name, const ScriptObject&);
    7271#if ENABLE(INSPECTOR)
    73         static bool set(ScriptState*, const char* name, InspectorBackend*);
    7472        static bool set(ScriptState*, const char* name, InspectorFrontendHost*);
    7573        static bool set(ScriptState*, const char* name, InjectedScriptHost*);
  • trunk/WebCore/bindings/v8/ScriptObject.cpp

    r54421 r64124  
    3939#include "V8Binding.h"
    4040#include "V8InjectedScriptHost.h"
    41 #include "V8InspectorBackend.h"
    4241#include "V8InspectorFrontendHost.h"
    4342#include "V8Proxy.h"
     
    147146
    148147#if ENABLE(INSPECTOR)
    149 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InspectorBackend* value)
    150 {
    151     ScriptScope scope(scriptState);
    152     scope.global()->Set(v8::String::New(name), toV8(value));
    153     return scope.success();
    154 }
    155 
    156148bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InspectorFrontendHost* value)
    157149{
  • trunk/WebCore/bindings/v8/ScriptObject.h

    r53766 r64124  
    3838namespace WebCore {
    3939    class InjectedScriptHost;
    40     class InspectorBackend;
    4140    class InspectorFrontendHost;
    4241    class ScriptState;
     
    7069    public:
    7170        static bool set(ScriptState*, const char* name, const ScriptObject&);
    72         static bool set(ScriptState*, const char* name, InspectorBackend*);
    7371        static bool set(ScriptState*, const char* name, InspectorFrontendHost*);
    7472        static bool set(ScriptState*, const char* name, InjectedScriptHost*);
  • trunk/WebCore/inspector/CodeGeneratorInspector.pm

    r63967 r64124  
    165165    my @backendHead;
    166166    push(@backendHead, "    ${backendClassName}(InspectorBackend* inspectorBackend) : m_inspectorBackend(inspectorBackend) { }");
    167     push(@backendHead, "    void dispatch(const String& message, String* exception);");
     167    push(@backendHead, "    void dispatch(const String& message);");
    168168    push(@backendHead, "private:");
    169169    $backendConstructor = join("\n", @backendHead);
     
    289289    my @mapEntries = map("dispatchMap.add(\"$_\", &${backendClassName}::$_);", @methods);
    290290
    291     push(@body, "void ${backendClassName}::dispatch(const String& message, String* exception)");
     291    push(@body, "void ${backendClassName}::dispatch(const String& message)");
    292292    push(@body, "{");
     293    push(@body, "    String exception;");
    293294    push(@body, "    typedef void (${backendClassName}::*CallHandler)(PassRefPtr<InspectorArray> args, String* exception);");
    294295    push(@body, "    typedef HashMap<String, CallHandler> DispatchMap;");
     
    301302    push(@body, "    if (!parsedMessage) {");
    302303    push(@body, "        ASSERT_NOT_REACHED();");
    303     push(@body, "        *exception = \"Error: Invalid message format. Message should be in JSON format.\";");
     304    push(@body, "        exception = \"Error: Invalid message format. Message should be in JSON format.\";");
    304305    push(@body, "        return;");
    305306    push(@body, "    }");
     
    308309    push(@body, "    if (!messageArray) {");
    309310    push(@body, "        ASSERT_NOT_REACHED();");
    310     push(@body, "        *exception = \"Error: Invalid message format. The message should be a JSONified array of arguments.\";");
     311    push(@body, "        exception = \"Error: Invalid message format. The message should be a JSONified array of arguments.\";");
    311312    push(@body, "        return;");
    312313    push(@body, "    }");
     
    314315    push(@body, "    if (!messageArray->length()) {");
    315316    push(@body, "        ASSERT_NOT_REACHED();");
    316     push(@body, "        *exception = \"Error: Invalid message format. Empty message was received.\";");
     317    push(@body, "        exception = \"Error: Invalid message format. Empty message was received.\";");
    317318    push(@body, "        return;");
    318319    push(@body, "    }");
     
    321322    push(@body, "    if (!messageArray->get(0)->asString(&methodName)) {");
    322323    push(@body, "        ASSERT_NOT_REACHED();");
    323     push(@body, "        *exception = \"Error: Invalid message format. The first element of the message should be method name.\";");
     324    push(@body, "        exception = \"Error: Invalid message format. The first element of the message should be method name.\";");
    324325    push(@body, "        return;");
    325326    push(@body, "    }");
     
    328329    push(@body, "    if (it == dispatchMap.end()) {");
    329330    push(@body, "        ASSERT_NOT_REACHED();");
    330     push(@body, "        *exception = String::format(\"Error: Invalid method name. '%s' wasn't found.\", methodName.utf8().data());");
     331    push(@body, "        exception = String::format(\"Error: Invalid method name. '%s' wasn't found.\", methodName.utf8().data());");
    331332    push(@body, "        return;");
    332333    push(@body, "    }");
    333334    push(@body, "");
    334     push(@body, "    ((*this).*it->second)(messageArray, exception);");
     335    push(@body, "    ((*this).*it->second)(messageArray, &exception);");
    335336    push(@body, "}");
    336337    return @body;
  • trunk/WebCore/inspector/InspectorFrontendClient.h

    r57146 r64124  
    6060
    6161    virtual void inspectedURLChanged(const String&) = 0;
     62
     63    virtual void sendMessageToBackend(const String&) = 0;
    6264};
    6365
  • trunk/WebCore/inspector/InspectorFrontendClientLocal.cpp

    r63896 r64124  
    3838#include "Frame.h"
    3939#include "FrameView.h"
     40#include "InspectorBackendDispatcher.h"
    4041#include "InspectorController.h"
    4142#include "InspectorFrontend.h"
     
    7374    // FIXME: don't keep reference to the script state
    7475    m_frontendScriptState = scriptStateFromPage(debuggerWorld(), m_frontendPage);
    75     ScriptGlobalObject::set(m_frontendScriptState, "InspectorBackend", m_inspectorController->inspectorBackend());
    7676    m_frontendHost = InspectorFrontendHost::create(this, m_frontendPage);
    7777    ScriptGlobalObject::set(m_frontendScriptState, "InspectorFrontendHost", m_frontendHost.get());
     
    160160    return roundf(max(minimumAttachedHeight, min<float>(preferredHeight, totalWindowHeight * maximumAttachedHeightRatio)));
    161161}
    162    
     162
     163void InspectorFrontendClientLocal::sendMessageToBackend(const String& message)
     164{
     165    m_inspectorController->inspectorBackendDispatcher()->dispatch(message);
     166}
     167
    163168} // namespace WebCore
    164169
  • trunk/WebCore/inspector/InspectorFrontendClientLocal.h

    r57146 r64124  
    6060    bool canAttachWindow();
    6161
     62    virtual void sendMessageToBackend(const String& message);
     63
    6264protected:
    6365    virtual void setAttachedWindowHeight(unsigned) = 0;
  • trunk/WebCore/inspector/InspectorFrontendHost.cpp

    r57429 r64124  
    208208}
    209209
     210void InspectorFrontendHost::sendMessageToBackend(const String& message)
     211{
     212    m_client->sendMessageToBackend(message);
     213}
     214
    210215#if ENABLE(CONTEXT_MENUS)
    211216void InspectorFrontendHost::showContextMenu(Event* event, const Vector<ContextMenuItem*>& items)
  • trunk/WebCore/inspector/InspectorFrontendHost.h

    r57429 r64124  
    7676    // Called from [Custom] implementations.
    7777    void showContextMenu(Event*, const Vector<ContextMenuItem*>& items);
     78    void sendMessageToBackend(const String& message);
    7879
    7980private:
  • trunk/WebCore/inspector/InspectorFrontendHost.idl

    r57146 r64124  
    5151        [Custom] DOMString port();
    5252        [Custom] void showContextMenu(in MouseEvent event, in DOMObject items);
     53        void sendMessageToBackend(in DOMString message);
    5354    };
    5455}
  • trunk/WebCore/inspector/front-end/InspectorBackendStub.js

    r63309 r64124  
    11/*
    2  * Copyright (C) 2009 Google Inc. All rights reserved.
     2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3333WebInspector.InspectorBackendStub = function()
    3434{
    35     this._attachedWindowHeight = 0;
    36     this._timelineEnabled = false;
     35    this._registerDelegate("addInspectedNode");
     36    this._registerDelegate("addScriptToEvaluateOnLoad");
     37    this._registerDelegate("changeTagName");
     38    this._registerDelegate("clearConsoleMessages");
     39    this._registerDelegate("copyNode");
     40    this._registerDelegate("deleteCookie");
     41    this._registerDelegate("didEvaluateForTestInFrontend");
     42    this._registerDelegate("disableMonitoringXHR");
     43    this._registerDelegate("disableResourceTracking");
     44    this._registerDelegate("disableSearchingForNode");
     45    this._registerDelegate("disableTimeline");
     46    this._registerDelegate("dispatchOnInjectedScript");
     47    this._registerDelegate("enableMonitoringXHR");
     48    this._registerDelegate("enableResourceTracking");
     49    this._registerDelegate("enableSearchingForNode");
     50    this._registerDelegate("enableTimeline");
     51    this._registerDelegate("getChildNodes");
     52    this._registerDelegate("getCookies");
     53    this._registerDelegate("getDatabaseTableNames");
     54    this._registerDelegate("getDOMStorageEntries");
     55    this._registerDelegate("getEventListenersForNode");
     56    this._registerDelegate("getOuterHTML");
     57    this._registerDelegate("getProfile");
     58    this._registerDelegate("getProfileHeaders");
     59    this._registerDelegate("removeProfile");
     60    this._registerDelegate("clearProfiles");
     61    this._registerDelegate("getResourceContent");
     62    this._registerDelegate("highlightDOMNode");
     63    this._registerDelegate("hideDOMNodeHighlight");
     64    this._registerDelegate("performSearch");
     65    this._registerDelegate("pushNodeByPathToFrontend");
     66    this._registerDelegate("releaseWrapperObjectGroup");
     67    this._registerDelegate("removeAllScriptsToEvaluateOnLoad");
     68    this._registerDelegate("reloadPage");
     69    this._registerDelegate("removeAttribute");
     70    this._registerDelegate("removeDOMStorageItem");
     71    this._registerDelegate("removeNode");
     72    this._registerDelegate("saveApplicationSettings");
     73    this._registerDelegate("saveSessionSettings");
     74    this._registerDelegate("searchCanceled");
     75    this._registerDelegate("setAttribute");
     76    this._registerDelegate("setDOMStorageItem");
     77    this._registerDelegate("setInjectedScriptSource");
     78    this._registerDelegate("setOuterHTML");
     79    this._registerDelegate("setTextNodeValue");
     80    this._registerDelegate("startProfiling");
     81    this._registerDelegate("startTimelineProfiler");
     82    this._registerDelegate("stopProfiling");
     83    this._registerDelegate("stopTimelineProfiler");
     84    this._registerDelegate("storeLastActivePanel");
     85    this._registerDelegate("takeHeapSnapshot");
     86
     87    this._registerDelegate("getAllStyles");
     88    this._registerDelegate("getStyles");
     89    this._registerDelegate("getComputedStyle");
     90    this._registerDelegate("getInlineStyle");
     91    this._registerDelegate("getStyleSheet");
     92    this._registerDelegate("getRuleRanges");
     93    this._registerDelegate("applyStyleText");
     94    this._registerDelegate("setStyleText");
     95    this._registerDelegate("setStyleProperty");
     96    this._registerDelegate("toggleStyleEnabled");
     97    this._registerDelegate("setRuleSelector");
     98    this._registerDelegate("addRule");
     99
     100    this._registerDelegate("disableDebugger");
     101    this._registerDelegate("editScriptSource");
     102    this._registerDelegate("getScriptSource");
     103    this._registerDelegate("enableDebugger");
     104    this._registerDelegate("setBreakpoint");
     105    this._registerDelegate("removeBreakpoint");
     106    this._registerDelegate("activateBreakpoints");
     107    this._registerDelegate("deactivateBreakpoints");
     108    this._registerDelegate("resume");
     109    this._registerDelegate("stepIntoStatement");
     110    this._registerDelegate("stepOutOfFunction");
     111    this._registerDelegate("stepOverStatement");
     112    this._registerDelegate("setPauseOnExceptionsState");
    37113}
    38114
    39115WebInspector.InspectorBackendStub.prototype = {
    40     wrapCallback: function(func)
     116    _registerDelegate: function(methodName)
    41117    {
    42         return func;
     118        this[methodName] = this.sendMessageToBackend.bind(this, methodName);
    43119    },
    44120
    45     closeWindow: function()
     121    sendMessageToBackend: function()
    46122    {
    47         this._windowVisible = false;
    48     },
    49 
    50     attach: function()
    51     {
    52     },
    53 
    54     detach: function()
    55     {
    56     },
    57 
    58     storeLastActivePanel: function(panel)
    59     {
    60     },
    61 
    62     clearConsoleMessages: function()
    63     {
    64     },
    65 
    66     getOuterHTML: function()
    67     {
    68     },
    69 
    70     setOuterHTML: function()
    71     {
    72     },
    73 
    74     addInspectedNode: function()
    75     {
    76     },
    77 
    78     search: function(sourceRow, query)
    79     {
    80     },
    81 
    82     moveByUnrestricted: function(x, y)
    83     {
    84     },
    85 
    86     getResourceContent: function(callId, identifier)
    87     {
    88         WebInspector.didGetResourceContent(callId, "");
    89     },
    90 
    91     highlightDOMNode: function(node)
    92     {
    93     },
    94 
    95     hideDOMNodeHighlight: function()
    96     {
    97     },
    98 
    99     inspectedWindow: function()
    100     {
    101         return window;
    102     },
    103 
    104     loaded: function()
    105     {
    106     },
    107 
    108     localizedStringsURL: function()
    109     {
    110         return undefined;
    111     },
    112 
    113     windowUnloading: function()
    114     {
    115         return false;
    116     },
    117 
    118     hiddenPanels: function()
    119     {
    120         return "";
    121     },
    122 
    123     enableResourceTracking: function()
    124     {
    125         WebInspector.resourceTrackingWasEnabled();
    126     },
    127 
    128     disableResourceTracking: function()
    129     {
    130         WebInspector.resourceTrackingWasDisabled();
    131     },
    132 
    133 
    134     enableSearchingForNode: function()
    135     {
    136         WebInspector.searchingForNodeWasEnabled();
    137     },
    138 
    139     disableSearchingForNode: function()
    140     {
    141         WebInspector.searchingForNodeWasDisabled();
    142     },
    143 
    144     enableMonitoringXHR: function()
    145     {
    146         WebInspector.monitoringXHRWasEnabled();
    147     },
    148 
    149     disableMonitoringXHR: function()
    150     {
    151         WebInspector.monitoringXHRWasDisabled();
    152     },
    153 
    154     reloadPage: function()
    155     {
    156     },
    157 
    158     enableDebugger: function()
    159     {
    160         WebInspector.debuggerWasEnabled();
    161     },
    162 
    163     disableDebugger: function()
    164     {
    165         WebInspector.debuggerWasDisabled();
    166     },
    167 
    168     setBreakpoint: function(callId, sourceID, line, enabled, condition)
    169     {
    170         WebInspector.didSetBreakpoint(callId, true, line);
    171     },
    172 
    173     removeBreakpoint: function(sourceID, line)
    174     {
    175     },
    176 
    177     activateBreakpoints: function()
    178     {
    179         this._breakpointsActivated = true;
    180     },
    181 
    182     deactivateBreakpoints: function()
    183     {
    184         this._breakpointsActivated = false;
    185     },
    186 
    187     pause: function()
    188     {
    189     },
    190 
    191     setPauseOnExceptionsState: function(value)
    192     {
    193         WebInspector.updatePauseOnExceptionsState(value);
    194     },
    195 
    196     editScriptSource: function()
    197     {
    198         WebInspector.didEditScriptSource(callId, false);
    199     },
    200 
    201     getScriptSource: function(callId, sourceID)
    202     {
    203         WebInspector.didGetScriptSource(callId, null);
    204     },
    205 
    206     resume: function()
    207     {
    208     },
    209 
    210     enableProfiler: function()
    211     {
    212         WebInspector.profilerWasEnabled();
    213     },
    214 
    215     disableProfiler: function()
    216     {
    217         WebInspector.profilerWasDisabled();
    218     },
    219 
    220     startProfiling: function()
    221     {
    222     },
    223 
    224     stopProfiling: function()
    225     {
    226     },
    227 
    228     getProfileHeaders: function(callId)
    229     {
    230         WebInspector.didGetProfileHeaders(callId, []);
    231     },
    232 
    233     getProfile: function(callId, uid)
    234     {
    235     },
    236 
    237     takeHeapSnapshot: function()
    238     {
    239     },
    240 
    241     databaseTableNames: function(database)
    242     {
    243         return [];
    244     },
    245 
    246     stepIntoStatement: function()
    247     {
    248     },
    249 
    250     stepOutOfFunction: function()
    251     {
    252     },
    253 
    254     stepOverStatement: function()
    255     {
    256     },
    257 
    258     saveApplicationSettings: function()
    259     {
    260     },
    261 
    262     saveSessionSettings: function()
    263     {
    264     },
    265 
    266     dispatchOnInjectedScript: function()
    267     {
    268     },
    269 
    270     releaseWrapperObjectGroup: function()
    271     {
    272     },
    273 
    274     setInjectedScriptSource: function()
    275     {
    276     },
    277    
    278     addScriptToEvaluateOnLoad: function()
    279     {
    280     },
    281 
    282     removeAllScriptsToEvaluateOnLoad: function()
    283     {
    284     },
    285 
    286     performSearch: function()
    287     {
    288     },
    289 
    290     searchCanceled: function()
    291     {
     123        var message = JSON.stringify(Array.prototype.slice.call(arguments));
     124        if (WebInspector._paramsObject && "page" in WebInspector._paramsObject)
     125            WebInspector.socket.send(message);
     126        else
     127            InspectorFrontendHost.sendMessageToBackend(message);
    292128    }
    293129}
  • trunk/WebKit/chromium/ChangeLog

    r64113 r64124  
     12010-07-27  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        WebInspector: Current implementation of message based inspector
     6        transport generated by CodeGeneratorInspector should be upstreamed
     7        from WebKit/chromium to WebCore.
     8        https://bugs.webkit.org/show_bug.cgi?id=42983
     9
     10        * WebKit.gypi:
     11        * src/InspectorFrontendClientImpl.cpp:
     12        (WebKit::InspectorFrontendClientImpl::sendMessageToBackend):
     13        * src/InspectorFrontendClientImpl.h:
     14        * src/ToolsAgent.h:
     15        * src/WebDevToolsAgentImpl.cpp:
     16        (WebKit::WebDevToolsAgentImpl::dispatchOnInspectorController):
     17        (WebKit::WebDevToolsAgentImpl::initDevToolsAgentHost):
     18        * src/WebDevToolsAgentImpl.h:
     19        * src/js/InspectorControllerImpl.js: Removed.
     20
    1212010-07-27  Dominic Mazzoni  <dmazzoni@google.com>
    222
  • trunk/WebKit/chromium/WebKit.gypi

    r63311 r64124  
    3434        # for copying them to resource dir, and for generating 'devtools.html' file.
    3535        'devtools_js_files': [
    36             'src/js/InspectorControllerImpl.js',
    3736            'src/js/ProfilerAgent.js',
    3837            'src/js/ProfilerProcessor.js',
  • trunk/WebKit/chromium/src/InspectorFrontendClientImpl.cpp

    r63311 r64124  
    125125}
    126126
     127void InspectorFrontendClientImpl::sendMessageToBackend(const String& message)
     128{
     129    WebDevToolsMessageData messageData;
     130    messageData.className = "ToolsAgent";
     131    messageData.methodName = "dispatchOnInspectorController";
     132    WebVector<WebString> args(static_cast<size_t>(1));
     133    args[0] = message;
     134    messageData.arguments.swap(args);
     135    m_client->sendMessageToAgent(messageData);
     136}
     137
    127138} // namespace WebKit
  • trunk/WebKit/chromium/src/InspectorFrontendClientImpl.h

    r57146 r64124  
    6969    virtual void inspectedURLChanged(const WebCore::String&);
    7070
     71    virtual void sendMessageToBackend(const WebCore::String&);
    7172private:
    7273    WebCore::Page* m_frontendPage;
  • trunk/WebKit/chromium/src/ToolsAgent.h

    r63965 r64124  
    4040#define TOOLS_AGENT_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \
    4141    /* Dispatches given function on the InspectorController object */ \
    42     METHOD2(dispatchOnInspectorController, int /* call_id */, \
    43         String /* message */) \
     42    METHOD1(dispatchOnInspectorController, String /* message */) \
    4443
    4544DEFINE_RPC_CLASS(ToolsAgent, TOOLS_AGENT_STRUCT)
  • trunk/WebKit/chromium/src/WebDevToolsAgentImpl.cpp

    r63965 r64124  
    5656#include "ScriptValue.h"
    5757#include "V8Binding.h"
    58 #include "V8InspectorBackend.h"
    5958#include "V8Proxy.h"
    6059#include "V8Utilities.h"
     
    9493using WebCore::String;
    9594using WebCore::V8DOMWrapper;
    96 using WebCore::V8InspectorBackend;
    9795using WebCore::V8Proxy;
    9896
     
    310308}
    311309
    312 void WebDevToolsAgentImpl::dispatchOnInspectorController(int callId, const String& message)
    313 {
    314     String exception;
    315     inspectorController()->inspectorBackendDispatcher()->dispatch(message, &exception);
    316     m_toolsAgentDelegateStub->didDispatchOn(callId, "", exception);
     310void WebDevToolsAgentImpl::dispatchOnInspectorController(const String& message)
     311{
     312    inspectorController()->inspectorBackendDispatcher()->dispatch(message);
    317313}
    318314
     
    376372        WebDevToolsAgentImpl::jsDispatchOnClient);
    377373    devtoolsAgentHost.build();
    378 
    379     v8::HandleScope scope;
    380     v8::Context::Scope utilityScope(m_utilityContext);
    381     // Call custom code to create inspector backend wrapper in the utility context
    382     // instead of calling V8DOMWrapper::convertToV8Object that would create the
    383     // wrapper in the Page main frame context.
    384     v8::Handle<v8::Object> backendWrapper = createInspectorBackendV8Wrapper();
    385     if (backendWrapper.IsEmpty())
    386         return;
    387     m_utilityContext->Global()->Set(v8::String::New("InspectorBackend"), backendWrapper);
    388 }
    389 
    390 v8::Local<v8::Object> WebDevToolsAgentImpl::createInspectorBackendV8Wrapper()
    391 {
    392     v8::Handle<v8::Function> function = V8InspectorBackend::GetTemplate()->GetFunction();
    393     if (function.IsEmpty()) {
    394         // Return if allocation failed.
    395         return v8::Local<v8::Object>();
    396     }
    397     v8::Local<v8::Object> instance = SafeAllocation::newInstance(function);
    398     if (instance.IsEmpty()) {
    399         // Avoid setting the wrapper if allocation failed.
    400         return v8::Local<v8::Object>();
    401     }
    402     InspectorBackend* backend = m_webViewImpl->page()->inspectorController()->inspectorBackend();
    403     V8DOMWrapper::setDOMWrapper(instance, &V8InspectorBackend::info, backend);
    404     // Create a weak reference to the v8 wrapper of InspectorBackend to deref
    405     // InspectorBackend when the wrapper is garbage collected.
    406     backend->ref();
    407     v8::Persistent<v8::Object> weakHandle = v8::Persistent<v8::Object>::New(instance);
    408     weakHandle.MakeWeak(backend, &InspectorBackendWeakReferenceCallback);
    409     return instance;
    410374}
    411375
  • trunk/WebKit/chromium/src/WebDevToolsAgentImpl.h

    r63965 r64124  
    7373
    7474    // ToolsAgent implementation.
    75     virtual void dispatchOnInspectorController(int callId, const WebCore::String& message);
     75    virtual void dispatchOnInspectorController(const WebCore::String& message);
    7676
    7777    // WebDevToolsAgentPrivate implementation.
     
    128128    WebCore::InspectorController* inspectorController();
    129129
    130     // Creates InspectorBackend v8 wrapper in the utility context so that it's
    131     // methods prototype is Function.protoype object from the utility context.
    132     // Otherwise some useful methods  defined on Function.prototype(such as bind)
    133     // are missing for InspectorController native methods.
    134     v8::Local<v8::Object> createInspectorBackendV8Wrapper();
    135 
    136130    int m_hostId;
    137131    WebDevToolsAgentClient* m_client;
Note: See TracChangeset for help on using the changeset viewer.