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

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

Issue 13144014: Implement spawnDomUri. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« no previous file with comments | « tools/dom/src/native_DOMImplementation.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/src/native_DOMPublic.dart
diff --git a/tools/dom/src/native_DOMPublic.dart b/tools/dom/src/native_DOMPublic.dart
index 5044945387b2bc1a40465d218c35733f44ec656a..4034d9165ebd438dde081c59beb1ab02a7f384de 100644
--- a/tools/dom/src/native_DOMPublic.dart
+++ b/tools/dom/src/native_DOMPublic.dart
@@ -4,8 +4,7 @@
part of html;
-// This API is exploratory.
-Future<SendPort> spawnDomFunction(Function topLevelFunction) {
+_makeSendPortFuture(spawnRequest) {
final completer = new Completer<SendPort>();
final port = new ReceivePort();
port.receive((result, _) {
@@ -13,10 +12,17 @@ Future<SendPort> spawnDomFunction(Function topLevelFunction) {
port.close();
});
// TODO: SendPort.hashCode is ugly way to access port id.
- _Utils.spawnDomFunction(topLevelFunction, port.toSendPort().hashCode);
+ spawnRequest(port.toSendPort().hashCode);
return completer.future;
}
+// This API is exploratory.
+Future<SendPort> spawnDomFunction(Function f) =>
+ _makeSendPortFuture((portId) { _Utils.spawnDomFunction(f, portId); });
+
+Future<SendPort> spawnDomUri(String uri) =>
+ _makeSendPortFuture((portId) { _Utils.spawnDomUri(uri, portId); });
+
// testRunner implementation.
// FIXME: provide a separate lib for testRunner.
« no previous file with comments | « tools/dom/src/native_DOMImplementation.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698