summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gpu_data_manager.h
diff options
context:
space:
mode:
authorzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-26 02:37:38 +0000
committerzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-26 02:37:38 +0000
commitbb4bf9d76e99ba7e1c7f4246dde03e2f9cf92227 (patch)
tree3acdd3c5c16508bed92f2749916aec15f35b6281 /chrome/browser/gpu_data_manager.h
parentb2d08988ad842790cabeb728a34473db064a660a (diff)
downloadchromium_src-bb4bf9d76e99ba7e1c7f4246dde03e2f9cf92227.zip
chromium_src-bb4bf9d76e99ba7e1c7f4246dde03e2f9cf92227.tar.gz
chromium_src-bb4bf9d76e99ba7e1c7f4246dde03e2f9cf92227.tar.bz2
With this CL, GPU blacklist auto update from the web is implemented. This allows us to blacklist bad GPU/drivers as soon as we discover them.
Note that this patch does not turn the auto update on. We will turn it on in a separate CL. Reland this patch after fixing a bug causing a XP test failure. BUG=68802 TEST=bots green TBR=kbr Review URL: http://codereview.chromium.org/6588035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76143 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gpu_data_manager.h')
-rw-r--r--chrome/browser/gpu_data_manager.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/chrome/browser/gpu_data_manager.h b/chrome/browser/gpu_data_manager.h
new file mode 100644
index 0000000..8275c4f
--- /dev/null
+++ b/chrome/browser/gpu_data_manager.h
@@ -0,0 +1,85 @@
+// 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.
+
+#ifndef CHROME_BROWSER_GPU_DATA_MANAGER_H_
+#define CHROME_BROWSER_GPU_DATA_MANAGER_H_
+#pragma once
+
+#include <set>
+
+#include "base/callback.h"
+#include "base/scoped_ptr.h"
+#include "base/singleton.h"
+#include "chrome/browser/web_resource/gpu_blacklist_updater.h"
+#include "chrome/common/gpu_feature_flags.h"
+#include "chrome/common/gpu_info.h"
+
+class DictionaryValue;
+class GpuBlacklist;
+class GPUInfo;
+
+class GpuDataManager {
+ public:
+ // Getter for the singleton. This will return NULL on failure.
+ static GpuDataManager* GetInstance();
+
+ // Only update if the level is higher than the cached GPUInfo level.
+ void UpdateGpuInfo(const GPUInfo& gpu_info);
+
+ const GPUInfo& gpu_info() const;
+
+ // If necessary, compute the flags before returning them.
+ GpuFeatureFlags GetGpuFeatureFlags();
+
+ // Add a callback.
+ void AddGpuInfoUpdateCallback(Callback0::Type* callback);
+
+ // Remove a callback.
+ // Returns true if removed, or false if it was not found.
+ bool RemoveGpuInfoUpdateCallback(Callback0::Type* callback);
+
+ private:
+ friend struct DefaultSingletonTraits<GpuDataManager>;
+
+ GpuDataManager();
+ virtual ~GpuDataManager();
+
+ bool LoadGpuBlacklist();
+
+ // Check if a newer version of GPU blacklist has been downloaded from the
+ // web (and saved in the local state); if yes, use the newer version instead.
+ // Return true if a newer version is installed.
+ bool UpdateGpuBlacklist();
+
+ // Check if we should go ahead and use gpu blacklist.
+ // If not, return NULL; otherwise, update and return the current list.
+ GpuBlacklist* GetGpuBlacklist();
+
+ // If flags hasn't been set and GPUInfo is available, run through blacklist
+ // and compute the flags.
+ void UpdateGpuFeatureFlags();
+
+ // Call all callbacks.
+ void RunGpuInfoUpdateCallbacks();
+
+ bool gpu_feature_flags_set_;
+ GpuFeatureFlags gpu_feature_flags_;
+
+ GPUInfo gpu_info_;
+
+ scoped_ptr<GpuBlacklist> gpu_blacklist_;
+
+ scoped_refptr<GpuBlacklistUpdater> gpu_blacklist_updater_;
+ // This is the version cached in local state that's automatically updated
+ // from the web.
+ DictionaryValue* gpu_blacklist_cache_;
+
+ // Map of callbacks.
+ std::set<Callback0::Type*> gpu_info_update_callbacks_;
+
+ DISALLOW_COPY_AND_ASSIGN(GpuDataManager);
+};
+
+#endif // CHROME_BROWSER_GPU_DATA_MANAGER_H_
+