Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 BIN_DARTUTILS_H_ | 5 #ifndef BIN_DARTUTILS_H_ |
| 6 #define BIN_DARTUTILS_H_ | 6 #define BIN_DARTUTILS_H_ |
| 7 | 7 |
| 8 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
| 9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
| 10 #include "platform/globals.h" | 10 #include "platform/globals.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 void operator=(const CommandLineOptions&); | 49 void operator=(const CommandLineOptions&); |
| 50 | 50 |
| 51 int count_; | 51 int count_; |
| 52 int max_count_; | 52 int max_count_; |
| 53 const char** arguments_; | 53 const char** arguments_; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 | 56 |
| 57 class DartUtils { | 57 class DartUtils { |
| 58 public: | 58 public: |
| 59 // The following Get/Set functions can call Dart_PropagateError(), | |
| 60 // which will never return. If you have memory to deallocate or | |
| 61 // other C++ level cleanup pending, it is not approprate to call | |
| 62 // these functions. | |
|
Søren Gjesse
2012/03/08 21:18:46
I can see how Dart_PropagateError makes it simpler
turnidge
2012/03/08 22:19:26
From offline discussion.
I will change the api to
| |
| 59 static int64_t GetIntegerValue(Dart_Handle value_obj); | 63 static int64_t GetIntegerValue(Dart_Handle value_obj); |
| 60 static const char* GetStringValue(Dart_Handle str_obj); | 64 static const char* GetStringValue(Dart_Handle str_obj); |
| 61 static bool GetBooleanValue(Dart_Handle bool_obj); | 65 static bool GetBooleanValue(Dart_Handle bool_obj); |
| 62 static void SetIntegerField(Dart_Handle handle, | 66 static void SetIntegerField(Dart_Handle handle, |
| 63 const char* name, | 67 const char* name, |
| 64 intptr_t val); | 68 intptr_t val); |
| 65 static intptr_t GetIntegerField(Dart_Handle handle, | 69 static intptr_t GetIntegerField(Dart_Handle handle, |
| 66 const char* name); | 70 const char* name); |
| 67 static void SetStringField(Dart_Handle handle, | 71 static void SetStringField(Dart_Handle handle, |
| 68 const char* name, | 72 const char* name, |
| 69 const char* val); | 73 const char* val); |
| 74 | |
| 70 static bool IsDartSchemeURL(const char* url_name); | 75 static bool IsDartSchemeURL(const char* url_name); |
| 71 static bool IsDartExtensionSchemeURL(const char* url_name); | 76 static bool IsDartExtensionSchemeURL(const char* url_name); |
| 72 static bool IsDartIOLibURL(const char* url_name); | 77 static bool IsDartIOLibURL(const char* url_name); |
| 73 static bool IsDartJsonLibURL(const char* url_name); | 78 static bool IsDartJsonLibURL(const char* url_name); |
| 74 static bool IsDartUriLibURL(const char* url_name); | 79 static bool IsDartUriLibURL(const char* url_name); |
| 75 static bool IsDartUtfLibURL(const char* url_name); | 80 static bool IsDartUtfLibURL(const char* url_name); |
| 76 static Dart_Handle CanonicalizeURL(CommandLineOptions* url_mapping, | 81 static Dart_Handle CanonicalizeURL(CommandLineOptions* url_mapping, |
| 77 Dart_Handle library, | 82 Dart_Handle library, |
| 78 const char* url_str); | 83 const char* url_str); |
| 79 static Dart_Handle ReadStringFromFile(const char* filename); | 84 static Dart_Handle ReadStringFromFile(const char* filename); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 | 276 |
| 272 class CObjectByteArray : public CObject { | 277 class CObjectByteArray : public CObject { |
| 273 public: | 278 public: |
| 274 DECLARE_COBJECT_CONSTRUCTORS(ByteArray) | 279 DECLARE_COBJECT_CONSTRUCTORS(ByteArray) |
| 275 | 280 |
| 276 int Length() const { return cobject_->value.as_byte_array.length; } | 281 int Length() const { return cobject_->value.as_byte_array.length; } |
| 277 uint8_t* Buffer() const { return cobject_->value.as_byte_array.values; } | 282 uint8_t* Buffer() const { return cobject_->value.as_byte_array.values; } |
| 278 }; | 283 }; |
| 279 | 284 |
| 280 #endif // BIN_DARTUTILS_H_ | 285 #endif // BIN_DARTUTILS_H_ |
| OLD | NEW |