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

Unified Diff: ppapi/proxy/ppapi_param_traits.cc

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, 1 month 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: ppapi/proxy/ppapi_param_traits.cc
diff --git a/ppapi/proxy/ppapi_param_traits.cc b/ppapi/proxy/ppapi_param_traits.cc
index 763d05c4ade08aada8200118d528f82eb67050c5..ea792e6d30dfb77f8ac46ceaba46f8469febe575 100644
--- a/ppapi/proxy/ppapi_param_traits.cc
+++ b/ppapi/proxy/ppapi_param_traits.cc
@@ -346,6 +346,7 @@ void ParamTraits<ppapi::proxy::SerializedHandle>::Write(Message* m,
break;
case ppapi::proxy::SerializedHandle::SOCKET:
case ppapi::proxy::SerializedHandle::CHANNEL_HANDLE:
+ case ppapi::proxy::SerializedHandle::FILE:
ParamTraits<IPC::PlatformFileForTransit>::Write(m, p.descriptor());
break;
case ppapi::proxy::SerializedHandle::INVALID:
@@ -386,6 +387,14 @@ bool ParamTraits<ppapi::proxy::SerializedHandle>::Read(const Message* m,
}
break;
}
+ case ppapi::proxy::SerializedHandle::FILE: {
+ IPC::PlatformFileForTransit desc;
+ if (ParamTraits<IPC::PlatformFileForTransit>::Read(m, iter, &desc)) {
+ r->set_file_handle(desc);
+ return true;
+ }
+ break;
+ }
case ppapi::proxy::SerializedHandle::INVALID:
return true;
// No default so the compiler will warn us if a new type is added.
@@ -552,6 +561,41 @@ void ParamTraits<ppapi::proxy::SerializedFontDescription>::Log(
std::string* l) {
}
+// ppapi::PepperFilePath -------------------------------------------------------
+
+// static
+void ParamTraits<ppapi::PepperFilePath>::Write(Message* m,
+ const param_type& p) {
+ WriteParam(m, static_cast<unsigned>(p.domain()));
+ WriteParam(m, p.path());
+}
+
+// static
+bool ParamTraits<ppapi::PepperFilePath>::Read(const Message* m,
+ PickleIterator* iter,
+ param_type* p) {
+ unsigned domain;
+ FilePath path;
+ if (!ReadParam(m, iter, &domain) || !ReadParam(m, iter, &path))
+ return false;
+ if (domain > ppapi::PepperFilePath::DOMAIN_MAX_VALID)
+ return false;
+
+ *p = ppapi::PepperFilePath(
+ static_cast<ppapi::PepperFilePath::Domain>(domain), path);
+ return true;
+}
+
+// static
+void ParamTraits<ppapi::PepperFilePath>::Log(const param_type& p,
+ std::string* l) {
+ l->append("(");
+ LogParam(static_cast<unsigned>(p.domain()), l);
+ l->append(", ");
+ LogParam(p.path(), l);
+ l->append(")");
+}
+
// SerializedFlashMenu ---------------------------------------------------------
// static

Powered by Google App Engine
This is Rietveld 408576698