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

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

Issue 15018011: dart:io | Add FileSystemEntity.stat() and FileStat class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix Windows failures. Created 7 years, 7 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
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 "include/dart_api.h" 8 #include "include/dart_api.h"
9 9
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 static const char* GetCanonicalPath(const char* reference_dir, 200 static const char* GetCanonicalPath(const char* reference_dir,
201 const char* filename); 201 const char* filename);
202 202
203 DISALLOW_ALLOCATION(); 203 DISALLOW_ALLOCATION();
204 DISALLOW_IMPLICIT_CONSTRUCTORS(DartUtils); 204 DISALLOW_IMPLICIT_CONSTRUCTORS(DartUtils);
205 }; 205 };
206 206
207 207
208 class CObject { 208 class CObject {
209 public: 209 public:
210 // These match the constants in sdk/lib/io/common.dart.
Søren Gjesse 2013/05/14 13:50:36 These constants should be moved. They are not part
Bill Hesse 2013/05/14 16:33:58 I would do this, but I don't know where you think
Søren Gjesse 2013/05/15 14:06:35 Let's create a new class NativePortRPC with these
211 static const int kSuccess = 0;
212 static const int kArgumentError = 1;
213 static const int kOSError = 2;
214 static const int kFileClosedError = 3;
215
210 explicit CObject(Dart_CObject *cobject) : cobject_(cobject) {} 216 explicit CObject(Dart_CObject *cobject) : cobject_(cobject) {}
211 Dart_CObject::Type type() { return cobject_->type; } 217 Dart_CObject::Type type() { return cobject_->type; }
212 Dart_CObject::TypedDataType byte_array_type() { 218 Dart_CObject::TypedDataType byte_array_type() {
213 ASSERT(type() == Dart_CObject::kTypedData || 219 ASSERT(type() == Dart_CObject::kTypedData ||
214 type() == Dart_CObject::kExternalTypedData); 220 type() == Dart_CObject::kExternalTypedData);
215 return cobject_->value.as_typed_data.type; 221 return cobject_->value.as_typed_data.type;
216 } 222 }
217 223
218 bool IsNull() { return type() == Dart_CObject::kNull; } 224 bool IsNull() { return type() == Dart_CObject::kNull; }
219 bool IsBool() { return type() == Dart_CObject::kBool; } 225 bool IsBool() { return type() == Dart_CObject::kBool; }
(...skipping 26 matching lines...) Expand all
246 static CObject* Null(); 252 static CObject* Null();
247 static CObject* True(); 253 static CObject* True();
248 static CObject* False(); 254 static CObject* False();
249 static CObject* Bool(bool value); 255 static CObject* Bool(bool value);
250 static Dart_CObject* NewInt32(int32_t value); 256 static Dart_CObject* NewInt32(int32_t value);
251 static Dart_CObject* NewInt64(int64_t value); 257 static Dart_CObject* NewInt64(int64_t value);
252 static Dart_CObject* NewIntptr(intptr_t value); 258 static Dart_CObject* NewIntptr(intptr_t value);
253 // TODO(sgjesse): Add support for kBigint. 259 // TODO(sgjesse): Add support for kBigint.
254 static Dart_CObject* NewDouble(double value); 260 static Dart_CObject* NewDouble(double value);
255 static Dart_CObject* NewString(int length); 261 static Dart_CObject* NewString(int length);
256 static Dart_CObject* NewString(const char* str); 262 static Dart_CObject* NewString(const char* str);
Søren Gjesse 2013/05/14 13:50:36 I don't think this comment belongs here. It is spe
Bill Hesse 2013/05/14 16:33:58 Removed. But the RPC protocol is exactly the func
Søren Gjesse 2013/05/15 14:06:35 That's right, see comment above.
263 // A CObject array cannot be returned as the result, since errors are
264 // encoded as arrays starting with a nonzero first element. It must be
265 // wrapped in an array starting with kSuccess, and unwrapped by the receiver.
257 static Dart_CObject* NewArray(int length); 266 static Dart_CObject* NewArray(int length);
258 static Dart_CObject* NewUint8Array(int length); 267 static Dart_CObject* NewUint8Array(int length);
259 static Dart_CObject* NewExternalUint8Array( 268 static Dart_CObject* NewExternalUint8Array(
260 int64_t length, uint8_t* data, void* peer, 269 int64_t length, uint8_t* data, void* peer,
261 Dart_WeakPersistentHandleFinalizer callback); 270 Dart_WeakPersistentHandleFinalizer callback);
262 static Dart_CObject* NewIOBuffer(int64_t length); 271 static Dart_CObject* NewIOBuffer(int64_t length);
263 static void FreeIOBufferData(Dart_CObject* object); 272 static void FreeIOBufferData(Dart_CObject* object);
264 273
265 Dart_CObject* AsApiCObject() { return cobject_; } 274 Dart_CObject* AsApiCObject() { return cobject_; }
266 275
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 } 504 }
496 505
497 private: 506 private:
498 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array); 507 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array);
499 }; 508 };
500 509
501 } // namespace bin 510 } // namespace bin
502 } // namespace dart 511 } // namespace dart
503 512
504 #endif // BIN_DARTUTILS_H_ 513 #endif // BIN_DARTUTILS_H_
OLDNEW
« no previous file with comments | « runtime/bin/builtin_natives.cc ('k') | runtime/bin/dartutils.cc » ('j') | runtime/bin/file.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698