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

Unified Diff: Source/bindings/scripts/unstable/v8_attributes.py

Issue 117063002: IDL compiler: [RaisesException] interface type attribute (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: EventHandler Created 7 years 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 | « no previous file | Source/bindings/tests/idls/TestObjectPython.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/unstable/v8_attributes.py
diff --git a/Source/bindings/scripts/unstable/v8_attributes.py b/Source/bindings/scripts/unstable/v8_attributes.py
index 56b14963983a8b4deef7524fcc81d2b27460dde3..9967cbd82fe6a730cc7770841299042ec5e4c66d 100644
--- a/Source/bindings/scripts/unstable/v8_attributes.py
+++ b/Source/bindings/scripts/unstable/v8_attributes.py
@@ -140,22 +140,28 @@ def generate_getter(interface, attribute, contents):
cpp_value = getter_expression(interface, attribute, contents)
# Normally we can inline the function call into the return statement to
# avoid the overhead of using a Ref<> temporary, but for some cases
- # (nullable types, EventHandler, [CachedAttribute], or if there are
- # exceptions), we need to use a local variable.
+ # (nullable types, [RaisesException], [CachedAttribute], and EventHandler)
+ # we need to use a local variable.
# FIXME: check if compilers are smart enough to inline this, and if so,
# always use a local variable (for readability and CG simplicity).
- if (attribute.is_nullable or
- idl_type == 'EventHandler' or
- 'CachedAttribute' in extended_attributes or
- contents['is_getter_raises_exception']):
+ if idl_type == 'EventHandler':
+ contents['cpp_value_original'] = cpp_value
+ cpp_rvalue = cpp_value = 'jsValue'
+ elif (attribute.is_nullable or
+ contents['is_getter_raises_exception'] or
+ 'CachedAttribute' in extended_attributes):
contents['cpp_value_original'] = cpp_value
- cpp_value = 'jsValue'
+ cpp_rvalue = cpp_value = 'jsValue'
+ if v8_types.is_interface_type(idl_type):
+ cpp_rvalue += '.release()'
+ else:
+ cpp_rvalue = cpp_value
if contents['is_keep_alive_for_gc']:
v8_set_return_value_statement = 'v8SetReturnValue(info, wrapper)'
includes.add('bindings/v8/V8HiddenPropertyName.h')
else:
- v8_set_return_value_statement = v8_types.v8_set_return_value(idl_type, cpp_value, extended_attributes=extended_attributes, script_wrappable='imp')
+ v8_set_return_value_statement = v8_types.v8_set_return_value(idl_type, cpp_rvalue, extended_attributes=extended_attributes, script_wrappable='imp')
contents.update({
'cpp_value': cpp_value,
« no previous file with comments | « no previous file | Source/bindings/tests/idls/TestObjectPython.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698