Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1786)

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/v8_interface.py

Issue 1876383003: Introduce infrastructure for tracing ScriptWrappables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert to traceActiveScriptWrappables - C++ is happier Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # coding=utf-8 2 # coding=utf-8
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 # FIXME: properly should be: 138 # FIXME: properly should be:
139 # 'cpp_type': set_wrapper_reference_to_argument.idl_type.cpp_type_ar gs(raw_type=True), 139 # 'cpp_type': set_wrapper_reference_to_argument.idl_type.cpp_type_ar gs(raw_type=True),
140 # (if type is non-wrapper type like NodeFilter, normally RefPtr) 140 # (if type is non-wrapper type like NodeFilter, normally RefPtr)
141 # Raw pointers faster though, and NodeFilter hacky anyway. 141 # Raw pointers faster though, and NodeFilter hacky anyway.
142 'cpp_type': set_wrapper_reference_to_argument.idl_type.implemented_a s + '*', 142 'cpp_type': set_wrapper_reference_to_argument.idl_type.implemented_a s + '*',
143 'idl_type': set_wrapper_reference_to_argument.idl_type, 143 'idl_type': set_wrapper_reference_to_argument.idl_type,
144 'v8_type': v8_types.v8_type(set_wrapper_reference_to_argument.idl_ty pe.name), 144 'v8_type': v8_types.v8_type(set_wrapper_reference_to_argument.idl_ty pe.name),
145 } 145 }
146 set_wrapper_reference_to['idl_type'].add_includes_for_type() 146 set_wrapper_reference_to['idl_type'].add_includes_for_type()
147 147
148 # [SetWrapperReferenceFrom] 148 # [Custom=VisitDOMWrapper]
149 has_visit_dom_wrapper = ( 149 has_visit_dom_wrapper = (
150 has_extended_attribute_value(interface, 'Custom', 'VisitDOMWrapper') or 150 has_extended_attribute_value(interface, 'Custom', 'VisitDOMWrapper') or
151 set_wrapper_reference_from or set_wrapper_reference_to) 151 set_wrapper_reference_from or set_wrapper_reference_to)
152 152
153 # [TraceWrapperReferences]
154 trace_wrapper_references = extended_attribute_value_as_list(interface, 'Trac eWrapperReferences')
155 if trace_wrapper_references:
156 includes.add('bindings/core/v8/ScriptWrappableVisitor.h')
157
153 wrapper_class_id = ('NodeClassId' if inherits_interface(interface.name, 'Nod e') else 'ObjectClassId') 158 wrapper_class_id = ('NodeClassId' if inherits_interface(interface.name, 'Nod e') else 'ObjectClassId')
154 159
155 v8_class_name = v8_utilities.v8_class_name(interface) 160 v8_class_name = v8_utilities.v8_class_name(interface)
156 cpp_class_name = cpp_name(interface) 161 cpp_class_name = cpp_name(interface)
157 cpp_class_name_or_partial = cpp_name_or_partial(interface) 162 cpp_class_name_or_partial = cpp_name_or_partial(interface)
158 v8_class_name_or_partial = v8_utilities.v8_class_name_or_partial(interface) 163 v8_class_name_or_partial = v8_utilities.v8_class_name_or_partial(interface)
159 164
160 context = { 165 context = {
161 'cpp_class': cpp_class_name, 166 'cpp_class': cpp_class_name,
162 'cpp_class_or_partial': cpp_class_name_or_partial, 167 'cpp_class_or_partial': cpp_class_name_or_partial,
163 'event_target_inheritance': 'InheritFromEventTarget' if is_event_target else 'NotInheritFromEventTarget', 168 'event_target_inheritance': 'InheritFromEventTarget' if is_event_target else 'NotInheritFromEventTarget',
164 'is_gc_type': True, 169 'is_gc_type': True,
165 # FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699 170 # FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699
166 'has_access_check_callbacks': (is_check_security and 171 'has_access_check_callbacks': (is_check_security and
167 interface.name != 'Window' and 172 interface.name != 'Window' and
168 interface.name != 'EventTarget'), 173 interface.name != 'EventTarget'),
169 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] 174 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction]
170 'has_partial_interface': len(interface.partial_interfaces) > 0, 175 'has_partial_interface': len(interface.partial_interfaces) > 0,
171 'has_visit_dom_wrapper': has_visit_dom_wrapper, 176 'has_visit_dom_wrapper': has_visit_dom_wrapper,
177 'trace_wrapper_references': trace_wrapper_references,
172 'header_includes': header_includes, 178 'header_includes': header_includes,
173 'interface_name': interface.name, 179 'interface_name': interface.name,
174 'is_array_buffer_or_view': is_array_buffer_or_view, 180 'is_array_buffer_or_view': is_array_buffer_or_view,
175 'is_check_security': is_check_security, 181 'is_check_security': is_check_security,
176 'is_event_target': is_event_target, 182 'is_event_target': is_event_target,
177 'is_exception': interface.is_exception, 183 'is_exception': interface.is_exception,
178 'is_global': is_global, 184 'is_global': is_global,
179 'is_node': inherits_interface(interface.name, 'Node'), 185 'is_node': inherits_interface(interface.name, 'Node'),
180 'is_partial': interface.is_partial, 186 'is_partial': interface.is_partial,
181 'is_typed_array_type': is_typed_array_type, 187 'is_typed_array_type': is_typed_array_type,
182 'lifetime': 'Dependent' if (has_visit_dom_wrapper or is_dependent_lifeti me) else 'Independent', 188 'lifetime': 'Dependent' if (has_visit_dom_wrapper or trace_wrapper_refer ences or is_dependent_lifetime) else 'Independent',
183 'measure_as': v8_utilities.measure_as(interface, None), # [MeasureAs] 189 'measure_as': v8_utilities.measure_as(interface, None), # [MeasureAs]
184 'origin_trial_enabled_function': v8_utilities.origin_trial_enabled_funct ion_name(interface, None), 190 'origin_trial_enabled_function': v8_utilities.origin_trial_enabled_funct ion_name(interface, None),
185 'parent_interface': parent_interface, 191 'parent_interface': parent_interface,
186 'pass_cpp_type': cpp_name(interface) + '*', 192 'pass_cpp_type': cpp_name(interface) + '*',
187 'active_scriptwrappable': active_scriptwrappable, 193 'active_scriptwrappable': active_scriptwrappable,
188 'runtime_enabled_function': runtime_enabled_function_name(interface), # [RuntimeEnabled] 194 'runtime_enabled_function': runtime_enabled_function_name(interface), # [RuntimeEnabled]
189 'set_wrapper_reference_from': set_wrapper_reference_from, 195 'set_wrapper_reference_from': set_wrapper_reference_from,
190 'set_wrapper_reference_to': set_wrapper_reference_to, 196 'set_wrapper_reference_to': set_wrapper_reference_to,
191 'v8_class': v8_class_name, 197 'v8_class': v8_class_name,
192 'v8_class_or_partial': v8_class_name_or_partial, 198 'v8_class_or_partial': v8_class_name_or_partial,
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 1385
1380 extended_attributes = deleter.extended_attributes 1386 extended_attributes = deleter.extended_attributes
1381 idl_type = deleter.idl_type 1387 idl_type = deleter.idl_type
1382 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState') 1388 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState')
1383 return { 1389 return {
1384 'is_call_with_script_state': is_call_with_script_state, 1390 'is_call_with_script_state': is_call_with_script_state,
1385 'is_custom': 'Custom' in extended_attributes, 1391 'is_custom': 'Custom' in extended_attributes,
1386 'is_raises_exception': 'RaisesException' in extended_attributes, 1392 'is_raises_exception': 'RaisesException' in extended_attributes,
1387 'name': cpp_name(deleter), 1393 'name': cpp_name(deleter),
1388 } 1394 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698