OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SOCKET_UNIX_EVENT_EMITTER_H_ | 5 #ifndef LIBRARIES_NACL_IO_SOCKET_UNIX_EVENT_EMITTER_H_ |
6 #define LIBRARIES_NACL_IO_SOCKET_UNIX_EVENT_EMITTER_H_ | 6 #define LIBRARIES_NACL_IO_SOCKET_UNIX_EVENT_EMITTER_H_ |
7 | 7 |
8 #include "nacl_io/fifo_char.h" | 8 #include "nacl_io/fifo_interface.h" |
9 #include "nacl_io/stream/stream_event_emitter.h" | 9 #include "nacl_io/stream/stream_event_emitter.h" |
10 | 10 |
11 #include "sdk_util/macros.h" | 11 #include "sdk_util/macros.h" |
12 #include "sdk_util/scoped_ref.h" | 12 #include "sdk_util/scoped_ref.h" |
13 #include "sdk_util/simple_lock.h" | 13 #include "sdk_util/simple_lock.h" |
14 | 14 |
15 namespace nacl_io { | 15 namespace nacl_io { |
16 | 16 |
17 class UnixEventEmitter; | 17 class UnixEventEmitter; |
18 class Node; | 18 class Node; |
19 | 19 |
20 typedef sdk_util::ScopedRef<UnixEventEmitter> ScopedUnixEventEmitter; | 20 typedef sdk_util::ScopedRef<UnixEventEmitter> ScopedUnixEventEmitter; |
21 | 21 |
22 class UnixEventEmitter : public StreamEventEmitter { | 22 class UnixEventEmitter : public StreamEventEmitter { |
23 public: | 23 public: |
24 uint32_t ReadIn_Locked(char* buffer, uint32_t len); | 24 uint32_t ReadIn_Locked(char* buffer, uint32_t len); |
25 uint32_t WriteOut_Locked(const char* buffer, uint32_t len); | 25 uint32_t WriteOut_Locked(const char* buffer, uint32_t len); |
26 | 26 |
27 uint32_t BytesInOutputFIFO(); | 27 uint32_t BytesInOutputFIFO(); |
28 uint32_t SpaceInInputFIFO(); | 28 uint32_t SpaceInInputFIFO(); |
29 | 29 |
30 virtual ScopedUnixEventEmitter GetPeerEmitter() = 0; | 30 virtual ScopedUnixEventEmitter GetPeerEmitter() = 0; |
31 | 31 |
32 static ScopedUnixEventEmitter MakeUnixEventEmitter(size_t size); | 32 static ScopedUnixEventEmitter MakeUnixEventEmitter(size_t size, int type); |
33 | 33 |
34 protected: | 34 protected: |
35 UnixEventEmitter() {} | 35 UnixEventEmitter() {} |
36 | 36 |
37 // Probably only need the master's lock. | 37 // Probably only need the master's lock. |
38 virtual const sdk_util::SimpleLock& GetFifoLock() = 0; | 38 virtual const sdk_util::SimpleLock& GetFifoLock() = 0; |
39 virtual FIFOInterface* in_fifo() { return in_fifoc(); } | 39 virtual FIFOInterface* in_fifo() { return in_fifoc(); } |
40 virtual FIFOInterface* out_fifo() { return out_fifoc(); } | 40 virtual FIFOInterface* out_fifo() { return out_fifoc(); } |
41 virtual FIFOChar* in_fifoc() = 0; | 41 virtual FIFOInterface* in_fifoc() = 0; |
42 virtual FIFOChar* out_fifoc() = 0; | 42 virtual FIFOInterface* out_fifoc() = 0; |
Sam Clegg
2016/02/08 17:30:55
Can we just drop in_fifoc and out_fifoc now?
cernekee
2016/02/08 22:53:29
Done.
| |
43 | 43 |
44 private: | 44 private: |
45 DISALLOW_COPY_AND_ASSIGN(UnixEventEmitter); | 45 DISALLOW_COPY_AND_ASSIGN(UnixEventEmitter); |
46 }; | 46 }; |
47 | 47 |
48 } // namespace nacl_io | 48 } // namespace nacl_io |
49 | 49 |
50 #endif // LIBRARIES_NACL_IO_SOCKET_UNIX_EVENT_EMITTER_H_ | 50 #endif // LIBRARIES_NACL_IO_SOCKET_UNIX_EVENT_EMITTER_H_ |
OLD | NEW |