Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/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" |
| 11 #include "mojo/public/cpp/application/application_runner.h" | 11 #include "mojo/public/cpp/application/application_runner.h" |
| 12 #include "mojo/services/test_service/test_time_service_impl.h" | 12 #include "mojo/services/test_service/test_time_service_impl.h" |
| 13 | 13 |
| 14 namespace mojo { | 14 namespace mojo { |
| 15 namespace test { | 15 namespace test { |
| 16 | 16 |
| 17 TestRequestTrackerApplication::TestRequestTrackerApplication() | 17 TestRequestTrackerApplication::TestRequestTrackerApplication() |
| 18 : test_tracked_request_factory_(&context_), | 18 : test_tracked_request_factory_(&context_) { |
| 19 test_request_tracker_factory_(&context_) { | |
| 20 } | 19 } |
| 21 | 20 |
| 22 TestRequestTrackerApplication::~TestRequestTrackerApplication() { | 21 TestRequestTrackerApplication::~TestRequestTrackerApplication() { |
| 23 } | 22 } |
| 24 | 23 |
| 25 bool TestRequestTrackerApplication::ConfigureIncomingConnection( | 24 bool TestRequestTrackerApplication::ConfigureIncomingConnection( |
| 26 ApplicationConnection* connection) { | 25 ApplicationConnection* connection) { |
| 27 // Every instance of the service and recorder shares the context. | 26 // Every instance of the service and recorder shares the context. |
| 28 // Note, this app is single-threaded, so this is thread safe. | 27 // Note, this app is single-threaded, so this is thread safe. |
| 29 connection->AddService(&test_tracked_request_factory_); | 28 connection->AddService(&test_tracked_request_factory_); |
| 30 connection->AddService(&test_request_tracker_factory_); | 29 connection->AddService<TestTimeService>(this); |
| 31 connection->AddService(this); | 30 connection->AddService<TestRequestTracker>(this); |
| 32 return true; | 31 return true; |
| 33 } | 32 } |
| 34 | 33 |
| 35 void TestRequestTrackerApplication::Create( | 34 void TestRequestTrackerApplication::Create( |
| 36 ApplicationConnection* connection, | 35 ApplicationConnection* connection, |
| 37 InterfaceRequest<TestTimeService> request) { | 36 InterfaceRequest<TestTimeService> request) { |
| 38 BindToRequest(new TestTimeServiceImpl(connection), &request); | 37 BindToRequest(new TestTimeServiceImpl(connection), &request); |
| 39 } | 38 } |
| 40 | 39 |
| 40 void TestRequestTrackerApplication::Create( | |
| 41 ApplicationConnection* connection, | |
| 42 InterfaceRequest<TestRequestTracker> request) { | |
| 43 TestRequestTrackerImpl* impl = | |
| 44 BindToRequest(new TestRequestTrackerImpl(&context_), &request); | |
|
DaveMoore
2014/11/11 17:18:45
Removing OnConnectionEstablished() means we can no
jamesr
2014/11/11 17:47:49
The fact that the OnConnectionEstablished() exists
| |
| 45 impl->OnConnectionEstablished(); | |
| 46 } | |
| 47 | |
| 41 } // namespace test | 48 } // namespace test |
| 42 } // namespace mojo | 49 } // namespace mojo |
| 43 | 50 |
| 44 MojoResult MojoMain(MojoHandle shell_handle) { | 51 MojoResult MojoMain(MojoHandle shell_handle) { |
| 45 mojo::ApplicationRunner runner( | 52 mojo::ApplicationRunner runner( |
| 46 new mojo::test::TestRequestTrackerApplication); | 53 new mojo::test::TestRequestTrackerApplication); |
| 47 return runner.Run(shell_handle); | 54 return runner.Run(shell_handle); |
| 48 } | 55 } |
| OLD | NEW |