Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Unified Diff: webkit/quota/quota_manager.cc

Issue 7002024: Implement QuotaTemporaryStorageEvictor. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added a TODO to call OnQuotaManagerDestroyed. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/quota/quota_manager.cc
diff --git a/webkit/quota/quota_manager.cc b/webkit/quota/quota_manager.cc
index 2e2db357f7c43231c0af6b7de76e9e4ef0df770a..740a46a44f014f7a55bc3034f0c8d0646bbe6750 100644
--- a/webkit/quota/quota_manager.cc
+++ b/webkit/quota/quota_manager.cc
@@ -15,6 +15,7 @@
#include "base/sys_info.h"
#include "net/base/net_util.h"
#include "webkit/quota/quota_database.h"
+#include "webkit/quota/quota_temporary_storage_evictor.h"
#include "webkit/quota/quota_types.h"
#include "webkit/quota/usage_tracker.h"
@@ -454,6 +455,7 @@ QuotaManager::~QuotaManager() {
std::mem_fun(&QuotaClient::OnQuotaManagerDestroyed));
if (database_.get())
db_thread_->DeleteSoon(FROM_HERE, database_.release());
+// TODO(dmikurube): Evictor::OnQuotaManagerDestroyedOnIOThread() appropriately.
}
void QuotaManager::GetUsageAndQuota(
@@ -580,10 +582,16 @@ void QuotaManager::LazyInitialize() {
new UsageTracker(clients_, kStorageTypeTemporary));
persistent_usage_tracker_.reset(
new UsageTracker(clients_, kStorageTypePersistent));
+ // TODO(dmikurube): Change this hard-coded 3 seconds.
+ // TODO(dmikurube): This init. could be delayed until InitializeTask finishes.
+ temporary_storage_evictor_ = new QuotaTemporaryStorageEvictor(
+ this, database_.get(), 3000, io_thread_, db_thread_);
scoped_refptr<InitializeTask> task(
new InitializeTask(this, database_.get(), db_thread_, profile_path_));
task->Start();
+
+ temporary_storage_evictor_->Start();
}
void QuotaManager::RegisterClient(QuotaClient* client) {
@@ -601,6 +609,39 @@ void QuotaManager::NotifyStorageModified(
tracker->UpdateUsageCache(client_id, origin, delta);
}
+void QuotaManager::DeleteOriginDataOnIOThread(
+ const GURL& origin,
+ StorageType type,
+ DeleteOriginDataCallback* callback) {
+ LazyInitialize();
+ LOG(ERROR) << "QM::DeleteOriginDataOnIOThread";
+ // TODO(dmikurube): Delete data of the |origin|.
+ /*
+ ++num_deleted_clients_;
+ DCHECK(num_deleted_clients_ <= num_clients_);
+ if (num_deleted_clients_ == num_clients_) {
+ if (is_deletion_failed_) {
+ // TODO(dmikurube): Should try ignoring the failed origin?
+ }
+
+ if (false ) { // More deletion required?
+ // Delete another origin.
+ db_message_loop_->PostTask(FROM_HERE, NewRunnableMethod(
+ this, &QuotaTemporaryStorageEvictor::Evict));
+ } else {
+ // Post the next task.
+ db_message_loop_->PostDelayedTask(FROM_HERE, NewRunnableMethod(
+ this, &QuotaTemporaryStorageEvictor::Evict), delay_ms_);
+ }
+ num_clients_ = 0;
+ num_deleted_clients_ = 0;
+ is_deletion_failed_ = false;
+ }
+ */
+ callback->Run(kQuotaStatusOk);
+ delete callback;
+}
+
UsageTracker* QuotaManager::GetUsageTracker(StorageType type) const {
switch (type) {
case kStorageTypeTemporary:

Powered by Google App Engine
This is Rietveld 408576698