| 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 #if defined(OS_LINUX) && defined(USE_X11) |
| 8 #include <X11/Xlib.h> |
| 9 #endif |
| 10 |
| 7 #include <string> | 11 #include <string> |
| 8 | 12 |
| 9 #include "base/bind.h" | 13 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
| 11 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 12 #include "base/environment.h" | 16 #include "base/environment.h" |
| 13 #include "base/i18n/time_formatting.h" | 17 #include "base/i18n/time_formatting.h" |
| 14 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
| 16 #include "base/sys_info.h" | 20 #include "base/sys_info.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 30 #include "gpu/config/gpu_feature_type.h" | 34 #include "gpu/config/gpu_feature_type.h" |
| 31 #include "gpu/config/gpu_info.h" | 35 #include "gpu/config/gpu_info.h" |
| 32 #include "third_party/angle/src/common/version.h" | 36 #include "third_party/angle/src/common/version.h" |
| 33 | 37 |
| 34 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
| 35 #include "ui/base/win/shell.h" | 39 #include "ui/base/win/shell.h" |
| 36 #endif | 40 #endif |
| 37 | 41 |
| 38 #if defined(OS_LINUX) && defined(USE_X11) | 42 #if defined(OS_LINUX) && defined(USE_X11) |
| 39 #include "ui/base/x/x11_util.h" | 43 #include "ui/base/x/x11_util.h" |
| 44 #include "ui/gfx/x/x11_atom_cache.h" |
| 40 #endif | 45 #endif |
| 41 | 46 |
| 42 namespace content { | 47 namespace content { |
| 43 namespace { | 48 namespace { |
| 44 | 49 |
| 45 WebUIDataSource* CreateGpuHTMLSource() { | 50 WebUIDataSource* CreateGpuHTMLSource() { |
| 46 WebUIDataSource* source = WebUIDataSource::Create(kChromeUIGpuHost); | 51 WebUIDataSource* source = WebUIDataSource::Create(kChromeUIGpuHost); |
| 47 | 52 |
| 48 source->SetJsonPath("strings.js"); | 53 source->SetJsonPath("strings.js"); |
| 49 source->AddResourcePath("gpu_internals.js", IDR_GPU_INTERNALS_JS); | 54 source->AddResourcePath("gpu_internals.js", IDR_GPU_INTERNALS_JS); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 ui::GuessWindowManagerName())); | 176 ui::GuessWindowManagerName())); |
| 172 { | 177 { |
| 173 scoped_ptr<base::Environment> env(base::Environment::Create()); | 178 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 174 std::string value; | 179 std::string value; |
| 175 const char kXDGCurrentDesktop[] = "XDG_CURRENT_DESKTOP"; | 180 const char kXDGCurrentDesktop[] = "XDG_CURRENT_DESKTOP"; |
| 176 if (env->GetVar(kXDGCurrentDesktop, &value)) | 181 if (env->GetVar(kXDGCurrentDesktop, &value)) |
| 177 basic_info->Append(NewDescriptionValuePair(kXDGCurrentDesktop, value)); | 182 basic_info->Append(NewDescriptionValuePair(kXDGCurrentDesktop, value)); |
| 178 const char kGDMSession[] = "GDMSESSION"; | 183 const char kGDMSession[] = "GDMSESSION"; |
| 179 if (env->GetVar(kGDMSession, &value)) | 184 if (env->GetVar(kGDMSession, &value)) |
| 180 basic_info->Append(NewDescriptionValuePair(kGDMSession, value)); | 185 basic_info->Append(NewDescriptionValuePair(kGDMSession, value)); |
| 186 const char* kAtomsToCache[] = { |
| 187 "_NET_WM_CM_S0", |
| 188 NULL |
| 189 }; |
| 190 ui::X11AtomCache atom_cache(gfx::GetXDisplay(), kAtomsToCache); |
| 191 std::string compositing_manager = XGetSelectionOwner( |
| 192 gfx::GetXDisplay(), |
| 193 atom_cache.GetAtom("_NET_WM_CM_S0")) != None ? "Yes" : "No"; |
| 194 basic_info->Append( |
| 195 NewDescriptionValuePair("Compositing manager", compositing_manager)); |
| 181 } | 196 } |
| 182 #endif | 197 #endif |
| 183 std::string direct_rendering = gpu_info.direct_rendering ? "Yes" : "No"; | 198 std::string direct_rendering = gpu_info.direct_rendering ? "Yes" : "No"; |
| 184 basic_info->Append( | 199 basic_info->Append( |
| 185 NewDescriptionValuePair("Direct rendering", direct_rendering)); | 200 NewDescriptionValuePair("Direct rendering", direct_rendering)); |
| 186 | 201 |
| 187 std::string reset_strategy = | 202 std::string reset_strategy = |
| 188 base::StringPrintf("0x%04x", gpu_info.gl_reset_notification_strategy); | 203 base::StringPrintf("0x%04x", gpu_info.gl_reset_notification_strategy); |
| 189 basic_info->Append(NewDescriptionValuePair( | 204 basic_info->Append(NewDescriptionValuePair( |
| 190 "Reset notification strategy", reset_strategy)); | 205 "Reset notification strategy", reset_strategy)); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 : WebUIController(web_ui) { | 420 : WebUIController(web_ui) { |
| 406 web_ui->AddMessageHandler(new GpuMessageHandler()); | 421 web_ui->AddMessageHandler(new GpuMessageHandler()); |
| 407 | 422 |
| 408 // Set up the chrome://gpu/ source. | 423 // Set up the chrome://gpu/ source. |
| 409 BrowserContext* browser_context = | 424 BrowserContext* browser_context = |
| 410 web_ui->GetWebContents()->GetBrowserContext(); | 425 web_ui->GetWebContents()->GetBrowserContext(); |
| 411 WebUIDataSource::Add(browser_context, CreateGpuHTMLSource()); | 426 WebUIDataSource::Add(browser_context, CreateGpuHTMLSource()); |
| 412 } | 427 } |
| 413 | 428 |
| 414 } // namespace content | 429 } // namespace content |
| OLD | NEW |