Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5009)

Unified Diff: chrome/browser/metrics/metrics_log.cc

Issue 291163006: Create GPUMetricsProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to review Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/metrics/metrics_log.cc
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index d65ae8fe2f438f16fce875732d9081342ccfe3ce..445b18343df217d9252123d74f71bef9d2e3a5d8 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -44,11 +44,8 @@
#include "components/metrics/proto/system_profile.pb.h"
#include "components/nacl/common/nacl_process_type.h"
#include "components/variations/active_field_trials.h"
-#include "content/public/browser/gpu_data_manager.h"
#include "content/public/common/content_client.h"
#include "content/public/common/webplugininfo.h"
-#include "gpu/config/gpu_info.h"
-#include "ui/gfx/screen.h"
#include "url/gurl.h"
#if defined(OS_ANDROID)
@@ -66,7 +63,6 @@ extern "C" IMAGE_DOS_HEADER __ImageBase;
#include "chrome/browser/metrics/metrics_log_chromeos.h"
#endif // OS_CHROMEOS
-using content::GpuDataManager;
using metrics::MetricsLogBase;
using metrics::OmniboxEventProto;
using metrics::ProfilerEventProto;
@@ -347,44 +343,6 @@ void ProductDataToProto(const GoogleUpdateSettings::ProductData& product_data,
}
#endif
-#if defined(OS_WIN)
-struct ScreenDPIInformation {
- double max_dpi_x;
- double max_dpi_y;
-};
-
-// Called once for each connected monitor.
-BOOL CALLBACK GetMonitorDPICallback(HMONITOR, HDC hdc, LPRECT, LPARAM dwData) {
- const double kMillimetersPerInch = 25.4;
- ScreenDPIInformation* screen_info =
- reinterpret_cast<ScreenDPIInformation*>(dwData);
- // Size of screen, in mm.
- DWORD size_x = GetDeviceCaps(hdc, HORZSIZE);
- DWORD size_y = GetDeviceCaps(hdc, VERTSIZE);
- double dpi_x = (size_x > 0) ?
- GetDeviceCaps(hdc, HORZRES) / (size_x / kMillimetersPerInch) : 0;
- double dpi_y = (size_y > 0) ?
- GetDeviceCaps(hdc, VERTRES) / (size_y / kMillimetersPerInch) : 0;
- screen_info->max_dpi_x = std::max(dpi_x, screen_info->max_dpi_x);
- screen_info->max_dpi_y = std::max(dpi_y, screen_info->max_dpi_y);
- return TRUE;
-}
-
-void WriteScreenDPIInformationProto(SystemProfileProto::Hardware* hardware) {
- HDC desktop_dc = GetDC(NULL);
- if (desktop_dc) {
- ScreenDPIInformation si = {0, 0};
- if (EnumDisplayMonitors(desktop_dc, NULL, GetMonitorDPICallback,
- reinterpret_cast<LPARAM>(&si))) {
- hardware->set_max_dpi_x(si.max_dpi_x);
- hardware->set_max_dpi_y(si.max_dpi_y);
- }
- ReleaseDC(GetDesktopWindow(), desktop_dc);
- }
-}
-
-#endif // defined(OS_WIN)
-
// Round a timestamp measured in seconds since epoch to one with a granularity
// of an hour. This can be used before uploaded potentially sensitive
// timestamps.
@@ -519,20 +477,6 @@ PrefService* MetricsLog::GetPrefService() {
return g_browser_process->local_state();
}
-gfx::Size MetricsLog::GetScreenSize() const {
- return gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().GetSizeInPixel();
-}
-
-float MetricsLog::GetScreenDeviceScaleFactor() const {
- return gfx::Screen::GetNativeScreen()->
- GetPrimaryDisplay().device_scale_factor();
-}
-
-int MetricsLog::GetScreenCount() const {
- // TODO(scottmg): NativeScreen maybe wrong. http://crbug.com/133312
- return gfx::Screen::GetNativeScreen()->GetNumDisplays();
-}
-
void MetricsLog::GetFieldTrialIds(
std::vector<ActiveGroupId>* field_trial_ids) const {
variations::GetFieldTrialActiveGroupIds(field_trial_ids);
@@ -769,31 +713,6 @@ void MetricsLog::RecordEnvironment(
cpu->set_vendor_name(cpu_info.vendor_name());
cpu->set_signature(cpu_info.signature());
- const gpu::GPUInfo& gpu_info =
- GpuDataManager::GetInstance()->GetGPUInfo();
- SystemProfileProto::Hardware::Graphics* gpu = hardware->mutable_gpu();
- gpu->set_vendor_id(gpu_info.gpu.vendor_id);
- gpu->set_device_id(gpu_info.gpu.device_id);
- gpu->set_driver_version(gpu_info.driver_version);
- gpu->set_driver_date(gpu_info.driver_date);
- SystemProfileProto::Hardware::Graphics::PerformanceStatistics*
- gpu_performance = gpu->mutable_performance_statistics();
- gpu_performance->set_graphics_score(gpu_info.performance_stats.graphics);
- gpu_performance->set_gaming_score(gpu_info.performance_stats.gaming);
- gpu_performance->set_overall_score(gpu_info.performance_stats.overall);
- gpu->set_gl_vendor(gpu_info.gl_vendor);
- gpu->set_gl_renderer(gpu_info.gl_renderer);
-
- const gfx::Size display_size = GetScreenSize();
- hardware->set_primary_screen_width(display_size.width());
- hardware->set_primary_screen_height(display_size.height());
- hardware->set_primary_screen_scale_factor(GetScreenDeviceScaleFactor());
- hardware->set_screen_count(GetScreenCount());
-
-#if defined(OS_WIN)
- WriteScreenDPIInformationProto(hardware);
-#endif
-
WriteGoogleUpdateProto(google_update_metrics);
WritePluginList(plugin_list);

Powered by Google App Engine
This is Rietveld 408576698