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

Side by Side Diff: runtime/lib/async_patch.dart

Issue 1274133002: Don't zone-register async callbacks for every await call in the VM. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | runtime/vm/ast_transformer.cc » ('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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 import "dart:_internal"; 5 import "dart:_internal";
6 6
7 // We need to pass the value as first argument and leave the second and third
8 // arguments empty (used for error handling).
9 // See vm/ast_transformer.cc for usage.
10 Function _asyncThenWrapperHelper(continuation) {
11 return Zone.current.registerUnaryCallback((x) => continuation(x, null, null));
12 }
13
14 // We need to pass the exception and stack trace objects as second and third
15 // parameter to the continuation. See vm/ast_transformer.cc for usage.
16 Function _asyncErrorWrapperHelper(continuation) {
17 return Zone.current.registerBinaryCallback(
18 (e, s) => continuation(null, e, s));
19 }
20
21 Future _awaitHelper(
22 var future, Function thenCallback, Function errorCallback) {
Lasse Reichstein Nielsen 2015/08/06 14:19:58 remove the "var", rename "future" to "result" (it
floitsch 2015/08/11 15:27:50 changed to 'expression'. "Result" would be the res
floitsch 2015/08/11 15:28:37 Actually changed to "object".
23 if (future is! Future) {
24 future = new Future.value(future);
25 }
Lasse Reichstein Nielsen 2015/08/06 14:19:58 if (result is! Future) { result = new _Future(
floitsch 2015/08/11 15:27:50 Done.
26 if (future is _Future) {
27 return future._thenNoZoneRegistration(thenCallback, errorCallback);
28 } else {
29 return future.then(thenCallback, onError: errorCallback);
30 }
31 }
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/ast_transformer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698