| OLD | NEW |
| (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 #include "mojo/services/test_service/test_request_tracker_application.h" | |
| 6 | |
| 7 #include <assert.h> | |
| 8 #include <utility> | |
| 9 | |
| 10 #include "mojo/public/c/system/main.h" | |
| 11 #include "mojo/services/test_service/test_time_service_impl.h" | |
| 12 #include "mojo/shell/public/cpp/application_runner.h" | |
| 13 #include "mojo/shell/public/cpp/connection.h" | |
| 14 | |
| 15 namespace mojo { | |
| 16 namespace test { | |
| 17 | |
| 18 TestRequestTrackerApplication::TestRequestTrackerApplication() {} | |
| 19 TestRequestTrackerApplication::~TestRequestTrackerApplication() {} | |
| 20 | |
| 21 void TestRequestTrackerApplication::Initialize(Connector* connector, | |
| 22 const std::string& url, | |
| 23 uint32_t id, | |
| 24 uint32_t user_id) { | |
| 25 connector_ = connector; | |
| 26 } | |
| 27 | |
| 28 bool TestRequestTrackerApplication::AcceptConnection(Connection* connection) { | |
| 29 // Every instance of the service and recorder shares the context. | |
| 30 // Note, this app is single-threaded, so this is thread safe. | |
| 31 connection->AddInterface<TestTimeService>(this); | |
| 32 connection->AddInterface<TestRequestTracker>(this); | |
| 33 connection->AddInterface<TestTrackedRequestService>(this); | |
| 34 return true; | |
| 35 } | |
| 36 | |
| 37 void TestRequestTrackerApplication::Create( | |
| 38 Connection* connection, | |
| 39 InterfaceRequest<TestTimeService> request) { | |
| 40 new TestTimeServiceImpl(connector_, std::move(request)); | |
| 41 } | |
| 42 | |
| 43 void TestRequestTrackerApplication::Create( | |
| 44 Connection* connection, | |
| 45 InterfaceRequest<TestRequestTracker> request) { | |
| 46 new TestRequestTrackerImpl(std::move(request), &context_); | |
| 47 } | |
| 48 | |
| 49 void TestRequestTrackerApplication::Create( | |
| 50 Connection* connection, | |
| 51 InterfaceRequest<TestTrackedRequestService> request) { | |
| 52 new TestTrackedRequestServiceImpl(std::move(request), &context_); | |
| 53 } | |
| 54 | |
| 55 } // namespace test | |
| 56 } // namespace mojo | |
| 57 | |
| 58 MojoResult MojoMain(MojoHandle shell_handle) { | |
| 59 mojo::ApplicationRunner runner( | |
| 60 new mojo::test::TestRequestTrackerApplication); | |
| 61 return runner.Run(shell_handle); | |
| 62 } | |
| OLD | NEW |