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

Unified Diff: ppapi/proxy/ppapi_param_traits.cc

Issue 10828023: PPAPI/NaCl: Make NaClIPCAdapter transfer handles more generally (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-add gyp files 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/ppapi_param_traits.h ('k') | ppapi/proxy/ppapi_proxy_export.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppapi_param_traits.cc
diff --git a/ppapi/proxy/ppapi_param_traits.cc b/ppapi/proxy/ppapi_param_traits.cc
index 87ce4fc1ee7fcc01a824c0e09e79689144944f76..bcb2df067e6848db40e229c9dafbe0108b40a77f 100644
--- a/ppapi/proxy/ppapi_param_traits.cc
+++ b/ppapi/proxy/ppapi_param_traits.cc
@@ -312,7 +312,62 @@ void ParamTraits< std::vector<ppapi::PPB_FileRef_CreateInfo> >::Log(
std::string* l) {
}
-#if !defined(OS_NACL)
+// SerializedHandle ------------------------------------------------------------
+
+// static
+void ParamTraits<ppapi::proxy::SerializedHandle>::Write(Message* m,
+ const param_type& p) {
+ ppapi::proxy::SerializedHandle::WriteHeader(p.header(), m);
+ switch (p.type()) {
+ case ppapi::proxy::SerializedHandle::SHARED_MEMORY:
+ ParamTraits<base::SharedMemoryHandle>::Write(m, p.shmem());
+ break;
+ case ppapi::proxy::SerializedHandle::SOCKET:
+ ParamTraits<IPC::PlatformFileForTransit>::Write(m, p.descriptor());
+ break;
+ case ppapi::proxy::SerializedHandle::INVALID:
+ break;
+ // No default so the compiler will warn on new types.
+ }
+}
+
+// static
+bool ParamTraits<ppapi::proxy::SerializedHandle>::Read(const Message* m,
+ PickleIterator* iter,
+ param_type* r) {
+ ppapi::proxy::SerializedHandle::Header header;
+ if (!ppapi::proxy::SerializedHandle::ReadHeader(iter, &header))
+ return false;
+ switch (header.type) {
+ case ppapi::proxy::SerializedHandle::SHARED_MEMORY: {
+ base::SharedMemoryHandle handle;
+ if (ParamTraits<base::SharedMemoryHandle>::Read(m, iter, &handle)) {
+ r->set_shmem(handle, header.size);
+ return true;
+ }
+ break;
+ }
+ case ppapi::proxy::SerializedHandle::SOCKET: {
+ IPC::PlatformFileForTransit socket;
+ if (ParamTraits<IPC::PlatformFileForTransit>::Read(m, iter, &socket)) {
+ r->set_socket(socket);
+ return true;
+ }
+ break;
+ }
+ case ppapi::proxy::SerializedHandle::INVALID:
+ return true;
+ // No default so the compiler will warn us if a new type is added.
+ }
+ return false;
+}
+
+// static
+void ParamTraits<ppapi::proxy::SerializedHandle>::Log(const param_type& p,
+ std::string* l) {
+}
+
+#if !defined(OS_NACL) && !defined(NACL_WIN64)
// PPBFlash_DrawGlyphs_Params --------------------------------------------------
// static
void ParamTraits<ppapi::proxy::PPBFlash_DrawGlyphs_Params>::Write(
@@ -507,6 +562,6 @@ bool ParamTraits<ppapi::PPB_X509Certificate_Fields>::Read(const Message* m,
void ParamTraits<ppapi::PPB_X509Certificate_Fields>::Log(const param_type& p,
std::string* l) {
}
-#endif // !defined(OS_NACL)
+#endif // !defined(OS_NACL) && !defined(NACL_WIN64)
} // namespace IPC
« no previous file with comments | « ppapi/proxy/ppapi_param_traits.h ('k') | ppapi/proxy/ppapi_proxy_export.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698