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

Unified Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 9405033: Revise gamepad interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 10 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 | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppapi_plugin_instance.cc
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 7dde8d740c2b559324b1f65c7b4a69f9be1c110e..a5d651591c94cf9dd3ae54091c19f0e5937caf7b 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -220,15 +220,6 @@ COMPILE_ASSERT_MATCHING_ENUM(TypeGrabbing, PP_CURSORTYPE_GRABBING);
// Do not assert WebCursorInfo::TypeCustom == PP_CURSORTYPE_CUSTOM;
// PP_CURSORTYPE_CUSTOM is pinned to allow new cursor types.
-// Ensure conversion from WebKit::WebGamepads to PP_GamepadsData_Dev is safe.
-// See also DCHECKs in SampleGamepads below.
-//
-// Temporarily disabled for 2-sided WebKit roll.
-//COMPILE_ASSERT(sizeof(WebKit::WebGamepads) == sizeof(PP_GamepadsData_Dev),
-// size_difference);
-//COMPILE_ASSERT(sizeof(WebKit::WebGamepad) == sizeof(PP_GamepadData_Dev),
-// size_difference);
-
// Sets |*security_origin| to be the WebKit security origin associated with the
// document containing the given plugin instance. On success, returns true. If
// the instance is invalid, returns false and |*security_origin| will be
@@ -1354,39 +1345,10 @@ bool PluginInstance::IsRectTopmost(const gfx::Rect& rect) {
}
void PluginInstance::SampleGamepads(PP_Instance instance,
- PP_GamepadsData_Dev* data) {
-
- // Because the WebKit objects have trivial ctors, using offsetof doesn't
- // work. Instead use this version based on src/v8/src/globals.h. This
- // workaround doesn't work in constant expressions as required for
- // COMPILE_ASSERT, so DCHECK instead.
-
-#define OFFSET_OF(type, field) \
- (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4)
-
-#define DCHECK_GAMEPADS_OFFSET(webkit_name, pp_name) \
- DCHECK(OFFSET_OF(WebKit::WebGamepads, webkit_name) \
- == OFFSET_OF(PP_GamepadsData_Dev, pp_name))
-
-#define DCHECK_GAMEPAD_OFFSET(webkit_name, pp_name) \
- DCHECK(OFFSET_OF(WebKit::WebGamepad, webkit_name) \
- == OFFSET_OF(PP_GamepadData_Dev, pp_name))
-
- DCHECK_GAMEPADS_OFFSET(length, length);
- DCHECK_GAMEPADS_OFFSET(items, items);
- DCHECK_GAMEPAD_OFFSET(connected, connected);
- DCHECK_GAMEPAD_OFFSET(id, id);
- DCHECK_GAMEPAD_OFFSET(timestamp, timestamp);
- DCHECK_GAMEPAD_OFFSET(axesLength, axes_length);
- DCHECK_GAMEPAD_OFFSET(axes, axes);
- DCHECK_GAMEPAD_OFFSET(buttonsLength, buttons_length);
- DCHECK_GAMEPAD_OFFSET(buttons, buttons);
-
-#undef OFFSET_OF
-#undef DCHECK_GAMEPADS_OFFSET
-#undef DCHECK_GAMEPAD_OFFSET
-
- delegate()->SampleGamepads(reinterpret_cast<WebKit::WebGamepads*>(data));
+ PP_GamepadsSampleData_Dev* data) {
+ WebKit::WebGamepads webkit_data;
+ delegate()->SampleGamepads(&webkit_data);
+ ConvertWebKitGamepadData(webkit_data, data);
}
bool PluginInstance::IsViewAccelerated() {
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698