OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_EVENT_EMITTER_PIPE_H_ | 5 #ifndef LIBRARIES_NACL_IO_EVENT_EMITTER_PIPE_H_ |
6 #define LIBRARIES_NACL_IO_EVENT_EMITTER_PIPE_H_ | 6 #define LIBRARIES_NACL_IO_EVENT_EMITTER_PIPE_H_ |
7 | 7 |
8 #include <poll.h> | 8 #include <poll.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <stdlib.h> | 10 #include <stdlib.h> |
11 | 11 |
12 #include "nacl_io/event_emitter_stream.h" | 12 #include "nacl_io/event_emitter_stream.h" |
13 #include "nacl_io/fifo_char.h" | 13 #include "nacl_io/fifo_char.h" |
14 | 14 |
15 #include "sdk_util/auto_lock.h" | 15 #include "sdk_util/auto_lock.h" |
16 #include "sdk_util/macros.h" | 16 #include "sdk_util/macros.h" |
17 | 17 |
18 namespace nacl_io { | 18 namespace nacl_io { |
19 | 19 |
20 class EventEmitterPipe; | 20 class EventEmitterPipe; |
21 typedef sdk_util::ScopedRef<EventEmitterPipe> ScopedEventEmitterPipe; | 21 typedef sdk_util::ScopedRef<EventEmitterPipe> ScopedEventEmitterPipe; |
22 | 22 |
23 class EventEmitterPipe : public EventEmitterStream { | 23 class EventEmitterPipe : public EventEmitterStream { |
24 public: | 24 public: |
25 EventEmitterPipe(size_t size); | 25 EventEmitterPipe(size_t size); |
26 | 26 |
27 size_t Read_Locked(char* data, size_t len); | 27 size_t Read_Locked(char* data, size_t len); |
28 size_t Write_Locked(const char* data, size_t len); | 28 size_t Write_Locked(const char* data, size_t len); |
29 | 29 |
| 30 protected: |
30 virtual FIFOChar* in_fifo() { return &fifo_; } | 31 virtual FIFOChar* in_fifo() { return &fifo_; } |
31 virtual FIFOChar* out_fifo() { return &fifo_; } | 32 virtual FIFOChar* out_fifo() { return &fifo_; } |
32 | 33 |
33 private: | 34 private: |
34 FIFOChar fifo_; | 35 FIFOChar fifo_; |
35 DISALLOW_COPY_AND_ASSIGN(EventEmitterPipe); | 36 DISALLOW_COPY_AND_ASSIGN(EventEmitterPipe); |
36 }; | 37 }; |
37 | 38 |
38 } // namespace nacl_io | 39 } // namespace nacl_io |
39 | 40 |
40 #endif // LIBRARIES_NACL_IO_EVENT_EMITTER_PIPE_H_ | 41 #endif // LIBRARIES_NACL_IO_EVENT_EMITTER_PIPE_H_ |
41 | 42 |
OLD | NEW |