summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/resource_message_params.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-10 07:06:39 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-10 07:06:39 +0000
commit00c0d0437c9f6f8896df580bcbeffd022d1cf878 (patch)
tree0177c166101ddd30916ee2eaf50d409d2e86ace2 /ppapi/proxy/resource_message_params.cc
parent7b64f86e2c50c086dba2d3aba2b1a0d22208f072 (diff)
downloadchromium_src-00c0d0437c9f6f8896df580bcbeffd022d1cf878.zip
chromium_src-00c0d0437c9f6f8896df580bcbeffd022d1cf878.tar.gz
chromium_src-00c0d0437c9f6f8896df580bcbeffd022d1cf878.tar.bz2
Implement the gamepad API in the IPC proxy
This does some reworking of the gamepad system to make it possible to hook in (previously it assumed that it was only talking to renderers) and I did some cleanup. Gamepad files were renamed to match the classes, and I did a bunch of test infrastructure work. IMPORTANT BEHAVIOR CHANGE: This changes the Web gamepad API to report all gamepad data as soon as any of them are interacted with. This is what we need to do for Pepper anyway (since it gets all or none of the share memory) and I think makes more sense for most consumers anyway. I separated out the user gesture detection code into a place where it can be used in the browser process as well, and exposed functionality in the gamepad provider to be notified when a user gesture happens. The existing gamepad test was disabled and had bitrotted. This fixes it. Review URL: https://chromiumcodereview.appspot.com/10912062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155676 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/resource_message_params.cc')
-rw-r--r--ppapi/proxy/resource_message_params.cc41
1 files changed, 40 insertions, 1 deletions
diff --git a/ppapi/proxy/resource_message_params.cc b/ppapi/proxy/resource_message_params.cc
index 5c70e49..6d3fa02 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()