diff options
author | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-28 18:02:02 +0000 |
---|---|---|
committer | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-28 18:02:02 +0000 |
commit | 3b2ba5a70afe7cc45b4ddaef1e467736218a70d3 (patch) | |
tree | c4b4f2b819bbb5ab3b09e429771e7fc29582e8e6 | |
parent | 7733fc48c73bd37cf546d07b05bdca1238ee4725 (diff) | |
download | chromium_src-3b2ba5a70afe7cc45b4ddaef1e467736218a70d3.zip chromium_src-3b2ba5a70afe7cc45b4ddaef1e467736218a70d3.tar.gz chromium_src-3b2ba5a70afe7cc45b4ddaef1e467736218a70d3.tar.bz2 |
Fix a regression in chrome://gpucrash etc.
So we won't have a GpuUIHost with id 0. It starts from 1.
BUG=105044
TEST=GPUCrashTest.Kill on GPU bots
Review URL: http://codereview.chromium.org/8680035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111721 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser_about_handler.cc | 6 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host_ui_shim.cc | 9 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host_ui_shim.h | 4 |
3 files changed, 16 insertions, 3 deletions
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 3998524..1d3eb95 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -1562,15 +1562,15 @@ bool WillHandleBrowserAboutURL(GURL* url, // Induce an intentional crash in the browser process. CHECK(false); } else if (host == chrome::kChromeUIGpuCleanHost) { - GpuProcessHostUIShim* shim = GpuProcessHostUIShim::FromID(0); + GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); if (shim) shim->SimulateRemoveAllContext(); } else if (host == chrome::kChromeUIGpuCrashHost) { - GpuProcessHostUIShim* shim = GpuProcessHostUIShim::FromID(0); + GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); if (shim) shim->SimulateCrash(); } else if (host == chrome::kChromeUIGpuHangHost) { - GpuProcessHostUIShim* shim = GpuProcessHostUIShim::FromID(0); + GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); if (shim) shim->SimulateHang(); #if defined(OS_CHROMEOS) diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc index e7bda6d..5c992e2 100644 --- a/content/browser/gpu/gpu_process_host_ui_shim.cc +++ b/content/browser/gpu/gpu_process_host_ui_shim.cc @@ -131,6 +131,15 @@ GpuProcessHostUIShim* GpuProcessHostUIShim::FromID(int host_id) { return g_hosts_by_id.Pointer()->Lookup(host_id); } +// static +GpuProcessHostUIShim* GpuProcessHostUIShim::GetOneInstance() { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + if (g_hosts_by_id.Pointer()->IsEmpty()) + return NULL; + IDMap<GpuProcessHostUIShim>::iterator it(g_hosts_by_id.Pointer()); + return it.GetCurrentValue(); +} + bool GpuProcessHostUIShim::Send(IPC::Message* msg) { DCHECK(CalledOnValidThread()); return BrowserThread::PostTask(BrowserThread::IO, diff --git a/content/browser/gpu/gpu_process_host_ui_shim.h b/content/browser/gpu/gpu_process_host_ui_shim.h index b274bad..976a559 100644 --- a/content/browser/gpu/gpu_process_host_ui_shim.h +++ b/content/browser/gpu/gpu_process_host_ui_shim.h @@ -66,6 +66,10 @@ class GpuProcessHostUIShim CONTENT_EXPORT static GpuProcessHostUIShim* FromID(int host_id); + // Get a GpuProcessHostUIShim instance; it doesn't matter which one. + // Return NULL if none has been created. + CONTENT_EXPORT static GpuProcessHostUIShim* GetOneInstance(); + // IPC::Channel::Sender implementation. virtual bool Send(IPC::Message* msg) OVERRIDE; |