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

Side by Side Diff: device/serial/serial_io_handler_posix.h

Issue 873903002: Set serial connection parameters immediately on connect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a comment explaing the "set" notation. Created 5 years, 10 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
« no previous file with comments | « device/serial/serial_io_handler.cc ('k') | device/serial/serial_io_handler_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_IO_HANDLER_POSIX_H_ 5 #ifndef DEVICE_SERIAL_SERIAL_IO_HANDLER_POSIX_H_
6 #define DEVICE_SERIAL_SERIAL_IO_HANDLER_POSIX_H_ 6 #define DEVICE_SERIAL_SERIAL_IO_HANDLER_POSIX_H_
7 7
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "device/serial/serial_io_handler.h" 9 #include "device/serial/serial_io_handler.h"
10 10
11 namespace device { 11 namespace device {
12 12
13 class SerialIoHandlerPosix : public SerialIoHandler, 13 class SerialIoHandlerPosix : public SerialIoHandler,
14 public base::MessageLoopForIO::Watcher { 14 public base::MessageLoopForIO::Watcher {
15 protected: 15 protected:
16 // SerialIoHandler impl. 16 // SerialIoHandler impl.
17 void ReadImpl() override; 17 void ReadImpl() override;
18 void WriteImpl() override; 18 void WriteImpl() override;
19 void CancelReadImpl() override; 19 void CancelReadImpl() override;
20 void CancelWriteImpl() override; 20 void CancelWriteImpl() override;
21 bool ConfigurePortImpl() override;
21 bool Flush() const override; 22 bool Flush() const override;
22 serial::DeviceControlSignalsPtr GetControlSignals() const override; 23 serial::DeviceControlSignalsPtr GetControlSignals() const override;
23 bool SetControlSignals( 24 bool SetControlSignals(
24 const serial::HostControlSignals& control_signals) override; 25 const serial::HostControlSignals& control_signals) override;
25 bool ConfigurePort(const serial::ConnectionOptions& options) override;
26 serial::ConnectionInfoPtr GetPortInfo() const override; 26 serial::ConnectionInfoPtr GetPortInfo() const override;
27 void RequestAccess( 27 void RequestAccess(
28 const std::string& port, 28 const std::string& port,
29 scoped_refptr<base::MessageLoopProxy> file_message_loop, 29 scoped_refptr<base::MessageLoopProxy> file_message_loop,
30 scoped_refptr<base::MessageLoopProxy> ui_message_loop) override; 30 scoped_refptr<base::MessageLoopProxy> ui_message_loop) override;
31 bool PostOpen() override;
32 31
33 private: 32 private:
34 friend class SerialIoHandler; 33 friend class SerialIoHandler;
35 34
36 SerialIoHandlerPosix( 35 SerialIoHandlerPosix(
37 scoped_refptr<base::MessageLoopProxy> file_thread_message_loop, 36 scoped_refptr<base::MessageLoopProxy> file_thread_message_loop,
38 scoped_refptr<base::MessageLoopProxy> ui_thread_message_loop); 37 scoped_refptr<base::MessageLoopProxy> ui_thread_message_loop);
39 ~SerialIoHandlerPosix() override; 38 ~SerialIoHandlerPosix() override;
40 39
41 // base::MessageLoopForIO::Watcher implementation. 40 // base::MessageLoopForIO::Watcher implementation.
42 void OnFileCanWriteWithoutBlocking(int fd) override; 41 void OnFileCanWriteWithoutBlocking(int fd) override;
43 void OnFileCanReadWithoutBlocking(int fd) override; 42 void OnFileCanReadWithoutBlocking(int fd) override;
44 43
45 void EnsureWatchingReads(); 44 void EnsureWatchingReads();
46 void EnsureWatchingWrites(); 45 void EnsureWatchingWrites();
47 46
48 base::MessageLoopForIO::FileDescriptorWatcher file_read_watcher_; 47 base::MessageLoopForIO::FileDescriptorWatcher file_read_watcher_;
49 base::MessageLoopForIO::FileDescriptorWatcher file_write_watcher_; 48 base::MessageLoopForIO::FileDescriptorWatcher file_write_watcher_;
50 49
51 // Flags indicating if the message loop is watching the device for IO events. 50 // Flags indicating if the message loop is watching the device for IO events.
52 bool is_watching_reads_; 51 bool is_watching_reads_;
53 bool is_watching_writes_; 52 bool is_watching_writes_;
54 53
55 DISALLOW_COPY_AND_ASSIGN(SerialIoHandlerPosix); 54 DISALLOW_COPY_AND_ASSIGN(SerialIoHandlerPosix);
56 }; 55 };
57 56
58 } // namespace device 57 } // namespace device
59 58
60 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_POSIX_H_ 59 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_POSIX_H_
OLDNEW
« no previous file with comments | « device/serial/serial_io_handler.cc ('k') | device/serial/serial_io_handler_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698