| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_ROUTER_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 bool expects_sync_requests, | 32 bool expects_sync_requests, |
| 33 scoped_refptr<base::SingleThreadTaskRunner> runner); | 33 scoped_refptr<base::SingleThreadTaskRunner> runner); |
| 34 ~Router() override; | 34 ~Router() override; |
| 35 | 35 |
| 36 // Sets the receiver to handle messages read from the message pipe that do | 36 // Sets the receiver to handle messages read from the message pipe that do |
| 37 // not have the kMessageIsResponse flag set. | 37 // not have the kMessageIsResponse flag set. |
| 38 void set_incoming_receiver(MessageReceiverWithResponderStatus* receiver) { | 38 void set_incoming_receiver(MessageReceiverWithResponderStatus* receiver) { |
| 39 incoming_receiver_ = receiver; | 39 incoming_receiver_ = receiver; |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Sets the interface name for this Router. Used only for debugging. |
| 43 void set_interface_name(const std::string& name) { |
| 44 DCHECK(thread_checker_.CalledOnValidThread()); |
| 45 connector_.set_interface_name(name); |
| 46 } |
| 47 |
| 42 // Sets the error handler to receive notifications when an error is | 48 // Sets the error handler to receive notifications when an error is |
| 43 // encountered while reading from the pipe or waiting to read from the pipe. | 49 // encountered while reading from the pipe or waiting to read from the pipe. |
| 44 void set_connection_error_handler(const Closure& error_handler) { | 50 void set_connection_error_handler(const Closure& error_handler) { |
| 45 error_handler_ = error_handler; | 51 error_handler_ = error_handler; |
| 46 } | 52 } |
| 47 | 53 |
| 48 // Returns true if an error was encountered while reading from the pipe or | 54 // Returns true if an error was encountered while reading from the pipe or |
| 49 // waiting to read from the pipe. | 55 // waiting to read from the pipe. |
| 50 bool encountered_error() const { | 56 bool encountered_error() const { |
| 51 DCHECK(thread_checker_.CalledOnValidThread()); | 57 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 bool encountered_error_; | 174 bool encountered_error_; |
| 169 Closure error_handler_; | 175 Closure error_handler_; |
| 170 base::ThreadChecker thread_checker_; | 176 base::ThreadChecker thread_checker_; |
| 171 base::WeakPtrFactory<Router> weak_factory_; | 177 base::WeakPtrFactory<Router> weak_factory_; |
| 172 }; | 178 }; |
| 173 | 179 |
| 174 } // namespace internal | 180 } // namespace internal |
| 175 } // namespace mojo | 181 } // namespace mojo |
| 176 | 182 |
| 177 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ | 183 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ |
| OLD | NEW |