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

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

Issue 91293002: Propagate errors from DartUtils helper functions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated comments Created 7 years 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') | no next file with comments »
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 "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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 int count_; 71 int count_;
72 int max_count_; 72 int max_count_;
73 const char** arguments_; 73 const char** arguments_;
74 74
75 DISALLOW_COPY_AND_ASSIGN(CommandLineOptions); 75 DISALLOW_COPY_AND_ASSIGN(CommandLineOptions);
76 }; 76 };
77 77
78 78
79 class DartUtils { 79 class DartUtils {
80 public: 80 public:
81 // TODO(turnidge): Clean up the implementations of these so that 81 // Returns the integer value of a Dart object. If the object is not
82 // they allow for proper error propagation. 82 // an integer value an API error is propagated.
83
84 // Assumes that the value object is known to be an integer object
85 // that fits in a signed 64-bit integer.
86 static int64_t GetIntegerValue(Dart_Handle value_obj); 83 static int64_t GetIntegerValue(Dart_Handle value_obj);
87 // Assumes that the value object is known to be an intptr_t. This should 84 // Returns the intptr_t value of a Dart object. If the object is not
88 // only be known when the value has been put into Dart as a pointer encoded 85 // an integer value or the value is outside the intptr_t range an
89 // in a 64-bit integer. This is the case for file and directory operations. 86 // API error is propagated.
90 static intptr_t GetIntptrValue(Dart_Handle value_obj); 87 static intptr_t GetIntptrValue(Dart_Handle value_obj);
91 // Checks that the value object is an integer object that fits in a 88 // Checks that the value object is an integer object that fits in a
92 // signed 64-bit integer. If it is, the value is returned in the 89 // signed 64-bit integer. If it is, the value is returned in the
93 // value out parameter and true is returned. Otherwise, false is 90 // value out parameter and true is returned. Otherwise, false is
94 // returned. 91 // returned.
95 static bool GetInt64Value(Dart_Handle value_obj, int64_t* value); 92 static bool GetInt64Value(Dart_Handle value_obj, int64_t* value);
93 // Returns the string value of a Dart object. If the object is not
94 // a string value an API error is propagated.
96 static const char* GetStringValue(Dart_Handle str_obj); 95 static const char* GetStringValue(Dart_Handle str_obj);
96 // Returns the boolean value of a Dart object. If the object is not
97 // a boolean value an API error is propagated.
97 static bool GetBooleanValue(Dart_Handle bool_obj); 98 static bool GetBooleanValue(Dart_Handle bool_obj);
99
98 static void SetIntegerField(Dart_Handle handle, 100 static void SetIntegerField(Dart_Handle handle,
99 const char* name, 101 const char* name,
100 intptr_t val); 102 intptr_t val);
101 static intptr_t GetIntegerField(Dart_Handle handle, 103 static intptr_t GetIntegerField(Dart_Handle handle,
102 const char* name); 104 const char* name);
103 static void SetStringField(Dart_Handle handle, 105 static void SetStringField(Dart_Handle handle,
104 const char* name, 106 const char* name,
105 const char* val); 107 const char* val);
106 static bool IsDartSchemeURL(const char* url_name); 108 static bool IsDartSchemeURL(const char* url_name);
107 static bool IsDartExtensionSchemeURL(const char* url_name); 109 static bool IsDartExtensionSchemeURL(const char* url_name);
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 } 535 }
534 536
535 private: 537 private:
536 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array); 538 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array);
537 }; 539 };
538 540
539 } // namespace bin 541 } // namespace bin
540 } // namespace dart 542 } // namespace dart
541 543
542 #endif // BIN_DARTUTILS_H_ 544 #endif // BIN_DARTUTILS_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/dartutils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698