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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 302143004: - Add Dart_EmptyString to return the canonical empty string similar to how (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_api_impl.h ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
===================================================================
--- runtime/vm/dart_api_impl.cc (revision 36820)
+++ runtime/vm/dart_api_impl.cc (working copy)
@@ -51,6 +51,7 @@
Dart_Handle Api::true_handle_ = NULL;
Dart_Handle Api::false_handle_ = NULL;
Dart_Handle Api::null_handle_ = NULL;
+Dart_Handle Api::empty_string_handle_ = NULL;
const char* CanonicalFunction(const char* func) {
@@ -372,21 +373,6 @@
}
-Dart_Handle Api::Null() {
- return null_handle_;
-}
-
-
-Dart_Handle Api::True() {
- return true_handle_;
-}
-
-
-Dart_Handle Api::False() {
- return false_handle_;
-}
-
-
ApiLocalScope* Api::TopScope(Isolate* isolate) {
ASSERT(isolate != NULL);
ApiState* state = isolate->api_state();
@@ -418,6 +404,9 @@
ASSERT(null_handle_ == NULL);
null_handle_ = Api::InitNewHandle(isolate, Object::null());
+
+ ASSERT(empty_string_handle_ == NULL);
+ empty_string_handle_ = Api::InitNewHandle(isolate, Symbols::Empty().raw());
}
@@ -1673,12 +1662,17 @@
// --- Objects ----
DART_EXPORT Dart_Handle Dart_Null() {
- Isolate* isolate = Isolate::Current();
- CHECK_ISOLATE(isolate);
+ ASSERT(Isolate::Current() != NULL);
return Api::Null();
}
+DART_EXPORT Dart_Handle Dart_EmptyString() {
+ ASSERT(Isolate::Current() != NULL);
+ return Api::EmptyString();
+}
+
+
DART_EXPORT bool Dart_IsNull(Dart_Handle object) {
return Api::UnwrapHandle(object) == Object::null();
}
@@ -2056,15 +2050,13 @@
// --- Booleans ----
DART_EXPORT Dart_Handle Dart_True() {
- Isolate* isolate = Isolate::Current();
- CHECK_ISOLATE(isolate);
+ ASSERT(Isolate::Current() != NULL);
return Api::True();
}
DART_EXPORT Dart_Handle Dart_False() {
- Isolate* isolate = Isolate::Current();
- CHECK_ISOLATE(isolate);
+ ASSERT(Isolate::Current() != NULL);
return Api::False();
}
« no previous file with comments | « runtime/vm/dart_api_impl.h ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698