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

Side by Side Diff: mojo/public/cpp/bindings/interface_endpoint_client.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_LIB_INTERFACE_ENDPOINT_CLIENT_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_ENDPOINT_CLIENT_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_ENDPOINT_CLIENT_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_ENDPOINT_CLIENT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 12
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
19 #include "base/threading/thread_checker.h" 19 #include "base/threading/thread_checker.h"
20 #include "mojo/public/cpp/bindings/message.h" 20 #include "mojo/public/cpp/bindings/message.h"
21 #include "mojo/public/cpp/bindings/message_filter.h" 21 #include "mojo/public/cpp/bindings/message_filter.h"
22 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" 22 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h"
23 23
24 namespace mojo { 24 namespace mojo {
25 25
26 class AssociatedGroup; 26 class AssociatedGroup;
27 27 class AssociatedGroupController;
28 namespace internal {
29
30 class MultiplexRouter;
31 class InterfaceEndpointController; 28 class InterfaceEndpointController;
32 29
33 // InterfaceEndpointClient handles message sending and receiving of an interface 30 // InterfaceEndpointClient handles message sending and receiving of an interface
34 // endpoint, either the implementation side or the client side. 31 // endpoint, either the implementation side or the client side.
35 // It should only be accessed and destructed on the creating thread. 32 // It should only be accessed and destructed on the creating thread.
36 class InterfaceEndpointClient : public MessageReceiverWithResponder { 33 class InterfaceEndpointClient : public MessageReceiverWithResponder {
37 public: 34 public:
38 // |receiver| is okay to be null. If it is not null, it must outlive this 35 // |receiver| is okay to be null. If it is not null, it must outlive this
39 // object. 36 // object.
40 InterfaceEndpointClient(ScopedInterfaceEndpointHandle handle, 37 InterfaceEndpointClient(ScopedInterfaceEndpointHandle handle,
(...skipping 15 matching lines...) Expand all
56 DCHECK(thread_checker_.CalledOnValidThread()); 53 DCHECK(thread_checker_.CalledOnValidThread());
57 return encountered_error_; 54 return encountered_error_;
58 } 55 }
59 56
60 // Returns true if this endpoint has any pending callbacks. 57 // Returns true if this endpoint has any pending callbacks.
61 bool has_pending_responders() const { 58 bool has_pending_responders() const {
62 DCHECK(thread_checker_.CalledOnValidThread()); 59 DCHECK(thread_checker_.CalledOnValidThread());
63 return !async_responders_.empty() || !sync_responses_.empty(); 60 return !async_responders_.empty() || !sync_responses_.empty();
64 } 61 }
65 62
66 MultiplexRouter* router() const { return handle_.router(); } 63 AssociatedGroupController* group_controller() const {
64 return handle_.group_controller();
65 }
67 AssociatedGroup* associated_group(); 66 AssociatedGroup* associated_group();
68 uint32_t interface_id() const; 67 uint32_t interface_id() const;
69 68
70 // After this call the object is in an invalid state and shouldn't be reused. 69 // After this call the object is in an invalid state and shouldn't be reused.
71 ScopedInterfaceEndpointHandle PassHandle(); 70 ScopedInterfaceEndpointHandle PassHandle();
72 71
73 // Raises an error on the underlying message pipe. It disconnects the pipe 72 // Raises an error on the underlying message pipe. It disconnects the pipe
74 // and notifies all interfaces running on this pipe. 73 // and notifies all interfaces running on this pipe.
75 void RaiseError(); 74 void RaiseError();
76 75
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 143
145 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 144 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
146 145
147 base::ThreadChecker thread_checker_; 146 base::ThreadChecker thread_checker_;
148 147
149 base::WeakPtrFactory<InterfaceEndpointClient> weak_ptr_factory_; 148 base::WeakPtrFactory<InterfaceEndpointClient> weak_ptr_factory_;
150 149
151 DISALLOW_COPY_AND_ASSIGN(InterfaceEndpointClient); 150 DISALLOW_COPY_AND_ASSIGN(InterfaceEndpointClient);
152 }; 151 };
153 152
154 } // namespace internal
155 } // namespace mojo 153 } // namespace mojo
156 154
157 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_ENDPOINT_CLIENT_H_ 155 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_ENDPOINT_CLIENT_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/associated_group_controller.h ('k') | mojo/public/cpp/bindings/interface_endpoint_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698