| 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 #ifndef CHROME_BROWSER_GPU_DATA_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_GPU_DATA_MANAGER_H_ |
| 6 #define CHROME_BROWSER_GPU_DATA_MANAGER_H_ | 6 #define CHROME_BROWSER_GPU_DATA_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "base/singleton.h" | 13 #include "base/singleton.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/web_resource/gpu_blacklist_updater.h" | 15 #include "chrome/browser/web_resource/gpu_blacklist_updater.h" |
| 16 #include "chrome/common/gpu_feature_flags.h" | 16 #include "chrome/common/gpu_feature_flags.h" |
| 17 #include "chrome/common/gpu_info.h" | 17 #include "chrome/common/gpu_info.h" |
| 18 | 18 |
| 19 class CommandLine; |
| 19 class DictionaryValue; | 20 class DictionaryValue; |
| 20 class GpuBlacklist; | 21 class GpuBlacklist; |
| 21 class GPUInfo; | 22 class GPUInfo; |
| 22 | 23 |
| 23 class GpuDataManager { | 24 class GpuDataManager { |
| 24 public: | 25 public: |
| 25 // Getter for the singleton. This will return NULL on failure. | 26 // Getter for the singleton. This will return NULL on failure. |
| 26 static GpuDataManager* GetInstance(); | 27 static GpuDataManager* GetInstance(); |
| 27 | 28 |
| 28 // Requests complete GPUinfo if it has not already been requested | 29 // Requests complete GPUinfo if it has not already been requested |
| (...skipping 15 matching lines...) Expand all Loading... |
| 44 // If necessary, compute the flags before returning them. | 45 // If necessary, compute the flags before returning them. |
| 45 GpuFeatureFlags GetGpuFeatureFlags(); | 46 GpuFeatureFlags GetGpuFeatureFlags(); |
| 46 | 47 |
| 47 // Add a callback. | 48 // Add a callback. |
| 48 void AddGpuInfoUpdateCallback(Callback0::Type* callback); | 49 void AddGpuInfoUpdateCallback(Callback0::Type* callback); |
| 49 | 50 |
| 50 // Remove a callback. | 51 // Remove a callback. |
| 51 // Returns true if removed, or false if it was not found. | 52 // Returns true if removed, or false if it was not found. |
| 52 bool RemoveGpuInfoUpdateCallback(Callback0::Type* callback); | 53 bool RemoveGpuInfoUpdateCallback(Callback0::Type* callback); |
| 53 | 54 |
| 55 // Inserting disable-feature switches into renderer process command-line |
| 56 // in correspondance to preliminary gpu feature flags. |
| 57 void AppendRendererCommandLine(CommandLine* command_line); |
| 58 |
| 54 private: | 59 private: |
| 55 friend struct DefaultSingletonTraits<GpuDataManager>; | 60 friend struct DefaultSingletonTraits<GpuDataManager>; |
| 56 | 61 |
| 57 GpuDataManager(); | 62 GpuDataManager(); |
| 58 virtual ~GpuDataManager(); | 63 virtual ~GpuDataManager(); |
| 59 | 64 |
| 60 bool LoadGpuBlacklist(); | 65 bool LoadGpuBlacklist(); |
| 61 | 66 |
| 62 // Check if a newer version of GPU blacklist has been downloaded from the | 67 // Check if a newer version of GPU blacklist has been downloaded from the |
| 63 // web (and saved in the local state); if yes, use the newer version instead. | 68 // web (and saved in the local state); if yes, use the newer version instead. |
| 64 // Return true if a newer version is installed. | 69 // Return true if a newer version is installed. |
| 65 bool UpdateGpuBlacklist(); | 70 bool UpdateGpuBlacklist(); |
| 66 | 71 |
| 67 // Check if we should go ahead and use gpu blacklist. | 72 // Check if we should go ahead and use gpu blacklist. |
| 68 // If not, return NULL; otherwise, update and return the current list. | 73 // If not, return NULL; otherwise, update and return the current list. |
| 69 GpuBlacklist* GetGpuBlacklist(); | 74 GpuBlacklist* GetGpuBlacklist(); |
| 70 | 75 |
| 71 // If flags hasn't been set and GPUInfo is available, run through blacklist | 76 // If flags hasn't been set and GPUInfo is available, run through blacklist |
| 72 // and compute the flags. | 77 // and compute the flags. |
| 73 void UpdateGpuFeatureFlags(); | 78 void UpdateGpuFeatureFlags(); |
| 74 | 79 |
| 75 // Call all callbacks. | 80 // Call all callbacks. |
| 76 void RunGpuInfoUpdateCallbacks(); | 81 void RunGpuInfoUpdateCallbacks(); |
| 77 | 82 |
| 78 bool complete_gpu_info_already_requested_; | 83 bool complete_gpu_info_already_requested_; |
| 79 | 84 |
| 80 bool gpu_feature_flags_set_; | 85 bool gpu_feature_flags_set_; |
| 81 GpuFeatureFlags gpu_feature_flags_; | 86 GpuFeatureFlags gpu_feature_flags_; |
| 87 GpuFeatureFlags preliminary_gpu_feature_flags_; |
| 82 | 88 |
| 83 GPUInfo gpu_info_; | 89 GPUInfo gpu_info_; |
| 84 | 90 |
| 85 scoped_ptr<GpuBlacklist> gpu_blacklist_; | 91 scoped_ptr<GpuBlacklist> gpu_blacklist_; |
| 86 | 92 |
| 87 scoped_refptr<GpuBlacklistUpdater> gpu_blacklist_updater_; | 93 scoped_refptr<GpuBlacklistUpdater> gpu_blacklist_updater_; |
| 88 // This is the version cached in local state that's automatically updated | 94 // This is the version cached in local state that's automatically updated |
| 89 // from the web. | 95 // from the web. |
| 90 DictionaryValue* gpu_blacklist_cache_; | 96 DictionaryValue* gpu_blacklist_cache_; |
| 91 | 97 |
| 92 // Map of callbacks. | 98 // Map of callbacks. |
| 93 std::set<Callback0::Type*> gpu_info_update_callbacks_; | 99 std::set<Callback0::Type*> gpu_info_update_callbacks_; |
| 94 | 100 |
| 95 ListValue log_messages_; | 101 ListValue log_messages_; |
| 96 | 102 |
| 97 DISALLOW_COPY_AND_ASSIGN(GpuDataManager); | 103 DISALLOW_COPY_AND_ASSIGN(GpuDataManager); |
| 98 }; | 104 }; |
| 99 | 105 |
| 100 #endif // CHROME_BROWSER_GPU_DATA_MANAGER_H_ | 106 #endif // CHROME_BROWSER_GPU_DATA_MANAGER_H_ |
| 101 | 107 |
| OLD | NEW |