summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-09 22:00:59 +0000
committerzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-09 22:00:59 +0000
commit27d8778e09e2dc4cc9b4882c87ac58fd15c81dd9 (patch)
tree0d7f16926c3eca6d001776752a8280f3578c06f7
parent3c2632de729773052b5561575db4e81017aff538 (diff)
downloadchromium_src-27d8778e09e2dc4cc9b4882c87ac58fd15c81dd9.zip
chromium_src-27d8778e09e2dc4cc9b4882c87ac58fd15c81dd9.tar.gz
chromium_src-27d8778e09e2dc4cc9b4882c87ac58fd15c81dd9.tar.bz2
Remove gpu_info() from GpuProcessHostUIShim. GPUInfo should be accessed through GpuDataManager, where it won't potentially bring up GPU process.
BUG=none TEST=bots green Review URL: http://codereview.chromium.org/6656003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77528 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/gpu_process_host_ui_shim.cc5
-rw-r--r--chrome/browser/gpu_process_host_ui_shim.h4
-rw-r--r--chrome/browser/metrics/metrics_log.cc10
-rw-r--r--chrome/test/gpu/gpu_pixel_browsertest.cc55
4 files changed, 14 insertions, 60 deletions
diff --git a/chrome/browser/gpu_process_host_ui_shim.cc b/chrome/browser/gpu_process_host_ui_shim.cc
index 54c9ad0..b7d0792 100644
--- a/chrome/browser/gpu_process_host_ui_shim.cc
+++ b/chrome/browser/gpu_process_host_ui_shim.cc
@@ -346,11 +346,6 @@ void GpuProcessHostUIShim::SendAboutGpuHang() {
Send(new GpuMsg_Hang());
}
-const GPUInfo& GpuProcessHostUIShim::gpu_info() const {
- DCHECK(CalledOnValidThread());
- return gpu_data_manager_->gpu_info();
-}
-
GpuProcessHostUIShim::~GpuProcessHostUIShim() {
DCHECK(CalledOnValidThread());
g_hosts_by_id.Remove(host_id_);
diff --git a/chrome/browser/gpu_process_host_ui_shim.h b/chrome/browser/gpu_process_host_ui_shim.h
index 40df849..1856f14 100644
--- a/chrome/browser/gpu_process_host_ui_shim.h
+++ b/chrome/browser/gpu_process_host_ui_shim.h
@@ -33,7 +33,6 @@ class GpuDataManager;
struct GPUCreateCommandBufferConfig;
struct GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params;
struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params;
-struct GPUInfo;
namespace IPC {
struct ChannelHandle;
@@ -123,9 +122,6 @@ class GpuProcessHostUIShim
// Useful for testing.
void SendAboutGpuHang();
- // Return all known information about the GPU.
- const GPUInfo& gpu_info() const;
-
// Can be called directly from the UI thread to log a message.
void AddCustomLogMessage(int level, const std::string& header,
const std::string& message);
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index 3dbe92f..cc5615d 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -19,7 +19,7 @@
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/gpu_process_host_ui_shim.h"
+#include "chrome/browser/gpu_data_manager.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/logging_chrome.h"
@@ -338,10 +338,10 @@ void MetricsLog::RecordEnvironment(
{
OPEN_ELEMENT_FOR_SCOPE("gpu");
- GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::GetForRenderer(0);
- if (ui_shim) {
- WriteIntAttribute("vendorid", ui_shim->gpu_info().vendor_id);
- WriteIntAttribute("deviceid", ui_shim->gpu_info().device_id);
+ GpuDataManager* gpu_data_manager = GpuDataManager::GetInstance();
+ if (gpu_data_manager) {
+ WriteIntAttribute("vendorid", gpu_data_manager->gpu_info().vendor_id);
+ WriteIntAttribute("deviceid", gpu_data_manager->gpu_info().device_id);
}
}
diff --git a/chrome/test/gpu/gpu_pixel_browsertest.cc b/chrome/test/gpu/gpu_pixel_browsertest.cc
index 5a6cebf..b310596 100644
--- a/chrome/test/gpu/gpu_pixel_browsertest.cc
+++ b/chrome/test/gpu/gpu_pixel_browsertest.cc
@@ -15,7 +15,6 @@
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "chrome/browser/gpu_data_manager.h"
-#include "chrome/browser/gpu_process_host_ui_shim.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/chrome_paths.h"
@@ -84,52 +83,16 @@ void ResizeTabContainer(Browser* browser, const gfx::Size& desired_size) {
browser->window()->SetBounds(window_rect);
}
-// Observes when any GPU info has been collected and quits the current message
-// loop.
-class GPUInfoCollectedObserver {
- public:
- explicit GPUInfoCollectedObserver(GpuProcessHostUIShim* gpu_host_shim)
- : gpu_host_shim_(gpu_host_shim),
- gpu_info_collected_(false) {
- gpu_info_update_callback_ =
- NewCallback(this, &GPUInfoCollectedObserver::OnGpuInfoCollected);
- GpuDataManager::GetInstance()->
- AddGpuInfoUpdateCallback(gpu_info_update_callback_);
- }
-
- void OnGpuInfoCollected() {
- gpu_info_collected_ = true;
- GpuDataManager::GetInstance()->
- RemoveGpuInfoUpdateCallback(gpu_info_update_callback_);
- delete gpu_info_update_callback_;
- MessageLoopForUI::current()->Quit();
- }
-
- bool gpu_info_collected() { return gpu_info_collected_; }
-
- private:
- GpuProcessHostUIShim* gpu_host_shim_;
- Callback0::Type* gpu_info_update_callback_;
- bool gpu_info_collected_;
-};
-
-// Collects info about the GPU. Iff the info is collected, |client_info| will be
-// set and true will be returned. This info may be partial or complete. This
-// will return false if we are running in a virtualized environment.
-bool CollectGPUInfo(GPUInfo* client_info) {
+// Obtains info about the GPU. Iff the info is collected, |client_info| will be
+// set and true will be returned. Here we only need vendor_id and device_id,
+// which should be always collected during browser startup, so no need to run
+// GPU information collection here.
+// This will return false if we are running in a virtualized environment.
+bool GetGPUInfo(GPUInfo* client_info) {
CHECK(client_info);
- GpuProcessHostUIShim* gpu_host_shim = GpuProcessHostUIShim::GetForRenderer(0);
- if (!gpu_host_shim)
+ const GPUInfo& info = GpuDataManager::GetInstance()->gpu_info();
+ if (info.vendor_id == 0 || info.device_id == 0)
return false;
- GPUInfo info = gpu_host_shim->gpu_info();
- if (info.level == GPUInfo::kUninitialized) {
- GPUInfoCollectedObserver observer(gpu_host_shim);
- gpu_host_shim->CollectGpuInfoAsynchronously(GPUInfo::kPartial);
- ui_test_utils::RunMessageLoop();
- if (!observer.gpu_info_collected())
- return false;
- info = gpu_host_shim->gpu_info();
- }
*client_info = info;
return true;
}
@@ -219,7 +182,7 @@ class GpuPixelBrowserTest : public InProcessBrowserTest {
#endif
if (using_gpu_) {
GPUInfo info;
- if (!CollectGPUInfo(&info)) {
+ if (!GetGPUInfo(&info)) {
LOG(ERROR) << "Could not get gpu info";
return false;
}