diff options
author | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-03 07:29:38 +0000 |
---|---|---|
committer | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-03 07:29:38 +0000 |
commit | 4e039f24f17dd7b3bd12e572e82cca978188055a (patch) | |
tree | 000610ced7295d052a5be50d67e8296bfc78de98 | |
parent | 4734d0becafa5b77d708020eed24d97148ea208d (diff) | |
download | chromium_src-4e039f24f17dd7b3bd12e572e82cca978188055a.zip chromium_src-4e039f24f17dd7b3bd12e572e82cca978188055a.tar.gz chromium_src-4e039f24f17dd7b3bd12e572e82cca978188055a.tar.bz2 |
Remove dead code for gpu blacklist auto-update.
BUG=103851
TEST=tree
R=kbr
Review URL: http://codereview.chromium.org/8758003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112879 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser_process.h | 3 | ||||
-rw-r--r-- | chrome/browser/browser_process_impl.cc | 8 | ||||
-rw-r--r-- | chrome/browser/browser_process_impl.h | 3 | ||||
-rw-r--r-- | chrome/browser/chrome_browser_main.cc | 29 | ||||
-rw-r--r-- | chrome/browser/web_resource/gpu_blacklist_updater.cc | 120 | ||||
-rw-r--r-- | chrome/browser/web_resource/gpu_blacklist_updater.h | 34 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 2 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 7 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 3 | ||||
-rw-r--r-- | chrome/test/base/testing_browser_process.cc | 4 | ||||
-rw-r--r-- | chrome/test/base/testing_browser_process.h | 1 | ||||
-rw-r--r-- | chrome/test/gpu/gpu_feature_browsertest.cc | 2 | ||||
-rw-r--r-- | content/browser/gpu/gpu_data_manager.cc | 41 | ||||
-rw-r--r-- | content/browser/gpu/gpu_data_manager.h | 8 |
14 files changed, 31 insertions, 234 deletions
diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h index faaa90c..c2bb8a7 100644 --- a/chrome/browser/browser_process.h +++ b/chrome/browser/browser_process.h @@ -26,7 +26,6 @@ class ComponentUpdateService; class DownloadRequestLimiter; class DownloadStatusUpdater; class ExtensionEventRouterForwarder; -class GpuBlacklistUpdater; class GoogleURLTracker; class IconManager; class IntranetRedirectDetector; @@ -219,8 +218,6 @@ class BrowserProcess { virtual MHTMLGenerationManager* mhtml_generation_manager() = 0; - virtual GpuBlacklistUpdater* gpu_blacklist_updater() = 0; - virtual ComponentUpdateService* component_updater() = 0; virtual CRLSetFetcher* crl_set_fetcher() = 0; diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index 37bdd925..fc7aeda 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -56,7 +56,6 @@ #include "chrome/browser/tab_closeable_state_watcher.h" #include "chrome/browser/tab_contents/thumbnail_generator.h" #include "chrome/browser/ui/browser_list.h" -#include "chrome/browser/web_resource/gpu_blacklist_updater.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" @@ -686,13 +685,6 @@ MHTMLGenerationManager* BrowserProcessImpl::mhtml_generation_manager() { return mhtml_generation_manager_.get(); } -GpuBlacklistUpdater* BrowserProcessImpl::gpu_blacklist_updater() { - if (!gpu_blacklist_updater_.get()) - gpu_blacklist_updater_ = new GpuBlacklistUpdater(); - - return gpu_blacklist_updater_.get(); -} - ComponentUpdateService* BrowserProcessImpl::component_updater() { #if defined(OS_CHROMEOS) return NULL; diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h index 2fb2095..423202d 100644 --- a/chrome/browser/browser_process_impl.h +++ b/chrome/browser/browser_process_impl.h @@ -124,7 +124,6 @@ class BrowserProcessImpl : public BrowserProcess, virtual ChromeNetLog* net_log() OVERRIDE; virtual prerender::PrerenderTracker* prerender_tracker() OVERRIDE; virtual MHTMLGenerationManager* mhtml_generation_manager() OVERRIDE; - virtual GpuBlacklistUpdater* gpu_blacklist_updater() OVERRIDE; virtual ComponentUpdateService* component_updater() OVERRIDE; virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE; @@ -281,8 +280,6 @@ class BrowserProcessImpl : public BrowserProcess, // Per-process listener for online state changes. scoped_ptr<BrowserOnlineStateObserver> online_state_observer_; - scoped_refptr<GpuBlacklistUpdater> gpu_blacklist_updater_; - #if !defined(OS_CHROMEOS) scoped_ptr<ComponentUpdateService> component_updater_; diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index bb235c7..3930cb6 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -78,7 +78,6 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" #include "chrome/browser/ui/webui/sync_promo_trial.h" -#include "chrome/browser/web_resource/gpu_blacklist_updater.h" #include "chrome/common/child_process_logging.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" @@ -93,11 +92,14 @@ #include "chrome/common/pref_names.h" #include "chrome/common/profiling.h" #include "chrome/installer/util/google_update_settings.h" +#include "content/browser/gpu/gpu_blacklist.h" +#include "content/browser/gpu/gpu_data_manager.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/content_client.h" #include "content/public/common/main_function_params.h" #include "grit/app_locale_settings.h" +#include "grit/browser_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/platform_locale_settings.h" @@ -447,6 +449,27 @@ Profile* CreateProfile(const content::MainFunctionParams& parameters, return NULL; } +// Load GPU Blacklist, collect preliminary gpu info, and compute preliminary +// gpu feature flags. +void InitializeGpuDataManager(const CommandLine& parsed_command_line) { + GpuDataManager::GetInstance(); + + if (parsed_command_line.HasSwitch(switches::kSkipGpuDataLoading)) + return; + + const base::StringPiece gpu_blacklist_json( + ResourceBundle::GetSharedInstance().GetRawDataResource( + IDR_GPU_BLACKLIST)); + chrome::VersionInfo version_info; + std::string chrome_version_string = + version_info.is_valid() ? version_info.Version() : "0"; + GpuBlacklist* gpu_blacklist = new GpuBlacklist(chrome_version_string); + bool succeed = gpu_blacklist->LoadGpuBlacklist( + gpu_blacklist_json.as_string(), GpuBlacklist::kCurrentOsOnly); + DCHECK(succeed); + GpuDataManager::GetInstance()->SetGpuBlacklist(gpu_blacklist); +} + #if defined(OS_CHROMEOS) // Class is used to login using passed username and password. @@ -1875,8 +1898,8 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { // ProfileKeyedServiceFactory::ServiceIsCreatedWithProfile() instead? CloudPrintProxyServiceFactory::GetForProfile(profile_); - // Initialize GpuDataManager and collect preliminary gpu info. - GpuBlacklistUpdater::Setup(); + // Load GPU Blacklist. + InitializeGpuDataManager(parsed_command_line()); // Start watching all browser threads for responsiveness. ThreadWatcherList::StartWatchingAll(parsed_command_line()); diff --git a/chrome/browser/web_resource/gpu_blacklist_updater.cc b/chrome/browser/web_resource/gpu_blacklist_updater.cc deleted file mode 100644 index 3a28087..0000000 --- a/chrome/browser/web_resource/gpu_blacklist_updater.cc +++ /dev/null @@ -1,120 +0,0 @@ -// 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/bind.h" -#include "base/command_line.h" -#include "base/logging.h" -#include "base/values.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/prefs/pref_service.h" -#include "chrome/browser/prefs/scoped_user_pref_update.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/profiles/profile_manager.h" -#include "chrome/common/chrome_notification_types.h" -#include "chrome/common/chrome_version_info.h" -#include "chrome/common/pref_names.h" -#include "content/browser/gpu/gpu_blacklist.h" -#include "content/browser/gpu/gpu_data_manager.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/common/content_switches.h" -#include "grit/browser_resources.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/gfx/gl/gl_implementation.h" -#include "ui/gfx/gl/gl_switches.h" - -using content::BrowserThread; - -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; - -std::string GetChromeVersionString() { - chrome::VersionInfo version_info; - return version_info.is_valid() ? version_info.Version() : "0"; -} - -} // namespace anonymous - -const char* GpuBlacklistUpdater::kDefaultGpuBlacklistURL = - "https://ssl.gstatic.com/chrome/config/software_rendering_list.json"; - -GpuBlacklistUpdater::GpuBlacklistUpdater() - : WebResourceService(g_browser_process->local_state(), - GpuBlacklistUpdater::kDefaultGpuBlacklistURL, - false, // don't append locale to URL - chrome::NOTIFICATION_CHROME_END, - prefs::kGpuBlacklistUpdate, - kStartGpuBlacklistFetchDelay, - kCacheUpdateDelay) { - prefs_->RegisterDictionaryPref(prefs::kGpuBlacklist); - InitializeGpuBlacklist(); -} - -GpuBlacklistUpdater::~GpuBlacklistUpdater() { } - -// static -void GpuBlacklistUpdater::Setup() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - - // Initialize GpuDataManager instance, which collects preliminary - // graphics information. - GpuDataManager::GetInstance(); - - // Skip auto updates in tests. - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - if (command_line.HasSwitch(switches::kSkipGpuDataLoading)) - return; - - // Initialize GpuBlacklistUpdater, which loads the current blacklist; - // then Schedule a GPU blacklist auto update. - GpuBlacklistUpdater* updater = - g_browser_process->gpu_blacklist_updater(); - DCHECK(updater); -} - -void GpuBlacklistUpdater::Unpack(const DictionaryValue& parsed_json) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - prefs_->Set(prefs::kGpuBlacklist, parsed_json); - UpdateGpuBlacklist(parsed_json, false); -} - -void GpuBlacklistUpdater::InitializeGpuBlacklist() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - - // We first load it from the browser resources. - const base::StringPiece gpu_blacklist_json( - ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_GPU_BLACKLIST)); - GpuBlacklist* built_in_list = new GpuBlacklist(GetChromeVersionString()); - bool succeed = built_in_list->LoadGpuBlacklist( - gpu_blacklist_json.as_string(), GpuBlacklist::kCurrentOsOnly); - DCHECK(succeed); - GpuDataManager::GetInstance()->SetBuiltInGpuBlacklist(built_in_list); - - // Then we check if the cached version is more up-to-date. - const DictionaryValue* gpu_blacklist_cache = - prefs_->GetDictionary(prefs::kGpuBlacklist); - DCHECK(gpu_blacklist_cache); - UpdateGpuBlacklist(*gpu_blacklist_cache, true); -} - -void GpuBlacklistUpdater::UpdateGpuBlacklist( - const DictionaryValue& gpu_blacklist_cache, bool preliminary) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - - scoped_ptr<GpuBlacklist> gpu_blacklist( - new GpuBlacklist(GetChromeVersionString())); - bool success = gpu_blacklist->LoadGpuBlacklist( - gpu_blacklist_cache, GpuBlacklist::kCurrentOsOnly); - if (success) { - GpuDataManager::GetInstance()->UpdateGpuBlacklist( - gpu_blacklist.release(), preliminary); - } -} diff --git a/chrome/browser/web_resource/gpu_blacklist_updater.h b/chrome/browser/web_resource/gpu_blacklist_updater.h deleted file mode 100644 index 9fe4c84..0000000 --- a/chrome/browser/web_resource/gpu_blacklist_updater.h +++ /dev/null @@ -1,34 +0,0 @@ -// 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_WEB_RESOURCE_GPU_BLACKLIST_UPDATER_H_ -#define CHROME_BROWSER_WEB_RESOURCE_GPU_BLACKLIST_UPDATER_H_ -#pragma once - -#include "chrome/browser/web_resource/web_resource_service.h" - -class GpuBlacklistUpdater : public WebResourceService { - public: - GpuBlacklistUpdater(); - - // Initialize GpuDataManager. - static void Setup(); - - // URL of the up-to-date gpu_blacklist.json file. - static const char* kDefaultGpuBlacklistURL; - - private: - virtual ~GpuBlacklistUpdater(); - - virtual void Unpack(const base::DictionaryValue& parsed_json) OVERRIDE; - - void InitializeGpuBlacklist(); - - void UpdateGpuBlacklist( - const base::DictionaryValue& gpu_blacklist_cache, bool preliminary); - - DISALLOW_COPY_AND_ASSIGN(GpuBlacklistUpdater); -}; - -#endif // CHROME_BROWSER_WEB_RESOURCE_GPU_BLACKLIST_UPDATER_H_ diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 548183a..5884782 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -3963,8 +3963,6 @@ 'browser/visitedlink/visitedlink_master.h', 'browser/web_applications/web_app.cc', 'browser/web_applications/web_app.h', - 'browser/web_resource/gpu_blacklist_updater.cc', - 'browser/web_resource/gpu_blacklist_updater.h', 'browser/web_resource/notification_promo.cc', 'browser/web_resource/notification_promo.h', 'browser/web_resource/promo_resource_service.cc', diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index dd9de9f..eaee7c8 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -1384,13 +1384,6 @@ const char kNTPAppPageNames[] = "ntp.app_page_names"; // When true, web store promos will never be shown. const char kNTPHideWebStorePromo[] = "ntp.hide_webstore_promo"; -// The most up-to-date GPU blacklist downloaded from the web, which replaces -// the one that's installed with chrome. -const char kGpuBlacklist[] = "gpu_blacklist"; - -// Last time of update of gpu_blacklist. -const char kGpuBlacklistUpdate[] = "gpu_blacklist_update"; - const char kDevToolsDisabled[] = "devtools.disabled"; // A boolean specifying whether dev tools window should be opened docked. diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 0123ab3..e60d9a1 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -494,9 +494,6 @@ extern const char kNTPWebStorePromoUserGroup[]; extern const char kNTPAppPageNames[]; extern const char kNTPHideWebStorePromo[]; -extern const char kGpuBlacklist[]; -extern const char kGpuBlacklistUpdate[]; - extern const char kDevToolsDisabled[]; extern const char kDevToolsOpenDocked[]; extern const char kDevToolsSplitLocation[]; diff --git a/chrome/test/base/testing_browser_process.cc b/chrome/test/base/testing_browser_process.cc index 8610f47..84008aa 100644 --- a/chrome/test/base/testing_browser_process.cc +++ b/chrome/test/base/testing_browser_process.cc @@ -232,10 +232,6 @@ MHTMLGenerationManager* TestingBrowserProcess::mhtml_generation_manager() { return NULL; } -GpuBlacklistUpdater* TestingBrowserProcess::gpu_blacklist_updater() { - return NULL; -} - ComponentUpdateService* TestingBrowserProcess::component_updater() { return NULL; } diff --git a/chrome/test/base/testing_browser_process.h b/chrome/test/base/testing_browser_process.h index c00d351..2f9dbc8 100644 --- a/chrome/test/base/testing_browser_process.h +++ b/chrome/test/base/testing_browser_process.h @@ -108,7 +108,6 @@ class TestingBrowserProcess : public BrowserProcess { virtual ChromeNetLog* net_log() OVERRIDE; virtual prerender::PrerenderTracker* prerender_tracker() OVERRIDE; virtual MHTMLGenerationManager* mhtml_generation_manager() OVERRIDE; - virtual GpuBlacklistUpdater* gpu_blacklist_updater() OVERRIDE; virtual ComponentUpdateService* component_updater() OVERRIDE; virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE; diff --git a/chrome/test/gpu/gpu_feature_browsertest.cc b/chrome/test/gpu/gpu_feature_browsertest.cc index b985ced..6c27cf0 100644 --- a/chrome/test/gpu/gpu_feature_browsertest.cc +++ b/chrome/test/gpu/gpu_feature_browsertest.cc @@ -51,7 +51,7 @@ class GpuFeatureTest : public InProcessBrowserTest { ASSERT_TRUE(blacklist->LoadGpuBlacklist( json_blacklist, GpuBlacklist::kAllOs)); - GpuDataManager::GetInstance()->SetBuiltInGpuBlacklist(blacklist); + GpuDataManager::GetInstance()->SetGpuBlacklist(blacklist); } void RunTest(const FilePath& url, GpuResultFlags expectations) { diff --git a/content/browser/gpu/gpu_data_manager.cc b/content/browser/gpu/gpu_data_manager.cc index 6be0ca8..17895b3 100644 --- a/content/browser/gpu/gpu_data_manager.cc +++ b/content/browser/gpu/gpu_data_manager.cc @@ -485,47 +485,12 @@ void GpuDataManager::AppendGpuCommandLine( } } -void GpuDataManager::SetBuiltInGpuBlacklist(GpuBlacklist* built_in_list) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK(built_in_list); - uint16 version_major, version_minor; - bool succeed = built_in_list->GetVersion( - &version_major, &version_minor); - DCHECK(succeed); - gpu_blacklist_.reset(built_in_list); - UpdateGpuFeatureFlags(); - preliminary_gpu_feature_flags_ = gpu_feature_flags_; - VLOG(1) << "Using software rendering list version " - << version_major << "." << version_minor; -} - -void GpuDataManager::UpdateGpuBlacklist( - GpuBlacklist* gpu_blacklist, bool preliminary) { +void GpuDataManager::SetGpuBlacklist(GpuBlacklist* gpu_blacklist) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(gpu_blacklist); - - scoped_ptr<GpuBlacklist> updated_list(gpu_blacklist); - - uint16 updated_version_major, updated_version_minor; - if (!updated_list->GetVersion( - &updated_version_major, &updated_version_minor)) - return; - - uint16 current_version_major, current_version_minor; - bool succeed = gpu_blacklist_->GetVersion( - ¤t_version_major, ¤t_version_minor); - DCHECK(succeed); - if (updated_version_major < current_version_major || - (updated_version_major == current_version_major && - updated_version_minor <= current_version_minor)) - return; - - gpu_blacklist_.reset(updated_list.release()); + gpu_blacklist_.reset(gpu_blacklist); UpdateGpuFeatureFlags(); - if (preliminary) - preliminary_gpu_feature_flags_ = gpu_feature_flags_; - VLOG(1) << "Using software rendering list version " - << updated_version_major << "." << updated_version_minor; + preliminary_gpu_feature_flags_ = gpu_feature_flags_; } void GpuDataManager::HandleGpuSwitch() { diff --git a/content/browser/gpu/gpu_data_manager.h b/content/browser/gpu/gpu_data_manager.h index e2585af..5880c2f 100644 --- a/content/browser/gpu/gpu_data_manager.h +++ b/content/browser/gpu/gpu_data_manager.h @@ -114,13 +114,7 @@ class CONTENT_EXPORT GpuDataManager { // Gives ownership of the built-in blacklist. This is always called on the // UI thread. - void SetBuiltInGpuBlacklist(GpuBlacklist* built_in_list); - - // Gives ownership of the latest blacklist. This is always called on the UI - // thread. - // TODO(zmo): Get rid of preliminary because it should not be exposed to - // outside GpuDataManager. - void UpdateGpuBlacklist(GpuBlacklist* updated_list, bool preliminary); + void SetGpuBlacklist(GpuBlacklist* gpu_blacklist); // This gets called when switching GPU might have happened. void HandleGpuSwitch(); |