| 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_FIFO_PACKET_H_ | 5 #ifndef LIBRARIES_NACL_IO_FIFO_PACKET_H_ |
| 6 #define LIBRARIES_NACL_IO_FIFO_PACKET_H_ | 6 #define LIBRARIES_NACL_IO_FIFO_PACKET_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 8 #include <string.h> | 9 #include <string.h> |
| 9 | 10 |
| 10 #include <list> | 11 #include <list> |
| 11 | 12 |
| 12 #include "nacl_io/fifo_interface.h" | 13 #include "nacl_io/fifo_interface.h" |
| 13 #include "ppapi/c/pp_resource.h" | 14 #include "ppapi/c/pp_resource.h" |
| 14 | 15 |
| 15 #include "sdk_util/macros.h" | 16 #include "sdk_util/macros.h" |
| 16 | 17 |
| 17 namespace nacl_io { | 18 namespace nacl_io { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 38 | 39 |
| 39 // Return a pointer to the top packet without releasing ownership. | 40 // Return a pointer to the top packet without releasing ownership. |
| 40 Packet* PeekPacket(); | 41 Packet* PeekPacket(); |
| 41 | 42 |
| 42 // Relinquish top packet, and remove it from the FIFO. | 43 // Relinquish top packet, and remove it from the FIFO. |
| 43 Packet* ReadPacket(); | 44 Packet* ReadPacket(); |
| 44 | 45 |
| 45 // Take ownership of packet and place it in the FIFO. | 46 // Take ownership of packet and place it in the FIFO. |
| 46 void WritePacket(Packet* packet); | 47 void WritePacket(Packet* packet); |
| 47 | 48 |
| 49 // Read out the top packet into a byte buffer. |
| 50 size_t Read(void* buf, size_t len); |
| 51 |
| 52 // Enqueue a new packet from a byte buffer. |
| 53 size_t Write(const void* buf, size_t len); |
| 54 |
| 48 private: | 55 private: |
| 49 std::list<Packet*> packets_; | 56 std::list<Packet*> packets_; |
| 50 uint32_t max_bytes_; | 57 uint32_t max_bytes_; |
| 51 uint32_t cur_bytes_; | 58 uint32_t cur_bytes_; |
| 52 | 59 |
| 53 DISALLOW_COPY_AND_ASSIGN(FIFOPacket); | 60 DISALLOW_COPY_AND_ASSIGN(FIFOPacket); |
| 54 }; | 61 }; |
| 55 | 62 |
| 56 } // namespace nacl_io | 63 } // namespace nacl_io |
| 57 | 64 |
| 58 #endif // LIBRARIES_NACL_IO_FIFO_PACKET_H_ | 65 #endif // LIBRARIES_NACL_IO_FIFO_PACKET_H_ |
| OLD | NEW |