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

Side by Side Diff: mojo/services/test_service/test_service_impl.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_service_impl.h" 5 #include "mojo/services/test_service/test_service_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/i18n/time_formatting.h" 8 #include "base/i18n/time_formatting.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "mojo/public/cpp/application/application_connection.h" 10 #include "mojo/public/cpp/application/application_connection.h"
(...skipping 13 matching lines...) Expand all
24 24
25 TestServiceImpl::~TestServiceImpl() { 25 TestServiceImpl::~TestServiceImpl() {
26 } 26 }
27 27
28 void TestServiceImpl::OnConnectionEstablished() { 28 void TestServiceImpl::OnConnectionEstablished() {
29 application_->AddRef(); 29 application_->AddRef();
30 } 30 }
31 31
32 void TestServiceImpl::OnConnectionError() { 32 void TestServiceImpl::OnConnectionError() {
33 application_->ReleaseRef(); 33 application_->ReleaseRef();
34 delete this;
34 } 35 }
35 36
36 void TestServiceImpl::Ping(const mojo::Callback<void()>& callback) { 37 void TestServiceImpl::Ping(const mojo::Callback<void()>& callback) {
37 if (tracking_) 38 if (tracking_)
38 tracking_->RecordNewRequest(); 39 tracking_->RecordNewRequest();
39 callback.Run(); 40 callback.Run();
40 } 41 }
41 42
42 void SendTimeResponse( 43 void SendTimeResponse(
43 const mojo::Callback<void(int64_t)>& requestor_callback, 44 const mojo::Callback<void(int64_t)>& requestor_callback,
(...skipping 16 matching lines...) Expand all
60 const mojo::Callback<void()>& callback) { 61 const mojo::Callback<void()>& callback) {
61 TestRequestTrackerPtr tracker; 62 TestRequestTrackerPtr tracker;
62 connection_->ConnectToService( 63 connection_->ConnectToService(
63 "mojo:mojo_test_request_tracker_app", &tracker); 64 "mojo:mojo_test_request_tracker_app", &tracker);
64 tracking_.reset( 65 tracking_.reset(
65 new TestRequestTrackerClientImpl(tracker.Pass(), Name_, callback)); 66 new TestRequestTrackerClientImpl(tracker.Pass(), Name_, callback));
66 } 67 }
67 68
68 } // namespace test 69 } // namespace test
69 } // namespace mojo 70 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698