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

Side by Side Diff: mojo/public/cpp/bindings/lib/interface_endpoint_client.cc

Issue 1465293002: Mojo C++ bindings: introduce public associated-interface-related types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/public/cpp/bindings/lib/interface_endpoint_client.h" 5 #include "mojo/public/cpp/bindings/lib/interface_endpoint_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "mojo/public/cpp/bindings/associated_group.h"
10 #include "mojo/public/cpp/bindings/lib/multiplex_router.h" 11 #include "mojo/public/cpp/bindings/lib/multiplex_router.h"
11 12
12 namespace mojo { 13 namespace mojo {
13 namespace internal { 14 namespace internal {
14 15
15 // ---------------------------------------------------------------------------- 16 // ----------------------------------------------------------------------------
16 17
17 namespace { 18 namespace {
18 19
19 // When receiving an incoming message which expects a repsonse, 20 // When receiving an incoming message which expects a repsonse,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 111 }
111 112
112 InterfaceEndpointClient::~InterfaceEndpointClient() { 113 InterfaceEndpointClient::~InterfaceEndpointClient() {
113 DCHECK(thread_checker_.CalledOnValidThread()); 114 DCHECK(thread_checker_.CalledOnValidThread());
114 115
115 STLDeleteValues(&responders_); 116 STLDeleteValues(&responders_);
116 117
117 handle_.router()->DetachEndpointClient(handle_); 118 handle_.router()->DetachEndpointClient(handle_);
118 } 119 }
119 120
121 AssociatedGroup* InterfaceEndpointClient::associated_group() {
122 if (!associated_group_)
123 associated_group_ = handle_.router()->CreateAssociatedGroup();
124 return associated_group_.get();
125 }
126
120 ScopedInterfaceEndpointHandle InterfaceEndpointClient::PassHandle() { 127 ScopedInterfaceEndpointHandle InterfaceEndpointClient::PassHandle() {
121 DCHECK(thread_checker_.CalledOnValidThread()); 128 DCHECK(thread_checker_.CalledOnValidThread());
122 DCHECK(!has_pending_responders()); 129 DCHECK(!has_pending_responders());
123 130
124 if (!handle_.is_valid()) 131 if (!handle_.is_valid())
125 return ScopedInterfaceEndpointHandle(); 132 return ScopedInterfaceEndpointHandle();
126 133
127 handle_.router()->DetachEndpointClient(handle_); 134 handle_.router()->DetachEndpointClient(handle_);
128 135
129 return handle_.Pass(); 136 return handle_.Pass();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } else { 216 } else {
210 if (!incoming_receiver_) 217 if (!incoming_receiver_)
211 return false; 218 return false;
212 219
213 return incoming_receiver_->Accept(message); 220 return incoming_receiver_->Accept(message);
214 } 221 }
215 } 222 }
216 223
217 } // namespace internal 224 } // namespace internal
218 } // namespace mojo 225 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/interface_endpoint_client.h ('k') | mojo/public/cpp/bindings/lib/multiplex_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698