| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 LIBRARIES_NACL_IO_DEVFS_TTY_NODE_H_ | 5 #ifndef LIBRARIES_NACL_IO_DEVFS_TTY_NODE_H_ |
| 6 #define LIBRARIES_NACL_IO_DEVFS_TTY_NODE_H_ | 6 #define LIBRARIES_NACL_IO_DEVFS_TTY_NODE_H_ |
| 7 | 7 |
| 8 #include <poll.h> | 8 #include <poll.h> |
| 9 #include <pthread.h> | 9 #include <pthread.h> |
| 10 | 10 |
| 11 #include <deque> | 11 #include <deque> |
| 12 | 12 |
| 13 #include <ppapi/c/pp_var.h> |
| 14 |
| 13 #include "nacl_io/char_node.h" | 15 #include "nacl_io/char_node.h" |
| 14 #include "nacl_io/ioctl.h" | 16 #include "nacl_io/ioctl.h" |
| 15 #include "nacl_io/ostermios.h" | 17 #include "nacl_io/ostermios.h" |
| 16 | 18 |
| 17 namespace nacl_io { | 19 namespace nacl_io { |
| 18 | 20 |
| 19 class TtyNode : public CharNode { | 21 class TtyNode : public CharNode { |
| 20 public: | 22 public: |
| 21 explicit TtyNode(Filesystem* filesystem); | 23 explicit TtyNode(Filesystem* filesystem); |
| 22 | 24 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 36 | 38 |
| 37 virtual Error Tcgetattr(struct termios* termios_p); | 39 virtual Error Tcgetattr(struct termios* termios_p); |
| 38 virtual Error Tcsetattr(int optional_actions, | 40 virtual Error Tcsetattr(int optional_actions, |
| 39 const struct termios* termios_p); | 41 const struct termios* termios_p); |
| 40 | 42 |
| 41 virtual Error Isatty() { return 0; } | 43 virtual Error Isatty() { return 0; } |
| 42 | 44 |
| 43 private: | 45 private: |
| 44 ScopedEventEmitter emitter_; | 46 ScopedEventEmitter emitter_; |
| 45 | 47 |
| 46 Error ProcessInput(struct tioc_nacl_input_string* message); | 48 Error ProcessInput(PP_Var var); |
| 49 Error ProcessInput(const char* buffer, size_t num_bytes); |
| 47 Error Echo(const char* string, int count); | 50 Error Echo(const char* string, int count); |
| 48 void InitTermios(); | 51 void InitTermios(); |
| 49 | 52 |
| 50 std::deque<char> input_buffer_; | 53 std::deque<char> input_buffer_; |
| 51 struct termios termios_; | 54 struct termios termios_; |
| 52 | 55 |
| 53 /// Current height of terminal in rows. Set via ioctl(2). | 56 /// Current height of terminal in rows. Set via ioctl(2). |
| 54 int rows_; | 57 int rows_; |
| 55 /// Current width of terminal in columns. Set via ioctl(2). | 58 /// Current width of terminal in columns. Set via ioctl(2). |
| 56 int cols_; | 59 int cols_; |
| 57 | 60 |
| 58 // Output handler for TTY. This is set via ioctl(2). | 61 // Output handler for TTY. This is set via ioctl(2). |
| 59 struct tioc_nacl_output output_handler_; | 62 struct tioc_nacl_output output_handler_; |
| 60 // Lock to protect output_handler_. This lock gets aquired whenever | 63 // Lock to protect output_handler_. This lock gets aquired whenever |
| 61 // output_handler_ is used or set. | 64 // output_handler_ is used or set. |
| 62 sdk_util::SimpleLock output_lock_; | 65 sdk_util::SimpleLock output_lock_; |
| 63 }; | 66 }; |
| 64 | 67 |
| 65 } // namespace nacl_io | 68 } // namespace nacl_io |
| 66 | 69 |
| 67 #endif // LIBRARIES_NACL_IO_DEVFS_TTY_NODE_H_ | 70 #endif // LIBRARIES_NACL_IO_DEVFS_TTY_NODE_H_ |
| OLD | NEW |