blob: 3c50c0c1504fe336a3f512b3a852eb592b68cea5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/web_resource/gpu_blacklist_updater.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/pref_names.h"
#include "content/browser/browser_thread.h"
#include "content/common/notification_type.h"
namespace {
// Delay on first fetch so we don't interfere with startup.
static const int kStartGpuBlacklistFetchDelay = 6000;
// Delay between calls to update the gpu blacklist (48 hours).
static const int kCacheUpdateDelay = 48 * 60 * 60 * 1000;
} // namespace
const char* GpuBlacklistUpdater::kDefaultGpuBlacklistURL =
"https://dl.google.com/dl/edgedl/chrome/gpu/software_rendering_list.json";
GpuBlacklistUpdater::GpuBlacklistUpdater()
: WebResourceService(GpuBlacklistUpdater::kDefaultGpuBlacklistURL,
false, // don't append locale to URL
NotificationType::NOTIFICATION_TYPE_COUNT,
prefs::kGpuBlacklistUpdate,
kStartGpuBlacklistFetchDelay,
kCacheUpdateDelay) {
}
GpuBlacklistUpdater::~GpuBlacklistUpdater() { }
void GpuBlacklistUpdater::Unpack(const DictionaryValue& parsed_json) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
PrefService* local_state = g_browser_process->local_state();
DCHECK(local_state);
DictionaryValue* gpu_blacklist_cache =
local_state->GetMutableDictionary(prefs::kGpuBlacklist);
DCHECK(gpu_blacklist_cache);
gpu_blacklist_cache->Clear();
gpu_blacklist_cache->MergeDictionary(&parsed_json);
}
|