summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-13 19:34:40 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-13 19:34:40 +0000
commit7108c64f6bd1e125e62161f356cdbff3dcf37032 (patch)
tree1ba3c2c494f01e065e53581309ed99f5b8f94a37
parentacc4ec81894936924635a483c3b6c146c30cde54 (diff)
downloadchromium_src-7108c64f6bd1e125e62161f356cdbff3dcf37032.zip
chromium_src-7108c64f6bd1e125e62161f356cdbff3dcf37032.tar.gz
chromium_src-7108c64f6bd1e125e62161f356cdbff3dcf37032.tar.bz2
Remove BrowserContext::PurgeMemory(). The MemoryPurger is gone.
BUG=350455 TEST=none R=jam@chromium.org, michaeln@chromium.org Review URL: https://codereview.chromium.org/194053002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256883 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/appcache/chrome_appcache_service.h3
-rw-r--r--content/browser/browser_context.cc27
-rw-r--r--content/browser/dom_storage/dom_storage_context_impl.cc11
-rw-r--r--content/browser/dom_storage/dom_storage_context_impl.h1
-rw-r--r--content/browser/dom_storage/dom_storage_context_impl_unittest.cc1
-rw-r--r--content/browser/dom_storage/dom_storage_context_wrapper.cc8
-rw-r--r--content/browser/dom_storage/dom_storage_context_wrapper.h3
-rw-r--r--content/public/browser/browser_context.h3
-rw-r--r--webkit/browser/appcache/appcache_database.cc7
-rw-r--r--webkit/browser/appcache/appcache_database.h1
-rw-r--r--webkit/browser/appcache/appcache_database_unittest.cc40
-rw-r--r--webkit/browser/appcache/appcache_service.h8
-rw-r--r--webkit/browser/appcache/appcache_storage.h2
-rw-r--r--webkit/browser/appcache/appcache_storage_impl.cc19
-rw-r--r--webkit/browser/appcache/appcache_storage_impl.h2
-rw-r--r--webkit/browser/appcache/mock_appcache_storage.h1
-rw-r--r--webkit/browser/appcache/view_appcache_internals_job.cc1
17 files changed, 27 insertions, 111 deletions
diff --git a/content/browser/appcache/chrome_appcache_service.h b/content/browser/appcache/chrome_appcache_service.h
index 3c787e5..61eafc1 100644
--- a/content/browser/appcache/chrome_appcache_service.h
+++ b/content/browser/appcache/chrome_appcache_service.h
@@ -45,8 +45,9 @@ class CONTENT_EXPORT ChromeAppCacheService
public:
explicit ChromeAppCacheService(quota::QuotaManagerProxy* proxy);
+ // If |cache_path| is empty we will use in-memory structs.
void InitializeOnIOThread(
- const base::FilePath& cache_path, // May be empty to use in-memory structs.
+ const base::FilePath& cache_path,
ResourceContext* resource_context,
net::URLRequestContextGetter* request_context_getter,
scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy);
diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc
index b720ae48..170f898 100644
--- a/content/browser/browser_context.cc
+++ b/content/browser/browser_context.cc
@@ -5,12 +5,9 @@
#include "content/public/browser/browser_context.h"
#if !defined(OS_IOS)
-#include "content/browser/appcache/chrome_appcache_service.h"
-#include "content/browser/dom_storage/dom_storage_context_wrapper.h"
#include "content/browser/download/download_manager_impl.h"
#include "content/browser/indexed_db/indexed_db_context_impl.h"
#include "content/browser/loader/resource_dispatcher_host_impl.h"
-#include "content/browser/storage_partition_impl.h"
#include "content/browser/storage_partition_impl_map.h"
#include "content/common/child_process_host_impl.h"
#include "content/public/browser/browser_thread.h"
@@ -68,12 +65,6 @@ StoragePartition* GetStoragePartitionFromConfig(
return partition_map->Get(partition_domain, partition_name, in_memory);
}
-// Run |callback| on each DOMStorageContextWrapper in |browser_context|.
-void PurgeDOMStorageContextInPartition(StoragePartition* storage_partition) {
- static_cast<StoragePartitionImpl*>(storage_partition)->
- GetDOMStorageContext()->PurgeMemory();
-}
-
void SaveSessionStateOnIOThread(
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
appcache::AppCacheService* appcache_service) {
@@ -90,10 +81,6 @@ void SaveSessionStateOnIndexedDBThread(
indexed_db_context->SetForceKeepSessionState();
}
-void PurgeMemoryOnIOThread(appcache::AppCacheService* appcache_service) {
- appcache_service->PurgeMemory();
-}
-
} // namespace
// static
@@ -253,20 +240,6 @@ void BrowserContext::SaveSessionState(BrowserContext* browser_context) {
}
}
-void BrowserContext::PurgeMemory(BrowserContext* browser_context) {
- if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) {
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- base::Bind(
- &PurgeMemoryOnIOThread,
- BrowserContext::GetDefaultStoragePartition(browser_context)->
- GetAppCacheService()));
- }
-
- ForEachStoragePartition(browser_context,
- base::Bind(&PurgeDOMStorageContextInPartition));
-}
-
#endif // !OS_IOS
BrowserContext::~BrowserContext() {
diff --git a/content/browser/dom_storage/dom_storage_context_impl.cc b/content/browser/dom_storage/dom_storage_context_impl.cc
index 2c31bd6..05a6587 100644
--- a/content/browser/dom_storage/dom_storage_context_impl.cc
+++ b/content/browser/dom_storage/dom_storage_context_impl.cc
@@ -160,17 +160,6 @@ void DOMStorageContextImpl::DeleteSessionStorage(
NotifyAreaCleared(area, usage_info.origin);
}
-void DOMStorageContextImpl::PurgeMemory() {
- // We can only purge memory from the local storage namespace
- // which is backed by disk.
- // TODO(marja): Purge sessionStorage, too. (Requires changes to the FastClear
- // functionality.)
- StorageNamespaceMap::iterator found =
- namespaces_.find(kLocalStorageNamespaceId);
- if (found != namespaces_.end())
- found->second->PurgeMemory(DOMStorageNamespace::PURGE_AGGRESSIVE);
-}
-
void DOMStorageContextImpl::Shutdown() {
is_shutdown_ = true;
StorageNamespaceMap::const_iterator it = namespaces_.begin();
diff --git a/content/browser/dom_storage/dom_storage_context_impl.h b/content/browser/dom_storage/dom_storage_context_impl.h
index a9400fb..d256d9c 100644
--- a/content/browser/dom_storage/dom_storage_context_impl.h
+++ b/content/browser/dom_storage/dom_storage_context_impl.h
@@ -117,7 +117,6 @@ class CONTENT_EXPORT DOMStorageContextImpl
void GetSessionStorageUsage(std::vector<SessionStorageUsageInfo>* infos);
void DeleteLocalStorage(const GURL& origin);
void DeleteSessionStorage(const SessionStorageUsageInfo& usage_info);
- void PurgeMemory();
// Used by content settings to alter the behavior around
// what data to keep and what data to discard at shutdown.
diff --git a/content/browser/dom_storage/dom_storage_context_impl_unittest.cc b/content/browser/dom_storage/dom_storage_context_impl_unittest.cc
index 7e33b73..85b16a5 100644
--- a/content/browser/dom_storage/dom_storage_context_impl_unittest.cc
+++ b/content/browser/dom_storage/dom_storage_context_impl_unittest.cc
@@ -82,7 +82,6 @@ TEST_F(DOMStorageContextImplTest, Basics) {
EXPECT_EQ(temp_dir_.path(), context_->localstorage_directory());
EXPECT_EQ(base::FilePath(), context_->sessionstorage_directory());
EXPECT_EQ(storage_policy_.get(), context_->special_storage_policy_.get());
- context_->PurgeMemory();
context_->DeleteLocalStorage(GURL("http://chromium.org/"));
const int kFirstSessionStorageNamespaceId = 1;
EXPECT_TRUE(context_->GetStorageNamespace(kLocalStorageNamespaceId));
diff --git a/content/browser/dom_storage/dom_storage_context_wrapper.cc b/content/browser/dom_storage/dom_storage_context_wrapper.cc
index 56ea51e..47d5b05 100644
--- a/content/browser/dom_storage/dom_storage_context_wrapper.cc
+++ b/content/browser/dom_storage/dom_storage_context_wrapper.cc
@@ -146,14 +146,6 @@ void DOMStorageContextWrapper::StartScavengingUnusedSessionStorage() {
context_));
}
-void DOMStorageContextWrapper::PurgeMemory() {
- DCHECK(context_.get());
- context_->task_runner()->PostShutdownBlockingTask(
- FROM_HERE,
- DOMStorageTaskRunner::PRIMARY_SEQUENCE,
- base::Bind(&DOMStorageContextImpl::PurgeMemory, context_));
-}
-
void DOMStorageContextWrapper::SetForceKeepSessionState() {
DCHECK(context_.get());
context_->task_runner()->PostShutdownBlockingTask(
diff --git a/content/browser/dom_storage/dom_storage_context_wrapper.h b/content/browser/dom_storage/dom_storage_context_wrapper.h
index 0971f88..0ed9507 100644
--- a/content/browser/dom_storage/dom_storage_context_wrapper.h
+++ b/content/browser/dom_storage/dom_storage_context_wrapper.h
@@ -44,9 +44,6 @@ class CONTENT_EXPORT DOMStorageContextWrapper :
RecreateSessionStorage(const std::string& persistent_id) OVERRIDE;
virtual void StartScavengingUnusedSessionStorage() OVERRIDE;
- // Called to free up memory that's not strictly needed.
- void PurgeMemory();
-
// Used by content settings to alter the behavior around
// what data to keep and what data to discard at shutdown.
// The policy is not so straight forward to describe, see
diff --git a/content/public/browser/browser_context.h b/content/public/browser/browser_context.h
index c16a77d..4f9e967 100644
--- a/content/public/browser/browser_context.h
+++ b/content/public/browser/browser_context.h
@@ -87,9 +87,6 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData {
// across the next restart.
static void SaveSessionState(BrowserContext* browser_context);
- // Tells the HTML5 objects on this context to purge any uneeded memory.
- static void PurgeMemory(BrowserContext* browser_context);
-
virtual ~BrowserContext();
// Returns the path of the directory where this context's data is stored.
diff --git a/webkit/browser/appcache/appcache_database.cc b/webkit/browser/appcache/appcache_database.cc
index 776f940..1fde2a7 100644
--- a/webkit/browser/appcache/appcache_database.cc
+++ b/webkit/browser/appcache/appcache_database.cc
@@ -211,13 +211,6 @@ AppCacheDatabase::AppCacheDatabase(const base::FilePath& path)
AppCacheDatabase::~AppCacheDatabase() {
}
-void AppCacheDatabase::CloseConnection() {
- // We can't close the connection for an in-memory database w/o
- // losing all of the data, so we don't do that.
- if (!db_file_path_.empty())
- ResetConnectionAndTables();
-}
-
void AppCacheDatabase::Disable() {
VLOG(1) << "Disabling appcache database.";
is_disabled_ = true;
diff --git a/webkit/browser/appcache/appcache_database.h b/webkit/browser/appcache/appcache_database.h
index 2100f5a..e647575 100644
--- a/webkit/browser/appcache/appcache_database.h
+++ b/webkit/browser/appcache/appcache_database.h
@@ -83,7 +83,6 @@ class WEBKIT_STORAGE_BROWSER_EXPORT AppCacheDatabase {
explicit AppCacheDatabase(const base::FilePath& path);
~AppCacheDatabase();
- void CloseConnection();
void Disable();
bool is_disabled() const { return is_disabled_; }
bool was_corruption_detected() const { return was_corruption_detected_; }
diff --git a/webkit/browser/appcache/appcache_database_unittest.cc b/webkit/browser/appcache/appcache_database_unittest.cc
index c432066..2ebffd0 100644
--- a/webkit/browser/appcache/appcache_database_unittest.cc
+++ b/webkit/browser/appcache/appcache_database_unittest.cc
@@ -93,11 +93,12 @@ TEST(AppCacheDatabaseTest, QuickIntegrityCheck) {
EXPECT_EQ(3, base::WriteFile(kOtherFile, "foo", 3));
// First create a valid db file.
- AppCacheDatabase db(kDbFile);
- EXPECT_TRUE(db.LazyOpen(true));
- EXPECT_TRUE(base::PathExists(kOtherFile));
- EXPECT_TRUE(base::PathExists(kDbFile));
- db.CloseConnection();
+ {
+ AppCacheDatabase db(kDbFile);
+ EXPECT_TRUE(db.LazyOpen(true));
+ EXPECT_TRUE(base::PathExists(kOtherFile));
+ EXPECT_TRUE(base::PathExists(kDbFile));
+ }
// Break it.
ASSERT_TRUE(sql::test::CorruptSizeInHeader(kDbFile));
@@ -106,6 +107,7 @@ TEST(AppCacheDatabaseTest, QuickIntegrityCheck) {
{
sql::ScopedErrorIgnorer ignore_errors;
ignore_errors.IgnoreError(SQLITE_CORRUPT);
+ AppCacheDatabase db(kDbFile);
EXPECT_TRUE(db.LazyOpen(true));
EXPECT_FALSE(base::PathExists(kOtherFile));
EXPECT_TRUE(base::PathExists(kDbFile));
@@ -153,22 +155,26 @@ TEST(AppCacheDatabaseTest, ExperimentalFlags) {
EXPECT_EQ(3, base::WriteFile(kOtherFile, "foo", 3));
EXPECT_TRUE(base::PathExists(kOtherFile));
- AppCacheDatabase db(kDbFile);
- EXPECT_TRUE(db.LazyOpen(true));
-
// Inject a non empty flags value, and verify it got there.
- EXPECT_TRUE(db.meta_table_->SetValue(kExperimentFlagsKey, kInjectedFlags));
- std::string flags;
- EXPECT_TRUE(db.meta_table_->GetValue(kExperimentFlagsKey, &flags));
- EXPECT_EQ(kInjectedFlags, flags);
- db.CloseConnection();
+ {
+ AppCacheDatabase db(kDbFile);
+ EXPECT_TRUE(db.LazyOpen(true));
+ EXPECT_TRUE(db.meta_table_->SetValue(kExperimentFlagsKey, kInjectedFlags));
+ std::string flags;
+ EXPECT_TRUE(db.meta_table_->GetValue(kExperimentFlagsKey, &flags));
+ EXPECT_EQ(kInjectedFlags, flags);
+ }
// If flags don't match the expected value, empty string by default,
// the database should be recreated and other files should be cleared out.
- EXPECT_TRUE(db.LazyOpen(false));
- EXPECT_TRUE(db.meta_table_->GetValue(kExperimentFlagsKey, &flags));
- EXPECT_TRUE(flags.empty());
- EXPECT_FALSE(base::PathExists(kOtherFile));
+ {
+ AppCacheDatabase db(kDbFile);
+ EXPECT_TRUE(db.LazyOpen(false));
+ std::string flags;
+ EXPECT_TRUE(db.meta_table_->GetValue(kExperimentFlagsKey, &flags));
+ EXPECT_TRUE(flags.empty());
+ EXPECT_FALSE(base::PathExists(kOtherFile));
+ }
}
TEST(AppCacheDatabaseTest, EntryRecords) {
diff --git a/webkit/browser/appcache/appcache_service.h b/webkit/browser/appcache/appcache_service.h
index c800e71..1755eee 100644
--- a/webkit/browser/appcache/appcache_service.h
+++ b/webkit/browser/appcache/appcache_service.h
@@ -16,7 +16,6 @@
#include "base/timer/timer.h"
#include "net/base/completion_callback.h"
#include "net/base/net_errors.h"
-#include "webkit/browser/appcache/appcache_storage.h"
#include "webkit/browser/quota/quota_manager_proxy.h"
#include "webkit/browser/webkit_storage_browser_export.h"
#include "webkit/common/appcache/appcache_interfaces.h"
@@ -40,6 +39,7 @@ class AppCacheBackendImpl;
class AppCacheExecutableHandlerFactory;
class AppCacheQuotaClient;
class AppCachePolicy;
+class AppCacheStorage;
// Refcounted container to avoid copying the collection in callbacks.
struct WEBKIT_STORAGE_BROWSER_EXPORT AppCacheInfoCollection
@@ -105,12 +105,6 @@ class WEBKIT_STORAGE_BROWSER_EXPORT AppCacheService {
// without relaunching the browser.
void ScheduleReinitialize();
- // Purges any memory not needed.
- void PurgeMemory() {
- if (storage_)
- storage_->PurgeMemory();
- }
-
// Determines if a request for 'url' can be satisfied while offline.
// This method always completes asynchronously.
void CanHandleMainResourceOffline(const GURL& url,
diff --git a/webkit/browser/appcache/appcache_storage.h b/webkit/browser/appcache/appcache_storage.h
index 5917a41..b7a696f 100644
--- a/webkit/browser/appcache/appcache_storage.h
+++ b/webkit/browser/appcache/appcache_storage.h
@@ -173,8 +173,6 @@ class WEBKIT_STORAGE_BROWSER_EXPORT AppCacheStorage {
virtual void DeleteResponses(
const GURL& manifest_url, const std::vector<int64>& response_ids) = 0;
- virtual void PurgeMemory() = 0;
-
// Generates unique storage ids for different object types.
int64 NewCacheId() {
return ++last_cache_id_;
diff --git a/webkit/browser/appcache/appcache_storage_impl.cc b/webkit/browser/appcache/appcache_storage_impl.cc
index d470166..66abca1 100644
--- a/webkit/browser/appcache/appcache_storage_impl.cc
+++ b/webkit/browser/appcache/appcache_storage_impl.cc
@@ -321,20 +321,6 @@ void AppCacheStorageImpl::InitTask::RunCompleted() {
storage_->service()->quota_client()->NotifyAppCacheReady();
}
-// CloseConnectionTask -------
-
-class AppCacheStorageImpl::CloseConnectionTask : public DatabaseTask {
- public:
- explicit CloseConnectionTask(AppCacheStorageImpl* storage)
- : DatabaseTask(storage) {}
-
- // DatabaseTask:
- virtual void Run() OVERRIDE { database_->CloseConnection(); }
-
- protected:
- virtual ~CloseConnectionTask() {}
-};
-
// DisableDatabaseTask -------
class AppCacheStorageImpl::DisableDatabaseTask : public DatabaseTask {
@@ -1666,11 +1652,6 @@ void AppCacheStorageImpl::DeleteResponses(
StartDeletingResponses(response_ids);
}
-void AppCacheStorageImpl::PurgeMemory() {
- scoped_refptr<CloseConnectionTask> task(new CloseConnectionTask(this));
- task->Schedule();
-}
-
void AppCacheStorageImpl::DelayedStartDeletingUnusedResponses() {
// Only if we haven't already begun.
if (!did_start_deleting_responses_) {
diff --git a/webkit/browser/appcache/appcache_storage_impl.h b/webkit/browser/appcache/appcache_storage_impl.h
index 46dcce5..2ea3ad6 100644
--- a/webkit/browser/appcache/appcache_storage_impl.h
+++ b/webkit/browser/appcache/appcache_storage_impl.h
@@ -64,7 +64,6 @@ class AppCacheStorageImpl : public AppCacheStorage {
const std::vector<int64>& response_ids) OVERRIDE;
virtual void DeleteResponses(const GURL& manifest_url,
const std::vector<int64>& response_ids) OVERRIDE;
- virtual void PurgeMemory() OVERRIDE;
private:
// The AppCacheStorageImpl class methods and datamembers may only be
@@ -72,7 +71,6 @@ class AppCacheStorageImpl : public AppCacheStorage {
// which access the DB on a seperate background thread.
class DatabaseTask;
class InitTask;
- class CloseConnectionTask;
class DisableDatabaseTask;
class GetAllInfoTask;
class StoreOrLoadTask;
diff --git a/webkit/browser/appcache/mock_appcache_storage.h b/webkit/browser/appcache/mock_appcache_storage.h
index 94ae958..cf9504a 100644
--- a/webkit/browser/appcache/mock_appcache_storage.h
+++ b/webkit/browser/appcache/mock_appcache_storage.h
@@ -59,7 +59,6 @@ class MockAppCacheStorage : public AppCacheStorage {
virtual void DeleteResponses(
const GURL& manifest_url,
const std::vector<int64>& response_ids) OVERRIDE;
- virtual void PurgeMemory() OVERRIDE {}
private:
friend class AppCacheRequestHandlerTest;
diff --git a/webkit/browser/appcache/view_appcache_internals_job.cc b/webkit/browser/appcache/view_appcache_internals_job.cc
index 7225882..71f4d9e 100644
--- a/webkit/browser/appcache/view_appcache_internals_job.cc
+++ b/webkit/browser/appcache/view_appcache_internals_job.cc
@@ -29,6 +29,7 @@
#include "webkit/browser/appcache/appcache_policy.h"
#include "webkit/browser/appcache/appcache_response.h"
#include "webkit/browser/appcache/appcache_service.h"
+#include "webkit/browser/appcache/appcache_storage.h"
namespace appcache {
namespace {