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

Side by Side Diff: services/dart/test/echo/lib/main.dart

Issue 1545483003: Dart: Reorganize files (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix build file Created 5 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
« no previous file with comments | « services/dart/test/echo/BUILD.gn ('k') | services/dart/test/echo/pubspec.lock » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 import 'dart:async';
6
7 import 'package:mojo/application.dart';
8 import 'package:mojo/bindings.dart';
9 import 'package:mojo/core.dart';
10 import 'package:_mojo_for_test_only/test/echo_service.mojom.dart';
11
12 class EchoServiceImpl implements EchoService {
13 EchoServiceStub _stub;
14 Application _application;
15
16 EchoServiceImpl(this._application, MojoMessagePipeEndpoint endpoint) {
17 _stub = new EchoServiceStub.fromEndpoint(endpoint, this);
18 }
19
20 dynamic echoString(String value, [Function responseFactory]) {
21 if (value == "quit") {
22 _stub.close();
23 }
24 return responseFactory(value);
25 }
26
27 dynamic delayedEchoString(String value, int millis,
28 [Function responseFactory]) {
29 if (value == "quit") {
30 _stub.close();
31 }
32 return new Future.delayed(
33 new Duration(milliseconds: millis), () => responseFactory(value));
34 }
35 }
36
37 class EchoApplication extends Application {
38 EchoApplication.fromHandle(MojoHandle handle) : super.fromHandle(handle);
39
40 @override
41 void acceptConnection(String requestorUrl, String resolvedUrl,
42 ApplicationConnection connection) {
43 connection.provideService(
44 EchoService.serviceName, (endpoint) => new EchoServiceImpl(this, endpoin t));
45 }
46 }
47
48 main(List args) {
49 MojoHandle appHandle = new MojoHandle(args[0]);
50 String url = args[1];
51 new EchoApplication.fromHandle(appHandle)
52 ..onError = ((_) {
53 MojoHandle.reportLeakedHandles();
54 });
55 }
OLDNEW
« no previous file with comments | « services/dart/test/echo/BUILD.gn ('k') | services/dart/test/echo/pubspec.lock » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698