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

Side by Side Diff: services/test_service/test_request_tracker_application.cc

Issue 1980763002: ApplicationConnection devolution, part 2.3. (Closed) Base URL: https://github.com/domokit/mojo.git@work794_app_conn_devo_2.2
Patch Set: Created 4 years, 7 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 2014 The Chromium Authors. All rights reserved. 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 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 #include "services/test_service/test_request_tracker_application.h" 5 #include "services/test_service/test_request_tracker_application.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "mojo/public/c/system/main.h" 9 #include "mojo/public/c/system/main.h"
10 #include "mojo/public/cpp/application/application_connection.h" 10 #include "mojo/public/cpp/application/application_connection.h"
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 void TestRequestTrackerApplication::Initialize(ApplicationImpl* app) { 24 void TestRequestTrackerApplication::Initialize(ApplicationImpl* app) {
25 app_impl_ = app; 25 app_impl_ = app;
26 } 26 }
27 27
28 bool TestRequestTrackerApplication::ConfigureIncomingConnection( 28 bool TestRequestTrackerApplication::ConfigureIncomingConnection(
29 ApplicationConnection* connection) { 29 ApplicationConnection* connection) {
30 // Every instance of the service and recorder shares the context. 30 // Every instance of the service and recorder shares the context.
31 // Note, this app is single-threaded, so this is thread safe. 31 // Note, this app is single-threaded, so this is thread safe.
32 connection->AddService<TestTimeService>(this); 32 connection->GetServiceProviderImpl().AddService<TestTimeService>(
33 connection->AddService<TestRequestTracker>(this); 33 [this](const ConnectionContext& connection_context,
34 connection->AddService<TestTrackedRequestService>(this); 34 InterfaceRequest<TestTimeService> request) {
35 new TestTimeServiceImpl(app_impl_, request.Pass());
36 });
37 connection->GetServiceProviderImpl().AddService<TestRequestTracker>(
38 [this](const ConnectionContext& connection_context,
39 InterfaceRequest<TestRequestTracker> request) {
40 new TestRequestTrackerImpl(request.Pass(), &context_);
41 });
42 connection->GetServiceProviderImpl().AddService<TestTrackedRequestService>(
43 [this](const ConnectionContext& connection_context,
44 InterfaceRequest<TestTrackedRequestService> request) {
45 new TestTrackedRequestServiceImpl(request.Pass(), &context_);
46 });
35 return true; 47 return true;
36 } 48 }
37 49
38 void TestRequestTrackerApplication::Create(
39 const ConnectionContext& connection_context,
40 InterfaceRequest<TestTimeService> request) {
41 new TestTimeServiceImpl(app_impl_, request.Pass());
42 }
43
44 void TestRequestTrackerApplication::Create(
45 const ConnectionContext& connection_context,
46 InterfaceRequest<TestRequestTracker> request) {
47 new TestRequestTrackerImpl(request.Pass(), &context_);
48 }
49
50 void TestRequestTrackerApplication::Create(
51 const ConnectionContext& connection_context,
52 InterfaceRequest<TestTrackedRequestService> request) {
53 new TestTrackedRequestServiceImpl(request.Pass(), &context_);
54 }
55
56 } // namespace test 50 } // namespace test
57 } // namespace mojo 51 } // namespace mojo
58 52
59 MojoResult MojoMain(MojoHandle application_request) { 53 MojoResult MojoMain(MojoHandle application_request) {
60 mojo::ApplicationRunner runner( 54 mojo::ApplicationRunner runner(
61 std::unique_ptr<mojo::test::TestRequestTrackerApplication>( 55 std::unique_ptr<mojo::test::TestRequestTrackerApplication>(
62 new mojo::test::TestRequestTrackerApplication())); 56 new mojo::test::TestRequestTrackerApplication()));
63 return runner.Run(application_request); 57 return runner.Run(application_request);
64 } 58 }
OLDNEW
« no previous file with comments | « services/test_service/test_request_tracker_application.h ('k') | services/test_service/test_service_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698