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

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

Issue 795833004: Use dictionaries for context creation attributes. Eliminate custom bindings. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 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 | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/templates/dictionary_v8.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/v8_types.py
diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py
index 9bc61dc8100d8407131274b1f68092afb4413020..b5170c6f31e5e3e482027d88e1f0204c6fec8252 100644
--- a/Source/bindings/scripts/v8_types.py
+++ b/Source/bindings/scripts/v8_types.py
@@ -715,6 +715,11 @@ def v8_conversion_type(idl_type, extended_attributes):
"""
extended_attributes = extended_attributes or {}
+ # Nullable dictionaries need to be handled differently than either
+ # non-nullable dictionaries or unions.
+ if idl_type.is_dictionary and idl_type.is_nullable:
+ return 'NullableDictionary'
+
if idl_type.is_dictionary or idl_type.is_union_type:
return 'DictionaryOrUnion'
@@ -789,6 +794,8 @@ V8_SET_RETURN_VALUE = {
'DOMWrapperDefault': 'v8SetReturnValue(info, {cpp_value})',
# Generic dictionary type
'Dictionary': 'v8SetReturnValue(info, {cpp_value})',
+ # Nullable dictionaries
+ 'NullableDictionary': 'v8SetReturnValue(info, result.get())',
# Union types or dictionaries
'DictionaryOrUnion': 'v8SetReturnValue(info, result)',
}
@@ -853,6 +860,15 @@ CPP_VALUE_TO_V8_VALUE = {
# General
'array': 'toV8({cpp_value}, {creation_context}, {isolate})',
'DOMWrapper': 'toV8({cpp_value}, {creation_context}, {isolate})',
+ # Passing nullable dictionaries isn't a pattern currently used
+ # anywhere in the web platform, and more work would be needed in
+ # the code generator to distinguish between passing null, and
+ # passing an object which happened to not contain any of the
+ # dictionary's defined attributes. For now, don't define
+ # NullableDictionary here, which will cause an exception to be
+ # thrown during code generation if an argument to a method is a
+ # nullable dictionary type.
+ #
# Union types or dictionaries
'DictionaryOrUnion': 'toV8({cpp_value}, {creation_context}, {isolate})',
}
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/templates/dictionary_v8.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698