Chromium Code Reviews| 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..1ffca32f5f2428d96b11b67afc5911c5981ecd82 |
| --- /dev/null |
| +++ b/native_client_sdk/src/libraries/nacl_io/packet.h |
| @@ -0,0 +1,50 @@ |
| +// 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 <string.h> |
| + |
| +#include <list> |
| +#include <vector> |
|
binji
2013/09/19 00:48:55
remove unneeded headers
noelallen1
2013/09/19 21:29:27
Done.
|
| + |
| +#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); |
|
binji
2013/09/19 00:48:55
turn this into an alternate constructor?
noelallen1
2013/09/20 00:51:27
Going to circle back on this.
|
| + |
| + // Take ownership the buffer, and address reference |
| + void Take(const void *buffer, size_t len, PP_Resource addr); |
|
binji
2013/09/19 00:48:55
unused. Remove?
noelallen1
2013/09/19 21:29:27
I was using this... I'll dbl check and remote. Or
|
| + |
| + 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_ |