diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-13 19:38:03 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-13 19:38:03 +0000 |
commit | b376d5098b0e8624bd9fd67aadfc469208c75c9f (patch) | |
tree | 161a2aa6bf47c25387e4e0d7eb1f3aa5a4e21786 /components | |
parent | 35a4e5cfe2ca73705f7ca062ea41d86e445647d9 (diff) | |
download | chromium_src-b376d5098b0e8624bd9fd67aadfc469208c75c9f.zip chromium_src-b376d5098b0e8624bd9fd67aadfc469208c75c9f.tar.gz chromium_src-b376d5098b0e8624bd9fd67aadfc469208c75c9f.tar.bz2 |
Remove the ability for the WebDataService to temporarily unload the database.
This was only used by the MemoryPurger, which is now gone.
BUG=350455
TEST=none
R=joi@chromium.org
Review URL: https://codereview.chromium.org/196923003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256889 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
6 files changed, 11 insertions, 39 deletions
diff --git a/components/webdata/common/web_data_service_backend.cc b/components/webdata/common/web_data_service_backend.cc index 9f48e52..12026bc 100644 --- a/components/webdata/common/web_data_service_backend.cc +++ b/components/webdata/common/web_data_service_backend.cc @@ -45,8 +45,7 @@ sql::InitStatus WebDataServiceBackend::LoadDatabaseIfNecessary() { db_.reset(new WebDatabase()); for (ScopedVector<WebDatabaseTable>::iterator it = tables_.begin(); - it != tables_.end(); - ++it) { + it != tables_.end(); ++it) { db_->AddTable(*it); } @@ -61,13 +60,11 @@ sql::InitStatus WebDataServiceBackend::LoadDatabaseIfNecessary() { return init_status_; } -void WebDataServiceBackend::ShutdownDatabase(bool should_reinit) { +void WebDataServiceBackend::ShutdownDatabase() { if (db_ && init_status_ == sql::INIT_OK) db_->CommitTransaction(); db_.reset(NULL); - init_complete_ = !should_reinit; // Setting init_complete_ to true will ensure - // that the init sequence is not re-run. - + init_complete_ = true; // Ensures the init sequence is not re-run. init_status_ = sql::INIT_FAILURE; } @@ -111,7 +108,7 @@ scoped_ptr<WDTypedResult> WebDataServiceBackend::ExecuteReadTask( } WebDataServiceBackend::~WebDataServiceBackend() { - ShutdownDatabase(false); + ShutdownDatabase(); } void WebDataServiceBackend::Commit() { diff --git a/components/webdata/common/web_data_service_backend.h b/components/webdata/common/web_data_service_backend.h index 3a6fe6f..3804422 100644 --- a/components/webdata/common/web_data_service_backend.h +++ b/components/webdata/common/web_data_service_backend.h @@ -35,7 +35,7 @@ class WEBDATA_EXPORT WebDataServiceBackend : public base::RefCountedDeleteOnMessageLoop<WebDataServiceBackend> { public: class Delegate { - public: + public: virtual ~Delegate() {} // Invoked when the backend has finished loading the db. @@ -59,9 +59,8 @@ class WEBDATA_EXPORT WebDataServiceBackend // the status of the database. sql::InitStatus LoadDatabaseIfNecessary(); - // Shuts down database. |should_reinit| tells us whether or not it should be - // possible to re-initialize the DB after the shutdown. - void ShutdownDatabase(bool should_reinit); + // Shuts down the database. + void ShutdownDatabase(); // Task wrappers to update requests and and notify |request_manager_|. These // are used in cases where the request is being made from the UI thread and an diff --git a/components/webdata/common/web_data_service_base.cc b/components/webdata/common/web_data_service_base.cc index 6427e5d..6f7b776 100644 --- a/components/webdata/common/web_data_service_base.cc +++ b/components/webdata/common/web_data_service_base.cc @@ -37,12 +37,6 @@ void WebDataServiceBase::Init() { wdbs_->LoadDatabase(); } -void WebDataServiceBase::UnloadDatabase() { - if (!wdbs_.get()) - return; - wdbs_->UnloadDatabase(); -} - void WebDataServiceBase::ShutdownDatabase() { if (!wdbs_.get()) return; diff --git a/components/webdata/common/web_data_service_base.h b/components/webdata/common/web_data_service_base.h index 3a39622..b80f4bc 100644 --- a/components/webdata/common/web_data_service_base.h +++ b/components/webdata/common/web_data_service_base.h @@ -62,11 +62,7 @@ class WEBDATA_EXPORT WebDataServiceBase // Initializes the web data service. virtual void Init(); - // Unloads the database without actually shutting down the service. This can - // be used to temporarily reduce the browser process' memory footprint. - void UnloadDatabase(); - - // Unloads the database permanently and shuts down service. + // Unloads the database and shuts down service. void ShutdownDatabase(); // Register a callback to be notified that the database has loaded. Multiple diff --git a/components/webdata/common/web_database_service.cc b/components/webdata/common/web_database_service.cc index 599ca03..61846d1 100644 --- a/components/webdata/common/web_database_service.cc +++ b/components/webdata/common/web_database_service.cc @@ -71,15 +71,6 @@ void WebDatabaseService::LoadDatabase() { Bind(&WebDataServiceBackend::InitDatabase, wds_backend_)); } -void WebDatabaseService::UnloadDatabase() { - db_loaded_ = false; - if (!wds_backend_) - return; - db_thread_->PostTask(FROM_HERE, - Bind(&WebDataServiceBackend::ShutdownDatabase, - wds_backend_, true)); -} - void WebDatabaseService::ShutdownDatabase() { db_loaded_ = false; loaded_callbacks_.clear(); @@ -87,9 +78,8 @@ void WebDatabaseService::ShutdownDatabase() { weak_ptr_factory_.InvalidateWeakPtrs(); if (!wds_backend_) return; - db_thread_->PostTask(FROM_HERE, - Bind(&WebDataServiceBackend::ShutdownDatabase, - wds_backend_, false)); + db_thread_->PostTask( + FROM_HERE, Bind(&WebDataServiceBackend::ShutdownDatabase, wds_backend_)); } WebDatabase* WebDatabaseService::GetDatabaseOnDB() const { diff --git a/components/webdata/common/web_database_service.h b/components/webdata/common/web_database_service.h index 4b30876..3c76657 100644 --- a/components/webdata/common/web_database_service.h +++ b/components/webdata/common/web_database_service.h @@ -70,11 +70,7 @@ class WEBDATA_EXPORT WebDatabaseService // Initializes the web database service. virtual void LoadDatabase(); - // Unloads the database without actually shutting down the service. This can - // be used to temporarily reduce the browser process' memory footprint. - virtual void UnloadDatabase(); - - // Unloads database and will not reload. + // Unloads the database and shuts down the service. virtual void ShutdownDatabase(); // Gets a pointer to the WebDatabase (owned by WebDatabaseService). |