| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 false, // don't append locale to URL | 40 false, // don't append locale to URL |
| 41 NotificationType::NOTIFICATION_TYPE_COUNT, | 41 NotificationType::NOTIFICATION_TYPE_COUNT, |
| 42 prefs::kGpuBlacklistUpdate, | 42 prefs::kGpuBlacklistUpdate, |
| 43 kStartGpuBlacklistFetchDelay, | 43 kStartGpuBlacklistFetchDelay, |
| 44 kCacheUpdateDelay), | 44 kCacheUpdateDelay), |
| 45 gpu_blacklist_cache_(NULL) { | 45 gpu_blacklist_cache_(NULL) { |
| 46 PrefService* local_state = g_browser_process->local_state(); | 46 PrefService* local_state = g_browser_process->local_state(); |
| 47 // If we bring up chrome normally, prefs should never be NULL; however, we | 47 // If we bring up chrome normally, prefs should never be NULL; however, we |
| 48 // we handle the case where local_state == NULL for certain tests. | 48 // we handle the case where local_state == NULL for certain tests. |
| 49 if (local_state) { | 49 if (local_state) { |
| 50 local_state->RegisterDictionaryPref(prefs::kGpuBlacklist); | 50 local_state->RegisterDictionaryPref(prefs::kGpuBlacklist, |
| 51 false /* don't sync pref */); |
| 51 gpu_blacklist_cache_ = local_state->GetDictionary(prefs::kGpuBlacklist); | 52 gpu_blacklist_cache_ = local_state->GetDictionary(prefs::kGpuBlacklist); |
| 52 DCHECK(gpu_blacklist_cache_); | 53 DCHECK(gpu_blacklist_cache_); |
| 53 } | 54 } |
| 54 | 55 |
| 55 LoadGpuBlacklist(); | 56 LoadGpuBlacklist(); |
| 56 } | 57 } |
| 57 | 58 |
| 58 GpuBlacklistUpdater::~GpuBlacklistUpdater() { } | 59 GpuBlacklistUpdater::~GpuBlacklistUpdater() { } |
| 59 | 60 |
| 60 void GpuBlacklistUpdater::Unpack(const DictionaryValue& parsed_json) { | 61 void GpuBlacklistUpdater::Unpack(const DictionaryValue& parsed_json) { |
| 61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 62 DictionaryPrefUpdate update(prefs_, prefs::kGpuBlacklist); | 63 DictionaryPrefUpdate update(prefs_, prefs::kGpuBlacklist); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 117 } |
| 117 } | 118 } |
| 118 } | 119 } |
| 119 } | 120 } |
| 120 | 121 |
| 121 // Need to initialize GpuDataManager to load the current GPU blacklist, | 122 // Need to initialize GpuDataManager to load the current GPU blacklist, |
| 122 // collect preliminary GPU info, and run through GPU blacklist. | 123 // collect preliminary GPU info, and run through GPU blacklist. |
| 123 GpuDataManager* gpu_data_manager = GpuDataManager::GetInstance(); | 124 GpuDataManager* gpu_data_manager = GpuDataManager::GetInstance(); |
| 124 gpu_data_manager->UpdateGpuBlacklist(gpu_blacklist.release()); | 125 gpu_data_manager->UpdateGpuBlacklist(gpu_blacklist.release()); |
| 125 } | 126 } |
| OLD | NEW |