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

Side by Side Diff: services/service_manager/public/cpp/lib/connector_impl.cc

Issue 2475543003: Introduce the image_decoder service (Closed)
Patch Set: . Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "services/service_manager/public/cpp/lib/connector_impl.h" 5 #include "services/service_manager/public/cpp/lib/connector_impl.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "services/service_manager/public/cpp/identity.h" 8 #include "services/service_manager/public/cpp/identity.h"
9 #include "services/service_manager/public/cpp/lib/connection_impl.h" 9 #include "services/service_manager/public/cpp/lib/connection_impl.h"
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 std::unique_ptr<Connector> ConnectorImpl::Clone() { 87 std::unique_ptr<Connector> ConnectorImpl::Clone() {
88 if (!BindIfNecessary()) 88 if (!BindIfNecessary())
89 return nullptr; 89 return nullptr;
90 90
91 mojom::ConnectorPtr connector; 91 mojom::ConnectorPtr connector;
92 mojom::ConnectorRequest request = GetProxy(&connector); 92 mojom::ConnectorRequest request = GetProxy(&connector);
93 connector_->Clone(std::move(request)); 93 connector_->Clone(std::move(request));
94 return base::MakeUnique<ConnectorImpl>(connector.PassInterface()); 94 return base::MakeUnique<ConnectorImpl>(connector.PassInterface());
95 } 95 }
96 96
97 void ConnectorImpl::BindRequest(mojom::ConnectorRequest request) {
98 if (!BindIfNecessary())
99 return;
100 connector_->Clone(std::move(request));
101 }
102
97 bool ConnectorImpl::BindIfNecessary() { 103 bool ConnectorImpl::BindIfNecessary() {
98 // Bind this object to the current thread the first time it is used to 104 // Bind this object to the current thread the first time it is used to
99 // connect. 105 // connect.
100 if (!connector_.is_bound()) { 106 if (!connector_.is_bound()) {
101 if (!unbound_state_.is_valid()) { 107 if (!unbound_state_.is_valid()) {
102 // It's possible to get here when the link to the service manager has been 108 // It's possible to get here when the link to the service manager has been
103 // severed 109 // severed
104 // (and so the connector pipe has been closed) but the app has chosen not 110 // (and so the connector pipe has been closed) but the app has chosen not
105 // to quit. 111 // to quit.
106 return false; 112 return false;
(...skipping 10 matching lines...) Expand all
117 return true; 123 return true;
118 } 124 }
119 125
120 std::unique_ptr<Connector> Connector::Create(mojom::ConnectorRequest* request) { 126 std::unique_ptr<Connector> Connector::Create(mojom::ConnectorRequest* request) {
121 mojom::ConnectorPtr proxy; 127 mojom::ConnectorPtr proxy;
122 *request = mojo::GetProxy(&proxy); 128 *request = mojo::GetProxy(&proxy);
123 return base::MakeUnique<ConnectorImpl>(proxy.PassInterface()); 129 return base::MakeUnique<ConnectorImpl>(proxy.PassInterface());
124 } 130 }
125 131
126 } // namespace service_manager 132 } // namespace service_manager
OLDNEW
« no previous file with comments | « services/service_manager/public/cpp/lib/connector_impl.h ('k') | services/service_manager/public/service_manifest.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698