Changeset 106218 in webkit


Ignore:
Timestamp:
Jan 30, 2012 12:57:18 AM (12 years ago)
Author:
yurys@chromium.org
Message:

Web Inspector: CodeGeneratorInspector.py: clean InspectorBackendDispatcher.h
https://bugs.webkit.org/show_bug.cgi?id=77062

Patch by Peter Rybin <peter.rybin@gmail.com> on 2012-01-30
Reviewed by Yury Semikhatsky.

Code generator is changed. Now it generates InspectorBackendDispatcher
as an abstract class so that implementation details could be fully
hidden in .cpp file in a separate 'impl' class. This should make .h
file more clear.
Also new formal interfaces to domain agents are generated. This is an
improvement over the current case when interfaces to agents are
definen implicitly at calling sites.

  • inspector/CodeGeneratorInspector.py:

(RawTypes):
(RawTypes.OutputPassModel):
(RawTypes.OutputPassModel.ByPointer):
(RawTypes.OutputPassModel.ByPointer.get_argument_prefix):
(RawTypes.OutputPassModel.ByPointer.get_parameter_type_suffix):
(RawTypes.OutputPassModel.ByReference):
(RawTypes.OutputPassModel.ByReference.get_argument_prefix):
(RawTypes.OutputPassModel.ByReference.get_parameter_type_suffix):
(RawTypes.BaseType.is_event_param_check_optional):
(RawTypes.String):
(RawTypes.String.get_output_pass_model):
(RawTypes.String.is_heavy_value):
(RawTypes.Int):
(RawTypes.Int.get_output_pass_model):
(RawTypes.Int.is_heavy_value):
(RawTypes.Number):
(RawTypes.Number.get_output_pass_model):
(RawTypes.Number.is_heavy_value):
(RawTypes.Bool.get_c_param_type):
(RawTypes.Bool):
(RawTypes.Bool.get_output_pass_model):
(RawTypes.Bool.is_heavy_value):
(RawTypes.Object):
(RawTypes.Object.get_output_pass_model):
(RawTypes.Object.is_heavy_value):
(RawTypes.Any.get_c_initializer):
(RawTypes.Any):
(RawTypes.Any.get_output_pass_model):
(RawTypes.Any.is_heavy_value):
(RawTypes.Array):
(RawTypes.Array.get_output_pass_model):
(RawTypes.Array.is_heavy_value):
(InspectorBackendDispatcherImpl):
(void):
(Generator):
(Generator.go):
(Generator.process_command):

  • inspector/InspectorController.cpp:

(WebCore::InspectorController::connectFrontend):

  • inspector/WorkerInspectorController.cpp:

(WebCore::WorkerInspectorController::connectFrontend):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r106217 r106218  
     12012-01-30  Peter Rybin  <peter.rybin@gmail.com>
     2
     3        Web Inspector: CodeGeneratorInspector.py: clean InspectorBackendDispatcher.h
     4        https://bugs.webkit.org/show_bug.cgi?id=77062
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        Code generator is changed. Now it generates InspectorBackendDispatcher
     9        as an abstract class so that implementation details could be fully
     10        hidden in .cpp file in a separate 'impl' class. This should make .h
     11        file more clear.
     12        Also new formal interfaces to domain agents are generated. This is an
     13        improvement over the current case when interfaces to agents are
     14        definen implicitly at calling sites.
     15
     16        * inspector/CodeGeneratorInspector.py:
     17        (RawTypes):
     18        (RawTypes.OutputPassModel):
     19        (RawTypes.OutputPassModel.ByPointer):
     20        (RawTypes.OutputPassModel.ByPointer.get_argument_prefix):
     21        (RawTypes.OutputPassModel.ByPointer.get_parameter_type_suffix):
     22        (RawTypes.OutputPassModel.ByReference):
     23        (RawTypes.OutputPassModel.ByReference.get_argument_prefix):
     24        (RawTypes.OutputPassModel.ByReference.get_parameter_type_suffix):
     25        (RawTypes.BaseType.is_event_param_check_optional):
     26        (RawTypes.String):
     27        (RawTypes.String.get_output_pass_model):
     28        (RawTypes.String.is_heavy_value):
     29        (RawTypes.Int):
     30        (RawTypes.Int.get_output_pass_model):
     31        (RawTypes.Int.is_heavy_value):
     32        (RawTypes.Number):
     33        (RawTypes.Number.get_output_pass_model):
     34        (RawTypes.Number.is_heavy_value):
     35        (RawTypes.Bool.get_c_param_type):
     36        (RawTypes.Bool):
     37        (RawTypes.Bool.get_output_pass_model):
     38        (RawTypes.Bool.is_heavy_value):
     39        (RawTypes.Object):
     40        (RawTypes.Object.get_output_pass_model):
     41        (RawTypes.Object.is_heavy_value):
     42        (RawTypes.Any.get_c_initializer):
     43        (RawTypes.Any):
     44        (RawTypes.Any.get_output_pass_model):
     45        (RawTypes.Any.is_heavy_value):
     46        (RawTypes.Array):
     47        (RawTypes.Array.get_output_pass_model):
     48        (RawTypes.Array.is_heavy_value):
     49        (InspectorBackendDispatcherImpl):
     50        (void):
     51        (Generator):
     52        (Generator.go):
     53        (Generator.process_command):
     54        * inspector/InspectorController.cpp:
     55        (WebCore::InspectorController::connectFrontend):
     56        * inspector/WorkerInspectorController.cpp:
     57        (WebCore::WorkerInspectorController::connectFrontend):
     58
    1592012-01-29  Zoltan Herczeg  <zherczeg@webkit.org>
    260
  • trunk/Source/WebCore/inspector/CodeGeneratorInspector.py

    r105863 r106218  
    220220            raise Exception("Unknown type: %s" % json_type)
    221221
     222    # For output parameter all values are passed by pointer except RefPtr-based types.
     223    class OutputPassModel:
     224        class ByPointer:
     225            @staticmethod
     226            def get_argument_prefix():
     227                return "&"
     228
     229            @staticmethod
     230            def get_parameter_type_suffix():
     231                return "*"
     232
     233        class ByReference:
     234            @staticmethod
     235            def get_argument_prefix():
     236                return ""
     237
     238            @staticmethod
     239            def get_parameter_type_suffix():
     240                return "&"
     241
    222242    class BaseType(object):
    223243        need_internal_runtime_cast_ = False
     
    230250        def is_event_param_check_optional():
    231251            return False
    232 
    233         @staticmethod
    234         def get_output_argument_prefix():
    235             return "&"
    236252
    237253        @classmethod
     
    294310            return ValidateMethodParams
    295311
     312        @staticmethod
     313        def get_output_pass_model():
     314            return RawTypes.OutputPassModel.ByPointer
     315
     316        @staticmethod
     317        def is_heavy_value():
     318            return True
     319
    296320        _plain_c_type = CParamType("String")
    297321        _ref_c_type = CParamType("const String&")
     
    322346            return ValidateMethodParams
    323347
     348        @staticmethod
     349        def get_output_pass_model():
     350            return RawTypes.OutputPassModel.ByPointer
     351
     352        @staticmethod
     353        def is_heavy_value():
     354            return False
     355
    324356        default_c_param_type = CParamType("int")
    325357
     
    344376        def get_validate_method_params():
    345377            raise Exception("TODO")
     378
     379        @staticmethod
     380        def get_output_pass_model():
     381            return RawTypes.OutputPassModel.ByPointer
     382
     383        @staticmethod
     384        def is_heavy_value():
     385            return False
    346386
    347387        default_c_param_type = CParamType("double")
     
    350390        @classmethod
    351391        def get_c_param_type(cls, param_type, optional):
    352             if (param_type == ParamType.EVENT):
     392            if param_type == ParamType.EVENT:
    353393                if optional:
    354394                    return cls._ref_c_type
     
    379419        def get_validate_method_params():
    380420            raise Exception("TODO")
     421
     422        @staticmethod
     423        def get_output_pass_model():
     424            return RawTypes.OutputPassModel.ByPointer
     425
     426        @staticmethod
     427        def is_heavy_value():
     428            return False
    381429
    382430        _plain_c_type = CParamType("bool")
     
    417465            raise Exception("TODO")
    418466
     467        @staticmethod
     468        def get_output_pass_model():
     469            return RawTypes.OutputPassModel.ByReference
     470
     471        @staticmethod
     472        def is_heavy_value():
     473            return True
     474
    419475        _plain_c_type = CParamType("RefPtr<InspectorObject>")
    420476        _ref_c_type = CParamType("PassRefPtr<InspectorObject>")
     
    436492        @staticmethod
    437493        def get_c_initializer():
    438             return "InspectorValue::create()"
     494            raise Exception("Unsupported")
    439495
    440496        @staticmethod
     
    456512        def get_raw_validator_call_text():
    457513            return "assertAny"
     514
     515        @staticmethod
     516        def get_output_pass_model():
     517            return RawTypes.OutputPassModel.ByReference
     518
     519        @staticmethod
     520        def is_heavy_value():
     521            return True
    458522
    459523        _plain_c_type = CParamType("RefPtr<InspectorValue>")
     
    495559        def get_validate_method_params():
    496560            raise Exception("TODO")
     561
     562        @staticmethod
     563        def get_output_pass_model():
     564            return RawTypes.OutputPassModel.ByReference
     565
     566        @staticmethod
     567        def is_heavy_value():
     568            return True
    497569
    498570        _plain_c_type = CParamType("RefPtr<InspectorArray>")
     
    15221594
    15231595    backend_method = string.Template(
    1524 """void InspectorBackendDispatcher::${domainName}_$methodName(long callId, InspectorObject*$requestMessageObject)
     1596"""void InspectorBackendDispatcherImpl::${domainName}_$methodName(long callId, InspectorObject*$requestMessageObject)
    15251597{
    15261598    RefPtr<InspectorArray> protocolErrors = InspectorArray::create();
     
    16161688class InspectorBackendDispatcher: public RefCounted<InspectorBackendDispatcher> {
    16171689public:
    1618     InspectorBackendDispatcher(InspectorFrontendChannel* inspectorFrontendChannel)
    1619         : m_inspectorFrontendChannel(inspectorFrontendChannel)
    1620 $constructorInit
    1621     { }
    1622 
    1623 $setters
    1624 
    1625     void clearFrontend() { m_inspectorFrontendChannel = 0; }
     1690    static PassRefPtr<InspectorBackendDispatcher> create(InspectorFrontendChannel* inspectorFrontendChannel);
     1691
     1692$agentInterfaces
     1693$virtualSetters
     1694
     1695    virtual void clearFrontend() = 0;
    16261696
    16271697    enum CommonErrorCode {
     
    16361706
    16371707    void reportProtocolError(const long* const callId, CommonErrorCode, const String& errorMessage) const;
    1638     void reportProtocolError(const long* const callId, CommonErrorCode, const String& errorMessage, PassRefPtr<InspectorArray> data) const;
    1639     void dispatch(const String& message);
     1708    virtual void reportProtocolError(const long* const callId, CommonErrorCode, const String& errorMessage, PassRefPtr<InspectorArray> data) const = 0;
     1709    virtual void dispatch(const String& message) = 0;
    16401710    static bool getCommandName(const String& message, String* result);
    16411711
     
    16451715
    16461716    static const char* commandNames[];
    1647 
     1717};
     1718
     1719} // namespace WebCore
     1720#endif // !defined(InspectorBackendDispatcher_h)
     1721
     1722
     1723""")
     1724
     1725    backend_cpp = string.Template(file_header_ +
     1726"""
     1727
     1728#include "config.h"
     1729#include "InspectorBackendDispatcher.h"
     1730#include <wtf/text/WTFString.h>
     1731#include <wtf/text/CString.h>
     1732
     1733#if ENABLE(INSPECTOR)
     1734
     1735#include "InspectorAgent.h"
     1736#include "InspectorValues.h"
     1737#include "InspectorFrontendChannel.h"
     1738#include <wtf/text/WTFString.h>
     1739$includes
     1740
     1741namespace WebCore {
     1742
     1743const char* InspectorBackendDispatcher::commandNames[] = {
     1744$methodNameDeclarations
     1745};
     1746
     1747
     1748class InspectorBackendDispatcherImpl : public InspectorBackendDispatcher {
     1749public:
     1750    InspectorBackendDispatcherImpl(InspectorFrontendChannel* inspectorFrontendChannel)
     1751        : m_inspectorFrontendChannel(inspectorFrontendChannel)
     1752$constructorInit
     1753    { }
     1754
     1755    void clearFrontend() { m_inspectorFrontendChannel = 0; }
     1756    void dispatch(const String& message);
     1757    void reportProtocolError(const long* const callId, CommonErrorCode, const String& errorMessage, PassRefPtr<InspectorArray> data) const;
     1758    using InspectorBackendDispatcher::reportProtocolError;
     1759
     1760$setters
    16481761private:
     1762$methodDeclarations
     1763
     1764    InspectorFrontendChannel* m_inspectorFrontendChannel;
     1765$fieldDeclarations
     1766
    16491767    static int getInt(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors);
    16501768    static String getString(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors);
     
    16541772    void sendResponse(long callId, PassRefPtr<InspectorObject> result, const String& errorMessage, PassRefPtr<InspectorArray> protocolErrors, ErrorString invocationError);
    16551773
    1656 $methodDeclarations
    1657 
    1658     InspectorFrontendChannel* m_inspectorFrontendChannel;
    1659 $fieldDeclarations
    16601774};
    16611775
    1662 } // namespace WebCore
    1663 #endif // !defined(InspectorBackendDispatcher_h)
    1664 
    1665 
    1666 """)
    1667 
    1668     backend_cpp = string.Template(file_header_ +
    1669 """
    1670 
    1671 #include "config.h"
    1672 #include "InspectorBackendDispatcher.h"
    1673 #include <wtf/text/WTFString.h>
    1674 #include <wtf/text/CString.h>
    1675 
    1676 #if ENABLE(INSPECTOR)
    1677 
    1678 #include "InspectorAgent.h"
    1679 #include "InspectorValues.h"
    1680 #include "InspectorFrontendChannel.h"
    1681 #include <wtf/text/WTFString.h>
    1682 $includes
    1683 
    1684 namespace WebCore {
    1685 
    1686 const char* InspectorBackendDispatcher::commandNames[] = {
    1687 $methodNameDeclarations
    1688 };
    1689 
    1690 
    16911776$methods
    1692 void InspectorBackendDispatcher::dispatch(const String& message)
     1777
     1778PassRefPtr<InspectorBackendDispatcher> InspectorBackendDispatcher::create(InspectorFrontendChannel* inspectorFrontendChannel)
     1779{
     1780    return adoptRef(new InspectorBackendDispatcherImpl(inspectorFrontendChannel));
     1781}
     1782
     1783
     1784void InspectorBackendDispatcherImpl::dispatch(const String& message)
    16931785{
    16941786    RefPtr<InspectorBackendDispatcher> protect = this;
    1695     typedef void (InspectorBackendDispatcher::*CallHandler)(long callId, InspectorObject* messageObject);
     1787    typedef void (InspectorBackendDispatcherImpl::*CallHandler)(long callId, InspectorObject* messageObject);
    16961788    typedef HashMap<String, CallHandler> DispatchMap;
    16971789    DEFINE_STATIC_LOCAL(DispatchMap, dispatchMap, );
     
    17511843}
    17521844
    1753 void InspectorBackendDispatcher::sendResponse(long callId, PassRefPtr<InspectorObject> result, const String& errorMessage, PassRefPtr<InspectorArray> protocolErrors, ErrorString invocationError)
     1845void InspectorBackendDispatcherImpl::sendResponse(long callId, PassRefPtr<InspectorObject> result, const String& errorMessage, PassRefPtr<InspectorArray> protocolErrors, ErrorString invocationError)
    17541846{
    17551847    if (protocolErrors->length()) {
     
    17741866}
    17751867
    1776 void InspectorBackendDispatcher::reportProtocolError(const long* const callId, CommonErrorCode code, const String& errorMessage, PassRefPtr<InspectorArray> data) const
     1868void InspectorBackendDispatcherImpl::reportProtocolError(const long* const callId, CommonErrorCode code, const String& errorMessage, PassRefPtr<InspectorArray> data) const
    17771869{
    17781870    DEFINE_STATIC_LOCAL(Vector<int>,s_commonErrors,);
     
    18041896}
    18051897
    1806 int InspectorBackendDispatcher::getInt(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
     1898int InspectorBackendDispatcherImpl::getInt(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
    18071899{
    18081900    ASSERT(protocolErrors);
     
    18381930}
    18391931
    1840 String InspectorBackendDispatcher::getString(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
     1932String InspectorBackendDispatcherImpl::getString(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
    18411933{
    18421934    ASSERT(protocolErrors);
     
    18721964}
    18731965
    1874 bool InspectorBackendDispatcher::getBoolean(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
     1966bool InspectorBackendDispatcherImpl::getBoolean(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
    18751967{
    18761968    ASSERT(protocolErrors);
     
    19061998}
    19071999
    1908 PassRefPtr<InspectorObject> InspectorBackendDispatcher::getObject(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
     2000PassRefPtr<InspectorObject> InspectorBackendDispatcherImpl::getObject(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
    19092001{
    19102002    ASSERT(protocolErrors);
     
    19402032}
    19412033
    1942 PassRefPtr<InspectorArray> InspectorBackendDispatcher::getArray(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
     2034PassRefPtr<InspectorArray> InspectorBackendDispatcherImpl::getArray(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
    19432035{
    19442036    ASSERT(protocolErrors);
     
    19732065    return value;
    19742066}
     2067
    19752068bool InspectorBackendDispatcher::getCommandName(const String& message, String* result)
    19762069{
     
    20422135    typebuilder_h = string.Template(file_header_ +
    20432136"""
    2044 #ifndef InspectorBackendDispatcher_h
    2045 #define InspectorBackendDispatcher_h
     2137#ifndef InspectorTypeBuilder_h
     2138#define InspectorTypeBuilder_h
    20462139
    20472140namespace WebCore {
     
    20532146
    20542147} // namespace WebCore
    2055 #endif // !defined(InspectorBackendDispatcher_h)
     2148#endif // !defined(InspectorTypeBuilder_h)
    20562149
    20572150""")
     
    22212314    backend_js_domain_initializer_list = []
    22222315
     2316    backend_virtual_setters_list = []
     2317    backend_agent_interface_list = []
    22232318    backend_setters_list = []
    22242319    backend_constructor_init_list = []
     
    22432338            Generator.backend_method_implementation_list,
    22442339            Generator.backend_method_name_declaration_list,
     2340            Generator.backend_agent_interface_list,
    22452341            Generator.frontend_class_field_lines,
    22462342            Generator.frontend_constructor_init_list,
     
    22822378                frontendDomainMethodDeclarations=join(flatten_list(frontend_method_declaration_lines), "")))
    22832379
     2380            agent_interface_name = Capitalizer.lower_camel_case_to_upper(domain_name) + "CommandHandler"
     2381            Generator.backend_agent_interface_list.append("    class %s {\n" % agent_interface_name)
     2382            Generator.backend_agent_interface_list.append("    public:\n")
    22842383            if "commands" in json_domain:
    22852384                for json_command in json_domain["commands"]:
    22862385                    Generator.process_command(json_command, domain_name, agent_field_name)
     2386            Generator.backend_agent_interface_list.append("    };\n\n")
    22872387
    22882388            if domain_guard:
     
    22962396        sorted_cycle_guardable_list_list = [
    22972397            Generator.backend_constructor_init_list,
     2398            Generator.backend_virtual_setters_list,
    22982399            Generator.backend_setters_list,
    22992400            Generator.backend_field_list,
     
    23112412                    domain_guard.generate_open(l)
    23122413
     2414            agent_interface_name = Capitalizer.lower_camel_case_to_upper(domain_name) + "CommandHandler"
     2415
    23132416            agent_type_name = domain_fixes.agent_type_name
    23142417            agent_field_name = domain_fixes.agent_field_name
    23152418            Generator.backend_constructor_init_list.append("        , m_%s(0)" % agent_field_name)
    2316             Generator.backend_setters_list.append("    void registerAgent(%s* %s) { ASSERT(!m_%s); m_%s = %s; }" % (agent_type_name, agent_field_name, agent_field_name, agent_field_name, agent_field_name))
    2317             Generator.backend_field_list.append("    %s* m_%s;" % (agent_type_name, agent_field_name))
     2419            Generator.backend_virtual_setters_list.append("    virtual void registerAgent(%s /* %s */* %s) = 0;" % (agent_type_name, agent_interface_name, agent_field_name))
     2420            Generator.backend_setters_list.append("    void registerAgent(%s /* %s */* %s) { ASSERT(!m_%s); m_%s = %s; }" % (agent_type_name, agent_interface_name, agent_field_name, agent_field_name, agent_field_name, agent_field_name))
     2421            Generator.backend_field_list.append("    %s /* %s */* m_%s;" % (agent_type_name, agent_interface_name, agent_field_name))
    23182422            Generator.backend_forward_list.append("class %s;" % agent_type_name)
    23192423            Generator.backend_include_list.append("#include \"%s.h\"" % agent_type_name)
     
    24192523        json_command_name = json_command["name"]
    24202524        Generator.method_name_enum_list.append("        k%s_%sCmd," % (domain_name, json_command["name"]))
    2421         Generator.method_handler_list.append("            &InspectorBackendDispatcher::%s_%s," % (domain_name, json_command_name))
     2525        Generator.method_handler_list.append("            &InspectorBackendDispatcherImpl::%s_%s," % (domain_name, json_command_name))
    24222526        Generator.backend_method_declaration_list.append("    void %s_%s(long callId, InspectorObject* requestMessageObject);" % (domain_name, json_command_name))
     2527
     2528        Generator.backend_agent_interface_list.append("        virtual void %s(ErrorString*" % json_command_name)
    24232529
    24242530        method_in_code = ""
     
    24402546
    24412547                var_type = param_raw_type.get_c_param_type(ParamType.INPUT, None)
     2548                formal_param_type = var_type
    24422549                getter_name = param_raw_type.get_getter_name()
    24432550
    2444                 if "optional" in json_parameter and json_parameter["optional"]:
     2551                optional = json_parameter.get("optional")
     2552                if optional:
    24452553                    code = ("    bool %s_valueFound = false;\n"
    24462554                            "    %s in_%s = get%s(paramsContainerPtr, \"%s\", &%s_valueFound, protocolErrorsPtr);\n" %
    24472555                           (json_param_name, var_type.get_text(), json_param_name, getter_name, json_param_name, json_param_name))
    24482556                    param = ", %s_valueFound ? &in_%s : 0" % (json_param_name, json_param_name)
     2557                    formal_param_type_pattern = "const %s*"
    24492558                else:
    24502559                    code = ("    %s in_%s = get%s(paramsContainerPtr, \"%s\", 0, protocolErrorsPtr);\n" %
    24512560                            (var_type.get_text(), json_param_name, getter_name, json_param_name))
    24522561                    param = ", in_%s" % json_param_name
     2562                    if param_raw_type.is_heavy_value():
     2563                        formal_param_type_pattern = "const %s&"
     2564                    else:
     2565                        formal_param_type_pattern = "%s"
    24532566
    24542567                method_in_code += code
    24552568                agent_call_param_list.append(param)
     2569                Generator.backend_agent_interface_list.append(", %s in_%s" % (formal_param_type_pattern % formal_param_type.get_text(), json_param_name))
    24562570
    24572571                js_bind_type = param_raw_type.get_js_bind_type()
     
    24812595
    24822596                code = "    %s out_%s = %s;\n" % (var_type.get_text(), json_return_name, initializer)
    2483                 param = ", %sout_%s" % (raw_type.get_output_argument_prefix(), json_return_name)
     2597                param = ", %sout_%s" % (raw_type.get_output_pass_model().get_argument_prefix(), json_return_name)
    24842598                cook = "        result->set%s(\"%s\", out_%s);\n" % (setter_type, json_return_name, json_return_name)
    24852599                if optional:
     2600                        # FIXME: support optional properly. Probably an additional output parameter should be in each case.
    24862601                    if var_type.get_text() == "bool":
    24872602                        cook = ("        if (out_%s)\n    " % json_return_name) + cook
    24882603                    else:
    2489                         # FIXME: support optionals.
    24902604                        cook = "        // FIXME: support optional here.\n" + cook
    24912605
    24922606                method_out_code += code
    24932607                agent_call_param_list.append(param)
     2608                Generator.backend_agent_interface_list.append(", %s%s out_%s" % (var_type.get_text(), raw_type.get_output_pass_model().get_parameter_type_suffix(), json_return_name))
    24942609                response_cook_list.append(cook)
    24952610
     
    25112626
    25122627        Generator.backend_js_domain_initializer_list.append("InspectorBackend.registerCommand(\"%s.%s\", [%s], %s);\n" % (domain_name, json_command_name, js_parameters_text, js_reply_list))
     2628        Generator.backend_agent_interface_list.append(") = 0;\n")
    25132629
    25142630    @staticmethod
     
    26052721
    26062722backend_h_file.write(Templates.backend_h.substitute(None,
     2723    virtualSetters=join(Generator.backend_virtual_setters_list, "\n"),
     2724    agentInterfaces=join(Generator.backend_agent_interface_list, ""),
     2725    methodNamesEnumContent=join(Generator.method_name_enum_list, "\n"),
     2726    forwardDeclarations=join(Generator.backend_forward_list, "\n")))
     2727
     2728backend_cpp_file.write(Templates.backend_cpp.substitute(None,
    26072729    constructorInit=join(Generator.backend_constructor_init_list, "\n"),
    26082730    setters=join(Generator.backend_setters_list, "\n"),
    2609     methodNamesEnumContent=join(Generator.method_name_enum_list, "\n"),
    2610     methodDeclarations=join(Generator.backend_method_declaration_list, "\n"),
    26112731    fieldDeclarations=join(Generator.backend_field_list, "\n"),
    2612     forwardDeclarations=join(Generator.backend_forward_list, "\n")))
    2613 
    2614 backend_cpp_file.write(Templates.backend_cpp.substitute(None,
    26152732    methodNameDeclarations=join(Generator.backend_method_name_declaration_list, "\n"),
    26162733    includes=join(Generator.backend_include_list, "\n"),
    26172734    methods=join(Generator.backend_method_implementation_list, "\n"),
     2735    methodDeclarations=join(Generator.backend_method_declaration_list, "\n"),
    26182736    messageHandlers=join(Generator.method_handler_list, "\n")))
    26192737
  • trunk/Source/WebCore/inspector/InspectorController.cpp

    r105877 r106218  
    219219
    220220    ASSERT(m_inspectorClient);
    221     m_inspectorBackendDispatcher = adoptRef(new InspectorBackendDispatcher(m_inspectorClient));
     221    m_inspectorBackendDispatcher = InspectorBackendDispatcher::create(m_inspectorClient);
    222222
    223223    InspectorBackendDispatcher* dispatcher = m_inspectorBackendDispatcher.get();
  • trunk/Source/WebCore/inspector/WorkerInspectorController.cpp

    r101531 r106218  
    124124    m_frontendChannel = adoptPtr(new PageInspectorProxy(m_workerContext));
    125125    m_frontend = adoptPtr(new InspectorFrontend(m_frontendChannel.get()));
    126     m_backendDispatcher = adoptRef(new InspectorBackendDispatcher(m_frontendChannel.get()));
     126    m_backendDispatcher = InspectorBackendDispatcher::create(m_frontendChannel.get());
    127127    m_consoleAgent->registerInDispatcher(m_backendDispatcher.get());
    128128#if ENABLE(JAVASCRIPT_DEBUGGER)
Note: See TracChangeset for help on using the changeset viewer.