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

Side by Side Diff: tools/dom/src/native_DOMPublic.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of html; 5 part of html;
6 6
7 _makeSendPortFuture(spawnRequest) {
8 final completer = new Completer<SendPort>.sync();
9 final port = new ReceivePort();
10 port.receive((result, _) {
11 completer.complete(result);
12 port.close();
13 });
14 // TODO: SendPort.hashCode is ugly way to access port id.
15 spawnRequest(port.toSendPort().hashCode);
16 return completer.future;
17 }
18
19 // This API is exploratory.
20 Future<SendPort> spawnDomFunction(Function f) =>
21 _makeSendPortFuture((portId) { _Utils.spawnDomFunction(f, portId); });
22
23 Future<SendPort> spawnDomUri(String uri) =>
24 _makeSendPortFuture((portId) { _Utils.spawnDomUri(uri, portId); });
25
26 // testRunner implementation. 7 // testRunner implementation.
27 // FIXME: provide a separate lib for testRunner. 8 // FIXME: provide a separate lib for testRunner.
28 9
29 var _testRunner; 10 var _testRunner;
30 11
31 TestRunner get testRunner { 12 TestRunner get testRunner {
32 if (_testRunner == null) 13 if (_testRunner == null)
33 _testRunner = new TestRunner._(_NPObject.retrieve("testRunner")); 14 _testRunner = new TestRunner._(_NPObject.retrieve("testRunner"));
34 return _testRunner; 15 return _testRunner;
35 } 16 }
36 17
37 class TestRunner { 18 class TestRunner {
38 final _NPObject _npObject; 19 final _NPObject _npObject;
39 20
40 TestRunner._(this._npObject); 21 TestRunner._(this._npObject);
41 22
42 display() => _npObject.invoke('display'); 23 display() => _npObject.invoke('display');
43 dumpAsText() => _npObject.invoke('dumpAsText'); 24 dumpAsText() => _npObject.invoke('dumpAsText');
44 notifyDone() => _npObject.invoke('notifyDone'); 25 notifyDone() => _npObject.invoke('notifyDone');
45 setCanOpenWindows() => _npObject.invoke('setCanOpenWindows'); 26 setCanOpenWindows() => _npObject.invoke('setCanOpenWindows');
46 waitUntilDone() => _npObject.invoke('waitUntilDone'); 27 waitUntilDone() => _npObject.invoke('waitUntilDone');
47 } 28 }
OLDNEW
« no previous file with comments | « tools/dom/src/native_DOMImplementation.dart ('k') | tools/dom/templates/html/dart2js/html_dart2js.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698