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

Unified Diff: runtime/bin/loader.cc

Issue 2558673002: Add Kernel Isolate (Closed)
Patch Set: wip Created 4 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/loader.cc
diff --git a/runtime/bin/loader.cc b/runtime/bin/loader.cc
index d0a95e259d1ba412f5711041a3326516b02ff475..70ee44471d6628f2a7a1892515fe274d6a771c2b 100644
--- a/runtime/bin/loader.cc
+++ b/runtime/bin/loader.cc
@@ -206,6 +206,24 @@ void Loader::SendRequest(Dart_LibraryTag tag,
}
+// Forward a request from the tag handler to the kernel isolate.
+// [ tag, send port, url ]
+void Loader::SendKernelRequest(Dart_LibraryTag tag, Dart_Handle url) {
+ // This port delivers loading messages to the Kernel isolate.
+ Dart_Port kernel_port = Dart_KernelPort();
+ ASSERT(kernel_port != ILLEGAL_PORT);
+
+ Dart_Handle request = Dart_NewList(3);
+ Dart_ListSetAt(request, 0, Dart_NewInteger(tag));
+ Dart_ListSetAt(request, 1, Dart_NewSendPort(port_));
+ Dart_ListSetAt(request, 2, url);
+ if (Dart_Post(kernel_port, request)) {
+ MonitorLocker ml(monitor_);
+ pending_operations_++;
+ }
+}
+
+
void Loader::QueueMessage(Dart_CObject* message) {
MonitorLocker ml(monitor_);
if (results_length_ == results_capacity_) {
@@ -625,12 +643,15 @@ Dart_Handle Loader::LibraryTagHandler(Dart_LibraryTag tag,
if (DartUtils::IsDartExtensionSchemeURL(url_string)) {
loader->SendImportExtensionRequest(url, Dart_LibraryUrl(library));
} else {
- loader->SendRequest(tag, url, (library != Dart_Null())
- ? Dart_LibraryUrl(library)
- : Dart_Null());
+ if (Dart_KernelIsolateIsRunning()) {
+ loader->SendKernelRequest(tag, url);
+ } else {
+ loader->SendRequest(tag, url, (library != Dart_Null())
+ ? Dart_LibraryUrl(library)
+ : Dart_Null());
+ }
}
-
if (blocking_call) {
// The outer invocation of the tag handler will block here until all nested
// invocations complete.
« no previous file with comments | « runtime/bin/loader.h ('k') | runtime/bin/main.cc » ('j') | runtime/tools/kernel-service.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698