OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/web_resource/gpu_blacklist_updater.h" | 5 #include "chrome/browser/web_resource/gpu_blacklist_updater.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 void GpuBlacklistUpdater::InitializeGpuBlacklist() { | 98 void GpuBlacklistUpdater::InitializeGpuBlacklist() { |
99 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 99 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
100 | 100 |
101 // We first load it from the browser resources. | 101 // We first load it from the browser resources. |
102 const base::StringPiece gpu_blacklist_json( | 102 const base::StringPiece gpu_blacklist_json( |
103 ResourceBundle::GetSharedInstance().GetRawDataResource( | 103 ResourceBundle::GetSharedInstance().GetRawDataResource( |
104 IDR_GPU_BLACKLIST)); | 104 IDR_GPU_BLACKLIST)); |
105 GpuBlacklist* built_in_list = new GpuBlacklist(GetChromeVersionString()); | 105 GpuBlacklist* built_in_list = new GpuBlacklist(GetChromeVersionString()); |
106 bool succeed = built_in_list->LoadGpuBlacklist( | 106 bool succeed = built_in_list->LoadGpuBlacklist( |
107 gpu_blacklist_json.as_string(), true); | 107 gpu_blacklist_json.as_string(), GpuBlacklist::kCurrentOsOnly); |
108 DCHECK(succeed); | 108 DCHECK(succeed); |
109 GpuDataManager::GetInstance()->SetBuiltInGpuBlacklist(built_in_list); | 109 GpuDataManager::GetInstance()->SetBuiltInGpuBlacklist(built_in_list); |
110 | 110 |
111 // Then we check if the cached version is more up-to-date. | 111 // Then we check if the cached version is more up-to-date. |
112 const DictionaryValue* gpu_blacklist_cache = | 112 const DictionaryValue* gpu_blacklist_cache = |
113 prefs_->GetDictionary(prefs::kGpuBlacklist); | 113 prefs_->GetDictionary(prefs::kGpuBlacklist); |
114 DCHECK(gpu_blacklist_cache); | 114 DCHECK(gpu_blacklist_cache); |
115 UpdateGpuBlacklist(*gpu_blacklist_cache, true); | 115 UpdateGpuBlacklist(*gpu_blacklist_cache, true); |
116 } | 116 } |
117 | 117 |
118 void GpuBlacklistUpdater::UpdateGpuBlacklist( | 118 void GpuBlacklistUpdater::UpdateGpuBlacklist( |
119 const DictionaryValue& gpu_blacklist_cache, bool preliminary) { | 119 const DictionaryValue& gpu_blacklist_cache, bool preliminary) { |
120 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 120 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
121 | 121 |
122 scoped_ptr<GpuBlacklist> gpu_blacklist( | 122 scoped_ptr<GpuBlacklist> gpu_blacklist( |
123 new GpuBlacklist(GetChromeVersionString())); | 123 new GpuBlacklist(GetChromeVersionString())); |
124 if (gpu_blacklist->LoadGpuBlacklist(gpu_blacklist_cache, true)) { | 124 bool success = gpu_blacklist->LoadGpuBlacklist( |
| 125 gpu_blacklist_cache, GpuBlacklist::kCurrentOsOnly); |
| 126 if (success) { |
125 GpuDataManager::GetInstance()->UpdateGpuBlacklist( | 127 GpuDataManager::GetInstance()->UpdateGpuBlacklist( |
126 gpu_blacklist.release(), preliminary); | 128 gpu_blacklist.release(), preliminary); |
127 } | 129 } |
128 } | 130 } |
OLD | NEW |