Commit e336f133 authored by jam@chromium.org's avatar jam@chromium.org

Get rid of last gpu_messages.h dependency in chrome by having chrome ask the...

Get rid of last gpu_messages.h dependency in chrome by having chrome ask the GPUProcessHostUIShim to hang/crash/clean the gpu process.

BUG=98716
Review URL: http://codereview.chromium.org/8548014

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110802 0039d316-1c4b-4281-b951-d872f2087c98
parent 54159b2b
......@@ -45,11 +45,10 @@
#include "chrome/common/net/gaia/google_service_auth_error.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
#include "content/browser/gpu/gpu_process_host.h"
#include "content/browser/gpu/gpu_process_host_ui_shim.h"
#include "content/browser/plugin_service.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/sensors/sensors_provider.h"
#include "content/common/gpu/gpu_messages.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_client.h"
......@@ -1563,14 +1562,17 @@ bool WillHandleBrowserAboutURL(GURL* url,
// Induce an intentional crash in the browser process.
CHECK(false);
} else if (host == chrome::kChromeUIGpuCleanHost) {
GpuProcessHost::SendOnIO(
0, content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, new GpuMsg_Clean());
GpuProcessHostUIShim* shim = GpuProcessHostUIShim::FromID(0);
if (shim)
shim->SimulateRemoveAllContext();
} else if (host == chrome::kChromeUIGpuCrashHost) {
GpuProcessHost::SendOnIO(
0, content::CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUCRASH, new GpuMsg_Crash());
GpuProcessHostUIShim* shim = GpuProcessHostUIShim::FromID(0);
if (shim)
shim->SimulateCrash();
} else if (host == chrome::kChromeUIGpuHangHost) {
GpuProcessHost::SendOnIO(
0, content::CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUHANG, new GpuMsg_Hang());
GpuProcessHostUIShim* shim = GpuProcessHostUIShim::FromID(0);
if (shim)
shim->SimulateHang();
#if defined(OS_CHROMEOS)
} else if (host == chrome::kChromeUIRotateHost) {
sensors::ScreenOrientation change;
......
......@@ -147,6 +147,18 @@ bool GpuProcessHostUIShim::OnMessageReceived(const IPC::Message& message) {
return OnControlMessageReceived(message);
}
void GpuProcessHostUIShim::SimulateRemoveAllContext() {
Send(new GpuMsg_Clean());
}
void GpuProcessHostUIShim::SimulateCrash() {
Send(new GpuMsg_Crash());
}
void GpuProcessHostUIShim::SimulateHang() {
Send(new GpuMsg_Hang());
}
GpuProcessHostUIShim::~GpuProcessHostUIShim() {
DCHECK(CalledOnValidThread());
g_hosts_by_id.Pointer()->Remove(host_id_);
......
......@@ -63,7 +63,7 @@ class GpuProcessHostUIShim
// Destroy all remaining GpuProcessHostUIShims.
CONTENT_EXPORT static void DestroyAll();
static GpuProcessHostUIShim* FromID(int host_id);
CONTENT_EXPORT static GpuProcessHostUIShim* FromID(int host_id);
// IPC::Channel::Sender implementation.
virtual bool Send(IPC::Message* msg) OVERRIDE;
......@@ -72,7 +72,11 @@ class GpuProcessHostUIShim
// The GpuProcessHost causes this to be called on the UI thread to
// dispatch the incoming messages from the GPU process, which are
// actually received on the IO thread.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual bool OnMessageReceived(const IPC::Message& message);
CONTENT_EXPORT void SimulateRemoveAllContext();
CONTENT_EXPORT void SimulateCrash();
CONTENT_EXPORT void SimulateHang();
private:
explicit GpuProcessHostUIShim(int host_id);
......
......@@ -11,9 +11,8 @@ namespace content {
// If you change this enum you also need to update
// tools/histograms/histograms.xml.
enum CauseForGpuLaunch {
CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUCRASH,
CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUHANG,
CAUSE_FOR_GPU_LAUNCH_GPUDATAMANAGER_REQUESTCOMPLETEGPUINFOIFNEEDED,
// Start enum from 2 to keep the same values for the histogram.
CAUSE_FOR_GPU_LAUNCH_GPUDATAMANAGER_REQUESTCOMPLETEGPUINFOIFNEEDED = 2,
CAUSE_FOR_GPU_LAUNCH_RENDERWIDGETFULLSCREENPEPPER_CREATECONTEXT,
CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE,
CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment