Changeset 82810 in webkit


Ignore:
Timestamp:
Apr 4, 2011 2:38:02 AM (13 years ago)
Author:
yurys@chromium.org
Message:

2011-04-01 Sergey Vorobyev <sergeyvorobyev@google.com>

Reviewed by Yury Semikhatsky.

Web Inspector: Separate sendMessageToFrontend function
from InspectorClient to individual interface.
https://bugs.webkit.org/show_bug.cgi?id=57548

Refactoring - covered with existing inspector tests.

  • GNUmakefile.am:
  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • inspector/CodeGeneratorInspector.pm:
  • inspector/InspectorClient.h:
  • inspector/InspectorFrontendChannel.h: Added. (WebCore::InspectorFrontendChannel::~InspectorFrontendChannel):
Location:
trunk/Source/WebCore
Files:
7 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r82809 r82810  
     12011-04-01  Sergey Vorobyev  <sergeyvorobyev@google.com>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: Separate sendMessageToFrontend function
     6        from InspectorClient to individual interface.
     7        https://bugs.webkit.org/show_bug.cgi?id=57548
     8
     9        Refactoring - covered with existing inspector tests.
     10
     11        * GNUmakefile.am:
     12        * WebCore.gypi:
     13        * WebCore.vcproj/WebCore.vcproj:
     14        * WebCore.xcodeproj/project.pbxproj:
     15        * inspector/CodeGeneratorInspector.pm:
     16        * inspector/InspectorClient.h:
     17        * inspector/InspectorFrontendChannel.h: Added.
     18        (WebCore::InspectorFrontendChannel::~InspectorFrontendChannel):
     19
    1202011-04-04  Nico Weber  <thakis@chromium.org>
    221
  • trunk/Source/WebCore/GNUmakefile.am

    r82669 r82810  
    20252025        Source/WebCore/inspector/InspectorDOMStorageResource.cpp \
    20262026        Source/WebCore/inspector/InspectorDOMStorageResource.h \
     2027        Source/WebCore/inspector/InspectorFrontendChannel.h \
    20272028        Source/WebCore/inspector/InspectorFrontendClient.h \
    20282029        Source/WebCore/inspector/InspectorFrontendClientLocal.cpp \
  • trunk/Source/WebCore/WebCore.gypi

    r82702 r82810  
    32143214            'inspector/InspectorDebuggerAgent.cpp',
    32153215            'inspector/InspectorDebuggerAgent.h',
     3216            'inspector/InspectorFrontendChannel.h',
    32163217            'inspector/InspectorFrontendClientLocal.cpp',
    32173218            'inspector/InspectorFrontendHost.cpp',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r82668 r82810  
    6647166471                        </File>
    6647266472                        <File
     66473                                RelativePath="..\inspector\InspectorFrontendChannel.h"
     66474                                >
     66475                        </File>
     66476                        <File
    6647366477                                RelativePath="..\inspector\InspectorFrontendClient.h"
    6647466478                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r82662 r82810  
    644644                20D629261253690B00081543 /* InspectorInstrumentation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 20D629241253690B00081543 /* InspectorInstrumentation.cpp */; };
    645645                20D629271253690B00081543 /* InspectorInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 20D629251253690B00081543 /* InspectorInstrumentation.h */; };
     646                227777601345DEA9008EA455 /* InspectorFrontendChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 2277775F1345DEA9008EA455 /* InspectorFrontendChannel.h */; settings = {ATTRIBUTES = (Private, ); }; };
    646647                22885E641301AE4C00526E68 /* JSDOMImplementationCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 22885E631301AE4C00526E68 /* JSDOMImplementationCustom.cpp */; };
    647648                228C284510D82500009D0D0E /* ScriptWrappable.h in Headers */ = {isa = PBXBuildFile; fileRef = 228C284410D82500009D0D0E /* ScriptWrappable.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    70447045                20D629241253690B00081543 /* InspectorInstrumentation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorInstrumentation.cpp; sourceTree = "<group>"; };
    70457046                20D629251253690B00081543 /* InspectorInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorInstrumentation.h; sourceTree = "<group>"; };
     7047                2277775F1345DEA9008EA455 /* InspectorFrontendChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontendChannel.h; sourceTree = "<group>"; };
    70467048                22885E631301AE4C00526E68 /* JSDOMImplementationCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMImplementationCustom.cpp; sourceTree = "<group>"; };
    70477049                228C284410D82500009D0D0E /* ScriptWrappable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptWrappable.h; sourceTree = "<group>"; };
     
    1317813180                                41F061730F5F00AC00A07EAC /* InspectorDOMStorageResource.cpp */,
    1317913181                                41F061720F5F00AC00A07EAC /* InspectorDOMStorageResource.h */,
     13182                                2277775F1345DEA9008EA455 /* InspectorFrontendChannel.h */,
    1318013183                                F344C7121125B82C00F26EEE /* InspectorFrontendClient.h */,
    1318113184                                F344C75711294FF600F26EEE /* InspectorFrontendClientLocal.cpp */,
     
    2119721200                                4F707A9A11EF679400ACDA69 /* InspectorBackendDispatcher.h in Headers */,
    2119821201                                F3D4C47912E07663003DA150 /* InspectorBrowserDebuggerAgent.h in Headers */,
     21202                                227777601345DEA9008EA455 /* InspectorFrontendChannel.h in Headers */,
    2119921203                                1C81B95C0E97330800266E07 /* InspectorClient.h in Headers */,
    2120021204                                F3335BF912E07DC300D33011 /* InspectorConsoleAgent.h in Headers */,
  • trunk/Source/WebCore/inspector/CodeGeneratorInspector.pm

    r82807 r82810  
    9191    "header" => "InspectorFrontend.h",
    9292};
    93 $typeTransform{"InspectorClient"} = {
    94     "forward" => "InspectorClient",
    95     "header" => "InspectorClient.h",
    96 };
    9793$typeTransform{"PassRefPtr"} = {
    9894    "forwardHeader" => "wtf/PassRefPtr.h",
     95};
     96$typeTransform{"InspectorFrontendChannel"} = {
     97    "forward" => "InspectorFrontendChannel",
     98    "header" => "InspectorFrontendChannel.h",
    9999};
    100100$typeTransform{"Object"} = {
     
    262262
    263263    $frontendClassName = "InspectorFrontend";
    264     $frontendConstructor = "    ${frontendClassName}(InspectorClient*);";
     264    $frontendConstructor = "    ${frontendClassName}(InspectorFrontendChannel*);";
    265265    push(@frontendFooter, "private:");
    266     push(@frontendFooter, "    InspectorClient* m_inspectorClient;");
     266    push(@frontendFooter, "    InspectorFrontendChannel* m_inspectorFrontendChannel;");
    267267    $frontendTypes{"String"} = 1;
    268     $frontendTypes{"InspectorClient"} = 1;
     268    $frontendTypes{"InspectorFrontendChannel"} = 1;
    269269    $frontendTypes{"PassRefPtr"} = 1;
    270270
     
    272272    $backendJSStubName = "InspectorBackendStub";
    273273    $backendTypes{"Inspector"} = 1;
    274     $backendTypes{"InspectorClient"} = 1;
     274    $backendTypes{"InspectorFrontendChannel"} = 1;
    275275    $backendTypes{"PassRefPtr"} = 1;
    276276    $backendTypes{"Object"} = 1;
     
    301301    push(@frontendMethods, "    class ${agentName} {");
    302302    push(@frontendMethods, "    public:");
    303     push(@frontendMethods, "        ${agentName}(InspectorClient* inspectorClient) : m_inspectorClient(inspectorClient) { }");
     303    push(@frontendMethods, "        ${agentName}(InspectorFrontendChannel* inspectorFrontendChannel) : m_inspectorFrontendChannel(inspectorFrontendChannel) { }");
    304304    push(@frontendMethods, @{$agent->{methodDeclarations}});
     305    push(@frontendMethods, "        void setInspectorFrontendChannel(InspectorFrontendChannel* inspectorFrontendChannel) { m_inspectorFrontendChannel = inspectorFrontendChannel; }");
     306    push(@frontendMethods, "        InspectorFrontendChannel* getInspectorFrontendChannel() { return m_inspectorFrontendChannel; }");
    305307    push(@frontendMethods, "    private:");
    306     push(@frontendMethods, "        InspectorClient* m_inspectorClient;");
     308    push(@frontendMethods, "        InspectorFrontendChannel* m_inspectorFrontendChannel;");
    307309    push(@frontendMethods, "    };");
    308310    push(@frontendMethods, "");
     
    320322{
    321323    my @frontendConstructorImpl;
    322     push(@frontendConstructorImpl, "${frontendClassName}::${frontendClassName}(InspectorClient* inspectorClient)");
    323     push(@frontendConstructorImpl, "    : m_inspectorClient(inspectorClient)");
     324    push(@frontendConstructorImpl, "${frontendClassName}::${frontendClassName}(InspectorFrontendChannel* inspectorFrontendChannel)");
     325    push(@frontendConstructorImpl, "    : m_inspectorFrontendChannel(inspectorFrontendChannel)");
    324326    foreach my $agentField (@frontendAgentFields) {
    325         push(@frontendConstructorImpl, "    , ${agentField}(inspectorClient)");
     327        push(@frontendConstructorImpl, "    , ${agentField}(inspectorFrontendChannel)");
    326328    }
    327329    push(@frontendConstructorImpl, "{");
     
    375377    push(@function, @pushArguments);
    376378    push(@function, "    ${functionName}Message->setObject(\"data\", dataObject);");
    377     push(@function, "    m_inspectorClient->sendMessageToFrontend(${functionName}Message->toJSONString());");
     379    push(@function, "    m_inspectorFrontendChannel->sendMessageToFrontend(${functionName}Message->toJSONString());");
    378380    push(@function, "}");
    379381    push(@function, "");
     
    475477        push(@function, "        }");
    476478    }
    477     push(@function, "        m_inspectorClient->sendMessageToFrontend(responseMessage->toJSONString());");
     479    push(@function, "        m_inspectorFrontendChannel->sendMessageToFrontend(responseMessage->toJSONString());");
    478480    push(@function, "    }");
    479481
     
    495497    errors->pushString(errorText);
    496498    message->setArray("protocolErrors", errors);
    497     m_inspectorClient->sendMessageToFrontend(message->toJSONString());
     499    m_inspectorFrontendChannel->sendMessageToFrontend(message->toJSONString());
    498500}
    499501EOF
     
    931933    my @fieldInitializers;
    932934
    933     push(@arguments, "InspectorClient* inspectorClient");
    934     push(@fieldInitializers, "        : m_inspectorClient(inspectorClient)");
    935     push(@backendFooter, "    InspectorClient* m_inspectorClient;");
     935    push(@arguments, "InspectorFrontendChannel* inspectorFrontendChannel");
     936    push(@fieldInitializers, "        : m_inspectorFrontendChannel(inspectorFrontendChannel)");
     937    push(@backendFooter, "    InspectorFrontendChannel* m_inspectorFrontendChannel;");
    936938
    937939    foreach my $domain (sort keys %backendDomains) {
  • trunk/Source/WebCore/inspector/InspectorClient.h

    r77617 r82810  
    11/*
    22 * Copyright (C) 2007 Apple Inc.  All rights reserved.
     3 * Copyright (C) 2011 Google Inc.  All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    2728#define InspectorClient_h
    2829
     30#include "InspectorFrontendChannel.h"
    2931#include <wtf/Forward.h>
    3032
     
    3537class Page;
    3638
    37 class InspectorClient {
     39class InspectorClient : public InspectorFrontendChannel {
    3840public:
    3941    virtual ~InspectorClient() { }
     
    4547    virtual void highlight(Node*) = 0;
    4648    virtual void hideHighlight() = 0;
    47 
    48     virtual bool sendMessageToFrontend(const String& message) = 0;
    4949
    5050    // Navigation can cause some WebKit implementations to change the view / page / inspector controller instance.
  • trunk/Source/WebCore/inspector/InspectorFrontendChannel.h

    r82809 r82810  
    11/*
    2  * Copyright (C) 2007 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2011 Google Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #ifndef InspectorClient_h
    27 #define InspectorClient_h
     26#ifndef InspectorFrontendChannel_h
     27#define InspectorFrontendChannel_h
     28
     29#if ENABLE(INSPECTOR)
    2830
    2931#include <wtf/Forward.h>
     
    3133namespace WebCore {
    3234
    33 class InspectorController;
    34 class Node;
    35 class Page;
    36 
    37 class InspectorClient {
     35class InspectorFrontendChannel {
    3836public:
    39     virtual ~InspectorClient() { }
    40 
    41     virtual void inspectorDestroyed() = 0;
    42 
    43     virtual void openInspectorFrontend(InspectorController*) = 0;
    44 
    45     virtual void highlight(Node*) = 0;
    46     virtual void hideHighlight() = 0;
    47 
     37    virtual ~InspectorFrontendChannel() { }
    4838    virtual bool sendMessageToFrontend(const String& message) = 0;
    49 
    50     // Navigation can cause some WebKit implementations to change the view / page / inspector controller instance.
    51     // However, there are some inspector controller states that should survive navigation (such as tracking resources
    52     // or recording timeline). Following callbacks allow embedders to track these states.
    53     virtual void updateInspectorStateCookie(const String&) { };
    54 
    55     bool doDispatchMessageOnFrontendPage(Page* frontendPage, const String& message);
    5639};
    5740
    5841} // namespace WebCore
    5942
    60 #endif // !defined(InspectorClient_h)
     43#endif // ENABLE(INSPECTOR)
     44
     45#endif // !defined(InspectorFrontendChannel_h)
Note: See TracChangeset for help on using the changeset viewer.