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

Unified Diff: tools/dom/src/native_DOMImplementation.dart

Issue 23868034: Remove spawnDomFunction from dart:html (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | « tests/html/js_interop_4_test.dart ('k') | tools/dom/src/native_DOMPublic.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/src/native_DOMImplementation.dart
diff --git a/tools/dom/src/native_DOMImplementation.dart b/tools/dom/src/native_DOMImplementation.dart
index 2a063c0f491e188066d7cad1a7b6f1d6f5388473..a7ec6464319816676a7bbf9c527eb05601af2f8b 100644
--- a/tools/dom/src/native_DOMImplementation.dart
+++ b/tools/dom/src/native_DOMImplementation.dart
@@ -94,7 +94,6 @@ class _Utils {
static window() native "Utils_window";
static forwardingPrint(String message) native "Utils_forwardingPrint";
static void spawnDomFunction(Function f, int replyTo) native "Utils_spawnDomFunction";
- static void spawnDomUri(String uri, int replyTo) native "Utils_spawnDomUri";
static int _getNewIsolateId() native "Utils_getNewIsolateId";
// The following methods were added for debugger integration to make working
@@ -366,8 +365,28 @@ class _DOMStringMap extends NativeFieldWrapperClass1 implements Map<String, Stri
bool get isNotEmpty => Maps.isNotEmpty(this);
}
+// TODO(vsm): Remove DOM isolate code. This is only used to support
+// printing and timers in background isolates. Background isolates
+// should just forward to the main DOM isolate instead of requiring a
+// special DOM isolate.
+
+_makeSendPortFuture(spawnRequest) {
+ final completer = new Completer<SendPort>.sync();
+ final port = new ReceivePort();
+ port.receive((result, _) {
+ completer.complete(result);
+ port.close();
+ });
+ // TODO: SendPort.hashCode is ugly way to access port id.
+ spawnRequest(port.toSendPort().hashCode);
+ return completer.future;
+}
+
+Future<SendPort> _spawnDomFunction(Function f) =>
+ _makeSendPortFuture((portId) { _Utils.spawnDomFunction(f, portId); });
+
final Future<SendPort> __HELPER_ISOLATE_PORT =
- spawnDomFunction(_helperIsolateMain);
+ _spawnDomFunction(_helperIsolateMain);
// Tricky part.
// Once __HELPER_ISOLATE_PORT gets resolved, it will still delay in .then
« no previous file with comments | « tests/html/js_interop_4_test.dart ('k') | tools/dom/src/native_DOMPublic.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698