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

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

Issue 23498015: [NaCl SDK] Support non blocking TCP/UDP (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef LIBRARIES_NACL_IO_FIFO_PACKET_H_
6 #define LIBRARIES_NACL_IO_FIFO_PACKET_H_
7
8 #include <string.h>
9
10 #include <list>
11 #include <vector>
12
13 #include "nacl_io/fifo_interface.h"
14 #include "ppapi/c/pp_resource.h"
15
16 #include "sdk_util/macros.h"
17
18 namespace nacl_io {
19
20 class Packet;
21
22 // FIFOPacket
23 //
24 // A FIFOPackiet is linked list of packets. Data is stored and returned
25 // in packet size increments. FIFOPacket signals EMPTY where there are
26 // no packets, and FULL when the total bytes of all packets meets or
27 // exceeds the max size hint.
28 class FIFOPacket : public FIFOInterface {
29 public:
30 explicit FIFOPacket(size_t size);
31 virtual ~FIFOPacket();
32
33 virtual bool IsEmpty();
34 virtual bool IsFull();
35 virtual bool Resize(size_t len);
36
37 size_t ReadAvailable();
38 size_t WriteAvailable();
39
40 // Return a pointer to the top packet without releasing ownership.
41 Packet* PeekPacket();
42
43 // Relinquish top packet, and remove it from the FIFO.
44 Packet* ReadPacket();
45
46 // Take ownership of packet and place it in the FIFO.
47 void WritePacket(Packet* packet);
48
49 private:
50 std::list<Packet*> packets_;
51 uint32_t max_bytes_;
52 uint32_t cur_bytes_;
53
54 DISALLOW_COPY_AND_ASSIGN(FIFOPacket);
55 };
56
57 } // namespace nacl_io
58
59 #endif // LIBRARIES_NACL_IO_FIFO_PACKET_H_
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/fifo_null.h ('k') | native_client_sdk/src/libraries/nacl_io/fifo_packet.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698