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

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: Fix namespace comment. 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
Index: samples/dartcombat/state.dart
diff --git a/samples/dartcombat/state.dart b/samples/dartcombat/state.dart
index c215cc0117fbbf2550c7d47ef1e2155bc20fab2d..d77bc1760f38e1f989a905a8d8e7736177c56670 100644
--- a/samples/dartcombat/state.dart
+++ b/samples/dartcombat/state.dart
@@ -1,7 +1,14 @@
-// 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((message, SendPort replyTo) {
kasperl 2012/08/03 05:20:27 port.receive(state.dispatch)?
+ state.dispatch(message, replyTo);
+ });
+}
+
/**
* 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 +16,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 +54,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'];

Powered by Google App Engine
This is Rietveld 408576698