summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-18 00:30:50 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-18 00:30:50 +0000
commitf09182462bb6c240cf9d6211eed080687c4d5b9c (patch)
treee8151f44003f5eb22b7d9e41f018caeb2285db52 /content
parent56ff47995a667275343921b55ff816152e6d1e77 (diff)
downloadchromium_src-f09182462bb6c240cf9d6211eed080687c4d5b9c.zip
chromium_src-f09182462bb6c240cf9d6211eed080687c4d5b9c.tar.gz
chromium_src-f09182462bb6c240cf9d6211eed080687c4d5b9c.tar.bz2
Collect GPU info before enabling sandbox.
BUG=112205 Review URL: https://chromiumcodereview.appspot.com/9401025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122646 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/gpu/gpu_child_thread.cc19
-rw-r--r--content/gpu/gpu_child_thread.h5
-rw-r--r--content/gpu/gpu_main.cc19
3 files changed, 25 insertions, 18 deletions
diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc
index 3aae568..9d5ac55 100644
--- a/content/gpu/gpu_child_thread.cc
+++ b/content/gpu/gpu_child_thread.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -13,7 +13,6 @@
#include "build/build_config.h"
#include "content/common/child_process.h"
#include "content/common/gpu/gpu_messages.h"
-#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "content/gpu/gpu_info_collector.h"
#include "content/gpu/gpu_watchdog_thread.h"
@@ -37,8 +36,10 @@ bool GpuProcessLogMessageHandler(int severity,
} // namespace
-GpuChildThread::GpuChildThread(bool dead_on_arrival)
- : dead_on_arrival_(dead_on_arrival) {
+GpuChildThread::GpuChildThread(bool dead_on_arrival,
+ const content::GPUInfo& gpu_info)
+ : dead_on_arrival_(dead_on_arrival),
+ gpu_info_(gpu_info) {
#if defined(OS_WIN)
target_services_ = NULL;
collecting_dx_diagnostics_ = false;
@@ -52,6 +53,9 @@ GpuChildThread::GpuChildThread(const std::string& channel_id)
target_services_ = NULL;
collecting_dx_diagnostics_ = false;
#endif
+ if (!gpu_info_collector::CollectGraphicsInfo(&gpu_info_)) {
+ LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo failed";
+ }
}
@@ -103,13 +107,6 @@ void GpuChildThread::OnInitialize() {
!CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU))
logging::SetLogMessageHandler(GpuProcessLogMessageHandler);
- // Always set gpu info and send it back, even if there's an error and it's
- // impartially collected.
- bool succeeded = gpu_info_collector::CollectGraphicsInfo(&gpu_info_);
- content::GetContentClient()->SetGpuInfo(gpu_info_);
- LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo complete. success = " <<
- succeeded;
-
// Record initialization only after collecting the GPU info because that can
// take a significant amount of time.
gpu_info_.initialization_time = base::Time::Now() - process_start_time_;
diff --git a/content/gpu/gpu_child_thread.h b/content/gpu/gpu_child_thread.h
index 111626a..0f39b42 100644
--- a/content/gpu/gpu_child_thread.h
+++ b/content/gpu/gpu_child_thread.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -34,7 +34,8 @@ class GpuWatchdogThread;
// commands to the GPU.
class GpuChildThread : public ChildThread {
public:
- explicit GpuChildThread(bool dead_on_arrival);
+ explicit GpuChildThread(bool dead_on_arrival,
+ const content::GPUInfo& gpu_info);
// For single-process mode.
explicit GpuChildThread(const std::string& channel_id);
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
index b1d6629..49155a31 100644
--- a/content/gpu/gpu_main.cc
+++ b/content/gpu/gpu_main.cc
@@ -15,9 +15,11 @@
#include "base/win/scoped_com_initializer.h"
#include "build/build_config.h"
#include "content/common/gpu/gpu_config.h"
+#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/main_function_params.h"
#include "content/gpu/gpu_child_thread.h"
+#include "content/gpu/gpu_info_collector.h"
#include "content/gpu/gpu_process.h"
#include "ui/gfx/gl/gl_surface.h"
#include "ui/gfx/gl/gl_switches.h"
@@ -71,10 +73,17 @@ int GpuMain(const content::MainFunctionParams& parameters) {
// GpuMsg_Initialize message from the browser.
bool dead_on_arrival = false;
- // Load the GL implementation and locate the bindings before starting the GPU
- // watchdog because this can take a lot of time and the GPU watchdog might
- // terminate the GPU process.
- if (!gfx::GLSurface::InitializeOneOff()) {
+ // Load and initialize the GL implementation and locate the GL entry points.
+ content::GPUInfo gpu_info;
+ if (gfx::GLSurface::InitializeOneOff()) {
+ // Collect information about the GPU.
+ if (!gpu_info_collector::CollectGraphicsInfo(&gpu_info)) {
+ LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo failed";
+ }
+
+ // Set the GPU info even if it failed.
+ content::GetContentClient()->SetGpuInfo(gpu_info);
+ } else {
LOG(INFO) << "gfx::GLSurface::InitializeOneOff failed";
dead_on_arrival = true;
}
@@ -114,7 +123,7 @@ int GpuMain(const content::MainFunctionParams& parameters) {
GpuProcess gpu_process;
- GpuChildThread* child_thread = new GpuChildThread(dead_on_arrival);
+ GpuChildThread* child_thread = new GpuChildThread(dead_on_arrival, gpu_info);
child_thread->Init(start_time);