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

Unified Diff: ppapi/proxy/resource_message_params.h

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/ppapi_messages.h ('k') | ppapi/proxy/resource_message_params.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/resource_message_params.h
diff --git a/ppapi/proxy/resource_message_params.h b/ppapi/proxy/resource_message_params.h
index ad1c96af715e8033a9fd7ac66e51eaf6b0af591e..bc522343e5e9d4b0dcb3d6bcbda001abc02bf3a7 100644
--- a/ppapi/proxy/resource_message_params.h
+++ b/ppapi/proxy/resource_message_params.h
@@ -5,9 +5,12 @@
#ifndef PPAPI_PROXY_RESOURCE_MESSAGE_PARAMS_H_
#define PPAPI_PROXY_RESOURCE_MESSAGE_PARAMS_H_
+#include <vector>
+
#include "ipc/ipc_message_utils.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/proxy/serialized_structs.h"
namespace ppapi {
namespace proxy {
@@ -20,6 +23,33 @@ class PPAPI_PROXY_EXPORT ResourceMessageParams {
PP_Resource pp_resource() const { return pp_resource_; }
int32_t sequence() const { return sequence_; }
+ const std::vector<SerializedHandle> handles() const { return handles_; }
+
+ // Returns a pointer to the handle at the given index if it exists and is of
+ // the given type. If the index doesn't exist or the handle isn't of the
+ // given type, returns NULL. Note that the pointer will be into an internal
+ // vector so will be invalidated if the params are mutated.
+ const SerializedHandle* GetHandleOfTypeAtIndex(
+ size_t index,
+ SerializedHandle::Type type) const;
+
+ // Helper functions to return shared memory handles passed in the params
+ // struct. If the index has a valid handle of the given type, it will be
+ // placed in the output parameter and the function will return true. If the
+ // handle doesn't exist or is a different type, the functions will return
+ // false and the output parameter will be untouched.
+ //
+ // Note that the handle could still be a "null" or invalid handle of
+ // the right type and the functions will succeed.
+ bool GetSharedMemoryHandleAtIndex(size_t index,
+ base::SharedMemoryHandle* handle) const;
+ bool GetSocketHandleAtIndex(size_t index,
+ IPC::PlatformFileForTransit* handle) const;
+
+ // Appends the given handle to the list of handles sent with the call or
+ // reply.
+ void AppendHandle(const SerializedHandle& handle);
+
protected:
ResourceMessageParams();
ResourceMessageParams(PP_Resource resource, int32_t sequence);
@@ -44,6 +74,11 @@ class PPAPI_PROXY_EXPORT ResourceMessageParams {
// confusion within the plugin and within callbacks on the same resource,
// there shouldn't be a security problem.
int32_t sequence_;
+
+ // A list of all handles transferred in the message. Handles go here so that
+ // the NaCl adapter can extract them generally when it rewrites them to
+ // go between Windows and NaCl (Posix) apps.
+ std::vector<SerializedHandle> handles_;
};
// Parameters common to all ResourceMessage "Call" requests.
« no previous file with comments | « ppapi/proxy/ppapi_messages.h ('k') | ppapi/proxy/resource_message_params.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698