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

Unified Diff: ppapi/proxy/resource_message_params.cc

Issue 10912062: Implement the gamepad API in the IPC proxy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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/resource_message_params.h ('k') | ppapi/shared_impl/ppapi_permissions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/resource_message_params.cc
diff --git a/ppapi/proxy/resource_message_params.cc b/ppapi/proxy/resource_message_params.cc
index 5c70e49d98ea9799f6e3ba2cb80d601b841e9075..6d3fa02f465236e903b54445ca1c8700cce15aa2 100644
--- a/ppapi/proxy/resource_message_params.cc
+++ b/ppapi/proxy/resource_message_params.cc
@@ -27,12 +27,51 @@ ResourceMessageParams::~ResourceMessageParams() {
void ResourceMessageParams::Serialize(IPC::Message* msg) const {
IPC::ParamTraits<PP_Resource>::Write(msg, pp_resource_);
IPC::ParamTraits<int32_t>::Write(msg, sequence_);
+ IPC::ParamTraits<std::vector<SerializedHandle> >::Write(msg, handles_);
}
bool ResourceMessageParams::Deserialize(const IPC::Message* msg,
PickleIterator* iter) {
return IPC::ParamTraits<PP_Resource>::Read(msg, iter, &pp_resource_) &&
- IPC::ParamTraits<int32_t>::Read(msg, iter, &sequence_);
+ IPC::ParamTraits<int32_t>::Read(msg, iter, &sequence_) &&
+ IPC::ParamTraits<std::vector<SerializedHandle> >::Read(
+ msg, iter, &handles_);
+}
+
+const SerializedHandle* ResourceMessageParams::GetHandleOfTypeAtIndex(
+ size_t index,
+ SerializedHandle::Type type) const {
+ if (handles_.size() <= index)
+ return NULL;
+ if (handles_[index].type() != type)
+ return NULL;
+ return &handles_[index];
+}
+
+bool ResourceMessageParams::GetSharedMemoryHandleAtIndex(
+ size_t index,
+ base::SharedMemoryHandle* handle) const {
+ const SerializedHandle* serialized = GetHandleOfTypeAtIndex(
+ index, SerializedHandle::SHARED_MEMORY);
+ if (!serialized)
+ return false;
+ *handle = serialized->shmem();
+ return true;
+}
+
+bool ResourceMessageParams::GetSocketHandleAtIndex(
+ size_t index,
+ IPC::PlatformFileForTransit* handle) const {
+ const SerializedHandle* serialized = GetHandleOfTypeAtIndex(
+ index, SerializedHandle::SOCKET);
+ if (!serialized)
+ return false;
+ *handle = serialized->descriptor();
+ return true;
+}
+
+void ResourceMessageParams::AppendHandle(const SerializedHandle& handle) {
+ handles_.push_back(handle);
}
ResourceMessageCallParams::ResourceMessageCallParams()
« no previous file with comments | « ppapi/proxy/resource_message_params.h ('k') | ppapi/shared_impl/ppapi_permissions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698