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

Side by Side Diff: examples/dart/hello_world/hello/main.dart

Issue 1027603002: Dart: Removes all but native calls and the handle watcher from the snapshot. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Hoist application interface dependence Created 5 years, 9 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 | « examples/dart/hello_world/hello/BUILD.gn ('k') | examples/dart/hello_world/world/BUILD.gn » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // To run this app: 5 // To run this app:
6 // mojo_shell mojo:hello 6 // mojo_shell mojo:hello
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:mojo.application'; 9
10 import 'dart:mojo.bindings'; 10 import 'package:mojo/public/dart/application.dart';
11 import 'dart:mojo.core'; 11 import 'package:mojo/public/dart/bindings.dart';
12 import 'package:mojo/public/dart/core.dart';
12 13
13 class Hello extends Application { 14 class Hello extends Application {
14 Hello.fromHandle(MojoHandle handle) : super.fromHandle(handle); 15 Hello.fromHandle(MojoHandle handle) : super.fromHandle(handle);
15 16
16 void initialize(List<String> args, String url) { 17 void initialize(List<String> args, String url) {
17 print("$url Hello"); 18 print("$url Hello");
18 19
19 // We expect to find the world mojo application at the same 20 // We expect to find the world mojo application at the same
20 // path as this application. 21 // path as this application.
21 var c = connectToApplication(url.replaceAll("hello", "world")); 22 var c = connectToApplication(url.replaceAll("hello", "world"));
22 23
23 // A call to close() here would cause this app to go down before the "world" 24 // A call to close() here would cause this app to go down before the "world"
24 // app has a chance to come up. Instead, we wait to close this app until 25 // app has a chance to come up. Instead, we wait to close this app until
25 // the "world" app comes up, does its print, and closes its end of the 26 // the "world" app comes up, does its print, and closes its end of the
26 // connection. 27 // connection.
27 c.onError = closeApplication; 28 c.onError = closeApplication;
28 } 29 }
29 30
30 Future closeApplication() async { 31 Future closeApplication() async {
31 await close(); 32 await close();
32 assert(MojoHandle.reportLeakedHandles()); 33 assert(MojoHandle.reportLeakedHandles());
33 } 34 }
34 } 35 }
35 36
36 main(List args) { 37 main(List args) {
37 MojoHandle appHandle = new MojoHandle(args[0]); 38 MojoHandle appHandle = new MojoHandle(args[0]);
38 new Hello.fromHandle(appHandle); 39 new Hello.fromHandle(appHandle);
39 } 40 }
OLDNEW
« no previous file with comments | « examples/dart/hello_world/hello/BUILD.gn ('k') | examples/dart/hello_world/world/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698