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 DEVICE_SERIAL_SERIAL_CONNECTION_FACTORY_H_ | 5 #ifndef DEVICE_SERIAL_SERIAL_CONNECTION_FACTORY_H_ |
6 #define DEVICE_SERIAL_SERIAL_CONNECTION_FACTORY_H_ | 6 #define DEVICE_SERIAL_SERIAL_CONNECTION_FACTORY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
Ken Rockot(use gerrit already)
2015/04/28 05:02:02
Oops, missed this before. Please also remove uses
Pranay
2015/05/04 03:25:23
Done.
| |
13 #include "base/single_thread_task_runner.h" | |
14 #include "base/thread_task_runner_handle.h" | |
13 #include "device/serial/data_stream.mojom.h" | 15 #include "device/serial/data_stream.mojom.h" |
14 #include "device/serial/serial.mojom.h" | 16 #include "device/serial/serial.mojom.h" |
15 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" | 17 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" |
16 | 18 |
17 namespace device { | 19 namespace device { |
18 | 20 |
19 class SerialIoHandler; | 21 class SerialIoHandler; |
20 | 22 |
21 class SerialConnectionFactory | 23 class SerialConnectionFactory |
22 : public base::RefCountedThreadSafe<SerialConnectionFactory> { | 24 : public base::RefCountedThreadSafe<SerialConnectionFactory> { |
23 public: | 25 public: |
24 typedef base::Callback<scoped_refptr<SerialIoHandler>()> IoHandlerFactory; | 26 typedef base::Callback<scoped_refptr<SerialIoHandler>()> IoHandlerFactory; |
25 | 27 |
26 SerialConnectionFactory( | 28 SerialConnectionFactory( |
27 const IoHandlerFactory& io_handler_factory, | 29 const IoHandlerFactory& io_handler_factory, |
28 scoped_refptr<base::MessageLoopProxy> connect_message_loop); | 30 scoped_refptr<base::SingleThreadTaskRunner> connect_task_runner); |
29 | 31 |
30 void CreateConnection( | 32 void CreateConnection( |
31 const std::string& path, | 33 const std::string& path, |
32 serial::ConnectionOptionsPtr options, | 34 serial::ConnectionOptionsPtr options, |
33 mojo::InterfaceRequest<serial::Connection> connection_request, | 35 mojo::InterfaceRequest<serial::Connection> connection_request, |
34 mojo::InterfaceRequest<serial::DataSink> sink, | 36 mojo::InterfaceRequest<serial::DataSink> sink, |
35 mojo::InterfaceRequest<serial::DataSource> source, | 37 mojo::InterfaceRequest<serial::DataSource> source, |
36 mojo::InterfacePtr<serial::DataSourceClient> source_client); | 38 mojo::InterfacePtr<serial::DataSourceClient> source_client); |
37 | 39 |
38 private: | 40 private: |
39 friend class base::RefCountedThreadSafe<SerialConnectionFactory>; | 41 friend class base::RefCountedThreadSafe<SerialConnectionFactory>; |
40 class ConnectTask; | 42 class ConnectTask; |
41 | 43 |
42 virtual ~SerialConnectionFactory(); | 44 virtual ~SerialConnectionFactory(); |
43 | 45 |
44 const IoHandlerFactory io_handler_factory_; | 46 const IoHandlerFactory io_handler_factory_; |
45 scoped_refptr<base::MessageLoopProxy> connect_message_loop_; | 47 scoped_refptr<base::SingleThreadTaskRunner> connect_task_runner_; |
46 | 48 |
47 DISALLOW_COPY_AND_ASSIGN(SerialConnectionFactory); | 49 DISALLOW_COPY_AND_ASSIGN(SerialConnectionFactory); |
48 }; | 50 }; |
49 | 51 |
50 } // namespace device | 52 } // namespace device |
51 | 53 |
52 #endif // DEVICE_SERIAL_SERIAL_CONNECTION_FACTORY_H_ | 54 #endif // DEVICE_SERIAL_SERIAL_CONNECTION_FACTORY_H_ |
OLD | NEW |