| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // TODO(sgjesse): Add support for kBigint. | 224 // TODO(sgjesse): Add support for kBigint. |
| 225 static Dart_CObject* NewDouble(double value); | 225 static Dart_CObject* NewDouble(double value); |
| 226 static Dart_CObject* NewString(int length); | 226 static Dart_CObject* NewString(int length); |
| 227 static Dart_CObject* NewString(const char* str); | 227 static Dart_CObject* NewString(const char* str); |
| 228 static Dart_CObject* NewArray(int length); | 228 static Dart_CObject* NewArray(int length); |
| 229 static Dart_CObject* NewUint8Array(int length); | 229 static Dart_CObject* NewUint8Array(int length); |
| 230 static Dart_CObject* NewExternalUint8Array(int64_t length, | 230 static Dart_CObject* NewExternalUint8Array(int64_t length, |
| 231 uint8_t* data, | 231 uint8_t* data, |
| 232 void* peer, | 232 void* peer, |
| 233 Dart_PeerFinalizer callback); | 233 Dart_PeerFinalizer callback); |
| 234 static Dart_CObject* NewIOBuffer(int64_t length); |
| 235 static void FreeIOBufferData(Dart_CObject* object); |
| 234 | 236 |
| 235 Dart_CObject* AsApiCObject() { return cobject_; } | 237 Dart_CObject* AsApiCObject() { return cobject_; } |
| 236 | 238 |
| 237 // Create a new CObject array with an illegal arguments error. | 239 // Create a new CObject array with an illegal arguments error. |
| 238 static CObject* IllegalArgumentError(); | 240 static CObject* IllegalArgumentError(); |
| 239 // Create a new CObject array with a file closed error. | 241 // Create a new CObject array with a file closed error. |
| 240 static CObject* FileClosedError(); | 242 static CObject* FileClosedError(); |
| 241 // Create a new CObject array with the current OS error. | 243 // Create a new CObject array with the current OS error. |
| 242 static CObject* NewOSError(); | 244 static CObject* NewOSError(); |
| 243 // Create a new CObject array with the specified OS error. | 245 // Create a new CObject array with the specified OS error. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 private: | 399 private: |
| 398 DISALLOW_COPY_AND_ASSIGN(CObjectUint8Array); | 400 DISALLOW_COPY_AND_ASSIGN(CObjectUint8Array); |
| 399 }; | 401 }; |
| 400 | 402 |
| 401 | 403 |
| 402 class CObjectExternalUint8Array : public CObject { | 404 class CObjectExternalUint8Array : public CObject { |
| 403 public: | 405 public: |
| 404 DECLARE_COBJECT_CONSTRUCTORS(ExternalUint8Array) | 406 DECLARE_COBJECT_CONSTRUCTORS(ExternalUint8Array) |
| 405 | 407 |
| 406 int Length() const { return cobject_->value.as_external_byte_array.length; } | 408 int Length() const { return cobject_->value.as_external_byte_array.length; } |
| 409 void SetLength(uint64_t length) { |
| 410 cobject_->value.as_external_byte_array.length = length; |
| 411 } |
| 407 uint8_t* Data() const { return cobject_->value.as_external_byte_array.data; } | 412 uint8_t* Data() const { return cobject_->value.as_external_byte_array.data; } |
| 408 void* Peer() const { return cobject_->value.as_external_byte_array.peer; } | 413 void* Peer() const { return cobject_->value.as_external_byte_array.peer; } |
| 409 Dart_PeerFinalizer Callback() const { | 414 Dart_PeerFinalizer Callback() const { |
| 410 return cobject_->value.as_external_byte_array.callback; | 415 return cobject_->value.as_external_byte_array.callback; |
| 411 } | 416 } |
| 412 | 417 |
| 413 private: | 418 private: |
| 414 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array); | 419 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array); |
| 415 }; | 420 }; |
| 416 | 421 |
| 417 #endif // BIN_DARTUTILS_H_ | 422 #endif // BIN_DARTUTILS_H_ |
| OLD | NEW |