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

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

Issue 2668153003: Mojo C++ Bindings: Eliminate unbound ThreadSafeInterfacePtr (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_ASSOCIATED_INTERFACE_PTR_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 13 matching lines...) Expand all
24 #include "mojo/public/cpp/bindings/lib/multiplex_router.h" 24 #include "mojo/public/cpp/bindings/lib/multiplex_router.h"
25 #include "mojo/public/cpp/system/message_pipe.h" 25 #include "mojo/public/cpp/system/message_pipe.h"
26 26
27 namespace mojo { 27 namespace mojo {
28 28
29 // Represents the client side of an associated interface. It is similar to 29 // Represents the client side of an associated interface. It is similar to
30 // InterfacePtr, except that it doesn't own a message pipe handle. 30 // InterfacePtr, except that it doesn't own a message pipe handle.
31 template <typename Interface> 31 template <typename Interface>
32 class AssociatedInterfacePtr { 32 class AssociatedInterfacePtr {
33 public: 33 public:
34 using PtrInfoType = AssociatedInterfacePtrInfo<Interface>;
35
34 // Constructs an unbound AssociatedInterfacePtr. 36 // Constructs an unbound AssociatedInterfacePtr.
35 AssociatedInterfacePtr() {} 37 AssociatedInterfacePtr() {}
36 AssociatedInterfacePtr(decltype(nullptr)) {} 38 AssociatedInterfacePtr(decltype(nullptr)) {}
37 39
38 AssociatedInterfacePtr(AssociatedInterfacePtr&& other) { 40 AssociatedInterfacePtr(AssociatedInterfacePtr&& other) {
39 internal_state_.Swap(&other.internal_state_); 41 internal_state_.Swap(&other.internal_state_);
40 } 42 }
41 43
42 AssociatedInterfacePtr& operator=(AssociatedInterfacePtr&& other) { 44 AssociatedInterfacePtr& operator=(AssociatedInterfacePtr&& other) {
43 reset(); 45 reset();
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 Interface::Version_)); 290 Interface::Version_));
289 291
290 AssociatedInterfaceRequest<Interface> request; 292 AssociatedInterfaceRequest<Interface> request;
291 request.Bind(std::move(endpoint1)); 293 request.Bind(std::move(endpoint1));
292 return request; 294 return request;
293 } 295 }
294 296
295 } // namespace mojo 297 } // namespace mojo
296 298
297 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ 299 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698