| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 // Delay on first fetch so we don't interfere with startup. | 32 // Delay on first fetch so we don't interfere with startup. |
| 33 static const int kStartGpuBlacklistFetchDelay = 6000; | 33 static const int kStartGpuBlacklistFetchDelay = 6000; |
| 34 | 34 |
| 35 // Delay between calls to update the gpu blacklist (48 hours). | 35 // Delay between calls to update the gpu blacklist (48 hours). |
| 36 static const int kCacheUpdateDelay = 48 * 60 * 60 * 1000; | 36 static const int kCacheUpdateDelay = 48 * 60 * 60 * 1000; |
| 37 | 37 |
| 38 std::string GetChromeVersionString() { | 38 std::string GetChromeVersionString() { |
| 39 static std::string cr_version; | 39 CR_DEFINE_STATIC_LOCAL(std::string, cr_version, ()); |
| 40 if (!cr_version.empty()) | 40 if (!cr_version.empty()) |
| 41 return cr_version; | 41 return cr_version; |
| 42 chrome::VersionInfo version_info; | 42 chrome::VersionInfo version_info; |
| 43 cr_version = version_info.is_valid() ? version_info.Version() : "0"; | 43 cr_version = version_info.is_valid() ? version_info.Version() : "0"; |
| 44 switch (version_info.GetChannel()) { | 44 switch (version_info.GetChannel()) { |
| 45 case chrome::VersionInfo::CHANNEL_STABLE: | 45 case chrome::VersionInfo::CHANNEL_STABLE: |
| 46 cr_version += " stable"; | 46 cr_version += " stable"; |
| 47 break; | 47 break; |
| 48 case chrome::VersionInfo::CHANNEL_BETA: | 48 case chrome::VersionInfo::CHANNEL_BETA: |
| 49 cr_version += " beta"; | 49 cr_version += " beta"; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 scoped_ptr<GpuBlacklist> gpu_blacklist( | 149 scoped_ptr<GpuBlacklist> gpu_blacklist( |
| 150 new GpuBlacklist(GetChromeVersionString())); | 150 new GpuBlacklist(GetChromeVersionString())); |
| 151 bool success = gpu_blacklist->LoadGpuBlacklist( | 151 bool success = gpu_blacklist->LoadGpuBlacklist( |
| 152 gpu_blacklist_cache, GpuBlacklist::kCurrentOsOnly); | 152 gpu_blacklist_cache, GpuBlacklist::kCurrentOsOnly); |
| 153 if (success) { | 153 if (success) { |
| 154 GpuDataManager::GetInstance()->UpdateGpuBlacklist( | 154 GpuDataManager::GetInstance()->UpdateGpuBlacklist( |
| 155 gpu_blacklist.release(), preliminary); | 155 gpu_blacklist.release(), preliminary); |
| 156 } | 156 } |
| 157 } | 157 } |
| OLD | NEW |