| OLD | NEW |
| 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_LIB_INTERFACE_ENDPOINT_CLIENT_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_ENDPOINT_CLIENT_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_ENDPOINT_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // Returns true if this endpoint has any pending callbacks. | 60 // Returns true if this endpoint has any pending callbacks. |
| 61 bool has_pending_responders() const { | 61 bool has_pending_responders() const { |
| 62 DCHECK(thread_checker_.CalledOnValidThread()); | 62 DCHECK(thread_checker_.CalledOnValidThread()); |
| 63 return !async_responders_.empty() || !sync_responses_.empty(); | 63 return !async_responders_.empty() || !sync_responses_.empty(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 MultiplexRouter* router() const { return handle_.router(); } | 66 MultiplexRouter* router() const { return handle_.router(); } |
| 67 AssociatedGroup* associated_group(); | 67 AssociatedGroup* associated_group(); |
| 68 uint32_t interface_id() const; | 68 uint32_t interface_id() const; |
| 69 | 69 |
| 70 void set_interface_name(const std::string& name) { |
| 71 DCHECK(thread_checker_.CalledOnValidThread()); |
| 72 interface_name_ = name; |
| 73 } |
| 74 |
| 70 // After this call the object is in an invalid state and shouldn't be reused. | 75 // After this call the object is in an invalid state and shouldn't be reused. |
| 71 ScopedInterfaceEndpointHandle PassHandle(); | 76 ScopedInterfaceEndpointHandle PassHandle(); |
| 72 | 77 |
| 73 // Raises an error on the underlying message pipe. It disconnects the pipe | 78 // Raises an error on the underlying message pipe. It disconnects the pipe |
| 74 // and notifies all interfaces running on this pipe. | 79 // and notifies all interfaces running on this pipe. |
| 75 void RaiseError(); | 80 void RaiseError(); |
| 76 | 81 |
| 77 // MessageReceiverWithResponder implementation: | 82 // MessageReceiverWithResponder implementation: |
| 78 bool Accept(Message* message) override; | 83 bool Accept(Message* message) override; |
| 79 bool AcceptWithResponder(Message* message, | 84 bool AcceptWithResponder(Message* message, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 HandleIncomingMessageThunk thunk_; | 140 HandleIncomingMessageThunk thunk_; |
| 136 | 141 |
| 137 AsyncResponderMap async_responders_; | 142 AsyncResponderMap async_responders_; |
| 138 SyncResponseMap sync_responses_; | 143 SyncResponseMap sync_responses_; |
| 139 | 144 |
| 140 uint64_t next_request_id_; | 145 uint64_t next_request_id_; |
| 141 | 146 |
| 142 Closure error_handler_; | 147 Closure error_handler_; |
| 143 bool encountered_error_; | 148 bool encountered_error_; |
| 144 | 149 |
| 150 // The name of the interface which is bound by this client. Used only for |
| 151 // debugging purposes. |
| 152 std::string interface_name_; |
| 153 |
| 145 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 154 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 146 | 155 |
| 147 base::ThreadChecker thread_checker_; | 156 base::ThreadChecker thread_checker_; |
| 148 | 157 |
| 149 base::WeakPtrFactory<InterfaceEndpointClient> weak_ptr_factory_; | 158 base::WeakPtrFactory<InterfaceEndpointClient> weak_ptr_factory_; |
| 150 | 159 |
| 151 DISALLOW_COPY_AND_ASSIGN(InterfaceEndpointClient); | 160 DISALLOW_COPY_AND_ASSIGN(InterfaceEndpointClient); |
| 152 }; | 161 }; |
| 153 | 162 |
| 154 } // namespace internal | 163 } // namespace internal |
| 155 } // namespace mojo | 164 } // namespace mojo |
| 156 | 165 |
| 157 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_ENDPOINT_CLIENT_H_ | 166 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_ENDPOINT_CLIENT_H_ |
| OLD | NEW |