Update the ICU's default timezone in browser/renderer
[chromium-blink-merge.git] / device / serial / serial_io_handler_posix.h
blob9a5b8329bcc41b61af4de05204219b79b8627819
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
3 // found in the LICENSE file.
5 #ifndef DEVICE_SERIAL_SERIAL_IO_HANDLER_POSIX_H_
6 #define DEVICE_SERIAL_SERIAL_IO_HANDLER_POSIX_H_
8 #include "base/message_loop/message_loop.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h"
11 #include "device/serial/serial_io_handler.h"
13 namespace device {
15 class SerialIoHandlerPosix : public SerialIoHandler,
16 public base::MessageLoopForIO::Watcher {
17 protected:
18 // SerialIoHandler impl.
19 void ReadImpl() override;
20 void WriteImpl() override;
21 void CancelReadImpl() override;
22 void CancelWriteImpl() override;
23 bool ConfigurePortImpl() override;
24 bool Flush() const override;
25 serial::DeviceControlSignalsPtr GetControlSignals() const override;
26 bool SetControlSignals(
27 const serial::HostControlSignals& control_signals) override;
28 serial::ConnectionInfoPtr GetPortInfo() const override;
29 void RequestAccess(
30 const std::string& port,
31 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner,
32 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) override;
34 private:
35 friend class SerialIoHandler;
37 SerialIoHandlerPosix(
38 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner,
39 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner);
40 ~SerialIoHandlerPosix() override;
42 // base::MessageLoopForIO::Watcher implementation.
43 void OnFileCanWriteWithoutBlocking(int fd) override;
44 void OnFileCanReadWithoutBlocking(int fd) override;
46 void EnsureWatchingReads();
47 void EnsureWatchingWrites();
49 base::MessageLoopForIO::FileDescriptorWatcher file_read_watcher_;
50 base::MessageLoopForIO::FileDescriptorWatcher file_write_watcher_;
52 // Flags indicating if the message loop is watching the device for IO events.
53 bool is_watching_reads_;
54 bool is_watching_writes_;
56 DISALLOW_COPY_AND_ASSIGN(SerialIoHandlerPosix);
59 } // namespace device
61 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_POSIX_H_