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 "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "include/dart_native_api.h" | 9 #include "include/dart_native_api.h" |
10 | 10 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 bool IsIntptr() { return IsInt32OrInt64(); } | 244 bool IsIntptr() { return IsInt32OrInt64(); } |
245 bool IsBigint() { return type() == Dart_CObject_kBigint; } | 245 bool IsBigint() { return type() == Dart_CObject_kBigint; } |
246 bool IsDouble() { return type() == Dart_CObject_kDouble; } | 246 bool IsDouble() { return type() == Dart_CObject_kDouble; } |
247 bool IsString() { return type() == Dart_CObject_kString; } | 247 bool IsString() { return type() == Dart_CObject_kString; } |
248 bool IsArray() { return type() == Dart_CObject_kArray; } | 248 bool IsArray() { return type() == Dart_CObject_kArray; } |
249 bool IsTypedData() { return type() == Dart_CObject_kTypedData; } | 249 bool IsTypedData() { return type() == Dart_CObject_kTypedData; } |
250 bool IsUint8Array() { | 250 bool IsUint8Array() { |
251 return type() == Dart_CObject_kTypedData && | 251 return type() == Dart_CObject_kTypedData && |
252 byte_array_type() == Dart_TypedData_kUint8; | 252 byte_array_type() == Dart_TypedData_kUint8; |
253 } | 253 } |
| 254 bool IsSendPort() { return type() == Dart_CObject_kSendPort; } |
254 | 255 |
255 bool IsTrue() { | 256 bool IsTrue() { |
256 return type() == Dart_CObject_kBool && cobject_->value.as_bool; | 257 return type() == Dart_CObject_kBool && cobject_->value.as_bool; |
257 } | 258 } |
258 | 259 |
259 bool IsFalse() { | 260 bool IsFalse() { |
260 return type() == Dart_CObject_kBool && !cobject_->value.as_bool; | 261 return type() == Dart_CObject_kBool && !cobject_->value.as_bool; |
261 } | 262 } |
262 | 263 |
263 void* operator new(size_t size) { | 264 void* operator new(size_t size) { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 } | 462 } |
462 void SetAt(intptr_t index, CObject* value) { | 463 void SetAt(intptr_t index, CObject* value) { |
463 cobject_->value.as_array.values[index] = value->AsApiCObject(); | 464 cobject_->value.as_array.values[index] = value->AsApiCObject(); |
464 } | 465 } |
465 | 466 |
466 private: | 467 private: |
467 DISALLOW_COPY_AND_ASSIGN(CObjectArray); | 468 DISALLOW_COPY_AND_ASSIGN(CObjectArray); |
468 }; | 469 }; |
469 | 470 |
470 | 471 |
| 472 class CObjectSendPort : public CObject { |
| 473 public: |
| 474 DECLARE_COBJECT_CONSTRUCTORS(SendPort) |
| 475 |
| 476 Dart_Port Value() const { return cobject_->value.as_send_port; } |
| 477 |
| 478 private: |
| 479 DISALLOW_COPY_AND_ASSIGN(CObjectSendPort); |
| 480 }; |
| 481 |
| 482 |
471 class CObjectTypedData : public CObject { | 483 class CObjectTypedData : public CObject { |
472 public: | 484 public: |
473 explicit CObjectTypedData(Dart_CObject *cobject) : CObject(cobject) { | 485 explicit CObjectTypedData(Dart_CObject *cobject) : CObject(cobject) { |
474 ASSERT(type() == Dart_CObject_kTypedData); | 486 ASSERT(type() == Dart_CObject_kTypedData); |
475 cobject_ = cobject; | 487 cobject_ = cobject; |
476 } | 488 } |
477 explicit CObjectTypedData(CObject* cobject) : CObject() { | 489 explicit CObjectTypedData(CObject* cobject) : CObject() { |
478 ASSERT(cobject != NULL); | 490 ASSERT(cobject != NULL); |
479 ASSERT(cobject->type() == Dart_CObject_kTypedData); | 491 ASSERT(cobject->type() == Dart_CObject_kTypedData); |
480 cobject_ = cobject->AsApiCObject(); | 492 cobject_ = cobject->AsApiCObject(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 } | 532 } |
521 | 533 |
522 private: | 534 private: |
523 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array); | 535 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array); |
524 }; | 536 }; |
525 | 537 |
526 } // namespace bin | 538 } // namespace bin |
527 } // namespace dart | 539 } // namespace dart |
528 | 540 |
529 #endif // BIN_DARTUTILS_H_ | 541 #endif // BIN_DARTUTILS_H_ |
OLD | NEW |