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

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

Issue 12212200: "Reverting 18531" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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/calculator/calculator.dart ('k') | samples/isolate_html/isolate_sample.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 part of dartcombatlib; 5 part of dartcombatlib;
6 6
7 /** Entrypoint to set up the dartcombat sample. */ 7 /** Entrypoint to set up the dartcombat sample. */
8 void setUpGame() { 8 void setUpGame() {
9 setupUI(); 9 setupUI();
10 createPlayers(); 10 createPlayers();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 ReceivePort proxy; 73 ReceivePort proxy;
74 74
75 SendPort _target; 75 SendPort _target;
76 76
77 SendPort get sendPort => proxy.toSendPort(); 77 SendPort get sendPort => proxy.toSendPort();
78 78
79 FlakyProxy(this._target) { 79 FlakyProxy(this._target) {
80 proxy = new ReceivePort(); 80 proxy = new ReceivePort();
81 81
82 proxy.receive((message, SendPort reply) { 82 proxy.receive((message, SendPort reply) {
83 new Timer(const Duration(milliseconds: 200), () { 83 window.setTimeout(() {
84 if (randomlyFail()) { 84 if (randomlyFail()) {
85 reply.send(const [false, "There was an error"], null); 85 reply.send(const [false, "There was an error"], null);
86 } else { 86 } else {
87 _target.send(message, reply); 87 _target.send(message, reply);
88 } 88 }
89 }); 89 }, 200);
90 }); 90 });
91 } 91 }
92 92
93 // TODO(sigmund): introduce UI to control flakiness, then do: 93 // TODO(sigmund): introduce UI to control flakiness, then do:
94 // => Math.random() > 0.9; 94 // => Math.random() > 0.9;
95 bool randomlyFail() => false; 95 bool randomlyFail() => false;
96 } 96 }
OLDNEW
« no previous file with comments | « samples/calculator/calculator.dart ('k') | samples/isolate_html/isolate_sample.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698