Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Functions | Variables
dart_utilities Namespace Reference

Classes

class  dart_utilities_monkey
 This is the monkey patched methods most delegate to v8_utilities but some are overridden in dart_utilities. More...
 

Functions

 _scoped_name (interface, definition, base_name)
 
 _bool_to_cpp (tf)
 
 _activity_logging_world_list (member, access_type=None)
 
 _call_with_arguments (member, call_with_values=None)
 
 _deprecate_as (member)
 
 _measure_as (definition_or_member)
 

Variables

dict _CALL_WITH_ARGUMENTS
 
list _CALL_WITH_VALUES
 
 DartUtilities = dart_utilities_monkey()
 
 activity_logging_world_list
 
 bool_to_cpp
 
 call_with_arguments
 
 capitalize
 
 cpp_name
 
 deprecate_as
 
 extended_attribute_value_contains
 
 has_extended_attribute
 
 has_extended_attribute_value
 
 measure_as
 
 scoped_name
 
 strip_suffix
 
 uncapitalize
 
 v8_class_name
 

Detailed Description

Functions shared by various parts of the code generator.

Extends IdlType and IdlUnion type with |enum_validation_expression| property.

Design doc: http://www.chromium.org/developers/design-documents/idl-compiler

Function Documentation

◆ _activity_logging_world_list()

dart_utilities._activity_logging_world_list (   member,
  access_type = None 
)
protected
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.

Definition at line 62 of file dart_utilities.py.

62def _activity_logging_world_list(member, access_type=None):
63 """Returns a set of world suffixes for which a definition member has activity logging, for specified access type.
64
65 access_type can be 'Getter' or 'Setter' if only checking getting or setting.
66 """
67 if 'ActivityLogging' not in member.extended_attributes:
68 return set()
69 activity_logging = member.extended_attributes['ActivityLogging']
70 # [ActivityLogging=For*] (no prefix, starts with the worlds suffix) means
71 # "log for all use (method)/access (attribute)", otherwise check that value
72 # agrees with specified access_type (Getter/Setter).
73 has_logging = (activity_logging.startswith('For') or
74 (access_type and activity_logging.startswith(access_type)))
75 if not has_logging:
76 return set()
77# TODO(terry): Remove Me?
78# includes.add('bindings/v8/V8DOMActivityLogger.h')
79 if activity_logging.endswith('ForIsolatedWorlds'):
80 return set([''])
81 return set(['', 'ForMainWorld']) # endswith('ForAllWorlds')
82
83
84# [CallWith]

◆ _bool_to_cpp()

dart_utilities._bool_to_cpp (   tf)
protected

Definition at line 57 of file dart_utilities.py.

57def _bool_to_cpp(tf):
58 return "true" if tf else "false"
59
60
61# [ActivityLogging]

◆ _call_with_arguments()

dart_utilities._call_with_arguments (   member,
  call_with_values = None 
)
protected

Definition at line 103 of file dart_utilities.py.

103def _call_with_arguments(member, call_with_values=None):
104 # Optional parameter so setter can override with [SetterCallWith]
105 call_with_values = call_with_values or member.extended_attributes.get(
106 'CallWith')
107 if not call_with_values:
108 return []
109 return [
110 _CALL_WITH_ARGUMENTS[value]
111 for value in _CALL_WITH_VALUES
112 if v8_utilities.extended_attribute_value_contains(
113 call_with_values, value)
114 ]
115
116
117# [DeprecateAs]

◆ _deprecate_as()

dart_utilities._deprecate_as (   member)
protected

Definition at line 118 of file dart_utilities.py.

118def _deprecate_as(member):
119 extended_attributes = member.extended_attributes
120 if 'DeprecateAs' not in extended_attributes:
121 return None
122# TODO(terry): Remove me?
123# includes.add('core/frame/UseCounter.h')
124 return extended_attributes['DeprecateAs']
125
126
127# [MeasureAs]

◆ _measure_as()

dart_utilities._measure_as (   definition_or_member)
protected

Definition at line 128 of file dart_utilities.py.

128def _measure_as(definition_or_member):
129 extended_attributes = definition_or_member.extended_attributes
130 if 'MeasureAs' not in extended_attributes:
131 return None
132# TODO(terry): Remove Me?
133# includes.add('core/frame/UseCounter.h')
134 return extended_attributes['MeasureAs']
135
136

◆ _scoped_name()

dart_utilities._scoped_name (   interface,
  definition,
  base_name 
)
protected

Definition at line 44 of file dart_utilities.py.

44def _scoped_name(interface, definition, base_name):
45 # partial interfaces are implemented as separate classes, with their members
46 # implemented as static member functions
47 partial_interface_implemented_as = definition.extended_attributes.get(
48 'PartialInterfaceImplementedAs')
49 if partial_interface_implemented_as:
50 return '%s::%s' % (partial_interface_implemented_as, base_name)
51 if (definition.is_static or
52 definition.name in ('Constructor', 'NamedConstructor')):
53 return '%s::%s' % (v8_utilities.cpp_name(interface), base_name)
54 return 'receiver->%s' % base_name
55
56

Variable Documentation

◆ _CALL_WITH_ARGUMENTS

dict dart_utilities._CALL_WITH_ARGUMENTS
protected
Initial value:
1= {
2 'ScriptState': '&state',
3 'ExecutionContext': 'context',
4 'ScriptArguments': 'scriptArguments.release()',
5 'ActiveWindow': 'DartUtilities::callingDomWindowForCurrentIsolate()',
6 'FirstWindow': 'DartUtilities::enteredDomWindowForCurrentIsolate()',
7}

Definition at line 85 of file dart_utilities.py.

◆ _CALL_WITH_VALUES

list dart_utilities._CALL_WITH_VALUES
protected
Initial value:
1= [
2 'ScriptState',
3 'ExecutionContext',
4 'ScriptArguments',
5 'ActiveWindow',
6 'FirstWindow',
7]

Definition at line 94 of file dart_utilities.py.

◆ activity_logging_world_list

dart_utilities.activity_logging_world_list

Definition at line 151 of file dart_utilities.py.

◆ bool_to_cpp

dart_utilities.bool_to_cpp

Definition at line 152 of file dart_utilities.py.

◆ call_with_arguments

dart_utilities.call_with_arguments

Definition at line 153 of file dart_utilities.py.

◆ capitalize

dart_utilities.capitalize

Definition at line 154 of file dart_utilities.py.

◆ cpp_name

dart_utilities.cpp_name

Definition at line 155 of file dart_utilities.py.

◆ DartUtilities

dart_utilities.DartUtilities = dart_utilities_monkey()

Definition at line 149 of file dart_utilities.py.

◆ deprecate_as

dart_utilities.deprecate_as

Definition at line 156 of file dart_utilities.py.

◆ extended_attribute_value_contains

dart_utilities.extended_attribute_value_contains

Definition at line 157 of file dart_utilities.py.

◆ has_extended_attribute

dart_utilities.has_extended_attribute

Definition at line 158 of file dart_utilities.py.

◆ has_extended_attribute_value

dart_utilities.has_extended_attribute_value

Definition at line 159 of file dart_utilities.py.

◆ measure_as

dart_utilities.measure_as

Definition at line 160 of file dart_utilities.py.

◆ scoped_name

dart_utilities.scoped_name

Definition at line 161 of file dart_utilities.py.

◆ strip_suffix

dart_utilities.strip_suffix

Definition at line 162 of file dart_utilities.py.

◆ uncapitalize

dart_utilities.uncapitalize

Definition at line 163 of file dart_utilities.py.

◆ v8_class_name

dart_utilities.v8_class_name

Definition at line 164 of file dart_utilities.py.