当前位置: 首页>>代码示例>>Python>>正文


Python includes.add函数代码示例

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


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

示例1: setter_expression

def setter_expression(interface, attribute, contents):
    extended_attributes = attribute.extended_attributes
    arguments = v8_utilities.call_with_arguments(attribute, extended_attributes.get('SetterCallWith'))

    this_setter_base_name = setter_base_name(attribute, arguments)
    setter_name = v8_utilities.scoped_name(interface, attribute, this_setter_base_name)

    if ('ImplementedBy' in extended_attributes and
        not attribute.is_static):
        arguments.append('imp')
    idl_type = attribute.idl_type
    if idl_type == 'EventHandler':
        getter_name = v8_utilities.scoped_name(interface, attribute, cpp_name(attribute))
        contents['event_handler_getter_expression'] = '%s(%s)' % (
            getter_name, ', '.join(arguments))
        if (interface.name in ['Window', 'WorkerGlobalScope'] and
            attribute.name == 'onerror'):
            includes.add('bindings/v8/V8ErrorHandler.h')
            arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHandler>(jsValue, true, info.GetIsolate())')
        else:
            arguments.append('V8EventListenerList::getEventListener(jsValue, true, ListenerFindOrCreate)')
    elif v8_types.is_interface_type(idl_type) and not v8_types.array_type(idl_type):
        # FIXME: should be able to eliminate WTF::getPtr in most or all cases
        arguments.append('WTF::getPtr(cppValue)')
    else:
        arguments.append('cppValue')
    if contents['is_setter_raises_exception']:
        arguments.append('exceptionState')

    return '%s(%s)' % (setter_name, ', '.join(arguments))
开发者ID:glenkim-dev,项目名称:blink-crosswalk,代码行数:30,代码来源:v8_attributes.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: setter_expression

def setter_expression(interface, attribute, contents):
    extended_attributes = attribute.extended_attributes
    arguments = v8_utilities.call_with_arguments(attribute, extended_attributes.get('SetterCallWith'))

    this_setter_base_name = setter_base_name(interface, attribute, arguments)
    setter_name = scoped_name(interface, attribute, this_setter_base_name)

    # Members of IDL partial interface definitions are implemented in C++ as
    # static member functions, which for instance members (non-static members)
    # take *impl as their first argument
    if ('PartialInterfaceImplementedAs' in extended_attributes and
        not attribute.is_static):
        arguments.append('*impl')
    idl_type = attribute.idl_type
    if idl_type.base_type == 'EventHandler':
        getter_name = scoped_name(interface, attribute, cpp_name(attribute))
        contents['event_handler_getter_expression'] = '%s(%s)' % (
            getter_name, ', '.join(arguments))
        if (interface.name in ['Window', 'WorkerGlobalScope'] and
            attribute.name == 'onerror'):
            includes.add('bindings/v8/V8ErrorHandler.h')
            arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHandler>(v8Value, true, info.GetIsolate())')
        else:
            arguments.append('V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate)')
    elif idl_type.is_interface_type and not idl_type.array_type:
        # FIXME: should be able to eliminate WTF::getPtr in most or all cases
        arguments.append('WTF::getPtr(cppValue)')
    else:
        arguments.append('cppValue')
    if contents['is_setter_raises_exception']:
        arguments.append('exceptionState')

    return '%s(%s)' % (setter_name, ', '.join(arguments))
开发者ID:TheTypoMaster,项目名称:evita,代码行数:33,代码来源:v8_attributes.py

示例4: scoped_content_attribute_name

def scoped_content_attribute_name(interface, attribute):
    content_attribute_name = attribute.extended_attributes["Reflect"] or attribute.name.lower()
    if interface.name.startswith("SVG"):
        namespace = "SVGNames"
    else:
        namespace = "HTMLNames"
    includes.add("core/%s.h" % namespace)
    return "%s::%sAttr" % (namespace, content_attribute_name)
开发者ID:howardroark2018,项目名称:chromium,代码行数:8,代码来源:v8_attributes.py

示例5: runtime_call_stats_context

def runtime_call_stats_context(interface, method):
    includes.add('platform/bindings/RuntimeCallStats.h')
    generic_counter_name = 'Blink_' + v8_utilities.cpp_name(interface) + '_' + method.name
    (method_counter, extended_attribute_defined) = v8_utilities.rcs_counter_name(method, generic_counter_name)
    return {
        'extended_attribute_defined': extended_attribute_defined,
        'method_counter': method_counter,
        'origin_safe_method_getter_counter': generic_counter_name + '_OriginSafeMethodGetter'
    }
开发者ID:eval1749,项目名称:evita,代码行数:9,代码来源:v8_methods.py

示例6: method_context

def method_context(interface, method):
    context = v8_methods.method_context(interface, method)

    arguments = method.arguments
    extended_attributes = method.extended_attributes
    idl_type = method.idl_type

#    idl_type.add_includes_for_type()
    this_cpp_value = cpp_value(interface, method, len(arguments))

    if context['is_call_with_script_state']:
        includes.add('bindings/core/dart/DartScriptState.h')

    if idl_type.union_arguments and len(idl_type.union_arguments) > 0:
        this_cpp_type = []
        for cpp_type in idl_type.member_types:
            this_cpp_type.append("RefPtr<%s>" % cpp_type)
    else:
        this_cpp_type = idl_type.cpp_type

    is_auto_scope = not 'DartNoAutoScope' in extended_attributes

    arguments_data = [argument_context(interface, method, argument, index)
                      for index, argument in enumerate(arguments)]

    union_arguments = []
    if idl_type.union_arguments:
        union_arguments.extend([union_arg['cpp_value']
                                for union_arg in idl_type.union_arguments])

    is_custom = 'Custom' in extended_attributes or 'DartCustom' in extended_attributes

    context.update({
        'arguments': arguments_data,
        'cpp_type': this_cpp_type,
        'cpp_value': this_cpp_value,
        'dart_type': dart_types.idl_type_to_dart_type(idl_type),
        'dart_name': extended_attributes.get('DartName'),
        'has_exception_state':
            context['is_raises_exception'] or
            any(argument for argument in arguments
                if argument.idl_type.name == 'SerializedScriptValue' or
                   argument.idl_type.is_integer_type),
        'is_auto_scope': is_auto_scope,
        'auto_scope': DartUtilities.bool_to_cpp(is_auto_scope),
        'is_custom': is_custom,
        'is_custom_dart': 'DartCustom' in extended_attributes,
        'is_custom_dart_new': DartUtilities.has_extended_attribute_value(method, 'DartCustom', 'New'),
        # FIXME(terry): DartStrictTypeChecking no longer supported; TypeChecking is
        #               new extended attribute.
        'is_strict_type_checking':
            'DartStrictTypeChecking' in extended_attributes or
            'DartStrictTypeChecking' in interface.extended_attributes,
        'union_arguments': union_arguments,
        'dart_set_return_value': dart_set_return_value(interface.name, method, this_cpp_value),
    })
    return context
开发者ID:Jamesducque,项目名称:mojo,代码行数:57,代码来源:dart_methods.py

示例7: measure_as

def measure_as(definition_or_member, interface):
    extended_attributes = definition_or_member.extended_attributes
    if "MeasureAs" in extended_attributes:
        includes.add("core/frame/UseCounter.h")
        return lambda suffix: extended_attributes["MeasureAs"]
    if "Measure" in extended_attributes:
        includes.add("core/frame/UseCounter.h")
        measure_as_name = capitalize(definition_or_member.name)
        if interface is not None:
            measure_as_name = "%s_%s" % (capitalize(interface.name), measure_as_name)
        return lambda suffix: "V8%s_%s" % (measure_as_name, suffix)
    return None
开发者ID:b-cuts,项目名称:blink-crosswalk,代码行数:12,代码来源:v8_utilities.py

示例8: runtime_call_stats_context

def runtime_call_stats_context(interface, attribute, context):
    includes.add('platform/bindings/RuntimeCallStats.h')
    generic_counter_name = 'Blink_' + v8_utilities.cpp_name(interface) + '_' + attribute.name
    (counter, extended_attribute_defined) = v8_utilities.rcs_counter_name(attribute, generic_counter_name)
    runtime_call_stats = {
        'extended_attribute_defined': extended_attribute_defined,
        'getter_counter': '%s_Getter' % counter,
        'setter_counter': '%s_Setter' % counter,
        'constructor_getter_callback_counter': '%s_ConstructorGetterCallback' % generic_counter_name,
    }
    context.update({
        'runtime_call_stats': runtime_call_stats
    })
开发者ID:eval1749,项目名称:evita,代码行数:13,代码来源:v8_attributes.py

示例9: scoped_content_attribute_name

def scoped_content_attribute_name(interface, attribute):
    content_attribute_name = attribute.extended_attributes["Reflect"] or attribute.name.lower()
    if interface.name.startswith("SVG"):
        # SVG's xmlbase/xmlspace/xmllang need special behavior, i.e.
        # it is in XMLNames namespace and the generated attribute has no xml prefix.
        if attribute.name.startswith("xml"):
            namespace = "XMLNames"
            content_attribute_name = content_attribute_name[3:]
        else:
            namespace = "SVGNames"
    else:
        namespace = "HTMLNames"
    includes.add("core/%s.h" % namespace)
    return "%s::%sAttr" % (namespace, content_attribute_name)
开发者ID:syncfusion,项目名称:SfQtWebKit,代码行数:14,代码来源:v8_attributes.py

示例10: v8_value_to_cpp_value_array_or_sequence

def v8_value_to_cpp_value_array_or_sequence(this_array_or_sequence_type, v8_value, index):
    # Index is None for setters, index (starting at 0) for method arguments,
    # and is used to provide a human-readable exception message
    if index is None:
        index = 0  # special case, meaning "setter"
    else:
        index += 1  # human-readable index
    if is_interface_type(this_array_or_sequence_type):
        this_cpp_type = None
        expression_format = '(toRefPtrNativeArray<{array_or_sequence_type}, V8{array_or_sequence_type}>({v8_value}, {index}, info.GetIsolate()))'
        includes.add('V8%s.h' % this_array_or_sequence_type)
    else:
        this_cpp_type = cpp_type(this_array_or_sequence_type)
        expression_format = 'toNativeArray<{cpp_type}>({v8_value}, {index}, info.GetIsolate())'
    expression = expression_format.format(array_or_sequence_type=this_array_or_sequence_type, cpp_type=this_cpp_type, index=index, v8_value=v8_value)
    return expression
开发者ID:cvsuser-chromium,项目名称:third_party_WebKit,代码行数:16,代码来源:v8_types.py

示例11: activity_logging_world_list

def activity_logging_world_list(member, access_type=''):
    """Returns a set of world suffixes for which a definition member has activity logging, for specified access type.

    access_type can be 'Getter' or 'Setter' if only checking getting or setting.
    """
    extended_attributes = member.extended_attributes
    if 'LogActivity' not in extended_attributes:
        return set()
    log_activity = extended_attributes['LogActivity']
    if log_activity and not log_activity.startswith(access_type):
        return set()

    includes.add('bindings/core/v8/V8DOMActivityLogger.h')
    if 'LogAllWorlds' in extended_attributes:
        return set(['', 'ForMainWorld'])
    return set([''])  # At minimum, include isolated worlds.
开发者ID:eval1749,项目名称:evita,代码行数:16,代码来源:v8_utilities.py

示例12: origin_trial_enabled_function_name

def origin_trial_enabled_function_name(definition_or_member):
    """Returns the name of the OriginTrials enabled function.

    An exception is raised if OriginTrialEnabled is used in conjunction with any
    of the following (which must be mutually exclusive with origin trials):
      - RuntimeEnabled

    The returned function checks if the IDL member should be enabled.
    Given extended attribute OriginTrialEnabled=FeatureName, return:
        OriginTrials::{featureName}Enabled

    If the OriginTrialEnabled extended attribute is found, the includes are
    also updated as a side-effect.
    """
    extended_attributes = definition_or_member.extended_attributes
    is_origin_trial_enabled = 'OriginTrialEnabled' in extended_attributes

    if is_origin_trial_enabled and 'RuntimeEnabled' in extended_attributes:
        raise Exception('[OriginTrialEnabled] and [RuntimeEnabled] must '
                        'not be specified on the same definition: %s'
                        % definition_or_member.name)

    if is_origin_trial_enabled:
        trial_name = extended_attributes['OriginTrialEnabled']
        return 'OriginTrials::%sEnabled' % uncapitalize(trial_name)

    is_feature_policy_enabled = 'FeaturePolicy' in extended_attributes

    if is_feature_policy_enabled and 'RuntimeEnabled' in extended_attributes:
        raise Exception('[FeaturePolicy] and [RuntimeEnabled] must '
                        'not be specified on the same definition: %s'
                        % definition_or_member.name)

    if is_feature_policy_enabled and 'SecureContext' in extended_attributes:
        raise Exception('[FeaturePolicy] and [SecureContext] must '
                        'not be specified on the same definition '
                        '(see https://crbug.com/695123 for workaround): %s'
                        % definition_or_member.name)

    if is_feature_policy_enabled:
        includes.add('platform/bindings/ScriptState.h')
        includes.add('platform/feature_policy/FeaturePolicy.h')

        trial_name = extended_attributes['FeaturePolicy']
        return 'FeaturePolicy::%sEnabled' % uncapitalize(trial_name)

    return None
开发者ID:eval1749,项目名称:evita,代码行数:47,代码来源:v8_utilities.py

示例13: runtime_enabled_function_name

def runtime_enabled_function_name(definition_or_member):
    """Returns the name of the RuntimeEnabledFeatures function.

    The returned function checks if a method/attribute is enabled.
    Given extended attribute RuntimeEnabled=FeatureName, return:
        RuntimeEnabledFeatures::{featureName}Enabled

    If the RuntimeEnabled extended attribute is found, the includes
    are also updated as a side-effect.
    """
    feature_name = runtime_feature_name(definition_or_member)

    if not feature_name:
        return

    includes.add('platform/RuntimeEnabledFeatures.h')
    return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name)
开发者ID:mirror,项目名称:chromium,代码行数:17,代码来源:v8_utilities.py

示例14: origin_trial_enabled_function_name

def origin_trial_enabled_function_name(definition_or_member):
    """Returns the name of the OriginTrials enabled function.

    An exception is raised if both the OriginTrialEnabled and RuntimeEnabled
    extended attributes are applied to the same IDL member. Only one of the
    two attributes can be applied to any member - they are mutually exclusive.

    The returned function checks if the IDL member should be enabled.
    Given extended attribute OriginTrialEnabled=FeatureName, return:
        OriginTrials::{featureName}Enabled

    If the OriginTrialEnabled extended attribute is found, the includes are
    also updated as a side-effect.
    """
    extended_attributes = definition_or_member.extended_attributes
    is_origin_trial_enabled = "OriginTrialEnabled" in extended_attributes

    if is_origin_trial_enabled and "RuntimeEnabled" in extended_attributes:
        raise Exception(
            "[OriginTrialEnabled] and [RuntimeEnabled] must "
            "not be specified on the same definition: "
            "%s.%s" % (definition_or_member.idl_name, definition_or_member.name)
        )

    if is_origin_trial_enabled:
        trial_name = extended_attributes["OriginTrialEnabled"]
        return "OriginTrials::%sEnabled" % uncapitalize(trial_name)

    is_feature_policy_enabled = "FeaturePolicy" in extended_attributes

    if is_feature_policy_enabled and "RuntimeEnabled" in extended_attributes:
        raise Exception(
            "[FeaturePolicy] and [RuntimeEnabled] must "
            "not be specified on the same definition: "
            "%s.%s" % (definition_or_member.idl_name, definition_or_member.name)
        )

    if is_feature_policy_enabled:
        includes.add("bindings/core/v8/ScriptState.h")
        includes.add("platform/feature_policy/FeaturePolicy.h")

        trial_name = extended_attributes["FeaturePolicy"]
        return "FeaturePolicy::%sEnabled" % uncapitalize(trial_name)

    return None
开发者ID:ollie314,项目名称:chromium,代码行数:45,代码来源:v8_utilities.py

示例15: generate_setter

def generate_setter(interface, attribute, contents):
    idl_type = attribute.idl_type
    extended_attributes = attribute.extended_attributes
    if v8_types.is_interface_type(idl_type) and not v8_types.array_type(idl_type):
        cpp_value = 'WTF::getPtr(cppValue)'
    else:
        cpp_value = 'cppValue'
    is_reflect = 'Reflect' in extended_attributes
    if is_reflect:
        includes.add('core/dom/custom/CustomElementCallbackDispatcher.h')
    contents.update({
        'cpp_setter': setter_expression(interface, attribute, contents),
        'enum_validation_expression': v8_utilities.enum_validation_expression(idl_type),
        'has_strict_type_checking': 'StrictTypeChecking' in extended_attributes and v8_types.is_interface_type(idl_type),
        'is_reflect': is_reflect,
        'v8_value_to_local_cpp_value': v8_types.v8_value_to_local_cpp_value(
            idl_type, extended_attributes, 'jsValue', 'cppValue'),
    })
开发者ID:cvsuser-chromium,项目名称:third_party_WebKit,代码行数:18,代码来源:v8_attributes.py


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