| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 The Dartium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // This file has been auto-generated by {{code_generator_dart}}. DO NOT MODIFY! |
| 6 |
| 7 #ifndef {{dart_class}}_h |
| 8 #define {{dart_class}}_h |
| 9 |
| 10 {% for filename in header_includes %} |
| 11 #include "{{filename}}" |
| 12 {% endfor %} |
| 13 |
| 14 #include "sky/engine/tonic/dart_converter.h" |
| 15 #include "sky/engine/tonic/dart_state.h" |
| 16 #include "sky/engine/wtf/PassOwnPtr.h" |
| 17 |
| 18 namespace blink { |
| 19 |
| 20 class {{dart_class}} : public {{cpp_class}} { |
| 21 public: |
| 22 typedef {{dart_class}} NativeType; |
| 23 |
| 24 static PassOwnPtr<NativeType> create(Dart_Handle object, |
| 25 Dart_Handle& exception) { |
| 26 return adoptPtr(new {{dart_class}}(object, exception)); |
| 27 } |
| 28 |
| 29 static PassOwnPtr<NativeType> createWithNullCheck(Dart_Handle object, |
| 30 Dart_Handle& exception) { |
| 31 if (Dart_IsNull(object)) |
| 32 return PassOwnPtr<NativeType>(); |
| 33 return create(object, exception); |
| 34 } |
| 35 |
| 36 static PassOwnPtr<NativeType> create(Dart_NativeArguments args, |
| 37 int index, |
| 38 Dart_Handle& exception) { |
| 39 Dart_Handle object = Dart_GetNativeArgument(args, index); |
| 40 return create(object, exception); |
| 41 } |
| 42 |
| 43 static PassOwnPtr<NativeType> createWithNullCheck(Dart_NativeArguments args, |
| 44 int index, |
| 45 Dart_Handle& exception) { |
| 46 Dart_Handle object = Dart_GetNativeArgument(args, index); |
| 47 if (Dart_IsNull(object)) |
| 48 return PassOwnPtr<NativeType>(); |
| 49 return create(object, exception); |
| 50 } |
| 51 |
| 52 {% for method in methods %} |
| 53 virtual {{method.cpp_type}} {{method.name}}({{method.argument_declarations | j
oin(', ')}}) override; |
| 54 {% endfor %} |
| 55 private: |
| 56 {{dart_class}}(Dart_Handle object, Dart_Handle& exception) |
| 57 : callback_(DartState::Current(), object, exception) { |
| 58 } |
| 59 |
| 60 DartCallback callback_; |
| 61 }; |
| 62 |
| 63 template <> |
| 64 struct DartConverter<{{ cpp_class }}*> { |
| 65 static PassOwnPtr<{{dart_class}}> FromArguments( |
| 66 Dart_NativeArguments args, int index, Dart_Handle& exception) { |
| 67 return {{dart_class}}::create(args, index, exception); |
| 68 } |
| 69 |
| 70 static PassOwnPtr<{{dart_class}}> FromArgumentsWithNullCheck( |
| 71 Dart_NativeArguments args, int index, Dart_Handle& exception) { |
| 72 return {{dart_class}}::createWithNullCheck(args, index, exception); |
| 73 } |
| 74 }; |
| 75 |
| 76 } // blink |
| 77 #endif // {{dart_class}}_h |
| OLD | NEW |