OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/metrics/gpu/gpu_metrics_provider.h" | 5 #include "components/metrics/gpu/gpu_metrics_provider.h" |
6 | 6 |
7 #include "components/metrics/proto/system_profile.pb.h" | 7 #include "components/metrics/proto/system_profile.pb.h" |
8 #include "content/public/browser/gpu_data_manager.h" | 8 #include "content/public/browser/gpu_data_manager.h" |
9 #include "gpu/config/gpu_info.h" | 9 #include "gpu/config/gpu_info.h" |
10 #include "ui/gfx/screen.h" | 10 #include "ui/gfx/screen.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 system_profile_proto->mutable_hardware(); | 68 system_profile_proto->mutable_hardware(); |
69 | 69 |
70 const gpu::GPUInfo& gpu_info = | 70 const gpu::GPUInfo& gpu_info = |
71 content::GpuDataManager::GetInstance()->GetGPUInfo(); | 71 content::GpuDataManager::GetInstance()->GetGPUInfo(); |
72 SystemProfileProto::Hardware::Graphics* gpu = | 72 SystemProfileProto::Hardware::Graphics* gpu = |
73 hardware->mutable_gpu(); | 73 hardware->mutable_gpu(); |
74 gpu->set_vendor_id(gpu_info.gpu.vendor_id); | 74 gpu->set_vendor_id(gpu_info.gpu.vendor_id); |
75 gpu->set_device_id(gpu_info.gpu.device_id); | 75 gpu->set_device_id(gpu_info.gpu.device_id); |
76 gpu->set_driver_version(gpu_info.driver_version); | 76 gpu->set_driver_version(gpu_info.driver_version); |
77 gpu->set_driver_date(gpu_info.driver_date); | 77 gpu->set_driver_date(gpu_info.driver_date); |
78 SystemProfileProto::Hardware::Graphics::PerformanceStatistics* | |
79 gpu_performance = gpu->mutable_performance_statistics(); | |
80 gpu_performance->set_graphics_score(gpu_info.performance_stats.graphics); | |
81 gpu_performance->set_gaming_score(gpu_info.performance_stats.gaming); | |
82 gpu_performance->set_overall_score(gpu_info.performance_stats.overall); | |
83 gpu->set_gl_vendor(gpu_info.gl_vendor); | 78 gpu->set_gl_vendor(gpu_info.gl_vendor); |
84 gpu->set_gl_renderer(gpu_info.gl_renderer); | 79 gpu->set_gl_renderer(gpu_info.gl_renderer); |
85 | 80 |
86 const gfx::Size display_size = GetScreenSize(); | 81 const gfx::Size display_size = GetScreenSize(); |
87 hardware->set_primary_screen_width(display_size.width()); | 82 hardware->set_primary_screen_width(display_size.width()); |
88 hardware->set_primary_screen_height(display_size.height()); | 83 hardware->set_primary_screen_height(display_size.height()); |
89 hardware->set_primary_screen_scale_factor(GetScreenDeviceScaleFactor()); | 84 hardware->set_primary_screen_scale_factor(GetScreenDeviceScaleFactor()); |
90 hardware->set_screen_count(GetScreenCount()); | 85 hardware->set_screen_count(GetScreenCount()); |
91 | 86 |
92 #if defined(OS_WIN) | 87 #if defined(OS_WIN) |
93 WriteScreenDPIInformationProto(hardware); | 88 WriteScreenDPIInformationProto(hardware); |
94 #endif | 89 #endif |
95 } | 90 } |
96 | 91 |
97 gfx::Size GPUMetricsProvider::GetScreenSize() const { | 92 gfx::Size GPUMetricsProvider::GetScreenSize() const { |
98 return gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().GetSizeInPixel(); | 93 return gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().GetSizeInPixel(); |
99 } | 94 } |
100 | 95 |
101 float GPUMetricsProvider::GetScreenDeviceScaleFactor() const { | 96 float GPUMetricsProvider::GetScreenDeviceScaleFactor() const { |
102 return gfx::Screen::GetNativeScreen()-> | 97 return gfx::Screen::GetNativeScreen()-> |
103 GetPrimaryDisplay().device_scale_factor(); | 98 GetPrimaryDisplay().device_scale_factor(); |
104 } | 99 } |
105 | 100 |
106 int GPUMetricsProvider::GetScreenCount() const { | 101 int GPUMetricsProvider::GetScreenCount() const { |
107 // TODO(scottmg): NativeScreen maybe wrong. http://crbug.com/133312 | 102 // TODO(scottmg): NativeScreen maybe wrong. http://crbug.com/133312 |
108 return gfx::Screen::GetNativeScreen()->GetNumDisplays(); | 103 return gfx::Screen::GetNativeScreen()->GetNumDisplays(); |
109 } | 104 } |
110 | 105 |
111 } // namespace metrics | 106 } // namespace metrics |
OLD | NEW |