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

Side by Side Diff: tests/stub-generator/src/MintMakerFullyIsolatedTest-generatedTest.dart

Issue 8463005: Revert files accidentially changed (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month 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 | « no previous file | tests/stub-generator/src/MintMakerPromiseWithStubsTest-generatedTest.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // IsolateStubs=MintMakerFullyIsolatedTest.dart:Mint,Purse,PowerfulPurse 5 // IsolateStubs=MintMakerFullyIsolatedTest.dart:Mint,Purse,PowerfulPurse
6 6
7 #import("../../isolate/src/TestFramework.dart"); 7 #import("../../isolate/src/TestFramework.dart");
8 8
9 /* class = Purse (tests/stub-generator/src/MintMakerFullyIsolatedTest.dart/MintM akerFullyIsolatedTest.dart: 9) */ 9 /* class = Purse (tests/stub-generator/src/MintMakerFullyIsolatedTest.dart/MintM akerFullyIsolatedTest.dart: 9) */
10 10
11 interface Purse$Proxy { 11 interface Purse$Proxy extends Proxy {
12 Promise<int> queryBalance(); 12 Promise<int> queryBalance();
13 13
14 Purse$Proxy sproutPurse(); 14 Purse$Proxy sproutPurse();
15 15
16 Promise<int> deposit(int amount, Purse$Proxy source); 16 Promise<int> deposit(int amount, Purse$Proxy source);
17 } 17 }
18 18
19 class Purse$ProxyImpl extends Proxy implements Purse$Proxy { 19 class Purse$ProxyImpl extends ProxyImpl implements Purse$Proxy {
20 Purse$ProxyImpl(Promise<SendPort> port) : super.forReply(port) { } 20 Purse$ProxyImpl(Promise<SendPort> port) : super.forReply(port) { }
21 Purse$ProxyImpl.forIsolate(Proxy isolate) : super.forReply(isolate.call([null] )) { } 21 Purse$ProxyImpl.forIsolate(Proxy isolate) : super.forReply(isolate.call([null] )) { }
22 factory Purse$ProxyImpl.createIsolate() { 22 factory Purse$ProxyImpl.createIsolate() {
23 Proxy isolate = new Proxy.forIsolate(new Purse$Dispatcher$Isolate()); 23 Proxy isolate = new Proxy.forIsolate(new Purse$Dispatcher$Isolate());
24 return new Purse$ProxyImpl.forIsolate(isolate); 24 return new Purse$ProxyImpl.forIsolate(isolate);
25 } 25 }
26 factory Purse$ProxyImpl.localProxy(Purse obj) { 26 factory Purse$ProxyImpl.localProxy(Purse obj) {
27 return new Purse$ProxyImpl(new Promise<SendPort>.fromValue(Dispatcher.serve( new Purse$Dispatcher(obj)))); 27 return new Purse$ProxyImpl(new Promise<SendPort>.fromValue(Dispatcher.serve( new Purse$Dispatcher(obj))));
28 } 28 }
29 29
30 Promise<int> queryBalance() { 30 Promise<int> queryBalance() {
31 return this.call(["queryBalance"]); 31 return this.call(["queryBalance"]);
32 } 32 }
33 33
34 Purse$Proxy sproutPurse() { 34 Purse$Proxy sproutPurse() {
35 return new Purse$ProxyImpl(this.call(["sproutPurse"])); 35 return new Purse$ProxyImpl(new PromiseProxy<SendPort>(this.call(["sproutPurs e"])));
36 } 36 }
37 37
38 Promise<int> deposit(int amount, Purse$Proxy source) { 38 Promise<int> deposit(int amount, Purse$Proxy source) {
39 return this.call(["deposit", amount, source]); 39 return new PromiseProxy<int>(this.call(["deposit", amount, source]));
40 } 40 }
41 } 41 }
42 42
43 class Purse$Dispatcher extends Dispatcher<Purse> { 43 class Purse$Dispatcher extends Dispatcher<Purse> {
44 Purse$Dispatcher(Purse thing) : super(thing) { } 44 Purse$Dispatcher(Purse thing) : super(thing) { }
45 45
46 void process(var message, void reply(var response)) { 46 void process(var message, void reply(var response)) {
47 String command = message[0]; 47 String command = message[0];
48 if (command == "Purse") { 48 if (command == "Purse") {
49 } else if (command == "queryBalance") { 49 } else if (command == "queryBalance") {
50 int queryBalance = target.queryBalance(); 50 int queryBalance = target.queryBalance();
51 reply(queryBalance); 51 reply(queryBalance);
52 } else if (command == "sproutPurse") { 52 } else if (command == "sproutPurse") {
53 Purse$Proxy sproutPurse = target.sproutPurse(); 53 Purse$Proxy sproutPurse = target.sproutPurse();
54 reply(sproutPurse); 54 reply(sproutPurse);
55 } else if (command == "deposit") { 55 } else if (command == "deposit") {
56 int amount = message[1]; 56 int amount = message[1];
57 Purse$Proxy source = new Purse$ProxyImpl(new Promise<SendPort>.fromValue(m essage[2])); 57 List<Promise<SendPort>> promises = new List<Promise<SendPort>>();
58 promises.add(new PromiseProxy<SendPort>(new Promise<SendPort>.fromValue(me ssage[2])));
59 Purse$Proxy source = new Purse$ProxyImpl(promises[0]);
58 Promise<int> deposit = target.deposit(amount, source); 60 Promise<int> deposit = target.deposit(amount, source);
59 reply(deposit); 61 reply(deposit);
60 } else { 62 } else {
61 // TODO(kasperl,benl): Somehow throw an exception instead. 63 // TODO(kasperl,benl): Somehow throw an exception instead.
62 reply("Exception: command '" + command + "' not understood by Purse."); 64 reply("Exception: command '" + command + "' not understood by Purse.");
63 } 65 }
64 } 66 }
65 } 67 }
66 68
67 class Purse$Dispatcher$Isolate extends Isolate { 69 class Purse$Dispatcher$Isolate extends Isolate {
68 Purse$Dispatcher$Isolate() : super() { } 70 Purse$Dispatcher$Isolate() : super() { }
69 71
70 void main() { 72 void main() {
71 this.port.receive(void _(var message, SendPort replyTo) { 73 this.port.receive(void _(var message, SendPort replyTo) {
72 Purse thing = new Purse(); 74 Purse thing = new Purse();
73 SendPort port = Dispatcher.serve(new Purse$Dispatcher(thing)); 75 SendPort port = Dispatcher.serve(new Purse$Dispatcher(thing));
74 Proxy proxy = new Proxy.forPort(replyTo); 76 Proxy proxy = new Proxy.forPort(replyTo);
75 proxy.send([port]); 77 proxy.send([port]);
76 }); 78 });
77 } 79 }
78 } 80 }
79 81
80 /* class = PowerfulPurse (tests/stub-generator/src/MintMakerFullyIsolatedTest.da rt/MintMakerFullyIsolatedTest.dart: 18) */ 82 /* class = PowerfulPurse (tests/stub-generator/src/MintMakerFullyIsolatedTest.da rt/MintMakerFullyIsolatedTest.dart: 18) */
81 83
82 interface PowerfulPurse$Proxy { 84 interface PowerfulPurse$Proxy extends Proxy {
83 void init(Mint$Proxy mint, int balance); 85 void init(Mint$Proxy mint, int balance);
84 86
85 Promise<int> grab(int amount); 87 Promise<int> grab(int amount);
86 88
87 Purse$Proxy weak(); 89 Purse$Proxy weak();
88 } 90 }
89 91
90 class PowerfulPurse$ProxyImpl extends Proxy implements PowerfulPurse$Proxy { 92 class PowerfulPurse$ProxyImpl extends ProxyImpl implements PowerfulPurse$Proxy {
91 PowerfulPurse$ProxyImpl(Promise<SendPort> port) : super.forReply(port) { } 93 PowerfulPurse$ProxyImpl(Promise<SendPort> port) : super.forReply(port) { }
92 PowerfulPurse$ProxyImpl.forIsolate(Proxy isolate) : super.forReply(isolate.cal l([null])) { } 94 PowerfulPurse$ProxyImpl.forIsolate(Proxy isolate) : super.forReply(isolate.cal l([null])) { }
93 factory PowerfulPurse$ProxyImpl.createIsolate() { 95 factory PowerfulPurse$ProxyImpl.createIsolate() {
94 Proxy isolate = new Proxy.forIsolate(new PowerfulPurse$Dispatcher$Isolate()) ; 96 Proxy isolate = new Proxy.forIsolate(new PowerfulPurse$Dispatcher$Isolate()) ;
95 return new PowerfulPurse$ProxyImpl.forIsolate(isolate); 97 return new PowerfulPurse$ProxyImpl.forIsolate(isolate);
96 } 98 }
97 factory PowerfulPurse$ProxyImpl.localProxy(PowerfulPurse obj) { 99 factory PowerfulPurse$ProxyImpl.localProxy(PowerfulPurse obj) {
98 return new PowerfulPurse$ProxyImpl(new Promise<SendPort>.fromValue(Dispatche r.serve(new PowerfulPurse$Dispatcher(obj)))); 100 return new PowerfulPurse$ProxyImpl(new Promise<SendPort>.fromValue(Dispatche r.serve(new PowerfulPurse$Dispatcher(obj))));
99 } 101 }
100 102
(...skipping 10 matching lines...) Expand all
111 } 113 }
112 } 114 }
113 115
114 class PowerfulPurse$Dispatcher extends Dispatcher<PowerfulPurse> { 116 class PowerfulPurse$Dispatcher extends Dispatcher<PowerfulPurse> {
115 PowerfulPurse$Dispatcher(PowerfulPurse thing) : super(thing) { } 117 PowerfulPurse$Dispatcher(PowerfulPurse thing) : super(thing) { }
116 118
117 void process(var message, void reply(var response)) { 119 void process(var message, void reply(var response)) {
118 String command = message[0]; 120 String command = message[0];
119 if (command == "PowerfulPurse") { 121 if (command == "PowerfulPurse") {
120 } else if (command == "init") { 122 } else if (command == "init") {
121 Mint$Proxy mint = new Mint$ProxyImpl(new Promise<SendPort>.fromValue(messa ge[1])); 123 List<Promise<SendPort>> promises = new List<Promise<SendPort>>();
124 promises.add(new PromiseProxy<SendPort>(new Promise<SendPort>.fromValue(me ssage[1])));
122 int balance = message[2]; 125 int balance = message[2];
126 Mint$Proxy mint = new Mint$ProxyImpl(promises[0]);
123 target.init(mint, balance); 127 target.init(mint, balance);
124 } else if (command == "grab") { 128 } else if (command == "grab") {
125 int amount = message[1]; 129 int amount = message[1];
126 int grab = target.grab(amount); 130 int grab = target.grab(amount);
127 reply(grab); 131 reply(grab);
128 } else if (command == "weak") { 132 } else if (command == "weak") {
129 Purse weak = target.weak(); 133 Purse weak = target.weak();
130 SendPort port = Dispatcher.serve(new Purse$Dispatcher(weak)); 134 SendPort port = Dispatcher.serve(new Purse$Dispatcher(weak));
131 reply(port); 135 reply(port);
132 } else { 136 } else {
(...skipping 11 matching lines...) Expand all
144 PowerfulPurse thing = new PowerfulPurse(); 148 PowerfulPurse thing = new PowerfulPurse();
145 SendPort port = Dispatcher.serve(new PowerfulPurse$Dispatcher(thing)); 149 SendPort port = Dispatcher.serve(new PowerfulPurse$Dispatcher(thing));
146 Proxy proxy = new Proxy.forPort(replyTo); 150 Proxy proxy = new Proxy.forPort(replyTo);
147 proxy.send([port]); 151 proxy.send([port]);
148 }); 152 });
149 } 153 }
150 } 154 }
151 155
152 /* class = Mint (tests/stub-generator/src/MintMakerFullyIsolatedTest.dart/MintMa kerFullyIsolatedTest.dart: 28) */ 156 /* class = Mint (tests/stub-generator/src/MintMakerFullyIsolatedTest.dart/MintMa kerFullyIsolatedTest.dart: 28) */
153 157
154 interface Mint$Proxy { 158 interface Mint$Proxy extends Proxy {
155 Purse$Proxy createPurse(int balance); 159 Purse$Proxy createPurse(int balance);
156 160
157 Promise<PowerfulPurse$Proxy> promote(Purse$Proxy purse); 161 Promise<PowerfulPurse$Proxy> promote(Purse$Proxy purse);
158 } 162 }
159 163
160 class Mint$ProxyImpl extends Proxy implements Mint$Proxy { 164 class Mint$ProxyImpl extends ProxyImpl implements Mint$Proxy {
161 Mint$ProxyImpl(Promise<SendPort> port) : super.forReply(port) { } 165 Mint$ProxyImpl(Promise<SendPort> port) : super.forReply(port) { }
162 Mint$ProxyImpl.forIsolate(Proxy isolate) : super.forReply(isolate.call([null]) ) { } 166 Mint$ProxyImpl.forIsolate(Proxy isolate) : super.forReply(isolate.call([null]) ) { }
163 factory Mint$ProxyImpl.createIsolate() { 167 factory Mint$ProxyImpl.createIsolate() {
164 Proxy isolate = new Proxy.forIsolate(new Mint$Dispatcher$Isolate()); 168 Proxy isolate = new Proxy.forIsolate(new Mint$Dispatcher$Isolate());
165 return new Mint$ProxyImpl.forIsolate(isolate); 169 return new Mint$ProxyImpl.forIsolate(isolate);
166 } 170 }
167 factory Mint$ProxyImpl.localProxy(Mint obj) { 171 factory Mint$ProxyImpl.localProxy(Mint obj) {
168 return new Mint$ProxyImpl(new Promise<SendPort>.fromValue(Dispatcher.serve(n ew Mint$Dispatcher(obj)))); 172 return new Mint$ProxyImpl(new Promise<SendPort>.fromValue(Dispatcher.serve(n ew Mint$Dispatcher(obj))));
169 } 173 }
170 174
171 Purse$Proxy createPurse(int balance) { 175 Purse$Proxy createPurse(int balance) {
172 return new Purse$ProxyImpl(this.call(["createPurse", balance])); 176 return new Purse$ProxyImpl(new PromiseProxy<SendPort>(this.call(["createPurs e", balance])));
173 } 177 }
174 178
175 Promise<PowerfulPurse$Proxy> promote(Purse$Proxy purse) { 179 Promise<PowerfulPurse$Proxy> promote(Purse$Proxy purse) {
176 return this.call(["promote", purse]); 180 return new Promise<PowerfulPurse$Proxy>.fromValue(new PowerfulPurse$ProxyImp l(new PromiseProxy<SendPort>(new PromiseProxy<SendPort>(this.call(["promote", pu rse])))));
177 } 181 }
178 } 182 }
179 183
180 class Mint$Dispatcher extends Dispatcher<Mint> { 184 class Mint$Dispatcher extends Dispatcher<Mint> {
181 Mint$Dispatcher(Mint thing) : super(thing) { } 185 Mint$Dispatcher(Mint thing) : super(thing) { }
182 186
183 void process(var message, void reply(var response)) { 187 void process(var message, void reply(var response)) {
184 String command = message[0]; 188 String command = message[0];
185 if (command == "Mint") { 189 if (command == "Mint") {
186 } else if (command == "createPurse") { 190 } else if (command == "createPurse") {
187 int balance = message[1]; 191 int balance = message[1];
188 Purse$Proxy createPurse = target.createPurse(balance); 192 Purse$Proxy createPurse = target.createPurse(balance);
189 reply(createPurse); 193 reply(createPurse);
190 } else if (command == "promote") { 194 } else if (command == "promote") {
191 Purse$Proxy purse = new Purse$ProxyImpl(new Promise<SendPort>.fromValue(me ssage[1])); 195 List<Promise<SendPort>> promises = new List<Promise<SendPort>>();
196 promises.add(new PromiseProxy<SendPort>(new Promise<SendPort>.fromValue(me ssage[1])));
197 Purse$Proxy purse = new Purse$ProxyImpl(promises[0]);
192 Promise<PowerfulPurse$Proxy> promote = target.promote(purse); 198 Promise<PowerfulPurse$Proxy> promote = target.promote(purse);
193 reply(promote); 199 reply(promote);
194 } else { 200 } else {
195 // TODO(kasperl,benl): Somehow throw an exception instead. 201 // TODO(kasperl,benl): Somehow throw an exception instead.
196 reply("Exception: command '" + command + "' not understood by Mint."); 202 reply("Exception: command '" + command + "' not understood by Mint.");
197 } 203 }
198 } 204 }
199 } 205 }
200 206
201 class Mint$Dispatcher$Isolate extends Isolate { 207 class Mint$Dispatcher$Isolate extends Isolate {
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 expect.succeeded(); 499 expect.succeeded();
494 print("##DONE##"); 500 print("##DONE##");
495 }); 501 });
496 } 502 }
497 503
498 } 504 }
499 505
500 main() { 506 main() {
501 runTests([MintMakerFullyIsolatedTest.testMain]); 507 runTests([MintMakerFullyIsolatedTest.testMain]);
502 } 508 }
OLDNEW
« no previous file with comments | « no previous file | tests/stub-generator/src/MintMakerPromiseWithStubsTest-generatedTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698