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

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

Issue 2100683002: Mojo C++ Bindings: Extract AssociatedGroupController from MultiplexRouter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: oops more gyp ugh Created 4 years, 5 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_SCOPED_INTERFACE_ENDPOINT_HANDLE_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_SCOPED_INTERFACE_ENDPOINT_HANDLE_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_SCOPED_INTERFACE_ENDPOINT_HANDLE_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_SCOPED_INTERFACE_ENDPOINT_HANDLE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "mojo/public/cpp/bindings/lib/interface_id.h" 10 #include "mojo/public/cpp/bindings/interface_id.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 13
14 namespace internal { 14 class AssociatedGroupController;
15 class MultiplexRouter;
16 }
17 15
18 // ScopedInterfaceEndpointHandle refers to one end of an interface, either the 16 // ScopedInterfaceEndpointHandle refers to one end of an interface, either the
19 // implementation side or the client side. 17 // implementation side or the client side.
20 class ScopedInterfaceEndpointHandle { 18 class ScopedInterfaceEndpointHandle {
21 public: 19 public:
22 // Creates an invalid endpoint handle. 20 // Creates an invalid endpoint handle.
23 ScopedInterfaceEndpointHandle(); 21 ScopedInterfaceEndpointHandle();
24 22
25 ScopedInterfaceEndpointHandle(ScopedInterfaceEndpointHandle&& other); 23 ScopedInterfaceEndpointHandle(ScopedInterfaceEndpointHandle&& other);
26 24
27 ~ScopedInterfaceEndpointHandle(); 25 ~ScopedInterfaceEndpointHandle();
28 26
29 ScopedInterfaceEndpointHandle& operator=( 27 ScopedInterfaceEndpointHandle& operator=(
30 ScopedInterfaceEndpointHandle&& other); 28 ScopedInterfaceEndpointHandle&& other);
31 29
32 bool is_valid() const { return internal::IsValidInterfaceId(id_); } 30 bool is_valid() const { return IsValidInterfaceId(id_); }
33 31
34 bool is_local() const { return is_local_; } 32 bool is_local() const { return is_local_; }
35 33
36 void reset(); 34 void reset();
37 void swap(ScopedInterfaceEndpointHandle& other); 35 void swap(ScopedInterfaceEndpointHandle& other);
38 36
39 // DO NOT USE METHODS BELOW THIS LINE. These are for internal use and testing. 37 // DO NOT USE METHODS BELOW THIS LINE. These are for internal use and testing.
40 38
41 internal::InterfaceId id() const { return id_; } 39 InterfaceId id() const { return id_; }
42 40
43 internal::MultiplexRouter* router() const { return router_.get(); } 41 AssociatedGroupController* group_controller() const {
42 return group_controller_.get();
43 }
44 44
45 // Releases the handle without closing it. 45 // Releases the handle without closing it.
46 internal::InterfaceId release(); 46 InterfaceId release();
47 47
48 private: 48 private:
49 friend class internal::MultiplexRouter; 49 friend class AssociatedGroupController;
50 50
51 // This is supposed to be used by MultiplexRouter only. 51 // This is supposed to be used by AssociatedGroupController only.
52 // |id| is the corresponding interface ID. 52 // |id| is the corresponding interface ID.
53 // If |is_local| is false, this handle is meant to be passed over |router| to 53 // If |is_local| is false, this handle is meant to be passed over a message
54 // the remote side. 54 // pipe the remote side of the associated group.
55 ScopedInterfaceEndpointHandle( 55 ScopedInterfaceEndpointHandle(
56 internal::InterfaceId id, 56 InterfaceId id,
57 bool is_local, 57 bool is_local,
58 scoped_refptr<internal::MultiplexRouter> router); 58 scoped_refptr<AssociatedGroupController> group_controller);
59 59
60 internal::InterfaceId id_; 60 InterfaceId id_;
61 bool is_local_; 61 bool is_local_;
62 scoped_refptr<internal::MultiplexRouter> router_; 62 scoped_refptr<AssociatedGroupController> group_controller_;
63 63
64 DISALLOW_COPY_AND_ASSIGN(ScopedInterfaceEndpointHandle); 64 DISALLOW_COPY_AND_ASSIGN(ScopedInterfaceEndpointHandle);
65 }; 65 };
66 66
67 } // namespace mojo 67 } // namespace mojo
68 68
69 #endif // MOJO_PUBLIC_CPP_BINDINGS_SCOPED_INTERFACE_ENDPOINT_HANDLE_H_ 69 #endif // MOJO_PUBLIC_CPP_BINDINGS_SCOPED_INTERFACE_ENDPOINT_HANDLE_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/serialization_util.h ('k') | mojo/public/cpp/bindings/tests/multiplex_router_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698