• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python includes.update函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中v8_globals.includes.update函数的典型用法代码示例。如果您正苦于以下问题:Python update函数的具体用法?Python update怎么用?Python update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了update函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: generate_interface

def generate_interface(interface):
    includes.clear()
    includes.update(INTERFACE_CPP_INCLUDES)
    v8_class_name = v8_utilities.v8_class_name(interface)

    template_contents = {
        'cpp_class_name': cpp_name(interface),
        'header_includes': INTERFACE_H_INCLUDES,
        'interface_name': interface.name,
        'v8_class_name': v8_class_name,
    }

    template_contents.update({
        'constants': [generate_constant(constant) for constant in interface.constants],
        'do_not_check_constants': 'DoNotCheckConstants' in interface.extended_attributes,
    })

    attributes = [v8_attributes.generate_attribute(interface, attribute)
                  for attribute in interface.attributes]
    template_contents.update({
        'attributes': attributes,
        'has_constructor_attributes': any(attribute['is_constructor'] for attribute in attributes),
        'has_per_context_enabled_attributes': any(attribute['per_context_enabled_function_name'] for attribute in attributes),
        'has_replaceable_attributes': any(attribute['is_replaceable'] for attribute in attributes),
        'has_runtime_enabled_attributes': any(attribute['runtime_enabled_function_name'] for attribute in attributes),
    })

    template_contents['methods'] = [v8_methods.generate_method(method)
                                    for method in interface.operations]

    return template_contents
开发者ID:chunywang,项目名称:blink-crosswalk,代码行数:31,代码来源:v8_interface.py


示例2: dictionary_context

def dictionary_context(dictionary, interfaces_info):
    includes.clear()
    includes.update(DICTIONARY_CPP_INCLUDES)

    members = [member_context(dictionary, member)
               for member in sorted(dictionary.members,
                                    key=operator.attrgetter('name'))]

    for member in members:
        if member['runtime_enabled_function']:
            includes.add('platform/RuntimeEnabledFeatures.h')
            break

    cpp_class = v8_utilities.cpp_name(dictionary)
    context = {
        'cpp_class': cpp_class,
        'header_includes': set(DICTIONARY_H_INCLUDES),
        'members': members,
        'required_member_names': sorted([member.name
                                         for member in dictionary.members
                                         if member.is_required]),
        'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion' in dictionary.extended_attributes,
        'v8_class': v8_types.v8_type(cpp_class),
        'v8_original_class': v8_types.v8_type(dictionary.name),
    }
    if dictionary.parent:
        IdlType(dictionary.parent).add_includes_for_type()
        parent_cpp_class = v8_utilities.cpp_name_from_interfaces_info(
            dictionary.parent, interfaces_info)
        context.update({
            'parent_cpp_class': parent_cpp_class,
            'parent_v8_class': v8_types.v8_type(parent_cpp_class),
        })
    return context
开发者ID:endlessm,项目名称:chromium-browser,代码行数:34,代码来源:v8_dictionary.py


示例3: callback_function_context

def callback_function_context(callback_function):
    includes.clear()
    includes.update(CALLBACK_FUNCTION_CPP_INCLUDES)
    idl_type = callback_function.idl_type
    idl_type_str = str(idl_type)
    forward_declarations = []
    for argument in callback_function.arguments:
        if argument.idl_type.is_interface_type:
            forward_declarations.append(argument.idl_type)
        argument.idl_type.add_includes_for_type(callback_function.extended_attributes)

    context = {
        "cpp_class": callback_function.name,
        "cpp_includes": sorted(includes),
        "forward_declarations": sorted(forward_declarations),
        "header_includes": sorted(CALLBACK_FUNCTION_H_INCLUDES),
        "idl_type": idl_type_str,
    }

    if idl_type_str != "void":
        context.update(
            {
                "return_cpp_type": idl_type.cpp_type + "&",
                "return_value": idl_type.v8_value_to_local_cpp_value(
                    callback_function.extended_attributes,
                    "v8ReturnValue",
                    "cppValue",
                    isolate="scriptState->isolate()",
                    bailout_return_value="false",
                ),
            }
        )

    context.update(arguments_context(callback_function.arguments, context.get("return_cpp_type")))
    return context
开发者ID:ollie314,项目名称:chromium,代码行数:35,代码来源:v8_callback_function.py


示例4: callback_function_context

def callback_function_context(callback_function):
    includes.clear()
    includes.update(CALLBACK_FUNCTION_CPP_INCLUDES)
    idl_type = callback_function.idl_type
    idl_type_str = str(idl_type)
    forward_declarations = []
    for argument in callback_function.arguments:
        if argument.idl_type.is_interface_type:
            forward_declarations.append(argument.idl_type)
        argument.idl_type.add_includes_for_type(callback_function.extended_attributes)

    context = {
        'cpp_class': callback_function.name,
        'cpp_includes': sorted(includes),
        'forward_declarations': sorted(forward_declarations),
        'header_includes': sorted(CALLBACK_FUNCTION_H_INCLUDES),
        'idl_type': idl_type_str,
    }

    if idl_type_str != 'void':
        context.update({
            'return_cpp_type': idl_type.cpp_type + '&',
            'return_value': idl_type.v8_value_to_local_cpp_value(
                callback_function.extended_attributes,
                'v8ReturnValue', 'cppValue',
                isolate='m_scriptState->isolate()',
                bailout_return_value='false'),
        })

    context.update(arguments_context(callback_function.arguments, context.get('return_cpp_type')))
    return context
开发者ID:mirror,项目名称:chromium,代码行数:31,代码来源:v8_callback_function.py


示例5: v8_value_to_cpp_value

def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index):
    this_array_or_sequence_type = array_or_sequence_type(idl_type)
    if this_array_or_sequence_type:
        return v8_value_to_cpp_value_array_or_sequence(this_array_or_sequence_type, v8_value, index)

    idl_type = preprocess_idl_type(idl_type)

    if 'EnforceRange' in extended_attributes:
        arguments = ', '.join([v8_value, 'EnforceRange', 'ok'])
    else:  # NormalConversion
        arguments = v8_value

    if idl_type in V8_VALUE_TO_CPP_VALUE_BASIC:
        cpp_expression_format = V8_VALUE_TO_CPP_VALUE_BASIC[idl_type]
    elif idl_type in V8_VALUE_TO_CPP_VALUE_AND_INCLUDES:
        cpp_expression_format, new_includes = V8_VALUE_TO_CPP_VALUE_AND_INCLUDES[idl_type]
        includes.update(new_includes)
    elif is_typed_array_type(idl_type):
        cpp_expression_format = (
            '{v8_value}->Is{idl_type}() ? '
            'V8{idl_type}::toNative(v8::Handle<v8::{idl_type}>::Cast({v8_value})) : 0')
        add_includes_for_type(idl_type)
    else:
        cpp_expression_format = (
            'V8{idl_type}::HasInstance({v8_value}, info.GetIsolate(), worldType(info.GetIsolate())) ? '
            'V8{idl_type}::toNative(v8::Handle<v8::Object>::Cast({v8_value})) : 0')
        add_includes_for_type(idl_type)

    return cpp_expression_format.format(arguments=arguments, idl_type=idl_type, v8_value=v8_value)
开发者ID:cvsuser-chromium,项目名称:third_party_WebKit,代码行数:29,代码来源:v8_types.py


示例6: callback_function_context

def callback_function_context(callback_function):
    includes.clear()
    includes.update(CALLBACK_FUNCTION_CPP_INCLUDES)
    idl_type = callback_function.idl_type
    idl_type_str = str(idl_type)

    for argument in callback_function.arguments:
        argument.idl_type.add_includes_for_type(
            callback_function.extended_attributes)

    context = {
        # While both |callback_function_name| and |cpp_class| are identical at
        # the moment, the two are being defined because their values may change
        # in the future (e.g. if we support [ImplementedAs=] in callback
        # functions).
        'callback_function_name': callback_function.name,
        'cpp_class': callback_function.name,
        'cpp_includes': sorted(includes),
        'forward_declarations': sorted(forward_declarations(callback_function)),
        'header_includes': sorted(CALLBACK_FUNCTION_H_INCLUDES),
        'idl_type': idl_type_str,
    }

    if idl_type_str != 'void':
        context.update({
            'return_cpp_type': idl_type.cpp_type + '&',
            'return_value': idl_type.v8_value_to_local_cpp_value(
                callback_function.extended_attributes,
                'v8ReturnValue', 'cppValue',
                isolate='script_state_->GetIsolate()',
                bailout_return_value='false'),
        })

    context.update(arguments_context(callback_function.arguments, context.get('return_cpp_type')))
    return context
开发者ID:eval1749,项目名称:evita,代码行数:35,代码来源:v8_callback_function.py


示例7: callback_interface_context

def callback_interface_context(callback_interface):
    includes.clear()
    includes.update(CALLBACK_INTERFACE_CPP_INCLUDES)
    return {
        "cpp_class": callback_interface.name,
        "v8_class": v8_utilities.v8_class_name(callback_interface),
        "header_includes": set(CALLBACK_INTERFACE_H_INCLUDES),
        "methods": [method_context(operation) for operation in callback_interface.operations],
    }
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:9,代码来源:v8_callback_interface.py


示例8: dictionary_context

def dictionary_context(dictionary):
    includes.clear()
    includes.update(DICTIONARY_CPP_INCLUDES)
    return {
        "cpp_class": v8_utilities.cpp_name(dictionary),
        "header_includes": set(DICTIONARY_H_INCLUDES),
        "members": [member_context(member) for member in sorted(dictionary.members, key=operator.attrgetter("name"))],
        "v8_class": v8_utilities.v8_class_name(dictionary),
    }
开发者ID:wulala-wuwu,项目名称:Blink,代码行数:9,代码来源:v8_dictionary.py


示例9: dictionary_context

def dictionary_context(dictionary):
    includes.clear()
    includes.update(DICTIONARY_CPP_INCLUDES)
    return {
        'cpp_class': v8_utilities.cpp_name(dictionary),
        'header_includes': set(DICTIONARY_H_INCLUDES),
        'members': [member_context(member)
                    for member in sorted(dictionary.members,
                                         key=operator.attrgetter('name'))],
        'v8_class': v8_utilities.v8_class_name(dictionary),
    }
开发者ID:syncfusion,项目名称:SfQtWebKit,代码行数:11,代码来源:v8_dictionary.py


示例10: member_impl_context

def member_impl_context(member, interfaces_info, header_includes,
                        header_forward_decls):
    idl_type = unwrap_nullable_if_needed(member.idl_type)
    cpp_name = v8_utilities.cpp_name(member)

    nullable_indicator_name = None
    if not idl_type.cpp_type_has_null_value:
        nullable_indicator_name = 'm_has' + cpp_name[0].upper() + cpp_name[1:]

    def has_method_expression():
        if nullable_indicator_name:
            return nullable_indicator_name
        elif idl_type.is_union_type:
            return '!m_%s.isNull()' % cpp_name
        elif idl_type.is_enum or idl_type.is_string_type:
            return '!m_%s.IsNull()' % cpp_name
        elif idl_type.name in ['Any', 'Object']:
            return '!(m_{0}.IsEmpty() || m_{0}.IsNull() || m_{0}.IsUndefined())'.format(cpp_name)
        elif idl_type.name == 'Dictionary':
            return '!m_%s.IsUndefinedOrNull()' % cpp_name
        else:
            return 'm_%s' % cpp_name

    cpp_default_value = None
    if member.default_value and not member.default_value.is_null:
        cpp_default_value = idl_type.literal_cpp_value(member.default_value)

    forward_decl_name = idl_type.impl_forward_declaration_name
    if forward_decl_name:
        includes.update(idl_type.impl_includes_for_type(interfaces_info))
        header_forward_decls.add(forward_decl_name)
    else:
        header_includes.update(idl_type.impl_includes_for_type(interfaces_info))

    setter_value = 'value'
    if idl_type.is_array_buffer_view_or_typed_array:
        setter_value += '.View()'

    return {
        'cpp_default_value': cpp_default_value,
        'cpp_name': cpp_name,
        'getter_expression': 'm_' + cpp_name,
        'getter_name': getter_name_for_dictionary_member(member),
        'has_method_expression': has_method_expression(),
        'has_method_name': has_method_name_for_dictionary_member(member),
        'is_nullable': idl_type.is_nullable,
        'is_traceable': idl_type.is_traceable,
        'member_cpp_type': idl_type.cpp_type_args(used_in_cpp_sequence=True),
        'null_setter_name': null_setter_name_for_dictionary_member(member),
        'nullable_indicator_name': nullable_indicator_name,
        'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True),
        'setter_name': setter_name_for_dictionary_member(member),
        'setter_value': setter_value,
    }
开发者ID:eval1749,项目名称:evita,代码行数:54,代码来源:v8_dictionary.py


示例11: private_script_interface_context

def private_script_interface_context(private_script_interface):
    includes.clear()
    includes.update(BLINK_IN_JS_INTERFACE_CPP_INCLUDES)
    return {
        'cpp_class': private_script_interface.name,
        'forward_declarations': forward_declarations(private_script_interface),
        'header_includes': set(BLINK_IN_JS_INTERFACE_H_INCLUDES),
        'methods': [method_context(operation)
                    for operation in private_script_interface.operations],
        'v8_class': v8_utilities.v8_class_name(private_script_interface),
    }
开发者ID:ewilligers,项目名称:blink,代码行数:11,代码来源:v8_private_script_interface.py


示例12: generate_callback_interface

def generate_callback_interface(callback_interface):
    includes.clear()
    includes.update(CALLBACK_INTERFACE_CPP_INCLUDES)
    return {
        'conditional_string': v8_utilities.conditional_string(callback_interface),
        'cpp_class': callback_interface.name,
        'v8_class': v8_utilities.v8_class_name(callback_interface),
        'header_includes': set(CALLBACK_INTERFACE_H_INCLUDES),
        'methods': [generate_method(operation)
                    for operation in callback_interface.operations],
    }
开发者ID:junmin-zhu,项目名称:blink,代码行数:11,代码来源:v8_callback_interface.py


示例13: legacy_callback_interface_context

def legacy_callback_interface_context(callback_interface, _):
    includes.clear()
    includes.update(LEGACY_CALLBACK_INTERFACE_CPP_INCLUDES)
    return {
        # TODO(bashi): Fix crbug.com/630986, and add 'methods'.
        'constants': [constant_context(constant, callback_interface)
                      for constant in callback_interface.constants],
        'cpp_class': callback_interface.name,
        'header_includes': set(CALLBACK_INTERFACE_H_INCLUDES),
        'interface_name': callback_interface.name,
        'v8_class': v8_utilities.v8_class_name(callback_interface),
    }
开发者ID:eval1749,项目名称:evita,代码行数:12,代码来源:v8_callback_interface.py


示例14: generate_callback_interface

def generate_callback_interface(callback_interface):
    includes.clear()
    includes.update(CALLBACK_INTERFACE_CPP_INCLUDES)

    methods = [generate_method(operation) for operation in callback_interface.operations]
    template_contents = {
        'cpp_class_name': callback_interface.name,
        'v8_class_name': v8_class_name(callback_interface),
        'header_includes': CALLBACK_INTERFACE_H_INCLUDES,
        'methods': methods,
    }
    return template_contents
开发者ID:chunywang,项目名称:blink-crosswalk,代码行数:12,代码来源:v8_callback_interface.py


示例15: generate_interface_code

    def generate_interface_code(self, definitions, interface_name, interface):
        interface_info = self.info_provider.interfaces_info[interface_name]
        full_path = interface_info.get('full_path')
        component = idl_filename_to_component(full_path)
        include_paths = interface_info.get('dependencies_include_paths')

        # Select appropriate Jinja template and contents function
        #
        # A callback interface with constants needs a special handling.
        # https://heycam.github.io/webidl/#legacy-callback-interface-object
        if interface.is_callback and len(interface.constants) > 0:
            header_template_filename = 'legacy_callback_interface.h.tmpl'
            cpp_template_filename = 'legacy_callback_interface.cpp.tmpl'
            interface_context = v8_callback_interface.legacy_callback_interface_context
        elif interface.is_callback:
            header_template_filename = 'callback_interface.h.tmpl'
            cpp_template_filename = 'callback_interface.cpp.tmpl'
            interface_context = v8_callback_interface.callback_interface_context
        elif interface.is_partial:
            interface_context = v8_interface.interface_context
            header_template_filename = 'partial_interface.h.tmpl'
            cpp_template_filename = 'partial_interface.cpp.tmpl'
            interface_name += 'Partial'
            assert component == 'core'
            component = 'modules'
            include_paths = interface_info.get('dependencies_other_component_include_paths')
        else:
            header_template_filename = 'interface.h.tmpl'
            cpp_template_filename = 'interface.cpp.tmpl'
            interface_context = v8_interface.interface_context

        template_context = interface_context(interface, definitions.interfaces)
        includes.update(interface_info.get('cpp_includes', {}).get(component, set()))
        if not interface.is_partial and not is_testing_target(full_path):
            template_context['header_includes'].add(self.info_provider.include_path_for_export)
            template_context['exported'] = self.info_provider.specifier_for_export
        # Add the include for interface itself
        if IdlType(interface_name).is_typed_array:
            template_context['header_includes'].add('core/typed_arrays/DOMTypedArray.h')
        else:
            template_context['header_includes'].add(interface_info['include_path'])
        template_context['header_includes'].update(
            interface_info.get('additional_header_includes', []))
        header_template = self.jinja_env.get_template(header_template_filename)
        cpp_template = self.jinja_env.get_template(cpp_template_filename)
        header_text, cpp_text = self.render_template(
            include_paths, header_template, cpp_template, template_context,
            component)
        header_path, cpp_path = self.output_paths(interface_name)
        return (
            (header_path, header_text),
            (cpp_path, cpp_text),
        )
开发者ID:eval1749,项目名称:evita,代码行数:53,代码来源:code_generator_v8.py


示例16: render_template

def render_template(interface_info, header_template, cpp_template,
                    template_context):
    template_context['code_generator'] = module_pyname

    # Add includes for any dependencies
    template_context['header_includes'] = sorted(
        template_context['header_includes'])
    includes.update(interface_info.get('dependencies_include_paths', []))
    template_context['cpp_includes'] = sorted(includes)

    header_text = header_template.render(template_context)
    cpp_text = cpp_template.render(template_context)
    return header_text, cpp_text
开发者ID:335969568,项目名称:Blink-1,代码行数:13,代码来源:code_generator_v8.py


示例17: generate_callback_interface

def generate_callback_interface(callback_interface):
    includes.clear()
    includes.update(CALLBACK_INTERFACE_CPP_INCLUDES)
    name = callback_interface.name

    methods = [generate_method(operation)
               for operation in callback_interface.operations]
    template_contents = {
        'cpp_class': name,
        'dart_class': dart_types.dart_type(callback_interface.name),
        'header_includes': set(CALLBACK_INTERFACE_H_INCLUDES),
        'methods': methods,
    }
    return template_contents
开发者ID:rafaelw,项目名称:mojo,代码行数:14,代码来源:dart_callback_interface.py


示例18: generate_code

    def generate_code(self, definitions, interface_name):
        """Returns .h/.cpp code as (header_text, cpp_text)."""
        try:
            interface = definitions.interfaces[interface_name]
        except KeyError:
            raise Exception('%s not in IDL definitions' % interface_name)

        # Store other interfaces for introspection
        interfaces.update(definitions.interfaces)

        # Set local type info
        IdlType.set_callback_functions(definitions.callback_functions.keys())
        IdlType.set_enums((enum.name, enum.values)
                          for enum in definitions.enumerations.values())

        # Select appropriate Jinja template and contents function
        if interface.is_callback:
            header_template_filename = 'callback_interface.h'
            cpp_template_filename = 'callback_interface.cpp'
            interface_context = v8_callback_interface.callback_interface_context
        elif 'PrivateScriptInterface' in interface.extended_attributes:
            # Currently private scripts don't have dependencies. Once private scripts have dependencies,
            # we should add them to interface_info.
            header_template_filename = 'private_script_interface.h'
            cpp_template_filename = 'private_script_interface.cpp'
            interface_context = v8_private_script_interface.private_script_interface_context
        else:
            header_template_filename = 'interface.h'
            cpp_template_filename = 'interface.cpp'
            interface_context = v8_interface.interface_context
        header_template = self.jinja_env.get_template(header_template_filename)
        cpp_template = self.jinja_env.get_template(cpp_template_filename)

        # Compute context (input values for Jinja)
        template_context = interface_context(interface)
        template_context['code_generator'] = module_pyname

        # Add includes for interface itself and any dependencies
        interface_info = self.interfaces_info[interface_name]
        if 'PrivateScriptInterface' not in interface.extended_attributes:
            template_context['header_includes'].add(interface_info['include_path'])
        template_context['header_includes'] = sorted(template_context['header_includes'])
        includes.update(interface_info.get('dependencies_include_paths', []))
        template_context['cpp_includes'] = sorted(includes)

        # Render Jinja templates
        header_text = header_template.render(template_context)
        cpp_text = cpp_template.render(template_context)
        return header_text, cpp_text
开发者ID:ewilligers,项目名称:blink,代码行数:49,代码来源:code_generator_v8.py


示例19: generate_attribute

def generate_attribute(interface, attribute):
    idl_type = attribute.idl_type
    extended_attributes = attribute.extended_attributes

    has_custom_getter = ('Custom' in extended_attributes and
                         extended_attributes['Custom'] in [None, 'Getter'])
    has_custom_setter = (not attribute.is_read_only and
                         'Custom' in extended_attributes and
                         extended_attributes['Custom'] in [None, 'Setter'])
    contents = {
        'access_control_list': access_control_list(attribute),
        'activity_logging_world_list_for_getter': v8_utilities.activity_logging_world_list(attribute, 'Getter'),  # [ActivityLogging]
        'activity_logging_world_list_for_setter': v8_utilities.activity_logging_world_list(attribute, 'Setter'),  # [ActivityLogging]
        'cached_attribute_validation_method': extended_attributes.get('CachedAttribute'),
        'conditional_string': v8_utilities.conditional_string(attribute),
        'cpp_type': v8_types.cpp_type(idl_type),
        'getter_callback_name': getter_callback_name(interface, attribute),
        'getter_callback_name_for_main_world': getter_callback_name_for_main_world(interface, attribute),
        'has_custom_getter': has_custom_getter,
        'has_custom_setter': has_custom_setter,
        'idl_type': idl_type,
        'is_call_with_execution_context': v8_utilities.has_extended_attribute_value(attribute, 'CallWith', 'ExecutionContext'),
        'is_constructor': is_constructor_attribute(attribute),
        'is_getter_raises_exception': has_extended_attribute(attribute, ('GetterRaisesException', 'RaisesException')),
        'is_keep_alive_for_gc': is_keep_alive_for_gc(attribute),
        'is_nullable': attribute.is_nullable,
        'is_read_only': attribute.is_read_only,
        'is_replaceable': 'Replaceable' in attribute.extended_attributes,
        'is_setter_raises_exception': has_extended_attribute(attribute, ('RaisesException', 'SetterRaisesException')),
        'is_static': attribute.is_static,
        'name': attribute.name,
        'per_context_enabled_function_name': v8_utilities.per_context_enabled_function_name(attribute),  # [PerContextEnabled]
        'property_attributes': property_attributes(attribute),
        'setter_callback_name': setter_callback_name(interface, attribute),
        'setter_callback_name_for_main_world': setter_callback_name_for_main_world(interface, attribute),
        'v8_type': v8_types.v8_type(idl_type),
        'runtime_enabled_function_name': v8_utilities.runtime_enabled_function_name(attribute),  # [RuntimeEnabled]
        'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended_attributes else [''],  # [PerWorldBindings]
        'wrapper_type_info': wrapper_type_info(attribute),
    }
    if is_constructor_attribute(attribute):
        includes.update(v8_types.includes_for_type(idl_type))
        return contents
    if not has_custom_getter:
        generate_getter(interface, attribute, contents)
    if not attribute.is_read_only and not has_custom_setter:
        generate_setter(interface, attribute, contents)

    return contents
开发者ID:cvsuser-chromium,项目名称:third_party_WebKit,代码行数:49,代码来源:v8_attributes.py


示例20: generate_interface_code

    def generate_interface_code(self, definitions, interface_name, interface):
        # Store other interfaces for introspection
        interfaces.update(definitions.interfaces)

        interface_info = self.info_provider.interfaces_info[interface_name]
        full_path = interface_info.get('full_path')
        component = idl_filename_to_component(full_path)
        include_paths = interface_info.get('dependencies_include_paths')

        # Select appropriate Jinja template and contents function
        if interface.is_callback:
            header_template_filename = 'callback_interface.h'
            cpp_template_filename = 'callback_interface.cpp'
            interface_context = v8_callback_interface.callback_interface_context
        elif interface.is_partial:
            interface_context = v8_interface.interface_context
            header_template_filename = 'partial_interface.h'
            cpp_template_filename = 'partial_interface.cpp'
            interface_name += 'Partial'
            assert component == 'core'
            component = 'modules'
            include_paths = interface_info.get('dependencies_other_component_include_paths')
        else:
            header_template_filename = 'interface.h'
            cpp_template_filename = 'interface.cpp'
            interface_context = v8_interface.interface_context

        template_context = interface_context(interface)
        includes.update(interface_info.get('cpp_includes', {}).get(component, set()))
        if not interface.is_partial and not is_testing_target(full_path):
            template_context['header_includes'].add(self.info_provider.include_path_for_export)
            template_context['exported'] = self.info_provider.specifier_for_export
        # Add the include for interface itself
        if IdlType(interface_name).is_typed_array:
            template_context['header_includes'].add('core/dom/DOMTypedArray.h')
        elif interface_info['include_path']:
            template_context['header_includes'].add(interface_info['include_path'])
        template_context['header_includes'].update(
            interface_info.get('additional_header_includes', []))
        header_template = self.jinja_env.get_template(header_template_filename)
        cpp_template = self.jinja_env.get_template(cpp_template_filename)
        header_text, cpp_text = render_template(
            include_paths, header_template, cpp_template, template_context,
            component)
        header_path, cpp_path = self.output_paths(interface_name)
        return (
            (header_path, header_text),
            (cpp_path, cpp_text),
        )
开发者ID:endlessm,项目名称:chromium-browser,代码行数:49,代码来源:code_generator_v8.py



注:本文中的v8_globals.includes.update函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python v8_types.cpp_template_type函数代码示例发布时间:2022-05-26
下一篇:
Python includes.clear函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap