| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef MOJO_DART_EMBEDDER_COMMON_H_ | 5 #ifndef MOJO_DART_EMBEDDER_COMMON_H_ |
| 6 #define MOJO_DART_EMBEDDER_COMMON_H_ | 6 #define MOJO_DART_EMBEDDER_COMMON_H_ |
| 7 | 7 |
| 8 #include "dart/runtime/include/dart_api.h" | 8 #include "dart/runtime/include/dart_api.h" |
| 9 | 9 |
| 10 namespace mojo { | 10 namespace mojo { |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 class DartEmbedder { | 13 class DartEmbedder { |
| 14 public: | 14 public: |
| 15 static Dart_Handle GetDartType(const char* library_url, |
| 16 const char* class_name); |
| 17 |
| 18 static Dart_Handle NewDartExceptionWithMessage(const char* library_url, |
| 19 const char* error_type, |
| 20 const char* message); |
| 21 |
| 22 static Dart_Handle NewInternalError(const char* message); |
| 23 |
| 15 // Returns the integer value of a Dart object. If the object is not | 24 // Returns the integer value of a Dart object. If the object is not |
| 16 // an integer value an API error is propagated. | 25 // an integer value an API error is propagated. |
| 17 static int64_t GetIntegerValue(Dart_Handle value_obj); | 26 static int64_t GetIntegerValue(Dart_Handle value_obj); |
| 18 // Returns the integer value of a Dart object. If the object is not | 27 // Returns the integer value of a Dart object. If the object is not |
| 19 // an integer value or outside the requested range an API error is | 28 // an integer value or outside the requested range an API error is |
| 20 // propagated. | 29 // propagated. |
| 21 static int64_t GetInt64ValueCheckRange( | 30 static int64_t GetInt64ValueCheckRange( |
| 22 Dart_Handle value_obj, int64_t lower, int64_t upper); | 31 Dart_Handle value_obj, int64_t lower, int64_t upper); |
| 23 // Returns the intptr_t value of a Dart object. If the object is not | 32 // Returns the intptr_t value of a Dart object. If the object is not |
| 24 // an integer value or the value is outside the intptr_t range an | 33 // an integer value or the value is outside the intptr_t range an |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // Creates a Uint8List with a copy of bytes. | 72 // Creates a Uint8List with a copy of bytes. |
| 64 // Any error is propagated. | 73 // Any error is propagated. |
| 65 static Dart_Handle MakeUint8TypedData(uint8_t* bytes, intptr_t length); | 74 static Dart_Handle MakeUint8TypedData(uint8_t* bytes, intptr_t length); |
| 66 }; | 75 }; |
| 67 | 76 |
| 68 } // namespace dart | 77 } // namespace dart |
| 69 } // namespace mojo | 78 } // namespace mojo |
| 70 | 79 |
| 71 | 80 |
| 72 #endif // MOJO_DART_EMBEDDER_COMMON_H_ | 81 #endif // MOJO_DART_EMBEDDER_COMMON_H_ |
| OLD | NEW |