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

Unified Diff: content/browser/renderer_host/gamepad_browser_message_filter.cc

Issue 8345027: Big patch to implement Chromium-side of Gamepad support (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: minor tidying Created 9 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: content/browser/renderer_host/gamepad_browser_message_filter.cc
diff --git a/content/browser/renderer_host/gamepad_browser_message_filter.cc b/content/browser/renderer_host/gamepad_browser_message_filter.cc
index 683bff58c2598233ab5b79345fc0783b4227def2..136a4ff3a7fdb2d14995deff2a8614fa0bf5e84c 100644
--- a/content/browser/renderer_host/gamepad_browser_message_filter.cc
+++ b/content/browser/renderer_host/gamepad_browser_message_filter.cc
@@ -4,9 +4,15 @@
#include "content/browser/renderer_host/gamepad_browser_message_filter.h"
+#include "content/browser/gamepad/gamepad_service.h"
#include "content/common/gamepad_messages.h"
-GamepadBrowserMessageFilter::GamepadBrowserMessageFilter() {
+namespace content {
+
+GamepadBrowserMessageFilter::GamepadBrowserMessageFilter(
+ content::RenderProcessHost* render_process_host)
+ : gamepad_service_(NULL),
+ render_process_host_(render_process_host) {
}
GamepadBrowserMessageFilter::~GamepadBrowserMessageFilter() {
@@ -28,14 +34,15 @@ bool GamepadBrowserMessageFilter::OnMessageReceived(
void GamepadBrowserMessageFilter::OnGamepadStartPolling(
base::SharedMemoryHandle* renderer_handle) {
- if (!provider_) {
- provider_ = new content::GamepadProvider(NULL);
- provider_->Start();
- }
- *renderer_handle = provider_->GetRendererSharedMemoryHandle(peer_handle());
+ if (!gamepad_service_)
+ gamepad_service_ = GamepadService::GetInstance();
+ gamepad_service_->Start(NULL, render_process_host_);
+ *renderer_handle = gamepad_service_->GetSharedMemoryHandle(peer_handle());
}
void GamepadBrowserMessageFilter::OnGamepadStopPolling() {
- // TODO(scottmg) Remove this message entirely?
- // Stop is currently handled by the refcount on provider_.
+ // TODO(scottmg): Probably get rid of this message. We can't trust it will
+ // arrive anyway if the renderer crashes, etc.
}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698