Commit 4e039f24 authored by zmo@google.com's avatar zmo@google.com

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
parent 4734d0be
...@@ -26,7 +26,6 @@ class ComponentUpdateService; ...@@ -26,7 +26,6 @@ class ComponentUpdateService;
class DownloadRequestLimiter; class DownloadRequestLimiter;
class DownloadStatusUpdater; class DownloadStatusUpdater;
class ExtensionEventRouterForwarder; class ExtensionEventRouterForwarder;
class GpuBlacklistUpdater;
class GoogleURLTracker; class GoogleURLTracker;
class IconManager; class IconManager;
class IntranetRedirectDetector; class IntranetRedirectDetector;
...@@ -219,8 +218,6 @@ class BrowserProcess { ...@@ -219,8 +218,6 @@ class BrowserProcess {
virtual MHTMLGenerationManager* mhtml_generation_manager() = 0; virtual MHTMLGenerationManager* mhtml_generation_manager() = 0;
virtual GpuBlacklistUpdater* gpu_blacklist_updater() = 0;
virtual ComponentUpdateService* component_updater() = 0; virtual ComponentUpdateService* component_updater() = 0;
virtual CRLSetFetcher* crl_set_fetcher() = 0; virtual CRLSetFetcher* crl_set_fetcher() = 0;
......
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
#include "chrome/browser/tab_closeable_state_watcher.h" #include "chrome/browser/tab_closeable_state_watcher.h"
#include "chrome/browser/tab_contents/thumbnail_generator.h" #include "chrome/browser/tab_contents/thumbnail_generator.h"
#include "chrome/browser/ui/browser_list.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_constants.h"
#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
...@@ -686,13 +685,6 @@ MHTMLGenerationManager* BrowserProcessImpl::mhtml_generation_manager() { ...@@ -686,13 +685,6 @@ MHTMLGenerationManager* BrowserProcessImpl::mhtml_generation_manager() {
return mhtml_generation_manager_.get(); 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() { ComponentUpdateService* BrowserProcessImpl::component_updater() {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
return NULL; return NULL;
......
...@@ -124,7 +124,6 @@ class BrowserProcessImpl : public BrowserProcess, ...@@ -124,7 +124,6 @@ class BrowserProcessImpl : public BrowserProcess,
virtual ChromeNetLog* net_log() OVERRIDE; virtual ChromeNetLog* net_log() OVERRIDE;
virtual prerender::PrerenderTracker* prerender_tracker() OVERRIDE; virtual prerender::PrerenderTracker* prerender_tracker() OVERRIDE;
virtual MHTMLGenerationManager* mhtml_generation_manager() OVERRIDE; virtual MHTMLGenerationManager* mhtml_generation_manager() OVERRIDE;
virtual GpuBlacklistUpdater* gpu_blacklist_updater() OVERRIDE;
virtual ComponentUpdateService* component_updater() OVERRIDE; virtual ComponentUpdateService* component_updater() OVERRIDE;
virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE; virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE;
...@@ -281,8 +280,6 @@ class BrowserProcessImpl : public BrowserProcess, ...@@ -281,8 +280,6 @@ class BrowserProcessImpl : public BrowserProcess,
// Per-process listener for online state changes. // Per-process listener for online state changes.
scoped_ptr<BrowserOnlineStateObserver> online_state_observer_; scoped_ptr<BrowserOnlineStateObserver> online_state_observer_;
scoped_refptr<GpuBlacklistUpdater> gpu_blacklist_updater_;
#if !defined(OS_CHROMEOS) #if !defined(OS_CHROMEOS)
scoped_ptr<ComponentUpdateService> component_updater_; scoped_ptr<ComponentUpdateService> component_updater_;
......
...@@ -78,7 +78,6 @@ ...@@ -78,7 +78,6 @@
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h"
#include "chrome/browser/ui/webui/sync_promo_trial.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/child_process_logging.h"
#include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
...@@ -93,11 +92,14 @@ ...@@ -93,11 +92,14 @@
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/common/profiling.h" #include "chrome/common/profiling.h"
#include "chrome/installer/util/google_update_settings.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/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/common/content_client.h" #include "content/public/common/content_client.h"
#include "content/public/common/main_function_params.h" #include "content/public/common/main_function_params.h"
#include "grit/app_locale_settings.h" #include "grit/app_locale_settings.h"
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h" #include "grit/chromium_strings.h"
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
#include "grit/platform_locale_settings.h" #include "grit/platform_locale_settings.h"
...@@ -447,6 +449,27 @@ Profile* CreateProfile(const content::MainFunctionParams& parameters, ...@@ -447,6 +449,27 @@ Profile* CreateProfile(const content::MainFunctionParams& parameters,
return NULL; 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) #if defined(OS_CHROMEOS)
// Class is used to login using passed username and password. // Class is used to login using passed username and password.
...@@ -1875,8 +1898,8 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { ...@@ -1875,8 +1898,8 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
// ProfileKeyedServiceFactory::ServiceIsCreatedWithProfile() instead? // ProfileKeyedServiceFactory::ServiceIsCreatedWithProfile() instead?
CloudPrintProxyServiceFactory::GetForProfile(profile_); CloudPrintProxyServiceFactory::GetForProfile(profile_);
// Initialize GpuDataManager and collect preliminary gpu info. // Load GPU Blacklist.
GpuBlacklistUpdater::Setup(); InitializeGpuDataManager(parsed_command_line());
// Start watching all browser threads for responsiveness. // Start watching all browser threads for responsiveness.
ThreadWatcherList::StartWatchingAll(parsed_command_line()); ThreadWatcherList::StartWatchingAll(parsed_command_line());
......
// 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);
}
}
// 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_
...@@ -3963,8 +3963,6 @@ ...@@ -3963,8 +3963,6 @@
'browser/visitedlink/visitedlink_master.h', 'browser/visitedlink/visitedlink_master.h',
'browser/web_applications/web_app.cc', 'browser/web_applications/web_app.cc',
'browser/web_applications/web_app.h', '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.cc',
'browser/web_resource/notification_promo.h', 'browser/web_resource/notification_promo.h',
'browser/web_resource/promo_resource_service.cc', 'browser/web_resource/promo_resource_service.cc',
......
...@@ -1384,13 +1384,6 @@ const char kNTPAppPageNames[] = "ntp.app_page_names"; ...@@ -1384,13 +1384,6 @@ const char kNTPAppPageNames[] = "ntp.app_page_names";
// When true, web store promos will never be shown. // When true, web store promos will never be shown.
const char kNTPHideWebStorePromo[] = "ntp.hide_webstore_promo"; 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"; const char kDevToolsDisabled[] = "devtools.disabled";
// A boolean specifying whether dev tools window should be opened docked. // A boolean specifying whether dev tools window should be opened docked.
......
...@@ -494,9 +494,6 @@ extern const char kNTPWebStorePromoUserGroup[]; ...@@ -494,9 +494,6 @@ extern const char kNTPWebStorePromoUserGroup[];
extern const char kNTPAppPageNames[]; extern const char kNTPAppPageNames[];
extern const char kNTPHideWebStorePromo[]; extern const char kNTPHideWebStorePromo[];
extern const char kGpuBlacklist[];
extern const char kGpuBlacklistUpdate[];
extern const char kDevToolsDisabled[]; extern const char kDevToolsDisabled[];
extern const char kDevToolsOpenDocked[]; extern const char kDevToolsOpenDocked[];
extern const char kDevToolsSplitLocation[]; extern const char kDevToolsSplitLocation[];
......
...@@ -232,10 +232,6 @@ MHTMLGenerationManager* TestingBrowserProcess::mhtml_generation_manager() { ...@@ -232,10 +232,6 @@ MHTMLGenerationManager* TestingBrowserProcess::mhtml_generation_manager() {
return NULL; return NULL;
} }
GpuBlacklistUpdater* TestingBrowserProcess::gpu_blacklist_updater() {
return NULL;
}
ComponentUpdateService* TestingBrowserProcess::component_updater() { ComponentUpdateService* TestingBrowserProcess::component_updater() {
return NULL; return NULL;
} }
......
...@@ -108,7 +108,6 @@ class TestingBrowserProcess : public BrowserProcess { ...@@ -108,7 +108,6 @@ class TestingBrowserProcess : public BrowserProcess {
virtual ChromeNetLog* net_log() OVERRIDE; virtual ChromeNetLog* net_log() OVERRIDE;
virtual prerender::PrerenderTracker* prerender_tracker() OVERRIDE; virtual prerender::PrerenderTracker* prerender_tracker() OVERRIDE;
virtual MHTMLGenerationManager* mhtml_generation_manager() OVERRIDE; virtual MHTMLGenerationManager* mhtml_generation_manager() OVERRIDE;
virtual GpuBlacklistUpdater* gpu_blacklist_updater() OVERRIDE;
virtual ComponentUpdateService* component_updater() OVERRIDE; virtual ComponentUpdateService* component_updater() OVERRIDE;
virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE; virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE;
......
...@@ -51,7 +51,7 @@ class GpuFeatureTest : public InProcessBrowserTest { ...@@ -51,7 +51,7 @@ class GpuFeatureTest : public InProcessBrowserTest {
ASSERT_TRUE(blacklist->LoadGpuBlacklist( ASSERT_TRUE(blacklist->LoadGpuBlacklist(
json_blacklist, GpuBlacklist::kAllOs)); json_blacklist, GpuBlacklist::kAllOs));
GpuDataManager::GetInstance()->SetBuiltInGpuBlacklist(blacklist); GpuDataManager::GetInstance()->SetGpuBlacklist(blacklist);
} }
void RunTest(const FilePath& url, GpuResultFlags expectations) { void RunTest(const FilePath& url, GpuResultFlags expectations) {
......
...@@ -485,47 +485,12 @@ void GpuDataManager::AppendGpuCommandLine( ...@@ -485,47 +485,12 @@ void GpuDataManager::AppendGpuCommandLine(
} }
} }
void GpuDataManager::SetBuiltInGpuBlacklist(GpuBlacklist* built_in_list) { void GpuDataManager::SetGpuBlacklist(GpuBlacklist* gpu_blacklist) {
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) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(gpu_blacklist); DCHECK(gpu_blacklist);
gpu_blacklist_.reset(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(
&current_version_major, &current_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());
UpdateGpuFeatureFlags(); UpdateGpuFeatureFlags();
if (preliminary) preliminary_gpu_feature_flags_ = gpu_feature_flags_;
preliminary_gpu_feature_flags_ = gpu_feature_flags_;
VLOG(1) << "Using software rendering list version "
<< updated_version_major << "." << updated_version_minor;
} }
void GpuDataManager::HandleGpuSwitch() { void GpuDataManager::HandleGpuSwitch() {
......
...@@ -114,13 +114,7 @@ class CONTENT_EXPORT GpuDataManager { ...@@ -114,13 +114,7 @@ class CONTENT_EXPORT GpuDataManager {
// Gives ownership of the built-in blacklist. This is always called on the // Gives ownership of the built-in blacklist. This is always called on the
// UI thread. // UI thread.
void SetBuiltInGpuBlacklist(GpuBlacklist* built_in_list); void SetGpuBlacklist(GpuBlacklist* gpu_blacklist);
// 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);
// This gets called when switching GPU might have happened. // This gets called when switching GPU might have happened.
void HandleGpuSwitch(); void HandleGpuSwitch();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment