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

Unified Diff: vm/dart_api_impl.cc

Issue 9614006: - Proper URI resolution when loading scripts from the standalone binary. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 9 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
« bin/main.cc ('K') | « bin/main.cc ('k') | vm/object_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/dart_api_impl.cc
===================================================================
--- vm/dart_api_impl.cc (revision 5061)
+++ vm/dart_api_impl.cc (working copy)
@@ -2011,18 +2011,31 @@
Dart_Handle* arguments) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
- // Finalize all classes.
- const char* msg = CheckIsolateState(isolate);
- if (msg != NULL) {
- return Api::NewError(msg);
- }
-
- // Now try to resolve and invoke the static function.
+ // Check whether class finalization is needed.
+ bool finalize_classes = true;
const Library& library =
Library::CheckedHandle(Api::UnwrapHandle(library_in));
if (library.IsNull()) {
return Api::NewError("No library specified");
}
+
+ // When calling functions in the dart:builtin library do not finalize as it
+ // should have been prefinalized.
+ Library& builtin =
+ Library::Handle(isolate->object_store()->builtin_library());
+ if (builtin.raw() == library.raw()) {
+ finalize_classes = false;
+ }
+
+ // Finalize all classes if needed.
+ if (finalize_classes) {
+ const char* msg = CheckIsolateState(isolate);
+ if (msg != NULL) {
+ return Api::NewError(msg);
+ }
+ }
+
+ // Now try to resolve and invoke the static function.
const String& class_name =
String::CheckedHandle(Api::UnwrapHandle(class_name_in));
const String& function_name =
@@ -2649,6 +2662,14 @@
library.set_import_map(mapping_array);
}
library.Register();
+ // If this is the dart:builtin library register it with the VM.
+ if (url_str.Equals("dart:builtin")) {
+ isolate->object_store()->set_builtin_library(library);
+ const char* msg = CheckIsolateState(isolate);
+ if (msg != NULL) {
+ return Api::NewError(msg);
+ }
+ }
} else if (!library.LoadNotStarted()) {
// The source for this library has either been loaded or is in the
// process of loading. Return an error.
« bin/main.cc ('K') | « bin/main.cc ('k') | vm/object_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698