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

Side by Side Diff: mojo/public/cpp/bindings/lib/associated_interface_ptr_state.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
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_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> // For |std::swap()|. 10 #include <algorithm> // For |std::swap()|.
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 #include <utility> 13 #include <utility>
14 14
15 #include "base/bind.h" 15 #include "base/bind.h"
16 #include "base/callback_forward.h" 16 #include "base/callback_forward.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/ptr_util.h" 18 #include "base/memory/ptr_util.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/single_thread_task_runner.h" 20 #include "base/single_thread_task_runner.h"
21 #include "mojo/public/cpp/bindings/associated_group.h" 21 #include "mojo/public/cpp/bindings/associated_group.h"
22 #include "mojo/public/cpp/bindings/associated_group_controller.h"
23 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" 22 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h"
24 #include "mojo/public/cpp/bindings/connection_error_callback.h" 23 #include "mojo/public/cpp/bindings/connection_error_callback.h"
25 #include "mojo/public/cpp/bindings/interface_endpoint_client.h" 24 #include "mojo/public/cpp/bindings/interface_endpoint_client.h"
26 #include "mojo/public/cpp/bindings/interface_id.h" 25 #include "mojo/public/cpp/bindings/interface_id.h"
27 #include "mojo/public/cpp/bindings/lib/control_message_handler.h" 26 #include "mojo/public/cpp/bindings/lib/control_message_handler.h"
28 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" 27 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h"
29 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" 28 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h"
30 #include "mojo/public/cpp/system/message_pipe.h" 29 #include "mojo/public/cpp/system/message_pipe.h"
31 30
32 namespace mojo { 31 namespace mojo {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 DCHECK(info.is_valid()); 92 DCHECK(info.is_valid());
94 93
95 version_ = info.version(); 94 version_ = info.version();
96 // The version is only queried from the client so the value passed here 95 // The version is only queried from the client so the value passed here
97 // will not be used. 96 // will not be used.
98 endpoint_client_.reset(new InterfaceEndpointClient( 97 endpoint_client_.reset(new InterfaceEndpointClient(
99 info.PassHandle(), nullptr, 98 info.PassHandle(), nullptr,
100 base::WrapUnique(new typename Interface::ResponseValidator_()), false, 99 base::WrapUnique(new typename Interface::ResponseValidator_()), false,
101 std::move(runner), 0u)); 100 std::move(runner), 0u));
102 proxy_.reset(new Proxy(endpoint_client_.get())); 101 proxy_.reset(new Proxy(endpoint_client_.get()));
103 if (Interface::PassesAssociatedKinds_) {
104 proxy_->set_group_controller(endpoint_client_->group_controller());
105 }
106 } 102 }
107 103
108 // After this method is called, the object is in an invalid state and 104 // After this method is called, the object is in an invalid state and
109 // shouldn't be reused. 105 // shouldn't be reused.
110 AssociatedInterfacePtrInfo<Interface> PassInterface() { 106 AssociatedInterfacePtrInfo<Interface> PassInterface() {
111 ScopedInterfaceEndpointHandle handle = endpoint_client_->PassHandle(); 107 ScopedInterfaceEndpointHandle handle = endpoint_client_->PassHandle();
112 endpoint_client_.reset(); 108 endpoint_client_.reset();
113 proxy_.reset(); 109 proxy_.reset();
114 return AssociatedInterfacePtrInfo<Interface>(std::move(handle), version_); 110 return AssociatedInterfacePtrInfo<Interface>(std::move(handle), version_);
115 } 111 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 157
162 uint32_t version_; 158 uint32_t version_;
163 159
164 DISALLOW_COPY_AND_ASSIGN(AssociatedInterfacePtrState); 160 DISALLOW_COPY_AND_ASSIGN(AssociatedInterfacePtrState);
165 }; 161 };
166 162
167 } // namespace internal 163 } // namespace internal
168 } // namespace mojo 164 } // namespace mojo
169 165
170 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_ 166 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/array_serialization.h ('k') | mojo/public/cpp/bindings/lib/binding_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698