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

Side by Side Diff: services/dart/test/pingpong_target/main.dart

Issue 996923003: Dart: Better handle leak checks. close() is async. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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
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 import 'dart:async'; 5 import 'dart:async';
6 import 'mojo:application'; 6 import 'mojo:application';
7 import 'mojo:bindings'; 7 import 'mojo:bindings';
8 import 'mojo:core'; 8 import 'mojo:core';
9 9
10 import 'package:services/dart/test/pingpong_service.mojom.dart'; 10 import 'package:services/dart/test/pingpong_service.mojom.dart';
(...skipping 14 matching lines...) Expand all
25 25
26 void ping(int pingValue) => _pingPongClient.ptr.pong(pingValue + 1); 26 void ping(int pingValue) => _pingPongClient.ptr.pong(pingValue + 1);
27 27
28 void quit() { 28 void quit() {
29 if (_pingPongClient != null) { 29 if (_pingPongClient != null) {
30 _pingPongClient.close(); 30 _pingPongClient.close();
31 _pingPongClient = null; 31 _pingPongClient = null;
32 } 32 }
33 _stub.close(); 33 _stub.close();
34 } 34 }
35
36 Future pingTargetUrl(String url, int count, [Function responseFactory]) {}
37
38 Future pingTargetService(ProxyBase proxyBase, int count,
39 [Function responseFactory]) {}
40
41 getPingPongService(PingPongServiceStub serviceStub) {}
35 } 42 }
36 43
37 class PingPongApplication extends Application { 44 class PingPongApplication extends Application {
38 PingPongApplication.fromHandle(MojoHandle handle) : super.fromHandle(handle); 45 PingPongApplication.fromHandle(MojoHandle handle) : super.fromHandle(handle);
39 46
40 @override 47 @override
41 void acceptConnection(String requestorUrl, String resolvedUrl, 48 void acceptConnection(String requestorUrl, String resolvedUrl,
42 ApplicationConnection connection) { 49 ApplicationConnection connection) {
43 connection.provideService(PingPongServiceName, 50 connection.provideService(PingPongServiceName,
44 (endpoint) => new PingPongServiceImpl(this, endpoint)); 51 (endpoint) => new PingPongServiceImpl(this, endpoint));
45 // Close the application when the first connection goes down. 52 // Close the application when the first connection goes down.
46 connection.onError = close; 53 connection.onError = closeApplication;
54 }
55
56 Future closeApplication() async {
57 await close();
58 assert(MojoHandle.reportLeakedHandles());
47 } 59 }
48 } 60 }
49 61
50 main(List args) { 62 main(List args) {
51 MojoHandle appHandle = new MojoHandle(args[0]); 63 MojoHandle appHandle = new MojoHandle(args[0]);
52 String url = args[1]; 64 String url = args[1];
53 new PingPongApplication.fromHandle(appHandle); 65 new PingPongApplication.fromHandle(appHandle);
54 } 66 }
OLDNEW
« mojo/public/tools/dart_analyze.py ('K') | « services/dart/test/pingpong/main.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698