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

Unified Diff: native_client_sdk/src/libraries/nacl_io/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 side-by-side diff with in-line comments
Download patch
Index: native_client_sdk/src/libraries/nacl_io/packet.h
diff --git a/native_client_sdk/src/libraries/nacl_io/packet.h b/native_client_sdk/src/libraries/nacl_io/packet.h
new file mode 100644
index 0000000000000000000000000000000000000000..46f3b3b710fdd5a022a3021b1dae12a7224830ed
--- /dev/null
+++ b/native_client_sdk/src/libraries/nacl_io/packet.h
@@ -0,0 +1,45 @@
+// 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_PACKET_H_
+#define LIBRARIES_NACL_IO_PACKET_H_
+
+#include "nacl_io/fifo_interface.h"
+#include "ppapi/c/pp_resource.h"
+
+#include "sdk_util/macros.h"
+
+namespace nacl_io {
+
+class PepperInterface;
+
+// NOTE: The Packet class always owns the buffer and address, either by 'Copy'
+// or by 'Take' ownership.
+class Packet {
+ public:
+ explicit Packet(PepperInterface* ppapi);
+ ~Packet();
+
+ // Copy the buffer, and address reference
+ void Copy(const void *buffer, size_t len, PP_Resource addr);
+
+ // Take ownership the buffer, and address reference
+ void Take(const void *buffer, size_t len, PP_Resource addr);
+
+ char* buffer() { return buffer_; }
+ PP_Resource addr() { return addr_; }
+ size_t len() { return len_; }
+
+ private:
+ PepperInterface* ppapi_;
+ PP_Resource addr_;
+ char* buffer_;
+ size_t len_;
+
+ DISALLOW_COPY_AND_ASSIGN(Packet);
+};
+
+} // namespace nacl_io
+
+#endif // LIBRARIES_NACL_IO_PACKET_H_
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/mount_stream.cc ('k') | native_client_sdk/src/libraries/nacl_io/packet.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698