| Index: native_client_sdk/src/libraries/nacl_io/fifo_char.h | 
| diff --git a/native_client_sdk/src/libraries/nacl_io/fifo_char.h b/native_client_sdk/src/libraries/nacl_io/fifo_char.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..e38034aef6e5f622765d37399880efb155d45f5f | 
| --- /dev/null | 
| +++ b/native_client_sdk/src/libraries/nacl_io/fifo_char.h | 
| @@ -0,0 +1,54 @@ | 
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. | 
| +// Use of this source code is governed by a BSD-style license that can be | 
| +// found in the LICENSE file. | 
| + | 
| +#ifndef LIBRARIES_NACL_IO_FIFO_CHAR_H_ | 
| +#define LIBRARIES_NACL_IO_FIFO_CHAR_H_ | 
| + | 
| +#include <vector> | 
| + | 
| +#include "nacl_io/fifo_interface.h" | 
| + | 
| +#include "sdk_util/macros.h" | 
| + | 
| +namespace nacl_io { | 
| + | 
| +// FIFOChar | 
| +// | 
| +// A FIFOChar is a circular buffer, signalling FULL and EMPTY as appropriate. | 
| +class FIFOChar : public FIFOInterface { | 
| + public: | 
| +  explicit FIFOChar(size_t size); | 
| +  virtual ~FIFOChar(); | 
| + | 
| +  virtual bool IsEmpty(); | 
| +  virtual bool IsFull(); | 
| +  virtual bool Resize(size_t len); | 
| + | 
| +  size_t ReadAvailable(); | 
| +  size_t WriteAvailable(); | 
| + | 
| +  // Reads out no more than the requested len without updating the tail. | 
| +  // Returns actual amount read. | 
| +  size_t Peek(void* buf, size_t len); | 
| + | 
| +  // Reads out the data making room in the FIFO.  Returns actual amount | 
| +  // read. | 
| +  size_t Read(void* buf, size_t len); | 
| + | 
| +  // Writes into the FIFO no more than len bytes, returns actual amount | 
| +  // written. | 
| +  size_t Write(const void* buf, size_t len); | 
| + | 
| +private: | 
| +  char* buffer_; | 
| +  size_t size_;   // Size of the FIFO | 
| +  size_t avail_;  // How much data is currently available | 
| +  size_t tail_;   // Next read location | 
| + | 
| +  DISALLOW_COPY_AND_ASSIGN(FIFOChar); | 
| +}; | 
| + | 
| +}  // namespace nacl_io | 
| + | 
| +#endif  // LIBRARIES_NACL_IO_FIFO_CHAR_H_ | 
|  |