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

Side by Side Diff: services/shell/public/cpp/lib/connection_impl.cc

Issue 2209943002: Eliminate outgoing InterfaceProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tracing
Patch Set: . Created 4 years, 4 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
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 "services/shell/public/cpp/lib/connection_impl.h" 5 #include "services/shell/public/cpp/lib/connection_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 const std::string& ConnectionImpl::GetConnectionName() { 68 const std::string& ConnectionImpl::GetConnectionName() {
69 return connection_name_; 69 return connection_name_;
70 } 70 }
71 71
72 const Identity& ConnectionImpl::GetRemoteIdentity() const { 72 const Identity& ConnectionImpl::GetRemoteIdentity() const {
73 return remote_; 73 return remote_;
74 } 74 }
75 75
76 void ConnectionImpl::SetConnectionLostClosure(const base::Closure& handler) { 76 void ConnectionImpl::SetConnectionLostClosure(const base::Closure& handler) {
77 remote_interfaces_->SetConnectionLostClosure(handler); 77 if (remote_interfaces_)
78 remote_interfaces_->SetConnectionLostClosure(handler);
79 else
80 exposed_interfaces_->SetConnectionLostClosure(handler);
78 } 81 }
79 82
80 shell::mojom::ConnectResult ConnectionImpl::GetResult() const { 83 shell::mojom::ConnectResult ConnectionImpl::GetResult() const {
81 return result_; 84 return result_;
82 } 85 }
83 86
84 bool ConnectionImpl::IsPending() const { 87 bool ConnectionImpl::IsPending() const {
85 return state_ == State::PENDING; 88 return state_ == State::PENDING;
86 } 89 }
87 90
88 uint32_t ConnectionImpl::GetRemoteInstanceID() const { 91 uint32_t ConnectionImpl::GetRemoteInstanceID() const {
89 return remote_id_; 92 return remote_id_;
90 } 93 }
91 94
92 void ConnectionImpl::AddConnectionCompletedClosure( 95 void ConnectionImpl::AddConnectionCompletedClosure(
93 const base::Closure& callback) { 96 const base::Closure& callback) {
94 if (IsPending()) 97 if (IsPending())
95 connection_completed_callbacks_.push_back(callback); 98 connection_completed_callbacks_.push_back(callback);
96 else 99 else
97 callback.Run(); 100 callback.Run();
98 } 101 }
99 102
100 bool ConnectionImpl::AllowsInterface(const std::string& interface_name) const { 103 bool ConnectionImpl::AllowsInterface(const std::string& interface_name) const {
101 return allow_all_interfaces_ || 104 return allow_all_interfaces_ ||
102 capability_request_.interfaces.count(interface_name); 105 capability_request_.interfaces.count(interface_name);
103 } 106 }
104 107
105 mojom::InterfaceProvider* ConnectionImpl::GetRemoteInterfaceProvider() {
106 return remote_interfaces_->get();
107 }
108
109 InterfaceRegistry* ConnectionImpl::GetInterfaceRegistry() { 108 InterfaceRegistry* ConnectionImpl::GetInterfaceRegistry() {
110 return exposed_interfaces_; 109 return exposed_interfaces_;
111 } 110 }
112 111
113 InterfaceProvider* ConnectionImpl::GetRemoteInterfaces() { 112 InterfaceProvider* ConnectionImpl::GetRemoteInterfaces() {
114 return remote_interfaces_; 113 return remote_interfaces_;
115 } 114 }
116 115
117 base::WeakPtr<Connection> ConnectionImpl::GetWeakPtr() { 116 base::WeakPtr<Connection> ConnectionImpl::GetWeakPtr() {
118 return weak_factory_.GetWeakPtr(); 117 return weak_factory_.GetWeakPtr();
(...skipping 13 matching lines...) Expand all
132 remote_id_ = target_application_id; 131 remote_id_ = target_application_id;
133 remote_.set_user_id(target_user_id); 132 remote_.set_user_id(target_user_id);
134 std::vector<base::Closure> callbacks; 133 std::vector<base::Closure> callbacks;
135 callbacks.swap(connection_completed_callbacks_); 134 callbacks.swap(connection_completed_callbacks_);
136 for (auto callback : callbacks) 135 for (auto callback : callbacks)
137 callback.Run(); 136 callback.Run();
138 } 137 }
139 138
140 } // namespace internal 139 } // namespace internal
141 } // namespace shell 140 } // namespace shell
OLDNEW
« no previous file with comments | « services/shell/public/cpp/lib/connection_impl.h ('k') | services/shell/public/cpp/lib/connector_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698