| OLD | NEW |
| 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 // This API is exploratory. | 5 // This API is exploratory. |
| 6 spawnDomIsolate(Window targetWindow, String entryPoint) { | 6 spawnDomFunction(Function topLevelFunction) { |
| 7 if (targetWindow is! _DOMWindowImpl && targetWindow is! _DOMWindowCrossFrameIm
pl) { | 7 return _Utils.spawnDomFunctionImpl(topLevelFunction); |
| 8 throw 'Bad window argument: $targetWindow'; | |
| 9 } | |
| 10 final result = new Completer<SendPort>(); | |
| 11 final port = _Utils.spawnDomIsolateImpl(targetWindow, entryPoint); | |
| 12 window.setTimeout(() { result.complete(port); }, 0); | |
| 13 return result.future; | |
| 14 } | 8 } |
| 15 | 9 |
| 16 // layoutTestController implementation. | 10 // layoutTestController implementation. |
| 17 // FIXME: provide a separate lib for layoutTestController. | 11 // FIXME: provide a separate lib for layoutTestController. |
| 18 | 12 |
| 19 var _layoutTestController; | 13 var _layoutTestController; |
| 20 | 14 |
| 21 LayoutTestController get layoutTestController() { | 15 LayoutTestController get layoutTestController() { |
| 22 if (_layoutTestController === null) | 16 if (_layoutTestController === null) |
| 23 _layoutTestController = new LayoutTestController._(_NPObject.retrieve("layou
tTestController")); | 17 _layoutTestController = new LayoutTestController._(_NPObject.retrieve("layou
tTestController")); |
| 24 return _layoutTestController; | 18 return _layoutTestController; |
| 25 } | 19 } |
| 26 | 20 |
| 27 class LayoutTestController { | 21 class LayoutTestController { |
| 28 final _NPObject _npObject; | 22 final _NPObject _npObject; |
| 29 | 23 |
| 30 LayoutTestController._(this._npObject); | 24 LayoutTestController._(this._npObject); |
| 31 | 25 |
| 32 display() => _npObject.invoke('display'); | 26 display() => _npObject.invoke('display'); |
| 33 dumpAsText() => _npObject.invoke('dumpAsText'); | 27 dumpAsText() => _npObject.invoke('dumpAsText'); |
| 34 notifyDone() => _npObject.invoke('notifyDone'); | 28 notifyDone() => _npObject.invoke('notifyDone'); |
| 35 setCanOpenWindows() => _npObject.invoke('setCanOpenWindows'); | 29 setCanOpenWindows() => _npObject.invoke('setCanOpenWindows'); |
| 36 waitUntilDone() => _npObject.invoke('waitUntilDone'); | 30 waitUntilDone() => _npObject.invoke('waitUntilDone'); |
| 37 } | 31 } |
| OLD | NEW |