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

Unified Diff: Source/bindings/scripts/v8_types.py

Issue 1192753003: Merge 196373 "binding: Supports static operations/attrs returnin..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/2357/
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/tests/idls/core/TestInterface.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/v8_types.py
===================================================================
--- Source/bindings/scripts/v8_types.py (revision 197430)
+++ Source/bindings/scripts/v8_types.py (working copy)
@@ -795,20 +795,30 @@
'DOMWrapperForMainWorld': 'v8SetReturnValueForMainWorld(info, WTF::getPtr({cpp_value}))',
'DOMWrapperFast': 'v8SetReturnValueFast(info, WTF::getPtr({cpp_value}), {script_wrappable})',
'DOMWrapperDefault': 'v8SetReturnValue(info, {cpp_value})',
+ # Note that static attributes and operations do not check whether |this| is
+ # an instance of the interface nor |this|'s creation context is the same as
+ # the current context. So we must always use the current context as the
+ # creation context of the DOM wrapper for the return value.
+ 'DOMWrapperStatic': 'v8SetReturnValue(info, {cpp_value}, info.GetIsolate()->GetCurrentContext()->Global())',
# Generic dictionary type
'Dictionary': 'v8SetReturnValue(info, {cpp_value})',
+ 'DictionaryStatic': '#error not implemented yet',
# Nullable dictionaries
'NullableDictionary': 'v8SetReturnValue(info, result.get())',
+ 'NullableDictionaryStatic': '#error not implemented yet',
# Union types or dictionaries
'DictionaryOrUnion': 'v8SetReturnValue(info, result)',
+ 'DictionaryOrUnionStatic': '#error not implemented yet',
}
-def v8_set_return_value(idl_type, cpp_value, extended_attributes=None, script_wrappable='', release=False, for_main_world=False):
+def v8_set_return_value(idl_type, cpp_value, extended_attributes=None, script_wrappable='', release=False, for_main_world=False, is_static=False):
"""Returns a statement that converts a C++ value to a V8 value and sets it as a return value.
"""
def dom_wrapper_conversion_type():
+ if is_static:
+ return 'DOMWrapperStatic'
if not script_wrappable:
return 'DOMWrapperDefault'
if for_main_world:
@@ -823,6 +833,8 @@
cpp_value = idl_type.cpp_value_to_v8_value(cpp_value, extended_attributes=extended_attributes)
if this_v8_conversion_type == 'DOMWrapper':
this_v8_conversion_type = dom_wrapper_conversion_type()
+ if is_static and this_v8_conversion_type in ('Dictionary', 'NullableDictionary', 'DictionaryOrUnion'):
+ this_v8_conversion_type += 'Static'
format_string = V8_SET_RETURN_VALUE[this_v8_conversion_type]
# FIXME: oilpan: Remove .release() once we remove all RefPtrs from generated code.
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/tests/idls/core/TestInterface.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698