Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/socket/fifo_packet.h

Issue 1679643002: nacl_io: Add SOCK_DGRAM support to socketpair() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit test failure Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698