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

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

Issue 380413003: Mojo: Use InterfaceFactory<Interface> for service registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some InterfaceProvider impls for common cases Created 6 years, 5 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 | Annotate | Revision Log
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 "mojo/services/test_service/test_request_tracker_application.h" 5 #include "mojo/services/test_service/test_request_tracker_application.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 8
9 #include "mojo/public/cpp/application/application_connection.h" 9 #include "mojo/public/cpp/application/application_connection.h"
10 #include "mojo/services/test_service/test_time_service_impl.h" 10 #include "mojo/services/test_service/test_time_service_impl.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 namespace test { 13 namespace test {
14 14
15 TestRequestTrackerApplication::TestRequestTrackerApplication() { 15 TestRequestTrackerApplication::TestRequestTrackerApplication() {
16 } 16 }
17 17
18 TestRequestTrackerApplication::~TestRequestTrackerApplication() { 18 TestRequestTrackerApplication::~TestRequestTrackerApplication() {
19 } 19 }
20 20
21 bool TestRequestTrackerApplication::ConfigureIncomingConnection( 21 bool TestRequestTrackerApplication::ConfigureIncomingConnection(
22 ApplicationConnection* connection) { 22 ApplicationConnection* connection) {
23 // Every instance of the service and recorder shares the context. 23 // Every instance of the service and recorder shares the context.
24 // Note, this app is single-threaded, so this is thread safe. 24 // Note, this app is single-threaded, so this is thread safe.
25 connection->AddService<TestTrackedRequestServiceImpl>(&context_); 25 connection->AddService<TestTrackedRequestServiceImpl>(&context_);
26 connection->AddService<TestRequestTrackerImpl>(&context_); 26 connection->AddService<TestRequestTrackerImpl>(&context_);
27 connection->AddService<TestTimeServiceImpl>(); 27 connection->AddServiceProvider(this);
28 return true; 28 return true;
29 } 29 }
30 30
31 void TestRequestTrackerApplication::BindToRequest(
32 ApplicationConnection* connection,
33 InterfaceRequest<TestTimeService> request) {
34 mojo::BindToRequest(new TestTimeServiceImpl(connection), &request);
35 }
36
31 } // namespace test 37 } // namespace test
32 38
33 // static 39 // static
34 ApplicationDelegate* ApplicationDelegate::Create() { 40 ApplicationDelegate* ApplicationDelegate::Create() {
35 return new mojo::test::TestRequestTrackerApplication(); 41 return new mojo::test::TestRequestTrackerApplication();
36 } 42 }
37 43
38 } // namespace mojo 44 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698