Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY! | 5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY! |
| 6 | 6 |
| 7 #include "config.h" | 7 #include "config.h" |
| 8 #include "{{v8_class}}.h" | 8 #include "{{v8_class}}.h" |
| 9 | 9 |
| 10 {% for filename in cpp_includes if filename != '%s.h' % v8_class %} | 10 {% for filename in cpp_includes if filename != '%s.h' % v8_class %} |
| 11 #include "{{filename}}" | 11 #include "{{filename}}" |
| 12 {% endfor %} | 12 {% endfor %} |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, { {cpp_class}}& impl, ExceptionState& exceptionState) | 16 void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, { {cpp_class}}& impl, ExceptionState& exceptionState) |
| 17 { | 17 { |
| 18 if (isUndefinedOrNull(v8Value)) | 18 if (isUndefinedOrNull(v8Value)) |
| 19 return; | 19 return; |
| 20 if (!v8Value->IsObject()) { | 20 if (!v8Value->IsObject()) { |
| 21 exceptionState.throwTypeError("cannot convert to dictionary."); | 21 exceptionState.throwTypeError("cannot convert to dictionary."); |
| 22 return; | 22 return; |
| 23 } | 23 } |
| 24 | 24 |
| 25 // FIXME: Do not use Dictionary and DictionaryHelper | 25 // FIXME: Do not use Dictionary and DictionaryHelper |
| 26 // https://crbug.com/321462 | 26 // https://crbug.com/321462 |
| 27 Dictionary dictionary(v8Value, isolate); | 27 Dictionary dictionary(v8Value, isolate); |
| 28 // FIXME: Remove this v8::TryCatch once the code is switched from | 28 // FIXME: Remove this v8::TryCatch once the code is switched from |
| 29 // Dictionary/DictionaryHelper to something that uses ExceptionState. | 29 // Dictionary/DictionaryHelper to something that uses ExceptionState. |
| 30 v8::TryCatch block; | 30 v8::TryCatch block; |
|
bashi
2014/11/17 02:20:45
I think you can fix this FIXME in this CL or a fol
zino
2014/11/19 18:12:19
I'm trying to fix this but I'm not familiar with t
bashi
2014/11/20 02:18:02
Hmm, let me investigate it later. I think I can fi
| |
| 31 {% for member in members %} | 31 {% for member in members %} |
| 32 {{member.cpp_type}} {{member.name}}; | 32 v8::Local<v8::Value> {{member.name}}Value; |
| 33 if (DictionaryHelper::getWithUndefinedOrNullCheck(dictionary, "{{member.name }}", {{member.name}})) { | 33 if (dictionary.getKey("{{member.name}}", {{member.name}}Value) && !isUndefin edOrNull({{member.name}}Value)) { |
|
haraken
2014/11/17 00:22:19
Is getWithUndefinedOrNullCheck still needed? It's
bashi
2014/11/17 02:20:45
Also, we can remove Dictionary here if you use v8_
zino
2014/11/19 18:12:19
Done.
| |
| 34 {{member.v8_value_to_local_cpp_value}}; | |
| 34 {% if member.enum_validation_expression %} | 35 {% if member.enum_validation_expression %} |
| 35 String string = {{member.name}}; | 36 String string = {{member.name}}; |
| 36 if (!({{member.enum_validation_expression}})) { | 37 if (!({{member.enum_validation_expression}})) { |
| 37 exceptionState.throwTypeError("member {{member.name}} ('" + string + "') is not a valid enum value."); | 38 exceptionState.throwTypeError("member {{member.name}} ('" + string + "') is not a valid enum value."); |
| 38 return; | 39 return; |
| 39 } | 40 } |
| 40 {% elif member.is_object %} | 41 {% elif member.is_object %} |
| 41 if (!{{member.name}}.isObject()) { | 42 if (!{{member.name}}.isObject()) { |
| 42 exceptionState.throwTypeError("member {{member.name}} is not an obje ct."); | 43 exceptionState.throwTypeError("member {{member.name}} is not an obje ct."); |
| 43 return; | 44 return; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 65 } else { | 66 } else { |
| 66 v8Object->Set(v8String(isolate, "{{member.name}}"), {{member.v8_default_ value}}); | 67 v8Object->Set(v8String(isolate, "{{member.name}}"), {{member.v8_default_ value}}); |
| 67 {% endif %} | 68 {% endif %} |
| 68 } | 69 } |
| 69 | 70 |
| 70 {% endfor %} | 71 {% endfor %} |
| 71 return v8Object; | 72 return v8Object; |
| 72 } | 73 } |
| 73 | 74 |
| 74 } // namespace blink | 75 } // namespace blink |
| OLD | NEW |