diff options
author | zmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-07 01:52:44 +0000 |
---|---|---|
committer | zmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-07 01:52:44 +0000 |
commit | 87a735d596a3b0734a9cb6531067f5fc6eac87fb (patch) | |
tree | e9bda5969ee93f000203425932bbd5a98fd12390 /content/gpu | |
parent | 4f7a731925ff71d03f7f5e4c99d5fd957a8b9cc4 (diff) | |
download | chromium_src-87a735d596a3b0734a9cb6531067f5fc6eac87fb.zip chromium_src-87a735d596a3b0734a9cb6531067f5fc6eac87fb.tar.gz chromium_src-87a735d596a3b0734a9cb6531067f5fc6eac87fb.tar.bz2 |
Exit the unsandboxed GPU process after GPUInfo collected.
BUG=164712
TEST=on windows, open about:gpu, see the second gpu process in task manager, then once the full info is displayed, the the second gpu process disappear.
Review URL: https://codereview.chromium.org/11466012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171686 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/gpu')
-rw-r--r-- | content/gpu/gpu_child_thread.cc | 54 | ||||
-rw-r--r-- | content/gpu/gpu_child_thread.h | 9 |
2 files changed, 14 insertions, 49 deletions
diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc index d9de095..b3b787a 100644 --- a/content/gpu/gpu_child_thread.cc +++ b/content/gpu/gpu_child_thread.cc @@ -55,7 +55,6 @@ GpuChildThread::GpuChildThread(GpuWatchdogThread* watchdog_thread, watchdog_thread_ = watchdog_thread; #if defined(OS_WIN) target_services_ = NULL; - collecting_dx_diagnostics_ = false; #endif } @@ -64,7 +63,6 @@ GpuChildThread::GpuChildThread(const std::string& channel_id) dead_on_arrival_(false) { #if defined(OS_WIN) target_services_ = NULL; - collecting_dx_diagnostics_ = false; #endif if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) || CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU)) { @@ -178,23 +176,22 @@ void GpuChildThread::OnCollectGraphicsInfo() { GetContentClient()->SetGpuInfo(gpu_info_); #if defined(OS_WIN) - if (!collecting_dx_diagnostics_) { - // Prevent concurrent collection of DirectX diagnostics. - collecting_dx_diagnostics_ = true; - - // Asynchronously collect the DirectX diagnostics because this can take a - // couple of seconds. - if (!base::WorkerPool::PostTask( - FROM_HERE, base::Bind(&GpuChildThread::CollectDxDiagnostics, this), - true)) { - // Flag GPU info as complete if the DirectX diagnostics cannot be - // collected. - collecting_dx_diagnostics_ = false; - gpu_info_.finalized = true; - } - } + // This is slow, but it's the only thing the unsandboxed GPU process does, + // and GpuDataManager prevents us from sending multiple collecting requests, + // so it's OK to be blocking. + gpu_info_collector::GetDxDiagnostics(&gpu_info_.dx_diagnostics); + gpu_info_.finalized = true; #endif // OS_WIN + Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); + +#if defined(OS_WIN) + if (!command_line->HasSwitch(switches::kSingleProcess) && + !command_line->HasSwitch(switches::kInProcessGPU)) { + // The unsandboxed GPU process fulfilled its duty. Rest in peace. + MessageLoop::current()->Quit(); + } +#endif // OS_WIN } void GpuChildThread::OnGetVideoMemoryUsageStats() { @@ -243,28 +240,5 @@ void GpuChildThread::OnDisableWatchdog() { } } -#if defined(OS_WIN) - -// Runs on a worker thread. The GPU process never terminates voluntarily so -// it is safe to assume that its message loop is valid. -void GpuChildThread::CollectDxDiagnostics(GpuChildThread* thread) { - DxDiagNode node; - gpu_info_collector::GetDxDiagnostics(&node); - - thread->message_loop()->PostTask( - FROM_HERE, base::Bind(&GpuChildThread::SetDxDiagnostics, thread, node)); -} - -// Runs on the main thread. -void GpuChildThread::SetDxDiagnostics(GpuChildThread* thread, - const DxDiagNode& node) { - thread->gpu_info_.dx_diagnostics = node; - thread->gpu_info_.finalized = true; - thread->collecting_dx_diagnostics_ = false; - thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); -} - -#endif - } // namespace content diff --git a/content/gpu/gpu_child_thread.h b/content/gpu/gpu_child_thread.h index de8d7f7..65579ad 100644 --- a/content/gpu/gpu_child_thread.h +++ b/content/gpu/gpu_child_thread.h @@ -66,12 +66,6 @@ class GpuChildThread : public ChildThread { void OnGetGpuTcmalloc(); #endif -#if defined(OS_WIN) - static void CollectDxDiagnostics(GpuChildThread* thread); - static void SetDxDiagnostics(GpuChildThread* thread, - const DxDiagNode& node); -#endif - // Set this flag to true if a fatal error occurred before we receive the // OnInitialize message, in which case we just declare ourselves DOA. bool dead_on_arrival_; @@ -81,9 +75,6 @@ class GpuChildThread : public ChildThread { #if defined(OS_WIN) // Windows specific client sandbox interface. sandbox::TargetServices* target_services_; - - // Indicates whether DirectX Diagnostics collection is ongoing. - bool collecting_dx_diagnostics_; #endif scoped_ptr<GpuChannelManager> gpu_channel_manager_; |