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

Side by Side Diff: corelib/src/implementation/promise_implementation.dart

Issue 8966029: Report errors and warnings for hiding elements, issue 572. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for comments Created 9 years 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 | « corelib/src/implementation/dual_pivot_quicksort.dart ('k') | no next file » | 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 // Dart core library. 5 // Dart core library.
6 6
7 class PromiseImpl<T> implements Promise<T> { 7 class PromiseImpl<T> implements Promise<T> {
8 8
9 // Enumeration of possible states: 9 // Enumeration of possible states:
10 static final int CREATED = 0; 10 static final int CREATED = 0;
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 314
315 Promise call(List message) { 315 Promise call(List message) {
316 return _marshal(message, (List marshalled) { 316 return _marshal(message, (List marshalled) {
317 // TODO(kasperl): For now, the [Promise.then] implementation allows 317 // TODO(kasperl): For now, the [Promise.then] implementation allows
318 // me to return a promise and it will do the promise chaining. 318 // me to return a promise and it will do the promise chaining.
319 final result = new Promise(); 319 final result = new Promise();
320 // The promise queue implementation guarantees that promise is 320 // The promise queue implementation guarantees that promise is
321 // resolved at this point. 321 // resolved at this point.
322 SendPortImpl outgoing = _promise.value; 322 SendPortImpl outgoing = _promise.value;
323 ReceivePort incoming = outgoing._callNow(marshalled); 323 ReceivePort incoming = outgoing._callNow(marshalled);
324 incoming.receive((List message, replyTo) { 324 incoming.receive((List receiveMessage, replyTo) {
325 result.complete(message[0]); 325 result.complete(receiveMessage[0]);
326 }); 326 });
327 return result; 327 return result;
328 }); 328 });
329 } 329 }
330 330
331 // Marshal the [message] and pass it to the [process] callback 331 // Marshal the [message] and pass it to the [process] callback
332 // function. Any promises are converted to a port which expects to 332 // function. Any promises are converted to a port which expects to
333 // receive a port from the other side down which the remote promise 333 // receive a port from the other side down which the remote promise
334 // can be completed by sending the promise's completion value. 334 // can be completed by sending the promise's completion value.
335 Promise _marshal(List message, process(List marshalled)) { 335 Promise _marshal(List message, process(List marshalled)) {
(...skipping 14 matching lines...) Expand all
350 // This port will receive a SendPort that can be used to 350 // This port will receive a SendPort that can be used to
351 // signal completion of this promise to the corresponding 351 // signal completion of this promise to the corresponding
352 // promise that the other end has created. 352 // promise that the other end has created.
353 ReceivePort receiveCompleter = new ReceivePort.singleShot(); 353 ReceivePort receiveCompleter = new ReceivePort.singleShot();
354 marshalled[i] = receiveCompleter.toSendPort(); 354 marshalled[i] = receiveCompleter.toSendPort();
355 Promise<SendPort> completer = new Promise<SendPort>(); 355 Promise<SendPort> completer = new Promise<SendPort>();
356 receiveCompleter.receive((var msg, SendPort replyPort) { 356 receiveCompleter.receive((var msg, SendPort replyPort) {
357 completer.complete(msg[0]); 357 completer.complete(msg[0]);
358 }); 358 });
359 entry.addCompleteHandler((value) { 359 entry.addCompleteHandler((value) {
360 completer.addCompleteHandler((SendPort port) { 360 completer.addCompleteHandler((SendPort completePort) {
361 _marshal([value], (List message) => port.send(message, null)); 361 _marshal([value], (List completeMessage) => completePort.send(comp leteMessage, null));
362 }); 362 });
363 }); 363 });
364 } else { 364 } else {
365 // FIXME(kasperl, benl): this should probably be a copy? 365 // FIXME(kasperl, benl): this should probably be a copy?
366 marshalled[i] = entry; 366 marshalled[i] = entry;
367 } 367 }
368 if (marshalled[i] is ReceivePort) { 368 if (marshalled[i] is ReceivePort) {
369 throw new Exception("Despite the documentation, you cannot send a Rece ivePort"); 369 throw new Exception("Despite the documentation, you cannot send a Rece ivePort");
370 } 370 }
371 } 371 }
372 return process(marshalled); 372 return process(marshalled);
373 }).flatten(); 373 }).flatten();
374 } 374 }
375 375
376 Promise<SendPort> _promise; 376 Promise<SendPort> _promise;
377 static Map<SendPort, Dispatcher> _dispatchers; 377 static Map<SendPort, Dispatcher> _dispatchers;
378 378
379 } 379 }
OLDNEW
« no previous file with comments | « corelib/src/implementation/dual_pivot_quicksort.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698