| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_DART_API_IMPL_H_ | 5 #ifndef VM_DART_API_IMPL_H_ |
| 6 #define VM_DART_API_IMPL_H_ | 6 #define VM_DART_API_IMPL_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 class ApiState; | 12 class ApiState; |
| 13 class LocalHandle; | 13 class LocalHandle; |
| 14 class Object; | 14 class Object; |
| 15 class PersistentHandle; | 15 class PersistentHandle; |
| 16 class RawObject; | 16 class RawObject; |
| 17 class UnhandledException; |
| 17 | 18 |
| 18 class Api : AllStatic { | 19 class Api : AllStatic { |
| 19 public: | 20 public: |
| 20 // Creates a new local handle. | 21 // Creates a new local handle. |
| 21 static Dart_Handle NewLocalHandle(const Object& object); | 22 static Dart_Handle NewLocalHandle(const Object& object); |
| 22 | 23 |
| 23 // Unwraps the raw object from the handle. | 24 // Unwraps the raw object from the handle. |
| 24 static RawObject* UnwrapHandle(Dart_Handle object); | 25 static RawObject* UnwrapHandle(Dart_Handle object); |
| 25 | 26 |
| 26 // Validates and converts the passed in handle as a local handle. | 27 // Validates and converts the passed in handle as a local handle. |
| 27 static LocalHandle* UnwrapAsLocalHandle(const ApiState& state, | 28 static LocalHandle* UnwrapAsLocalHandle(const ApiState& state, |
| 28 Dart_Handle object); | 29 Dart_Handle object); |
| 29 | 30 |
| 30 // Validates and converts the passed in handle as a persistent handle. | 31 // Validates and converts the passed in handle as a persistent handle. |
| 31 static PersistentHandle* UnwrapAsPersistentHandle(const ApiState& state, | 32 static PersistentHandle* UnwrapAsPersistentHandle(const ApiState& state, |
| 32 Dart_Handle object); | 33 Dart_Handle object); |
| 33 | 34 |
| 34 // Gets the handle used to designate successful return. | 35 // Gets the handle used to designate successful return. |
| 35 static Dart_Handle Success(); | 36 static Dart_Handle Success(); |
| 36 | 37 |
| 37 // Generates a handle used to designate an error return. | 38 // Generates a handle used to designate an error return. |
| 38 static Dart_Handle Error(const char* format, ...); | 39 static Dart_Handle Error(const char* format, ...); |
| 39 | 40 |
| 40 static Dart_Handle VError(const char* format, va_list args); | 41 static Dart_Handle VError(const char* format, va_list args); |
| 41 | 42 |
| 43 // Generates an error handle from an unhandled exception. |
| 44 static Dart_Handle ErrorFromException(const Object& obj); |
| 45 |
| 42 // Gets a handle to Null. | 46 // Gets a handle to Null. |
| 43 static Dart_Handle Null(); | 47 static Dart_Handle Null(); |
| 44 | 48 |
| 45 // Gets a handle to True. | 49 // Gets a handle to True. |
| 46 static Dart_Handle True(); | 50 static Dart_Handle True(); |
| 47 | 51 |
| 48 // Gets a handle to False | 52 // Gets a handle to False |
| 49 static Dart_Handle False(); | 53 static Dart_Handle False(); |
| 50 | 54 |
| 51 // Allocates space in the local zone. | 55 // Allocates space in the local zone. |
| 52 static uword Allocate(intptr_t size); | 56 static uword Allocate(intptr_t size); |
| 53 | 57 |
| 54 // Reallocates space in the local zone. | 58 // Reallocates space in the local zone. |
| 55 static uword Reallocate(uword ptr, intptr_t old_size, intptr_t new_size); | 59 static uword Reallocate(uword ptr, intptr_t old_size, intptr_t new_size); |
| 56 }; | 60 }; |
| 57 | 61 |
| 58 } // namespace dart. | 62 } // namespace dart. |
| 59 | 63 |
| 60 #endif // VM_DART_API_IMPL_H_ | 64 #endif // VM_DART_API_IMPL_H_ |
| OLD | NEW |