Chromium Code Reviews| Index: native_client_sdk/src/libraries/nacl_io/socket/unix_event_emitter.h |
| diff --git a/native_client_sdk/src/libraries/nacl_io/socket/unix_event_emitter.h b/native_client_sdk/src/libraries/nacl_io/socket/unix_event_emitter.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9e1aa8322ef988ccfdd55a81b29573e34b9e3835 |
| --- /dev/null |
| +++ b/native_client_sdk/src/libraries/nacl_io/socket/unix_event_emitter.h |
| @@ -0,0 +1,55 @@ |
| + |
|
binji
2015/09/17 01:03:58
missing line?
avallee
2015/09/17 19:00:31
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef LIBRARIES_NACL_IO_SOCKET_UNIX_EVENT_EMITTER_H_ |
| +#define LIBRARIES_NACL_IO_SOCKET_UNIX_EVENT_EMITTER_H_ |
| + |
| +#include "nacl_io/fifo_char.h" |
| +#include "nacl_io/stream/stream_event_emitter.h" |
| + |
| +#include "sdk_util/macros.h" |
| +#include "sdk_util/scoped_ref.h" |
| +#include "sdk_util/simple_lock.h" |
| + |
| +namespace nacl_io { |
| + |
| +class UnixEventEmitter; |
| +class Node; |
| + |
| +typedef sdk_util::ScopedRef<UnixEventEmitter> ScopedUnixEventEmitter; |
| + |
| +class UnixEventEmitter : public StreamEventEmitter { |
| + public: |
| + uint32_t ReadIn_Locked(char* buffer, uint32_t len); |
| + uint32_t WriteOut_Locked(const char* buffer, uint32_t len); |
| + |
| + // bool GetError_Locked(); |
|
binji
2015/09/17 01:03:58
remove
avallee
2015/09/17 19:00:31
Done.
|
| + // void SetError_Locked(); |
| + // void UpdateStatus_Locked(); |
| + // void SetRecvEndOfStream_Locked(); |
| + |
| + uint32_t BytesInOutputFIFO(); |
| + uint32_t SpaceInInputFIFO(); |
| + |
| + virtual ScopedUnixEventEmitter GetPeerEmitter() = 0; |
| + |
| + static ScopedUnixEventEmitter MakeUnixEventEmitter(size_t size); |
| + |
| + protected: |
| + UnixEventEmitter() {} |
| + |
| + // Probably only need the master's lock. |
| + virtual const sdk_util::SimpleLock& GetFifoLock() = 0; |
| + virtual FIFOInterface* in_fifo() { return in_fifoc(); } |
| + virtual FIFOInterface* out_fifo() { return out_fifoc(); } |
| + virtual FIFOChar* in_fifoc() = 0; |
| + virtual FIFOChar* out_fifoc() = 0; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(UnixEventEmitter); |
| +}; |
| + |
| +} // namespace nacl_io |
| + |
| +#endif // LIBRARIES_NACL_IO_SOCKET_UNIX_EVENT_EMITTER_H_ |