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 "bin/utils.h" | 9 #include "bin/utils.h" |
10 #include "include/dart_api.h" | 10 #include "include/dart_api.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 DISALLOW_ALLOCATION(); | 199 DISALLOW_ALLOCATION(); |
200 DISALLOW_IMPLICIT_CONSTRUCTORS(DartUtils); | 200 DISALLOW_IMPLICIT_CONSTRUCTORS(DartUtils); |
201 }; | 201 }; |
202 | 202 |
203 | 203 |
204 class CObject { | 204 class CObject { |
205 public: | 205 public: |
206 explicit CObject(Dart_CObject *cobject) : cobject_(cobject) {} | 206 explicit CObject(Dart_CObject *cobject) : cobject_(cobject) {} |
207 Dart_CObject::Type type() { return cobject_->type; } | 207 Dart_CObject::Type type() { return cobject_->type; } |
208 Dart_CObject::TypedDataType byte_array_type() { | 208 Dart_CObject::TypedDataType byte_array_type() { |
209 ASSERT(type() == Dart_CObject::kTypedData); | 209 ASSERT(type() == Dart_CObject::kTypedData || |
| 210 type() == Dart_CObject::kExternalTypedData); |
210 return cobject_->value.as_typed_data.type; | 211 return cobject_->value.as_typed_data.type; |
211 } | 212 } |
212 | 213 |
213 bool IsNull() { return type() == Dart_CObject::kNull; } | 214 bool IsNull() { return type() == Dart_CObject::kNull; } |
214 bool IsBool() { return type() == Dart_CObject::kBool; } | 215 bool IsBool() { return type() == Dart_CObject::kBool; } |
215 bool IsInt32() { return type() == Dart_CObject::kInt32; } | 216 bool IsInt32() { return type() == Dart_CObject::kInt32; } |
216 bool IsInt64() { return type() == Dart_CObject::kInt64; } | 217 bool IsInt64() { return type() == Dart_CObject::kInt64; } |
217 bool IsInt32OrInt64() { return IsInt32() || IsInt64(); } | 218 bool IsInt32OrInt64() { return IsInt32() || IsInt64(); } |
218 bool IsIntptr() { return IsInt32OrInt64(); } | 219 bool IsIntptr() { return IsInt32OrInt64(); } |
219 bool IsBigint() { return type() == Dart_CObject::kBigint; } | 220 bool IsBigint() { return type() == Dart_CObject::kBigint; } |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 void* Peer() const { return cobject_->value.as_external_typed_data.peer; } | 488 void* Peer() const { return cobject_->value.as_external_typed_data.peer; } |
488 Dart_WeakPersistentHandleFinalizer Callback() const { | 489 Dart_WeakPersistentHandleFinalizer Callback() const { |
489 return cobject_->value.as_external_typed_data.callback; | 490 return cobject_->value.as_external_typed_data.callback; |
490 } | 491 } |
491 | 492 |
492 private: | 493 private: |
493 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array); | 494 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array); |
494 }; | 495 }; |
495 | 496 |
496 #endif // BIN_DARTUTILS_H_ | 497 #endif // BIN_DARTUTILS_H_ |
OLD | NEW |