OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/gpu/gpu_internals_ui.h" | 5 #include "content/browser/gpu/gpu_internals_ui.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <sstream> | |
9 #include <string> | 10 #include <string> |
10 | 11 |
11 #include "base/bind.h" | 12 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
14 #include "base/environment.h" | 15 #include "base/environment.h" |
15 #include "base/i18n/time_formatting.h" | 16 #include "base/i18n/time_formatting.h" |
16 #include "base/macros.h" | 17 #include "base/macros.h" |
17 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
18 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
(...skipping 16 matching lines...) Expand all Loading... | |
35 #include "gpu/config/gpu_feature_type.h" | 36 #include "gpu/config/gpu_feature_type.h" |
36 #include "gpu/config/gpu_info.h" | 37 #include "gpu/config/gpu_info.h" |
37 #include "third_party/angle/src/common/version.h" | 38 #include "third_party/angle/src/common/version.h" |
38 #include "ui/gl/gpu_switching_manager.h" | 39 #include "ui/gl/gpu_switching_manager.h" |
39 | 40 |
40 #if defined(OS_LINUX) && defined(USE_X11) | 41 #if defined(OS_LINUX) && defined(USE_X11) |
41 #include <X11/Xlib.h> | 42 #include <X11/Xlib.h> |
42 #endif | 43 #endif |
43 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
44 #include "ui/base/win/shell.h" | 45 #include "ui/base/win/shell.h" |
46 #include "ui/gfx/win/physical_size.h" | |
45 #endif | 47 #endif |
46 | 48 |
47 #if defined(OS_LINUX) && defined(USE_X11) | 49 #if defined(OS_LINUX) && defined(USE_X11) |
48 #include "ui/base/x/x11_util.h" | 50 #include "ui/base/x/x11_util.h" |
49 #include "ui/gfx/x/x11_atom_cache.h" | 51 #include "ui/gfx/x/x11_atom_cache.h" |
50 #endif | 52 #endif |
51 | 53 |
52 namespace content { | 54 namespace content { |
53 namespace { | 55 namespace { |
54 | 56 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 } | 143 } |
142 #if defined(OS_WIN) | 144 #if defined(OS_WIN) |
143 std::string compositor = | 145 std::string compositor = |
144 ui::win::IsAeroGlassEnabled() ? "Aero Glass" : "none"; | 146 ui::win::IsAeroGlassEnabled() ? "Aero Glass" : "none"; |
145 basic_info->Append( | 147 basic_info->Append( |
146 NewDescriptionValuePair("Desktop compositing", compositor)); | 148 NewDescriptionValuePair("Desktop compositing", compositor)); |
147 if (GpuDataManagerImpl::GetInstance()->ShouldUseWarp()) { | 149 if (GpuDataManagerImpl::GetInstance()->ShouldUseWarp()) { |
148 basic_info->Append(NewDescriptionValuePair("Using WARP", | 150 basic_info->Append(NewDescriptionValuePair("Using WARP", |
149 new base::FundamentalValue(true))); | 151 new base::FundamentalValue(true))); |
150 } | 152 } |
153 | |
154 std::vector<gfx::DisplaySize> display_sizes; | |
155 gfx::GetPhysicalSizeForDisplays(&display_sizes); | |
156 for (size_t i = 0; i < display_sizes.size(); ++i) { | |
robliao
2016/01/11 18:42:20
Could probably use the C++11 foreach here too.
for
Bret
2016/01/12 00:23:46
Done.
| |
157 const gfx::DisplaySize& display_size = display_sizes[i]; | |
158 int w = display_size.width_mm; | |
159 int h = display_size.height_mm; | |
160 double size_mm = sqrt(w * w + h * h); | |
161 double size_inches = 0.0393701 * size_mm; | |
162 double rounded_size_inches = floor(10.0 * size_inches) / 10.0; | |
163 std::ostringstream size_stream; | |
scottmg
2016/01/09 01:00:05
I see we've recently changed the style guide to al
Bret
2016/01/12 00:23:46
Done.
| |
164 size_stream << rounded_size_inches << "\""; | |
165 std::ostringstream description_stream; | |
166 description_stream << "Diagonal Monitor Size of " | |
167 << display_size.display_name; | |
168 basic_info->Append( | |
169 NewDescriptionValuePair(description_stream.str(), size_stream.str())); | |
170 } | |
151 #endif | 171 #endif |
152 | 172 |
153 std::string disabled_extensions; | 173 std::string disabled_extensions; |
154 GpuDataManagerImpl::GetInstance()->GetDisabledExtensions( | 174 GpuDataManagerImpl::GetInstance()->GetDisabledExtensions( |
155 &disabled_extensions); | 175 &disabled_extensions); |
156 | 176 |
157 basic_info->Append( | 177 basic_info->Append( |
158 NewDescriptionValuePair("Driver vendor", gpu_info.driver_vendor)); | 178 NewDescriptionValuePair("Driver vendor", gpu_info.driver_vendor)); |
159 basic_info->Append(NewDescriptionValuePair("Driver version", | 179 basic_info->Append(NewDescriptionValuePair("Driver version", |
160 gpu_info.driver_version)); | 180 gpu_info.driver_version)); |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
523 : WebUIController(web_ui) { | 543 : WebUIController(web_ui) { |
524 web_ui->AddMessageHandler(new GpuMessageHandler()); | 544 web_ui->AddMessageHandler(new GpuMessageHandler()); |
525 | 545 |
526 // Set up the chrome://gpu/ source. | 546 // Set up the chrome://gpu/ source. |
527 BrowserContext* browser_context = | 547 BrowserContext* browser_context = |
528 web_ui->GetWebContents()->GetBrowserContext(); | 548 web_ui->GetWebContents()->GetBrowserContext(); |
529 WebUIDataSource::Add(browser_context, CreateGpuHTMLSource()); | 549 WebUIDataSource::Add(browser_context, CreateGpuHTMLSource()); |
530 } | 550 } |
531 | 551 |
532 } // namespace content | 552 } // namespace content |
OLD | NEW |