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

Unified Diff: samples/dartcombat/player.dart

Issue 10837070: Remove old isolate API and update all code in the repository to use (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 years, 5 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 | « samples/chat/chat_server_lib.dart ('k') | samples/dartcombat/setup.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/dartcombat/player.dart
diff --git a/samples/dartcombat/player.dart b/samples/dartcombat/player.dart
index 6649f55afa4f6e9588e3020a7512526a5c5caf7c..51d336d263d00e0d0828c6c6d4501ed9bea6f1e4 100644
--- a/samples/dartcombat/player.dart
+++ b/samples/dartcombat/player.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -33,26 +33,30 @@ interface Enemy default EnemyImpl {
* contains the actual player state.
*/
class PlayerImpl implements Player {
- final Future<SendPort> portToPlayer;
+ final SendPort portToPlayer;
- PlayerImpl() : portToPlayer = new PlayerState().spawn();
+ // TODO(ager): This will break with dart2js once spawnFunction runs
+ // isolates in web workers. The player isolates need access to the
+ // DOM and should be spawned with something like spawnFunctionInDOM
+ // that will run on the renderer thread.
+ PlayerImpl() : portToPlayer = spawnFunction(spawnPlayer);
void setup(Window window, int player) {
- portToPlayer.then((SendPort port) => port.call(
+ portToPlayer.call(
{ "action" : MessageIds.SETUP,
- "args" : [player] }));
+ "args" : [player] });
}
void set enemy(SendPort portToEnemy) {
- portToPlayer.then((port) => port.call(
+ portToPlayer.call(
{ "action" : MessageIds.SET_ENEMY,
- "args" : [portToEnemy]}));
+ "args" : [portToEnemy]});
}
void set _portForTest(SendPort testPort) {
- portToPlayer.then((port) => port.call(
+ portToPlayer.call(
{ "action" : MessageIds.SET_PORT_FOR_TEST,
- "args" : [testPort]}));
+ "args" : [testPort]});
}
}
« no previous file with comments | « samples/chat/chat_server_lib.dart ('k') | samples/dartcombat/setup.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698