diff options
author | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-21 00:01:01 +0000 |
---|---|---|
committer | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-21 00:01:01 +0000 |
commit | 406e408bcfbcfd041e0c4e882c1085d013f0ac09 (patch) | |
tree | 837689561dbc179930a5029d147b1830c0facbc1 /content | |
parent | a8970b9c012ac43a5a846940799d97d302e72442 (diff) | |
download | chromium_src-406e408bcfbcfd041e0c4e882c1085d013f0ac09.zip chromium_src-406e408bcfbcfd041e0c4e882c1085d013f0ac09.tar.gz chromium_src-406e408bcfbcfd041e0c4e882c1085d013f0ac09.tar.bz2 |
use NOTIFICATION_RENDERER_PROCESS_TERMINATED, not CLOSED for gamepad notification
_CLOSED is not sent on normal navigation so the background thread does not get paused (because GamepadService is not notified that the renderer using the gamepad api has gone away).
_TERMINATED is sent on both close and navigation, so use it instead.
R=jam@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10806051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147743 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/gamepad/gamepad_service.cc | 15 | ||||
-rw-r--r-- | content/browser/gamepad/gamepad_service.h | 4 |
2 files changed, 10 insertions, 9 deletions
diff --git a/content/browser/gamepad/gamepad_service.cc b/content/browser/gamepad/gamepad_service.cc index 0efd505..cb9206b 100644 --- a/content/browser/gamepad/gamepad_service.cc +++ b/content/browser/gamepad/gamepad_service.cc @@ -42,7 +42,7 @@ void GamepadService::Start( BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&GamepadService::RegisterForCloseNotification, + base::Bind(&GamepadService::RegisterForTerminationNotification, base::Unretained(this), associated_rph)); } @@ -51,9 +51,10 @@ void GamepadService::Terminate() { provider_.reset(); } -void GamepadService::RegisterForCloseNotification(RenderProcessHost* rph) { +void GamepadService::RegisterForTerminationNotification( + RenderProcessHost* rph) { registrar_.Add(this, - NOTIFICATION_RENDERER_PROCESS_CLOSED, + NOTIFICATION_RENDERER_PROCESS_TERMINATED, Source<RenderProcessHost>(rph)); } @@ -69,7 +70,7 @@ void GamepadService::Stop(const NotificationSource& source) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&GamepadService::UnregisterForCloseNotification, + base::Bind(&GamepadService::UnregisterForTerminationNotification, base::Unretained(this), source)); @@ -77,15 +78,15 @@ void GamepadService::Stop(const NotificationSource& source) { provider_->Pause(); } -void GamepadService::UnregisterForCloseNotification( +void GamepadService::UnregisterForTerminationNotification( const NotificationSource& source) { - registrar_.Remove(this, NOTIFICATION_RENDERER_PROCESS_CLOSED, source); + registrar_.Remove(this, NOTIFICATION_RENDERER_PROCESS_TERMINATED, source); } void GamepadService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NOTIFICATION_RENDERER_PROCESS_CLOSED); + DCHECK(type == NOTIFICATION_RENDERER_PROCESS_TERMINATED); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, diff --git a/content/browser/gamepad/gamepad_service.h b/content/browser/gamepad/gamepad_service.h index 4a446b7..4e10112 100644 --- a/content/browser/gamepad/gamepad_service.h +++ b/content/browser/gamepad/gamepad_service.h @@ -48,8 +48,8 @@ class GamepadService : public NotificationObserver { void Stop(const NotificationSource& source); // Run on UI thread to receive/stop notifications of renderer closes. - void RegisterForCloseNotification(RenderProcessHost* rph); - void UnregisterForCloseNotification(const NotificationSource& source); + void RegisterForTerminationNotification(RenderProcessHost* rph); + void UnregisterForTerminationNotification(const NotificationSource& source); // NotificationObserver overrides: virtual void Observe(int type, |