diff options
author | scheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-06 00:10:50 +0000 |
---|---|---|
committer | scheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-06 00:10:50 +0000 |
commit | 7f3a2cfa5bd4f04195c8eb044258f4c7cba5141a (patch) | |
tree | c7bbd990b886262b380667622e2bbe3ce3a04c49 /content | |
parent | b184ddebb9646658091716dc330a0098a7e23800 (diff) | |
download | chromium_src-7f3a2cfa5bd4f04195c8eb044258f4c7cba5141a.zip chromium_src-7f3a2cfa5bd4f04195c8eb044258f4c7cba5141a.tar.gz chromium_src-7f3a2cfa5bd4f04195c8eb044258f4c7cba5141a.tar.bz2 |
Histogram added: GPU.GPUProcessLaunchCause
- This will help distinguish why the GPU process was started.
Also, corrected code in "about:" page parsing to not spawn the GPU process unless a GPU related page is being requested.
BUG=78361
TEST=about:histograms includes GPU.GPUProcessLaunchCause after GPU use (e.g. about:gpu).
Review URL: http://codereview.chromium.org/6794002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80555 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/gpu_process_host.cc | 13 | ||||
-rw-r--r-- | content/browser/gpu_process_host.h | 7 | ||||
-rw-r--r-- | content/browser/renderer_host/gpu_message_filter.cc | 6 | ||||
-rw-r--r-- | content/browser/renderer_host/gpu_message_filter.h | 5 | ||||
-rw-r--r-- | content/common/gpu_messages.h | 10 | ||||
-rw-r--r-- | content/common/gpu_process_launch_causes.h | 24 | ||||
-rw-r--r-- | content/content_common.gypi | 1 | ||||
-rw-r--r-- | content/renderer/render_widget_fullscreen_pepper.cc | 3 | ||||
-rw-r--r-- | content/renderer/webgraphicscontext3d_command_buffer_impl.cc | 4 |
9 files changed, 59 insertions, 14 deletions
diff --git a/content/browser/gpu_process_host.cc b/content/browser/gpu_process_host.cc index ba00e98..fab8f12 100644 --- a/content/browser/gpu_process_host.cc +++ b/content/browser/gpu_process_host.cc @@ -52,10 +52,13 @@ static const int kGpuMaxCrashCount = 3; // static GpuProcessHost* GpuProcessHost::Create( int host_id, - const GpuFeatureFlags& gpu_feature_flags) { + const GpuFeatureFlags& gpu_feature_flags, + content::CauseForGpuLaunch cause_for_gpu_launch) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - GpuProcessHost* host = new GpuProcessHost(host_id, gpu_feature_flags); + GpuProcessHost* host = new GpuProcessHost(host_id, + gpu_feature_flags, + cause_for_gpu_launch); if (!host->Init()) { delete host; return NULL; @@ -76,11 +79,15 @@ GpuProcessHost* GpuProcessHost::FromID(int host_id) { GpuProcessHost::GpuProcessHost( int host_id, - const GpuFeatureFlags& gpu_feature_flags) + const GpuFeatureFlags& gpu_feature_flags, + content::CauseForGpuLaunch cause_for_gpu_launch) : BrowserChildProcessHost(GPU_PROCESS, NULL), host_id_(host_id), gpu_feature_flags_(gpu_feature_flags) { g_hosts_by_id.AddWithID(this, host_id_); + UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLaunchCause", + cause_for_gpu_launch, + content::CAUSE_FOR_GPU_LAUNCH_MAX_ENUM); } GpuProcessHost::~GpuProcessHost() { diff --git a/content/browser/gpu_process_host.h b/content/browser/gpu_process_host.h index 7058046..7513beb 100644 --- a/content/browser/gpu_process_host.h +++ b/content/browser/gpu_process_host.h @@ -9,6 +9,7 @@ #include "base/threading/non_thread_safe.h" #include "content/browser/browser_child_process_host.h" #include "content/common/gpu_feature_flags.h" +#include "content/common/gpu_process_launch_causes.h" namespace IPC { class Message; @@ -22,7 +23,8 @@ class GpuProcessHost : public BrowserChildProcessHost, // FromID with the same id. static GpuProcessHost* Create( int host_id, - const GpuFeatureFlags& gpu_feature_flags); + const GpuFeatureFlags& gpu_feature_flags, + content::CauseForGpuLaunch); // Get the GPU process host for the GPU process with the given ID. Returns // null if the process no longer exists. @@ -35,7 +37,8 @@ class GpuProcessHost : public BrowserChildProcessHost, private: GpuProcessHost(int host_id, - const GpuFeatureFlags& gpu_feature_flags); + const GpuFeatureFlags& gpu_feature_flags, + content::CauseForGpuLaunch); virtual ~GpuProcessHost(); bool Init(); diff --git a/content/browser/renderer_host/gpu_message_filter.cc b/content/browser/renderer_host/gpu_message_filter.cc index 5d46260..9902a96 100644 --- a/content/browser/renderer_host/gpu_message_filter.cc +++ b/content/browser/renderer_host/gpu_message_filter.cc @@ -160,7 +160,8 @@ class CreateCommandBufferCallback : public CallbackRunner<Tuple1<int32> > { } // namespace -void GpuMessageFilter::OnEstablishGpuChannel() { +void GpuMessageFilter::OnEstablishGpuChannel( + content::CauseForGpuLaunch cause_for_gpu_launch) { scoped_ptr<EstablishChannelCallback> callback( new EstablishChannelCallback(this)); @@ -173,7 +174,8 @@ void GpuMessageFilter::OnEstablishGpuChannel() { // to something like OnCreateGpuProcess. GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id_); if (!ui_shim) { - ui_shim = GpuProcessHostUIShim::GetForRenderer(render_process_id_); + ui_shim = GpuProcessHostUIShim::GetForRenderer(render_process_id_, + cause_for_gpu_launch); if (!ui_shim) { callback->Run(IPC::ChannelHandle(), static_cast<base::ProcessHandle>(NULL), diff --git a/content/browser/renderer_host/gpu_message_filter.h b/content/browser/renderer_host/gpu_message_filter.h index 7c0f398..34e75f1 100644 --- a/content/browser/renderer_host/gpu_message_filter.h +++ b/content/browser/renderer_host/gpu_message_filter.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,6 +7,7 @@ #pragma once #include "content/browser/browser_message_filter.h" +#include "content/common/gpu_process_launch_causes.h" class GpuProcessHost; class GpuProcessHostUIShim; @@ -38,7 +39,7 @@ class GpuMessageFilter : public BrowserMessageFilter, virtual ~GpuMessageFilter(); // Message handlers called on the browser IO thread: - void OnEstablishGpuChannel(); + void OnEstablishGpuChannel(content::CauseForGpuLaunch); void OnSynchronizeGpu(IPC::Message* reply); void OnCreateViewCommandBuffer( int32 render_view_id, diff --git a/content/common/gpu_messages.h b/content/common/gpu_messages.h index 9e510b5..c2cc216 100644 --- a/content/common/gpu_messages.h +++ b/content/common/gpu_messages.h @@ -5,16 +5,17 @@ #include <vector> #include <string> + #include "base/shared_memory.h" #include "content/common/common_param_traits.h" #include "content/common/gpu_info.h" -#include "gpu/ipc/gpu_command_buffer_traits.h" +#include "content/common/gpu_process_launch_causes.h" #include "gpu/command_buffer/common/command_buffer.h" +#include "gpu/ipc/gpu_command_buffer_traits.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_message_macros.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/size.h" - // Multiply-included message file, hence no include guard. #define IPC_MESSAGE_START GpuMsgStart @@ -117,6 +118,8 @@ IPC_STRUCT_TRAITS_BEGIN(GPUInfo) #endif IPC_STRUCT_TRAITS_END() +IPC_ENUM_TRAITS(content::CauseForGpuLaunch) + //------------------------------------------------------------------------------ // GPU Messages // These are messages from the browser to the GPU process. @@ -199,7 +202,8 @@ IPC_MESSAGE_CONTROL3(GpuMsg_GpuChannelEstablished, // A renderer sends this when it wants to create a connection to the GPU // process. The browser will create the GPU process if necessary, and will // return a handle to the channel via a GpuChannelEstablished message. -IPC_MESSAGE_CONTROL0(GpuHostMsg_EstablishGpuChannel) +IPC_MESSAGE_CONTROL1(GpuHostMsg_EstablishGpuChannel, + content::CauseForGpuLaunch) // A renderer sends this to the browser process to provide a synchronization // point for GPU operations, in particular to make sure the GPU channel has diff --git a/content/common/gpu_process_launch_causes.h b/content/common/gpu_process_launch_causes.h new file mode 100644 index 0000000..c84f9fe9 --- /dev/null +++ b/content/common/gpu_process_launch_causes.h @@ -0,0 +1,24 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_COMMON_GPU_PROCESS_LAUNCH_CAUSES_H_ +#define CONTENT_COMMON_GPU_PROCESS_LAUNCH_CAUSES_H_ +#pragma once + +namespace content { + +enum CauseForGpuLaunch { + CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUCRASH, + CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUHANG, + CAUSE_FOR_GPU_LAUNCH_GPUDATAMANAGER_REQUESTCOMPLETEGPUINFOIFNEEDED, + CAUSE_FOR_GPU_LAUNCH_RENDERWIDGETFULLSCREENPEPPER_CREATECONTEXT, + CAUSE_FOR_GPU_LAUNCH_RENDERWIDGETHOSTVIEWMAC_DEALLOCFAKEPLUGINWINDOWHANDLE, + CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE, + CAUSE_FOR_GPU_LAUNCH_MAX_ENUM +}; + +} // namespace content + + +#endif // CONTENT_COMMON_GPU_PROCESS_LAUNCH_CAUSES_H_ diff --git a/content/content_common.gypi b/content/content_common.gypi index 6225b90..a8e4def 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -100,6 +100,7 @@ 'common/geoposition.h', 'common/gpu_info.cc', 'common/gpu_info.h', + 'common/gpu_process_launch_causes.h', 'common/gpu_messages.h', 'common/hi_res_timer_manager_posix.cc', 'common/hi_res_timer_manager_win.cc', diff --git a/content/renderer/render_widget_fullscreen_pepper.cc b/content/renderer/render_widget_fullscreen_pepper.cc index 9c9e6d5..7fa1fa6 100644 --- a/content/renderer/render_widget_fullscreen_pepper.cc +++ b/content/renderer/render_widget_fullscreen_pepper.cc @@ -266,7 +266,8 @@ void RenderWidgetFullscreenPepper::CreateContext() { DCHECK(!context_); RenderThread* render_thread = RenderThread::current(); DCHECK(render_thread); - GpuChannelHost* host = render_thread->EstablishGpuChannelSync(); + GpuChannelHost* host = render_thread->EstablishGpuChannelSync( + content::CAUSE_FOR_GPU_LAUNCH_RENDERWIDGETFULLSCREENPEPPER_CREATECONTEXT); if (!host) return; const int32 attribs[] = { diff --git a/content/renderer/webgraphicscontext3d_command_buffer_impl.cc b/content/renderer/webgraphicscontext3d_command_buffer_impl.cc index 7f1f8a5..ad4cec0 100644 --- a/content/renderer/webgraphicscontext3d_command_buffer_impl.cc +++ b/content/renderer/webgraphicscontext3d_command_buffer_impl.cc @@ -54,7 +54,9 @@ bool WebGraphicsContext3DCommandBufferImpl::initialize( RenderThread* render_thread = RenderThread::current(); if (!render_thread) return false; - GpuChannelHost* host = render_thread->EstablishGpuChannelSync(); + GpuChannelHost* host = render_thread->EstablishGpuChannelSync( + content:: + CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE); if (!host) return false; DCHECK(host->state() == GpuChannelHost::kConnected); |