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

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

Issue 2329463004: ABANDONED CL: Changes needed to make things compile after running rewrite_to_chrome_style tool. (Closed)
Patch Set: Rebasing the fixes... Created 3 years, 10 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 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 'LogAllWorlds' not in extended_attributes): 193 'LogAllWorlds' not in extended_attributes):
194 return True 194 return True
195 return False 195 return False
196 196
197 197
198 # [CallWith] 198 # [CallWith]
199 CALL_WITH_ARGUMENTS = { 199 CALL_WITH_ARGUMENTS = {
200 'ScriptState': 'scriptState', 200 'ScriptState': 'scriptState',
201 'ExecutionContext': 'executionContext', 201 'ExecutionContext': 'executionContext',
202 'ScriptArguments': 'scriptArguments', 202 'ScriptArguments': 'scriptArguments',
203 'CurrentWindow': 'currentDOMWindow(info.GetIsolate())', 203 'CurrentWindow': 'CurrentDOMWindow(info.GetIsolate())',
204 'EnteredWindow': 'enteredDOMWindow(info.GetIsolate())', 204 'EnteredWindow': 'EnteredDOMWindow(info.GetIsolate())',
205 'Document': 'document', 205 'Document': 'document',
206 'ThisValue': 'ScriptValue(scriptState, info.Holder())', 206 'ThisValue': 'ScriptValue(scriptState, info.Holder())',
207 } 207 }
208 # List because key order matters, as we want arguments in deterministic order 208 # List because key order matters, as we want arguments in deterministic order
209 CALL_WITH_VALUES = [ 209 CALL_WITH_VALUES = [
210 'ScriptState', 210 'ScriptState',
211 'ExecutionContext', 211 'ExecutionContext',
212 'ScriptArguments', 212 'ScriptArguments',
213 'CurrentWindow', 213 'CurrentWindow',
214 'EnteredWindow', 214 'EnteredWindow',
(...skipping 21 matching lines...) Expand all
236 def deprecate_as(member): 236 def deprecate_as(member):
237 extended_attributes = member.extended_attributes 237 extended_attributes = member.extended_attributes
238 if 'DeprecateAs' not in extended_attributes: 238 if 'DeprecateAs' not in extended_attributes:
239 return None 239 return None
240 includes.add('core/frame/Deprecation.h') 240 includes.add('core/frame/Deprecation.h')
241 return extended_attributes['DeprecateAs'] 241 return extended_attributes['DeprecateAs']
242 242
243 243
244 # [Exposed] 244 # [Exposed]
245 EXPOSED_EXECUTION_CONTEXT_METHOD = { 245 EXPOSED_EXECUTION_CONTEXT_METHOD = {
246 'AnimationWorklet': 'isAnimationWorkletGlobalScope', 246 'AnimationWorklet': 'IsAnimationWorkletGlobalScope',
247 'AudioWorklet': 'isAudioWorkletGlobalScope', 247 'AudioWorklet': 'IsAudioWorkletGlobalScope',
248 'CompositorWorker': 'isCompositorWorkerGlobalScope', 248 'CompositorWorker': 'IsCompositorWorkerGlobalScope',
249 'DedicatedWorker': 'isDedicatedWorkerGlobalScope', 249 'DedicatedWorker': 'IsDedicatedWorkerGlobalScope',
250 'PaintWorklet': 'isPaintWorkletGlobalScope', 250 'PaintWorklet': 'IsPaintWorkletGlobalScope',
251 'ServiceWorker': 'isServiceWorkerGlobalScope', 251 'ServiceWorker': 'IsServiceWorkerGlobalScope',
252 'SharedWorker': 'isSharedWorkerGlobalScope', 252 'SharedWorker': 'IsSharedWorkerGlobalScope',
253 'Window': 'isDocument', 253 'Window': 'IsDocument',
254 'Worker': 'isWorkerGlobalScope', 254 'Worker': 'IsWorkerGlobalScope',
255 'Worklet': 'isWorkletGlobalScope', 255 'Worklet': 'IsWorkletGlobalScope',
256 } 256 }
257 257
258 258
259 EXPOSED_WORKERS = set([ 259 EXPOSED_WORKERS = set([
260 'CompositorWorker', 260 'CompositorWorker',
261 'DedicatedWorker', 261 'DedicatedWorker',
262 'SharedWorker', 262 'SharedWorker',
263 'ServiceWorker', 263 'ServiceWorker',
264 ]) 264 ])
265 265
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 raise ValueError('Interface members\' exposure sets must be a subset of the interface\'s.') 337 raise ValueError('Interface members\' exposure sets must be a subset of the interface\'s.')
338 338
339 return exposure_set.code() 339 return exposure_set.code()
340 340
341 341
342 # [SecureContext] 342 # [SecureContext]
343 def secure_context(member, interface): 343 def secure_context(member, interface):
344 """Returns C++ code that checks whether an interface/method/attribute/etc. i s exposed 344 """Returns C++ code that checks whether an interface/method/attribute/etc. i s exposed
345 to the current context.""" 345 to the current context."""
346 if 'SecureContext' in member.extended_attributes or 'SecureContext' in inter face.extended_attributes: 346 if 'SecureContext' in member.extended_attributes or 'SecureContext' in inter face.extended_attributes:
347 return "executionContext->isSecureContext()" 347 return "executionContext->IsSecureContext()"
348 return None 348 return None
349 349
350 350
351 # [ImplementedAs] 351 # [ImplementedAs]
352 def cpp_name(definition_or_member): 352 def cpp_name(definition_or_member):
353 extended_attributes = definition_or_member.extended_attributes 353 extended_attributes = definition_or_member.extended_attributes
354 if 'ImplementedAs' not in extended_attributes: 354 if 'ImplementedAs' not in extended_attributes:
355 return definition_or_member.name 355 return definition_or_member.name
356 return extended_attributes['ImplementedAs'] 356 return extended_attributes['ImplementedAs']
357 357
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 """Returns True if the interface's member needs to be defined on every 458 """Returns True if the interface's member needs to be defined on every
459 instance object. 459 instance object.
460 460
461 The following members must be defiend on an instance object. 461 The following members must be defiend on an instance object.
462 - [Unforgeable] members 462 - [Unforgeable] members
463 - regular members of [Global] or [PrimaryGlobal] interfaces 463 - regular members of [Global] or [PrimaryGlobal] interfaces
464 """ 464 """
465 if member.is_static: 465 if member.is_static:
466 return False 466 return False
467 467
468 # TODO(yukishiino): Remove a hack for toString once we support 468 # TODO(yukishiino): Remove a hack for ToString once we support
469 # Symbol.toStringTag. 469 # Symbol.ToStringTag.
470 if (interface.name == 'Window' and member.name == 'toString'): 470 if interface.name == 'Window' and member.name == 'ToString':
471 return False 471 return False
472 472
473 # TODO(yukishiino): Implement "interface object" and its [[Call]] method 473 # TODO(yukishiino): Implement "interface object" and its [[Call]] method
474 # in a better way. Then we can get rid of this hack. 474 # in a better way. Then we can get rid of this hack.
475 if is_constructor_attribute(member): 475 if is_constructor_attribute(member):
476 return True 476 return True
477 477
478 if ('PrimaryGlobal' in interface.extended_attributes or 478 if ('PrimaryGlobal' in interface.extended_attributes or
479 'Global' in interface.extended_attributes or 479 'Global' in interface.extended_attributes or
480 'Unforgeable' in member.extended_attributes or 480 'Unforgeable' in member.extended_attributes or
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 def named_property_getter(interface): 604 def named_property_getter(interface):
605 try: 605 try:
606 # Find named property getter, if present; has form: 606 # Find named property getter, if present; has form:
607 # getter TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1) 607 # getter TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1)
608 getter = next( 608 getter = next(
609 method 609 method
610 for method in interface.operations 610 for method in interface.operations
611 if ('getter' in method.specials and 611 if ('getter' in method.specials and
612 len(method.arguments) == 1 and 612 len(method.arguments) == 1 and
613 str(method.arguments[0].idl_type) == 'DOMString')) 613 str(method.arguments[0].idl_type) == 'DOMString'))
614 getter.name = getter.name or 'anonymousNamedGetter' 614 getter.name = getter.name or 'AnonymousNamedGetter'
615 return getter 615 return getter
616 except StopIteration: 616 except StopIteration:
617 return None 617 return None
618 618
619 619
620 def named_property_setter(interface): 620 def named_property_setter(interface):
621 try: 621 try:
622 # Find named property setter, if present; has form: 622 # Find named property setter, if present; has form:
623 # setter RETURN_TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1, ARG_TYPE ARG2 ) 623 # setter RETURN_TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1, ARG_TYPE ARG2 )
624 return next( 624 return next(
(...skipping 20 matching lines...) Expand all
645 return None 645 return None
646 646
647 647
648 IdlInterface.legacy_caller = property(legacy_caller) 648 IdlInterface.legacy_caller = property(legacy_caller)
649 IdlInterface.indexed_property_getter = property(indexed_property_getter) 649 IdlInterface.indexed_property_getter = property(indexed_property_getter)
650 IdlInterface.indexed_property_setter = property(indexed_property_setter) 650 IdlInterface.indexed_property_setter = property(indexed_property_setter)
651 IdlInterface.indexed_property_deleter = property(indexed_property_deleter) 651 IdlInterface.indexed_property_deleter = property(indexed_property_deleter)
652 IdlInterface.named_property_getter = property(named_property_getter) 652 IdlInterface.named_property_getter = property(named_property_getter)
653 IdlInterface.named_property_setter = property(named_property_setter) 653 IdlInterface.named_property_setter = property(named_property_setter)
654 IdlInterface.named_property_deleter = property(named_property_deleter) 654 IdlInterface.named_property_deleter = property(named_property_deleter)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698