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

Unified Diff: ppapi/proxy/serialized_structs.h

Issue 11359097: Refactored the PPB_Flash_File_ModuleLocal/FileRef to the new ppapi resource model (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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
« no previous file with comments | « ppapi/proxy/resource_message_params.cc ('k') | ppapi/proxy/serialized_structs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/serialized_structs.h
diff --git a/ppapi/proxy/serialized_structs.h b/ppapi/proxy/serialized_structs.h
index 04d7f5d1cea8fbc972ba381ba09f0d961ed2ff51..bdc1b678bc5b1b8370c3aeaa7d9c3308f7a770cc 100644
--- a/ppapi/proxy/serialized_structs.h
+++ b/ppapi/proxy/serialized_structs.h
@@ -91,7 +91,7 @@ struct PPBURLLoader_UpdateProgress_Params {
// them in NaClIPCAdapter for use in NaCl.
class PPAPI_PROXY_EXPORT SerializedHandle {
public:
- enum Type { INVALID, SHARED_MEMORY, SOCKET, CHANNEL_HANDLE };
+ enum Type { INVALID, SHARED_MEMORY, SOCKET, CHANNEL_HANDLE, FILE };
struct Header {
Header() : type(INVALID), size(0) {}
Header(Type type_arg, uint32_t size_arg)
@@ -108,7 +108,7 @@ class PPAPI_PROXY_EXPORT SerializedHandle {
// Create a shared memory handle.
SerializedHandle(const base::SharedMemoryHandle& handle, uint32_t size);
- // Create a socket or channel handle.
+ // Create a socket, channel or file handle.
SerializedHandle(const Type type,
const IPC::PlatformFileForTransit& descriptor);
@@ -116,6 +116,7 @@ class PPAPI_PROXY_EXPORT SerializedHandle {
bool is_shmem() const { return type_ == SHARED_MEMORY; }
bool is_socket() const { return type_ == SOCKET; }
bool is_channel_handle() const { return type_ == CHANNEL_HANDLE; }
+ bool is_file() const { return type_ == FILE; }
const base::SharedMemoryHandle& shmem() const {
DCHECK(is_shmem());
return shm_handle_;
@@ -125,7 +126,7 @@ class PPAPI_PROXY_EXPORT SerializedHandle {
return size_;
}
const IPC::PlatformFileForTransit& descriptor() const {
- DCHECK(is_socket() || is_channel_handle());
+ DCHECK(is_socket() || is_channel_handle() || is_file());
return descriptor_;
}
void set_shmem(const base::SharedMemoryHandle& handle, uint32_t size) {
@@ -149,6 +150,13 @@ class PPAPI_PROXY_EXPORT SerializedHandle {
shm_handle_ = base::SharedMemory::NULLHandle();
size_ = 0;
}
+ void set_file_handle(const IPC::PlatformFileForTransit& descriptor) {
+ type_ = FILE;
+
+ descriptor_ = descriptor;
+ shm_handle_ = base::SharedMemory::NULLHandle();
+ size_ = 0;
+ }
void set_null_shmem() {
set_shmem(base::SharedMemory::NULLHandle(), 0);
}
@@ -158,6 +166,9 @@ class PPAPI_PROXY_EXPORT SerializedHandle {
void set_null_channel_handle() {
set_channel_handle(IPC::InvalidPlatformFileForTransit());
}
+ void set_null_file_handle() {
+ set_file_handle(IPC::InvalidPlatformFileForTransit());
+ }
bool IsHandleValid() const;
Header header() const {
« no previous file with comments | « ppapi/proxy/resource_message_params.cc ('k') | ppapi/proxy/serialized_structs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698