Chromium Code Reviews| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/environment.h" | |
| 12 #include "base/i18n/time_formatting.h" | 13 #include "base/i18n/time_formatting.h" |
| 13 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 15 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
| 16 #include "base/values.h" | 17 #include "base/values.h" |
| 17 #include "content/browser/gpu/compositor_util.h" | 18 #include "content/browser/gpu/compositor_util.h" |
| 18 #include "content/browser/gpu/gpu_data_manager_impl.h" | 19 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 19 #include "content/grit/content_resources.h" | 20 #include "content/grit/content_resources.h" |
| 20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/browser/gpu_data_manager_observer.h" | 22 #include "content/public/browser/gpu_data_manager_observer.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 basic_info->Append(NewDescriptionValuePair("GL_VERSION", | 159 basic_info->Append(NewDescriptionValuePair("GL_VERSION", |
| 159 gpu_info.gl_version)); | 160 gpu_info.gl_version)); |
| 160 basic_info->Append(NewDescriptionValuePair("GL_EXTENSIONS", | 161 basic_info->Append(NewDescriptionValuePair("GL_EXTENSIONS", |
| 161 gpu_info.gl_extensions)); | 162 gpu_info.gl_extensions)); |
| 162 basic_info->Append(NewDescriptionValuePair("Window system binding vendor", | 163 basic_info->Append(NewDescriptionValuePair("Window system binding vendor", |
| 163 gpu_info.gl_ws_vendor)); | 164 gpu_info.gl_ws_vendor)); |
| 164 basic_info->Append(NewDescriptionValuePair("Window system binding version", | 165 basic_info->Append(NewDescriptionValuePair("Window system binding version", |
| 165 gpu_info.gl_ws_version)); | 166 gpu_info.gl_ws_version)); |
| 166 basic_info->Append(NewDescriptionValuePair("Window system binding extensions", | 167 basic_info->Append(NewDescriptionValuePair("Window system binding extensions", |
| 167 gpu_info.gl_ws_extensions)); | 168 gpu_info.gl_ws_extensions)); |
| 168 #if defined(OS_LINUX) && defined(USE_X11) | 169 #if defined(OS_LINUX) |
| 170 #if defined(USE_X11) | |
| 169 basic_info->Append(NewDescriptionValuePair("Window manager", | 171 basic_info->Append(NewDescriptionValuePair("Window manager", |
| 170 ui::GuessWindowManagerName())); | 172 ui::GuessWindowManagerName())); |
| 171 #endif | 173 #endif // USE_X11 |
| 174 { | |
|
Ken Russell (switch to Gerrit)
2014/09/04 21:48:34
This block should go inside the USE_X11 #if guards
Zhenyao Mo
2014/09/04 21:51:54
Done.
| |
| 175 scoped_ptr<base::Environment> env(base::Environment::Create()); | |
| 176 std::string value; | |
| 177 const char kXDGCurrentDesktop[] = "XDG_CURRENT_DESKTOP"; | |
| 178 if (env->GetVar(kXDGCurrentDesktop, &value)) | |
| 179 basic_info->Append(NewDescriptionValuePair(kXDGCurrentDesktop, value)); | |
| 180 const char kGDMSession[] = "GDMSESSION"; | |
| 181 if (env->GetVar(kGDMSession, &value)) | |
| 182 basic_info->Append(NewDescriptionValuePair(kGDMSession, value)); | |
| 183 } | |
| 184 #endif // OS_LINUX | |
| 172 std::string direct_rendering = gpu_info.direct_rendering ? "Yes" : "No"; | 185 std::string direct_rendering = gpu_info.direct_rendering ? "Yes" : "No"; |
| 173 basic_info->Append( | 186 basic_info->Append( |
| 174 NewDescriptionValuePair("Direct rendering", direct_rendering)); | 187 NewDescriptionValuePair("Direct rendering", direct_rendering)); |
| 175 | 188 |
| 176 std::string reset_strategy = | 189 std::string reset_strategy = |
| 177 base::StringPrintf("0x%04x", gpu_info.gl_reset_notification_strategy); | 190 base::StringPrintf("0x%04x", gpu_info.gl_reset_notification_strategy); |
| 178 basic_info->Append(NewDescriptionValuePair( | 191 basic_info->Append(NewDescriptionValuePair( |
| 179 "Reset notification strategy", reset_strategy)); | 192 "Reset notification strategy", reset_strategy)); |
| 180 | 193 |
| 181 basic_info->Append(NewDescriptionValuePair( | 194 basic_info->Append(NewDescriptionValuePair( |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 : WebUIController(web_ui) { | 407 : WebUIController(web_ui) { |
| 395 web_ui->AddMessageHandler(new GpuMessageHandler()); | 408 web_ui->AddMessageHandler(new GpuMessageHandler()); |
| 396 | 409 |
| 397 // Set up the chrome://gpu/ source. | 410 // Set up the chrome://gpu/ source. |
| 398 BrowserContext* browser_context = | 411 BrowserContext* browser_context = |
| 399 web_ui->GetWebContents()->GetBrowserContext(); | 412 web_ui->GetWebContents()->GetBrowserContext(); |
| 400 WebUIDataSource::Add(browser_context, CreateGpuHTMLSource()); | 413 WebUIDataSource::Add(browser_context, CreateGpuHTMLSource()); |
| 401 } | 414 } |
| 402 | 415 |
| 403 } // namespace content | 416 } // namespace content |
| OLD | NEW |