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

Unified Diff: benchmarks/mojo_rtt_benchmark/lib/main.dart

Issue 2006093002: Dart: Futures -> Callbacks. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 4 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 | « benchmarks/mojo_rtt_benchmark/lib/echo_server.dart ('k') | examples/dart/device_info/lib/main.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: benchmarks/mojo_rtt_benchmark/lib/main.dart
diff --git a/benchmarks/mojo_rtt_benchmark/lib/main.dart b/benchmarks/mojo_rtt_benchmark/lib/main.dart
index 8d1f1e00116dc444639f97ccfaa4c1bdc7a814d6..03114011459cca2b1b75ce8bea492b7b58c0e734 100644
--- a/benchmarks/mojo_rtt_benchmark/lib/main.dart
+++ b/benchmarks/mojo_rtt_benchmark/lib/main.dart
@@ -69,18 +69,18 @@ class EchoTracingApp extends Application {
}
if (_doEcho) {
if (_warmup) {
- _echo(idx, "ping").then((r) {
+ _echo(idx, "ping", (String r) {
new Timer(kDelay, () => _run(idx + 1));
});
} else {
- _tracedEcho(idx, "ping").then((r) {
+ _tracedEcho(idx, "ping", (String r) {
new Timer(kDelay, () => _run(idx + 1));
});
}
}
}
- Future _tracedEcho(int idx, String s) {
+ void _tracedEcho(int idx, String s, void callback(String r)) {
// This is not the correct way to use the Timeline API. In particular,
// the start and end events below could occur on different threads.
// This could mess up the interpretation of the trace by about:tracing.
@@ -89,14 +89,14 @@ class EchoTracingApp extends Application {
// Using the sync API means that we only record one event after the finish
// time has been recorded.
Timeline.startSync("ping");
- return _echo(idx, s).then((r) {
+ _echo(idx, s, (String r) {
Timeline.finishSync();
- return r;
+ callback(r);
});
}
- Future _echo(int idx, String s) {
- return _echoProxies[idx].echoString(s);
+ void _echo(int idx, String s, void callback(String r)) {
+ _echoProxies[idx].echoString(s, callback);
}
_errorHandler(Object e) {
« no previous file with comments | « benchmarks/mojo_rtt_benchmark/lib/echo_server.dart ('k') | examples/dart/device_info/lib/main.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698