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_service_impl.h" | 5 #include "mojo/services/test_service/test_service_impl.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
9 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
10 #include "mojo/application/public/cpp/application_impl.h" | 12 #include "mojo/application/public/cpp/application_impl.h" |
11 #include "mojo/services/test_service/test_service_application.h" | 13 #include "mojo/services/test_service/test_service_application.h" |
12 #include "mojo/services/test_service/test_time_service_impl.h" | 14 #include "mojo/services/test_service/test_time_service_impl.h" |
13 #include "mojo/services/test_service/tracked_service.h" | 15 #include "mojo/services/test_service/tracked_service.h" |
14 | 16 |
15 namespace mojo { | 17 namespace mojo { |
16 namespace test { | 18 namespace test { |
17 | 19 |
18 TestServiceImpl::TestServiceImpl(ApplicationImpl* app_impl, | 20 TestServiceImpl::TestServiceImpl(ApplicationImpl* app_impl, |
19 TestServiceApplication* application, | 21 TestServiceApplication* application, |
20 InterfaceRequest<TestService> request) | 22 InterfaceRequest<TestService> request) |
21 : application_(application), | 23 : application_(application), |
22 app_impl_(app_impl), | 24 app_impl_(app_impl), |
23 binding_(this, request.Pass()) { | 25 binding_(this, std::move(request)) { |
24 binding_.set_connection_error_handler( | 26 binding_.set_connection_error_handler( |
25 [this]() { application_->ReleaseRef(); }); | 27 [this]() { application_->ReleaseRef(); }); |
26 } | 28 } |
27 | 29 |
28 TestServiceImpl::~TestServiceImpl() { | 30 TestServiceImpl::~TestServiceImpl() { |
29 } | 31 } |
30 | 32 |
31 void TestServiceImpl::Ping(const mojo::Callback<void()>& callback) { | 33 void TestServiceImpl::Ping(const mojo::Callback<void()>& callback) { |
32 if (tracking_) | 34 if (tracking_) |
33 tracking_->RecordNewRequest(); | 35 tracking_->RecordNewRequest(); |
(...skipping 14 matching lines...) Expand all Loading... |
48 tracking_->RecordNewRequest(); | 50 tracking_->RecordNewRequest(); |
49 time_service_->StartTrackingRequests(mojo::Callback<void()>()); | 51 time_service_->StartTrackingRequests(mojo::Callback<void()>()); |
50 } | 52 } |
51 time_service_->GetPartyTime(base::Bind(&SendTimeResponse, callback)); | 53 time_service_->GetPartyTime(base::Bind(&SendTimeResponse, callback)); |
52 } | 54 } |
53 | 55 |
54 void TestServiceImpl::StartTrackingRequests( | 56 void TestServiceImpl::StartTrackingRequests( |
55 const mojo::Callback<void()>& callback) { | 57 const mojo::Callback<void()>& callback) { |
56 TestRequestTrackerPtr tracker; | 58 TestRequestTrackerPtr tracker; |
57 app_impl_->ConnectToService("mojo:test_request_tracker_app", &tracker); | 59 app_impl_->ConnectToService("mojo:test_request_tracker_app", &tracker); |
58 tracking_.reset(new TrackedService(tracker.Pass(), Name_, callback)); | 60 tracking_.reset(new TrackedService(std::move(tracker), Name_, callback)); |
59 } | 61 } |
60 | 62 |
61 } // namespace test | 63 } // namespace test |
62 } // namespace mojo | 64 } // namespace mojo |
OLD | NEW |