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

Unified Diff: samples/dartcombat/state.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, 4 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/dartcombat/setup.dart ('k') | samples/tests/samples/chat/chat_server_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/dartcombat/state.dart
diff --git a/samples/dartcombat/state.dart b/samples/dartcombat/state.dart
index c215cc0117fbbf2550c7d47ef1e2155bc20fab2d..0d0186c8ce76c0fd3df551a1f4b430c3a3cd766c 100644
--- a/samples/dartcombat/state.dart
+++ b/samples/dartcombat/state.dart
@@ -1,7 +1,12 @@
-// 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.
+void spawnPlayer() {
+ PlayerState state = new PlayerState();
+ port.receive(state.dispatch);
+}
+
/**
* Stores the actual data on a player's boat grid, the UI representation for its
* grid and the status of each shot. Acts as a controller handling isolate
@@ -9,7 +14,7 @@
* events.
*/
// TODO(sigmund): move UI setup out of here, e.g. into a controller class.
-class PlayerState extends Isolate {
+class PlayerState {
/** internal id for this player. */
int _id;
@@ -47,15 +52,6 @@ class PlayerState extends Isolate {
/** Port used for testing purposes. */
SendPort _portForTest;
- // This can take no arguments for now (wait for isolate redesign).
- PlayerState() : super.light() {}
-
- void main() {
- this.port.receive((message, SendPort replyTo) {
- dispatch(message, replyTo);
- });
- }
-
/** dispatches all messages that are expected in this isolate. */
void dispatch(var message, SendPort replyTo) {
int action = message['action'];
« no previous file with comments | « samples/dartcombat/setup.dart ('k') | samples/tests/samples/chat/chat_server_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698