Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(716)

Side by Side Diff: runtime/bin/dartutils.h

Issue 10698011: Support posting of external data into dart as external uint8 arrays through the Dart API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/dartutils.cc » ('j') | runtime/vm/dart_api_message.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 static CObject* Bool(bool value); 162 static CObject* Bool(bool value);
163 static Dart_CObject* NewInt32(int32_t value); 163 static Dart_CObject* NewInt32(int32_t value);
164 static Dart_CObject* NewInt64(int64_t value); 164 static Dart_CObject* NewInt64(int64_t value);
165 static Dart_CObject* NewIntptr(intptr_t value); 165 static Dart_CObject* NewIntptr(intptr_t value);
166 // TODO(sgjesse): Add support for kBigint. 166 // TODO(sgjesse): Add support for kBigint.
167 static Dart_CObject* NewDouble(double value); 167 static Dart_CObject* NewDouble(double value);
168 static Dart_CObject* NewString(int length); 168 static Dart_CObject* NewString(int length);
169 static Dart_CObject* NewString(const char* str); 169 static Dart_CObject* NewString(const char* str);
170 static Dart_CObject* NewArray(int length); 170 static Dart_CObject* NewArray(int length);
171 static Dart_CObject* NewUint8Array(int length); 171 static Dart_CObject* NewUint8Array(int length);
172 static Dart_CObject* NewExternalUint8Array(int length,
173 uint8_t* data,
174 void* peer,
175 Dart_PeerFinalizer callback);
172 176
173 Dart_CObject* AsApiCObject() { return cobject_; } 177 Dart_CObject* AsApiCObject() { return cobject_; }
174 178
175 // Create a new CObject array with an illegal arguments error. 179 // Create a new CObject array with an illegal arguments error.
176 static CObject* IllegalArgumentError(); 180 static CObject* IllegalArgumentError();
177 // Create a new CObject array with a file closed error. 181 // Create a new CObject array with a file closed error.
178 static CObject* FileClosedError(); 182 static CObject* FileClosedError();
179 // Create a new CObject array with the current OS error. 183 // Create a new CObject array with the current OS error.
180 static CObject* NewOSError(); 184 static CObject* NewOSError();
181 // Create a new CObject array with the specified OS error. 185 // Create a new CObject array with the specified OS error.
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 302
299 303
300 class CObjectUint8Array : public CObject { 304 class CObjectUint8Array : public CObject {
301 public: 305 public:
302 DECLARE_COBJECT_CONSTRUCTORS(Uint8Array) 306 DECLARE_COBJECT_CONSTRUCTORS(Uint8Array)
303 307
304 int Length() const { return cobject_->value.as_byte_array.length; } 308 int Length() const { return cobject_->value.as_byte_array.length; }
305 uint8_t* Buffer() const { return cobject_->value.as_byte_array.values; } 309 uint8_t* Buffer() const { return cobject_->value.as_byte_array.values; }
306 }; 310 };
307 311
312
313 class CObjectExternalUint8Array : public CObject {
314 public:
315 DECLARE_COBJECT_CONSTRUCTORS(ExternalUint8Array)
316
317 int Length() const { return cobject_->value.as_external_byte_array.length; }
318 uint8_t* Data() const { return cobject_->value.as_external_byte_array.data; }
319 void* Peer() const { return cobject_->value.as_external_byte_array.peer; }
320 Dart_PeerFinalizer Callback() const {
321 return cobject_->value.as_external_byte_array.callback;
322 }
siva 2012/06/28 16:44:05 DISALLOW_COPY_AND_ASSIGN(...); Seems to be missin
Mads Ager (google) 2012/06/28 18:06:51 Me neither, but they are there now. Thanks. :)
323 };
324
308 #endif // BIN_DARTUTILS_H_ 325 #endif // BIN_DARTUTILS_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/dartutils.cc » ('j') | runtime/vm/dart_api_message.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698