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

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

Issue 10911315: Move gpu blacklist data file to content side. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 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
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/string_piece.h"
11 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
12 #include "base/sys_info.h" 13 #include "base/sys_info.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "base/version.h" 15 #include "base/version.h"
15 #include "content/browser/gpu/gpu_process_host.h" 16 #include "content/browser/gpu/gpu_process_host.h"
16 #include "content/browser/gpu/gpu_util.h" 17 #include "content/browser/gpu/gpu_util.h"
17 #include "content/common/gpu/gpu_messages.h" 18 #include "content/common/gpu/gpu_messages.h"
18 #include "content/gpu/gpu_info_collector.h" 19 #include "content/gpu/gpu_info_collector.h"
19 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/gpu_data_manager_observer.h" 21 #include "content/public/browser/gpu_data_manager_observer.h"
21 #include "content/public/common/content_client.h" 22 #include "content/public/common/content_client.h"
22 #include "content/public/common/content_switches.h" 23 #include "content/public/common/content_switches.h"
24 #include "grit/content_resources.h"
23 #include "ui/base/ui_base_switches.h" 25 #include "ui/base/ui_base_switches.h"
24 #include "ui/gl/gl_implementation.h" 26 #include "ui/gl/gl_implementation.h"
25 #include "ui/gl/gl_switches.h" 27 #include "ui/gl/gl_switches.h"
26 #include "webkit/plugins/plugin_switches.h" 28 #include "webkit/plugins/plugin_switches.h"
27 29
28 #if defined(OS_WIN) 30 #if defined(OS_WIN)
29 #include "base/win/windows_version.h" 31 #include "base/win/windows_version.h"
30 #endif 32 #endif
31 33
32 using content::BrowserThread; 34 using content::BrowserThread;
(...skipping 22 matching lines...) Expand all
55 update_histograms_(true) { 57 update_histograms_(true) {
56 CommandLine* command_line = CommandLine::ForCurrentProcess(); 58 CommandLine* command_line = CommandLine::ForCurrentProcess();
57 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { 59 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) {
58 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); 60 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas);
59 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); 61 command_line->AppendSwitch(switches::kDisableAcceleratedLayers);
60 } 62 }
61 if (command_line->HasSwitch(switches::kDisableGpu)) 63 if (command_line->HasSwitch(switches::kDisableGpu))
62 BlacklistCard(); 64 BlacklistCard();
63 } 65 }
64 66
65 void GpuDataManagerImpl::Initialize( 67 void GpuDataManagerImpl::Initialize(const std::string& browser_version_string) {
66 const std::string& browser_version_string,
67 const std::string& gpu_blacklist_json) {
68 content::GPUInfo gpu_info; 68 content::GPUInfo gpu_info;
69 gpu_info_collector::CollectPreliminaryGraphicsInfo(&gpu_info); 69 gpu_info_collector::CollectPreliminaryGraphicsInfo(&gpu_info);
70 #if defined(ARCH_CPU_X86_FAMILY) 70 #if defined(ARCH_CPU_X86_FAMILY)
71 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) 71 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id)
72 gpu_info.finalized = true; 72 gpu_info.finalized = true;
73 #endif 73 #endif
74 74 CommandLine* command_line = CommandLine::ForCurrentProcess();
75 Initialize(browser_version_string, gpu_blacklist_json, gpu_info); 75 std::string gpu_blacklist_string;
76 if (!command_line->HasSwitch(switches::kIgnoreGpuBlacklist)) {
77 const base::StringPiece gpu_blacklist_json =
78 content::GetContentClient()->GetDataResource(
79 IDR_GPU_BLACKLIST, ui::SCALE_FACTOR_NONE);
80 gpu_blacklist_string = gpu_blacklist_json.as_string();
81 }
82 Initialize(browser_version_string, gpu_blacklist_string, gpu_info);
76 } 83 }
77 84
78 void GpuDataManagerImpl::Initialize( 85 void GpuDataManagerImpl::Initialize(
79 const std::string& browser_version_string, 86 const std::string& browser_version_string,
80 const std::string& gpu_blacklist_json, 87 const std::string& gpu_blacklist_json,
81 const content::GPUInfo& gpu_info) { 88 const content::GPUInfo& gpu_info) {
82 { 89 {
83 // This function should only be called in testing. 90 // This function should only be called in testing.
84 // We need clean up the gpu_info_ for a clean initialization. 91 // We need clean up the gpu_info_ for a clean initialization.
85 const content::GPUInfo empty_gpu_info; 92 const content::GPUInfo empty_gpu_info;
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 433
427 void GpuDataManagerImpl::BlacklistCard() { 434 void GpuDataManagerImpl::BlacklistCard() {
428 card_blacklisted_ = true; 435 card_blacklisted_ = true;
429 436
430 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL; 437 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL;
431 438
432 EnableSoftwareRenderingIfNecessary(); 439 EnableSoftwareRenderingIfNecessary();
433 NotifyGpuInfoUpdate(); 440 NotifyGpuInfoUpdate();
434 } 441 }
435 442
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698