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

Side by Side Diff: samples/dartcombat/setup.dart

Issue 10919146: Get rid of a lot of () for getters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samples/dartcombat/grids.dart ('k') | samples/leap/leap_leg.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** Entrypoint to set up the dartcombat sample. */ 5 /** Entrypoint to set up the dartcombat sample. */
6 void setUpGame() { 6 void setUpGame() {
7 setupUI(); 7 setupUI();
8 createPlayers(); 8 createPlayers();
9 } 9 }
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 /** 66 /**
67 * A proxy between ports that randomly drops messages to simulate isolates 67 * A proxy between ports that randomly drops messages to simulate isolates
68 * across the network. 68 * across the network.
69 */ 69 */
70 class FlakyProxy { 70 class FlakyProxy {
71 ReceivePort proxy; 71 ReceivePort proxy;
72 72
73 SendPort _target; 73 SendPort _target;
74 74
75 SendPort get sendPort() => proxy.toSendPort(); 75 SendPort get sendPort => proxy.toSendPort();
76 76
77 FlakyProxy(this._target) { 77 FlakyProxy(this._target) {
78 proxy = new ReceivePort(); 78 proxy = new ReceivePort();
79 79
80 proxy.receive((message, SendPort reply) { 80 proxy.receive((message, SendPort reply) {
81 window.setTimeout(() { 81 window.setTimeout(() {
82 if (randomlyFail()) { 82 if (randomlyFail()) {
83 reply.send(const [false, "There was an error"], null); 83 reply.send(const [false, "There was an error"], null);
84 } else { 84 } else {
85 _target.send(message, reply); 85 _target.send(message, reply);
86 } 86 }
87 }, 200); 87 }, 200);
88 }); 88 });
89 } 89 }
90 90
91 // TODO(sigmund): introduce UI to control flakiness, then do: 91 // TODO(sigmund): introduce UI to control flakiness, then do:
92 // => Math.random() > 0.9; 92 // => Math.random() > 0.9;
93 bool randomlyFail() => false; 93 bool randomlyFail() => false;
94 } 94 }
OLDNEW
« no previous file with comments | « samples/dartcombat/grids.dart ('k') | samples/leap/leap_leg.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698