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

Side by Side Diff: content/browser/gpu/gpu_data_manager_impl.cc

Issue 12467002: Revert 185146 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_data_manager_impl.h" 5 #include "content/browser/gpu/gpu_data_manager_impl.h"
6 6
7 #include <set>
8
9 #if defined(OS_MACOSX) 7 #if defined(OS_MACOSX)
10 #include <ApplicationServices/ApplicationServices.h> 8 #include <ApplicationServices/ApplicationServices.h>
11 #endif // OS_MACOSX 9 #endif // OS_MACOSX
12 10
13 #include "base/bind.h" 11 #include "base/bind.h"
14 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
15 #include "base/command_line.h" 13 #include "base/command_line.h"
16 #include "base/file_util.h" 14 #include "base/file_util.h"
17 #include "base/metrics/field_trial.h" 15 #include "base/metrics/field_trial.h"
18 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
19 #include "base/string16.h"
20 #include "base/string_piece.h" 17 #include "base/string_piece.h"
21 #include "base/stringprintf.h" 18 #include "base/stringprintf.h"
22 #include "base/sys_info.h" 19 #include "base/sys_info.h"
23 #include "base/values.h" 20 #include "base/values.h"
24 #include "base/version.h" 21 #include "base/version.h"
25 #include "content/browser/gpu/gpu_process_host.h" 22 #include "content/browser/gpu/gpu_process_host.h"
26 #include "content/browser/gpu/gpu_util.h" 23 #include "content/browser/gpu/gpu_util.h"
27 #include "content/common/gpu/gpu_messages.h" 24 #include "content/common/gpu/gpu_messages.h"
28 #include "content/gpu/gpu_info_collector.h" 25 #include "content/gpu/gpu_info_collector.h"
29 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
30 #include "content/public/browser/gpu_data_manager_observer.h" 27 #include "content/public/browser/gpu_data_manager_observer.h"
31 #include "content/public/common/content_client.h" 28 #include "content/public/common/content_client.h"
32 #include "content/public/common/content_constants.h" 29 #include "content/public/common/content_constants.h"
33 #include "content/public/common/content_switches.h" 30 #include "content/public/common/content_switches.h"
34 #include "grit/content_resources.h" 31 #include "grit/content_resources.h"
35 #include "ui/base/ui_base_switches.h" 32 #include "ui/base/ui_base_switches.h"
36 #include "ui/gl/gl_implementation.h" 33 #include "ui/gl/gl_implementation.h"
37 #include "ui/gl/gl_switches.h" 34 #include "ui/gl/gl_switches.h"
38 #include "ui/gl/gpu_switching_manager.h" 35 #include "ui/gl/gpu_switching_manager.h"
39 #include "webkit/plugins/plugin_switches.h" 36 #include "webkit/plugins/plugin_switches.h"
40 37
41 #if defined(OS_WIN) 38 #if defined(OS_WIN)
42 #include "base/win/registry.h"
43 #include "base/win/windows_version.h" 39 #include "base/win/windows_version.h"
44 #endif 40 #endif
45 41
46 namespace content { 42 namespace content {
47 namespace { 43 namespace {
48 44
49 // Strip out the non-digital info; if after that, we get an empty string, 45 // Strip out the non-digital info; if after that, we get an empty string,
50 // return "0". 46 // return "0".
51 std::string ProcessVersionString(const std::string& raw_string) { 47 std::string ProcessVersionString(const std::string& raw_string) {
52 const std::string valid_set = "0123456789."; 48 const std::string valid_set = "0123456789.";
(...skipping 27 matching lines...) Expand all
80 const int kNumResetsWithinDuration = 1; 76 const int kNumResetsWithinDuration = 1;
81 77
82 // Enums for UMA histograms. 78 // Enums for UMA histograms.
83 enum BlockStatusHistogram { 79 enum BlockStatusHistogram {
84 BLOCK_STATUS_NOT_BLOCKED, 80 BLOCK_STATUS_NOT_BLOCKED,
85 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED, 81 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED,
86 BLOCK_STATUS_ALL_DOMAINS_BLOCKED, 82 BLOCK_STATUS_ALL_DOMAINS_BLOCKED,
87 BLOCK_STATUS_MAX 83 BLOCK_STATUS_MAX
88 }; 84 };
89 85
90 #if defined(OS_WIN)
91 bool GetInstalledProgramDisplayNames(std::set<string16>* display_names) {
92 base::win::RegKey key;
93
94 if (FAILED(key.Open(
95 HKEY_LOCAL_MACHINE, L"SOFTWARE", KEY_READ | KEY_WOW64_64KEY))) {
96 return false;
97 }
98
99 if (FAILED(key.OpenKey(L"Microsoft", KEY_READ | KEY_WOW64_64KEY)))
100 return false;
101
102 if (FAILED(key.OpenKey(L"Windows", KEY_READ | KEY_WOW64_64KEY)))
103 return false;
104
105 if (FAILED(key.OpenKey(L"CurrentVersion", KEY_READ | KEY_WOW64_64KEY)))
106 return false;
107
108 if (FAILED(key.OpenKey(L"Uninstall", KEY_READ | KEY_WOW64_64KEY)))
109 return false;
110
111 for (base::win::RegistryKeyIterator key_it(key.Handle(), NULL);
112 key_it.Valid();
113 ++key_it) {
114 base::win::RegKey sub_key;
115 if (FAILED(sub_key.Open(
116 key.Handle(), key_it.Name(), KEY_READ | KEY_WOW64_64KEY))) {
117 continue;
118 }
119
120 string16 display_name;
121 if (FAILED(sub_key.ReadValue(L"DisplayName", &display_name)))
122 continue;
123
124 display_names->insert(display_name);
125 }
126
127 return true;
128 }
129 #endif
130 } // namespace anonymous 86 } // namespace anonymous
131 87
132 // static 88 // static
133 GpuDataManager* GpuDataManager::GetInstance() { 89 GpuDataManager* GpuDataManager::GetInstance() {
134 return GpuDataManagerImpl::GetInstance(); 90 return GpuDataManagerImpl::GetInstance();
135 } 91 }
136 92
137 // static 93 // static
138 GpuDataManagerImpl* GpuDataManagerImpl::GetInstance() { 94 GpuDataManagerImpl* GpuDataManagerImpl::GetInstance() {
139 return Singleton<GpuDataManagerImpl>::get(); 95 return Singleton<GpuDataManagerImpl>::get();
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 break; 429 break;
474 } 430 }
475 } else { 431 } else {
476 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false"); 432 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false");
477 } 433 }
478 434
479 if (!swiftshader_path.empty()) 435 if (!swiftshader_path.empty())
480 command_line->AppendSwitchPath(switches::kSwiftShaderPath, 436 command_line->AppendSwitchPath(switches::kSwiftShaderPath,
481 swiftshader_path); 437 swiftshader_path);
482 438
483 #if defined(OS_WIN)
484 // DisplayLink drivers cause a hang when running in the GPU process sandbox.
485 std::set<string16> installed_display_names;
486 if (GetInstalledProgramDisplayNames(&installed_display_names)) {
487 if (installed_display_names.find(L"DisplayLink Core Software") !=
488 installed_display_names.end()) {
489 command_line->AppendSwitch(switches::kReduceGpuSandbox);
490 }
491 }
492 #endif
493
494 { 439 {
495 base::AutoLock auto_lock(gpu_info_lock_); 440 base::AutoLock auto_lock(gpu_info_lock_);
496 if (gpu_info_.optimus) 441 if (gpu_info_.optimus)
497 command_line->AppendSwitch(switches::kReduceGpuSandbox); 442 command_line->AppendSwitch(switches::kReduceGpuSandbox);
498 if (gpu_info_.amd_switchable) { 443 if (gpu_info_.amd_switchable) {
499 // The image transport surface currently doesn't work with AMD Dynamic 444 // The image transport surface currently doesn't work with AMD Dynamic
500 // Switchable graphics. 445 // Switchable graphics.
501 command_line->AppendSwitch(switches::kReduceGpuSandbox); 446 command_line->AppendSwitch(switches::kReduceGpuSandbox);
502 command_line->AppendSwitch(switches::kDisableImageTransportSurface); 447 command_line->AppendSwitch(switches::kDisableImageTransportSurface);
503 } 448 }
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 797
853 void GpuDataManagerImpl::Notify3DAPIBlocked(const GURL& url, 798 void GpuDataManagerImpl::Notify3DAPIBlocked(const GURL& url,
854 int render_process_id, 799 int render_process_id,
855 int render_view_id, 800 int render_view_id,
856 ThreeDAPIType requester) { 801 ThreeDAPIType requester) {
857 observer_list_->Notify(&GpuDataManagerObserver::DidBlock3DAPIs, 802 observer_list_->Notify(&GpuDataManagerObserver::DidBlock3DAPIs,
858 url, render_process_id, render_view_id, requester); 803 url, render_process_id, render_view_id, requester);
859 } 804 }
860 805
861 } // namespace content 806 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698