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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 10416050: Remove the partially completed code for remote IsolateMirrors and (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
Index: runtime/vm/dart_api_impl.cc
===================================================================
--- runtime/vm/dart_api_impl.cc (revision 7926)
+++ runtime/vm/dart_api_impl.cc (working copy)
@@ -699,6 +699,14 @@
}
+DART_EXPORT Dart_Handle Dart_DebugName() {
+ Isolate* isolate = Isolate::Current();
+ CHECK_ISOLATE(isolate);
+ return Api::NewHandle(isolate, String::New(isolate->name()));
+}
+
+
+
DART_EXPORT void Dart_EnterIsolate(Dart_Isolate dart_isolate) {
CHECK_NO_ISOLATE(Isolate::Current());
Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate);
@@ -2458,6 +2466,10 @@
const Array& kNoArgNames = Array::Handle(isolate);
const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(target));
+ if (obj.IsError()) {
+ return target;
+ }
+
if (obj.IsNull() || obj.IsInstance()) {
Instance& instance = Instance::Handle(isolate);
instance ^= obj.raw();
@@ -2856,20 +2868,35 @@
}
+DART_EXPORT Dart_Handle Dart_GetNativeInstanceFieldCount(Dart_Handle obj,
+ int* count) {
+ Isolate* isolate = Isolate::Current();
+ DARTSCOPE(isolate);
+ const Instance& instance = Api::UnwrapInstanceHandle(isolate, obj);
+ if (instance.IsNull()) {
+ RETURN_TYPE_ERROR(isolate, obj, Instance);
+ }
+ const Class& cls = Class::Handle(isolate, instance.clazz());
+ *count = cls.num_native_fields();
+ return Api::Success(isolate);
+}
+
+
DART_EXPORT Dart_Handle Dart_GetNativeInstanceField(Dart_Handle obj,
int index,
intptr_t* value) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
- const Instance& object = Api::UnwrapInstanceHandle(isolate, obj);
- if (object.IsNull()) {
+ const Instance& instance = Api::UnwrapInstanceHandle(isolate, obj);
+ if (instance.IsNull()) {
RETURN_TYPE_ERROR(isolate, obj, Instance);
}
- if (!object.IsValidNativeIndex(index)) {
+ if (!instance.IsValidNativeIndex(index)) {
return Api::NewError(
- "Invalid index passed in to access native instance field");
+ "%s: invalid index %d passed in to access native instance field",
+ CURRENT_FUNC, index);
}
- *value = object.GetNativeField(index);
+ *value = instance.GetNativeField(index);
return Api::Success(isolate);
}
@@ -2879,15 +2906,16 @@
intptr_t value) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
- const Instance& object = Api::UnwrapInstanceHandle(isolate, obj);
- if (object.IsNull()) {
+ const Instance& instance = Api::UnwrapInstanceHandle(isolate, obj);
+ if (instance.IsNull()) {
RETURN_TYPE_ERROR(isolate, obj, Instance);
}
- if (!object.IsValidNativeIndex(index)) {
+ if (!instance.IsValidNativeIndex(index)) {
return Api::NewError(
- "Invalid index passed in to set native instance field");
+ "%s: invalid index %d passed in to set native instance field",
+ CURRENT_FUNC, index);
}
- object.SetNativeField(index, value);
+ instance.SetNativeField(index, value);
return Api::Success(isolate);
}
@@ -3102,6 +3130,24 @@
}
+DART_EXPORT Dart_Handle Dart_RegisteredLibraryUrls() {
+ Isolate* isolate = Isolate::Current();
+ DARTSCOPE(isolate);
+ const GrowableObjectArray& lib_urls = GrowableObjectArray::Handle(
+ isolate, GrowableObjectArray::New());
+ const GrowableObjectArray& libs = GrowableObjectArray::Handle(
+ isolate, isolate->object_store()->libraries());
+ Library& lib = Library::Handle(isolate);
+ String& lib_url = String::Handle(isolate);
+ for (int i = 0; i < libs.Length(); i++) {
+ lib ^= libs.At(i);
+ lib_url = lib.url();
+ lib_urls.Add(lib_url);
+ }
+ return Api::NewHandle(isolate, lib_urls.raw());
+}
+
+
static void CompileAll(Isolate* isolate, Dart_Handle* result) {
ASSERT(isolate != NULL);
const Error& error = Error::Handle(isolate, Library::CompileAll());
@@ -3155,6 +3201,19 @@
}
+DART_EXPORT Dart_Handle Dart_LibraryName(Dart_Handle library) {
+ Isolate* isolate = Isolate::Current();
+ DARTSCOPE(isolate);
+ const Library& lib = Api::UnwrapLibraryHandle(isolate, library);
+ if (lib.IsNull()) {
+ RETURN_TYPE_ERROR(isolate, library, Library);
+ }
+ const String& name = String::Handle(isolate, lib.name());
+ ASSERT(!name.IsNull());
+ return Api::NewHandle(isolate, name.raw());
+}
+
+
DART_EXPORT Dart_Handle Dart_LibraryUrl(Dart_Handle library) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);

Powered by Google App Engine
This is Rietveld 408576698