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

Side by Side Diff: mojo/public/cpp/bindings/associated_binding.h

Issue 2660733002: Mojo C++ bindings: introduce an optional array to store transferred interface IDs in messages. (Closed)
Patch Set: . Created 3 years, 10 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
« no previous file with comments | « ipc/ipc_mojo_bootstrap.cc ('k') | mojo/public/cpp/bindings/associated_group_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
18 #include "base/threading/thread_task_runner_handle.h" 18 #include "base/threading/thread_task_runner_handle.h"
19 #include "mojo/public/cpp/bindings/associated_group.h" 19 #include "mojo/public/cpp/bindings/associated_group.h"
20 #include "mojo/public/cpp/bindings/associated_group_controller.h"
21 #include "mojo/public/cpp/bindings/associated_interface_request.h" 20 #include "mojo/public/cpp/bindings/associated_interface_request.h"
22 #include "mojo/public/cpp/bindings/connection_error_callback.h" 21 #include "mojo/public/cpp/bindings/connection_error_callback.h"
23 #include "mojo/public/cpp/bindings/interface_endpoint_client.h" 22 #include "mojo/public/cpp/bindings/interface_endpoint_client.h"
24 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" 23 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h"
25 #include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h" 24 #include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h"
26 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" 25 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h"
27 26
28 namespace mojo { 27 namespace mojo {
29 28
30 class MessageReceiver; 29 class MessageReceiver;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 101
103 if (!handle.is_valid() || !handle.is_local()) { 102 if (!handle.is_valid() || !handle.is_local()) {
104 endpoint_client_.reset(); 103 endpoint_client_.reset();
105 return; 104 return;
106 } 105 }
107 106
108 endpoint_client_.reset(new InterfaceEndpointClient( 107 endpoint_client_.reset(new InterfaceEndpointClient(
109 std::move(handle), &stub_, 108 std::move(handle), &stub_,
110 base::WrapUnique(new typename Interface::RequestValidator_()), 109 base::WrapUnique(new typename Interface::RequestValidator_()),
111 Interface::HasSyncMethods_, std::move(runner), Interface::Version_)); 110 Interface::HasSyncMethods_, std::move(runner), Interface::Version_));
112
113 if (Interface::PassesAssociatedKinds_) {
114 stub_.serialization_context()->group_controller =
115 endpoint_client_->group_controller();
116 }
117 } 111 }
118 112
119 // Adds a message filter to be notified of each incoming message before 113 // Adds a message filter to be notified of each incoming message before
120 // dispatch. If a filter returns |false| from Accept(), the message is not 114 // dispatch. If a filter returns |false| from Accept(), the message is not
121 // dispatched and the pipe is closed. Filters cannot be removed. 115 // dispatched and the pipe is closed. Filters cannot be removed.
122 void AddFilter(std::unique_ptr<MessageReceiver> filter) { 116 void AddFilter(std::unique_ptr<MessageReceiver> filter) {
123 DCHECK(endpoint_client_); 117 DCHECK(endpoint_client_);
124 endpoint_client_->AddFilter(std::move(filter)); 118 endpoint_client_->AddFilter(std::move(filter));
125 } 119 }
126 120
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 private: 184 private:
191 std::unique_ptr<InterfaceEndpointClient> endpoint_client_; 185 std::unique_ptr<InterfaceEndpointClient> endpoint_client_;
192 typename Interface::template Stub_<ImplRefTraits> stub_; 186 typename Interface::template Stub_<ImplRefTraits> stub_;
193 187
194 DISALLOW_COPY_AND_ASSIGN(AssociatedBinding); 188 DISALLOW_COPY_AND_ASSIGN(AssociatedBinding);
195 }; 189 };
196 190
197 } // namespace mojo 191 } // namespace mojo
198 192
199 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ 193 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_
OLDNEW
« no previous file with comments | « ipc/ipc_mojo_bootstrap.cc ('k') | mojo/public/cpp/bindings/associated_group_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698