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

Unified Diff: frog/await/samples/mintmaker/mintmaker.dart

Issue 10548047: Remove frog from the repository. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move test and update apidoc.gyp. Created 8 years, 6 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 | « frog/await/samples/dartcombat/views.dart ('k') | frog/await/transformation.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/await/samples/mintmaker/mintmaker.dart
diff --git a/frog/await/samples/mintmaker/mintmaker.dart b/frog/await/samples/mintmaker/mintmaker.dart
deleted file mode 100644
index 1938927470d4fb10aafa41d1f054e8aa35e397fc..0000000000000000000000000000000000000000
--- a/frog/await/samples/mintmaker/mintmaker.dart
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Copied from MintMakerRpcTest (under tests/isolate/src/).
-
-#library('mintmaker');
-
-class Mint {
- Mint();
- Purse createPurse(int initialBalance) {
- return new Purse(initialBalance);
- }
-}
-
-class Purse {
- int _balance;
-
- Purse(this._balance) {}
-
- int queryBalance() {
- return _balance;
- }
-
- int deposit(int amount, Purse source) {
- if (source._balance < amount) {
- throw "OverdraftException";
- }
- source._balance -= amount;
- _balance += amount;
- return _balance;
- }
-}
-
-
-class MintProxy extends RpcProxy {
- MintProxy(Future<SendPort> sendPort) : super(sendPort) { }
- Future<PurseProxy> createPurse(int initialBalance) {
- return sendCommand("createPurse", [initialBalance], (sendPort) {
- Completer<SendPort> completer = new Completer();
- completer.complete(sendPort);
- return new PurseProxy(completer.future);
- });
- }
- Future<String> close() {
- return sendCommand("close", null, null);
- }
-}
-
-class MintReceiver extends RpcReceiver<Mint> {
- MintReceiver(ReceivePort receivePort) : super(new Mint(), receivePort) {}
- Object receiveCommand(String command, List args) {
- switch(command) {
- case "createPurse":
- int balance = args[0];
- Purse purse = target.createPurse(balance);
- return new PurseReceiver(purse, new ReceivePort());
- case "close":
- RpcReceiver.closeAll();
- return "close command processed";
- default:
- throw "MintReceiver unrecognized command";
- }
- }
-}
-
-class PurseProxy extends RpcProxy {
- PurseProxy(Future<SendPort> sendPort) : super(sendPort) { }
- Future<int> queryBalance() {
- return sendCommand("queryBalance", null, null);
- }
- Future<int> deposit(int amount, PurseProxy from) {
- return sendCommand("deposit", [amount, from], null);
- }
-}
-
-class PurseReceiver extends RpcReceiver<Purse> {
-
- PurseReceiver(Purse purse, ReceivePort receivePort) : super(purse, receivePort) {}
-
- Object receiveCommand(String command, List args) {
- switch(command) {
- case "queryBalance":
- return target.queryBalance();
- case "deposit":
- int amount = args[0];
- Purse fromPurse = args[1];
- return target.deposit(amount, fromPurse);
- default:
- throw "PurseReceiver unrecognized command";
- }
- }
-}
-
-class MintIsolate extends Isolate {
- MintIsolate() : super.light() {}
-
- MintProxy open() {
- return new MintProxy(spawn());
- }
-
- void main() {
- ReceivePort receivePort = port;
- new MintReceiver(receivePort);
- }
-}
« no previous file with comments | « frog/await/samples/dartcombat/views.dart ('k') | frog/await/transformation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698