Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / browser / renderer_host / pepper / pepper_gamepad_host.cc
index 818bf24..bbb72b8 100644 (file)
@@ -23,8 +23,7 @@ PepperGamepadHost::PepperGamepadHost(BrowserPpapiHost* host,
       browser_ppapi_host_(host),
       gamepad_service_(GamepadService::GetInstance()),
       is_started_(false),
-      weak_factory_(this) {
-}
+      weak_factory_(this) {}
 
 PepperGamepadHost::PepperGamepadHost(GamepadService* gamepad_service,
                                      BrowserPpapiHost* host,
@@ -34,20 +33,19 @@ PepperGamepadHost::PepperGamepadHost(GamepadService* gamepad_service,
       browser_ppapi_host_(host),
       gamepad_service_(gamepad_service),
       is_started_(false),
-      weak_factory_(this) {
-}
+      weak_factory_(this) {}
 
 PepperGamepadHost::~PepperGamepadHost() {
   if (is_started_)
-    gamepad_service_->RemoveConsumer();
+    gamepad_service_->RemoveConsumer(this);
 }
 
 int32_t PepperGamepadHost::OnResourceMessageReceived(
     const IPC::Message& msg,
     ppapi::host::HostMessageContext* context) {
   IPC_BEGIN_MESSAGE_MAP(PepperGamepadHost, msg)
-    PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Gamepad_RequestMemory,
-                                        OnRequestMemory)
+  PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Gamepad_RequestMemory,
+                                      OnRequestMemory)
   IPC_END_MESSAGE_MAP()
   return PP_ERROR_FAILED;
 }
@@ -57,7 +55,7 @@ int32_t PepperGamepadHost::OnRequestMemory(
   if (is_started_)
     return PP_ERROR_FAILED;
 
-  gamepad_service_->AddConsumer();
+  gamepad_service_->ConsumerBecameActive(this);
   is_started_ = true;
 
   // Don't send the shared memory back until the user has interacted with the