Chromium Code Reviews| 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']; |