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

Unified Diff: runtime/lib/isolate.cc

Issue 545483002: Per isolate package root. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed test. Created 6 years, 3 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/include/dart_api.h ('k') | runtime/lib/isolate_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/isolate.cc
diff --git a/runtime/lib/isolate.cc b/runtime/lib/isolate.cc
index f85726d1e02dc35b5a5fa8ee767d2f3ecb48bc7a..82a0fc183b7c452bf0c8531bc913c5cd77a96323 100644
--- a/runtime/lib/isolate.cc
+++ b/runtime/lib/isolate.cc
@@ -18,6 +18,7 @@
#include "vm/resolver.h"
#include "vm/snapshot.h"
#include "vm/symbols.h"
+#include "vm/unicode.h"
namespace dart {
@@ -153,6 +154,7 @@ static bool CreateIsolate(Isolate* parent_isolate,
Isolate* child_isolate = reinterpret_cast<Isolate*>(
(callback)(state->script_url(),
state->function_name(),
+ state->package_root(),
init_data,
error));
if (child_isolate == NULL) {
@@ -216,11 +218,12 @@ DEFINE_NATIVE_ENTRY(Isolate_spawnFunction, 3) {
}
-DEFINE_NATIVE_ENTRY(Isolate_spawnUri, 4) {
+DEFINE_NATIVE_ENTRY(Isolate_spawnUri, 5) {
GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0));
GET_NON_NULL_NATIVE_ARGUMENT(String, uri, arguments->NativeArgAt(1));
GET_NON_NULL_NATIVE_ARGUMENT(Instance, args, arguments->NativeArgAt(2));
GET_NON_NULL_NATIVE_ARGUMENT(Instance, message, arguments->NativeArgAt(3));
+ GET_NATIVE_ARGUMENT(String, package_root, arguments->NativeArgAt(4));
// Canonicalize the uri with respect to the current isolate.
char* error = NULL;
@@ -233,8 +236,17 @@ DEFINE_NATIVE_ENTRY(Isolate_spawnUri, 4) {
ThrowIsolateSpawnException(msg);
}
- return Spawn(isolate, new IsolateSpawnState(port.Id(), canonical_uri,
- args, message));
+ char* utf8_package_root = NULL;
+ if (!package_root.IsNull()) {
+ const intptr_t len = Utf8::Length(package_root);
+ Zone* zone = isolate->current_zone();
+ utf8_package_root = zone->Alloc<char>(len + 1);
+ package_root.ToUTF8(reinterpret_cast<uint8_t*>(utf8_package_root), len);
+ utf8_package_root[len] = '\0';
+ }
+
+ return Spawn(isolate, new IsolateSpawnState(
+ port.Id(), canonical_uri, utf8_package_root, args, message));
}
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/lib/isolate_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698