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

Unified Diff: ppapi/proxy/serialized_structs.h

Issue 10912011: Change NaCl IPC PPAPI proxy startup to support a NaCl-Browser process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « ppapi/proxy/ppb_audio_proxy.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
===================================================================
--- ppapi/proxy/serialized_structs.h (revision 154143)
+++ ppapi/proxy/serialized_structs.h (working copy)
@@ -107,7 +107,7 @@
// them in NaClIPCAdapter for use in NaCl.
class PPAPI_PROXY_EXPORT SerializedHandle {
public:
- enum Type { INVALID, SHARED_MEMORY, SOCKET };
+ enum Type { INVALID, SHARED_MEMORY, SOCKET, CHANNEL_HANDLE };
struct Header {
Header() : type(INVALID), size(0) {}
Header(Type type_arg, uint32_t size_arg)
@@ -124,15 +124,14 @@
// Create a shared memory handle.
SerializedHandle(const base::SharedMemoryHandle& handle, uint32_t size);
- // Create a socket handle.
- // TODO(dmichael): If we have other ways to use FDs later, this would be
- // ambiguous.
- explicit SerializedHandle(
- const IPC::PlatformFileForTransit& socket_descriptor);
+ // Create a socket or channel handle.
+ SerializedHandle(const Type type,
+ const IPC::PlatformFileForTransit& descriptor);
Type type() const { return type_; }
bool is_shmem() const { return type_ == SHARED_MEMORY; }
bool is_socket() const { return type_ == SOCKET; }
+ bool is_channel_handle() const { return type_ == CHANNEL_HANDLE; }
const base::SharedMemoryHandle& shmem() const {
DCHECK(is_shmem());
return shm_handle_;
@@ -142,7 +141,7 @@
return size_;
}
const IPC::PlatformFileForTransit& descriptor() const {
- DCHECK(is_socket());
+ DCHECK(is_socket() || is_channel_handle());
return descriptor_;
}
void set_shmem(const base::SharedMemoryHandle& handle, uint32_t size) {
@@ -159,12 +158,22 @@
shm_handle_ = base::SharedMemory::NULLHandle();
size_ = 0;
}
+ void set_channel_handle(const IPC::PlatformFileForTransit& descriptor) {
+ type_ = CHANNEL_HANDLE;
+
+ descriptor_ = descriptor;
+ shm_handle_ = base::SharedMemory::NULLHandle();
+ size_ = 0;
+ }
void set_null_shmem() {
set_shmem(base::SharedMemory::NULLHandle(), 0);
}
void set_null_socket() {
set_socket(IPC::InvalidPlatformFileForTransit());
}
+ void set_null_channel_handle() {
+ set_channel_handle(IPC::InvalidPlatformFileForTransit());
+ }
bool IsHandleValid() const;
Header header() const {
@@ -189,7 +198,7 @@
base::SharedMemoryHandle shm_handle_;
uint32_t size_;
- // This is valid if type == SOCKET.
+ // This is valid if type == SOCKET || type == CHANNEL_HANDLE.
IPC::PlatformFileForTransit descriptor_;
};
« no previous file with comments | « ppapi/proxy/ppb_audio_proxy.cc ('k') | ppapi/proxy/serialized_structs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698