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

Unified Diff: webkit/quota/quota_manager.cc

Issue 7029007: Implement EvictOriginData in QuotaManager. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Extracted only EvictOriginData (f.k.a. DeleteOriginData). 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
« no previous file with comments | « webkit/quota/quota_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/quota/quota_manager.cc
diff --git a/webkit/quota/quota_manager.cc b/webkit/quota/quota_manager.cc
index 01f9c75b989cda7a84d7ca6378ca8b0ef2606005..cb2ab8297b70883031ac5eb18616cb11beccb50a 100644
--- a/webkit/quota/quota_manager.cc
+++ b/webkit/quota/quota_manager.cc
@@ -515,6 +515,8 @@ QuotaManager::QuotaManager(bool is_incognito,
db_disabled_(false),
io_thread_(io_thread),
db_thread_(db_thread),
+ num_deletion_requested_clients_(0),
+ num_deleted_clients_(0),
temporary_global_quota_(-1) {
}
@@ -735,11 +737,56 @@ void QuotaManager::GetLRUOrigin(
task->Start();
}
+void QuotaManager::OnOriginDataEvicted(
+ QuotaStatusCode status,
+ EvictOriginDataCallback* callback) {
kinuko 2011/05/17 09:48:55 This method won't take the callback parameter for
Dai Mikurube (NOT FULLTIME) 2011/05/18 04:34:48 Done.
+ LOG(ERROR) << "QM::OnOriginDataDeleted";
+ DCHECK(io_thread_->BelongsToCurrentThread());
+
+ if (status != kQuotaStatusOk) {
+ // TODO(dmikurube): Handle error.
+ }
+
+ ++num_deleted_clients_;
+ DCHECK(num_deleted_clients_ <= num_deletion_requested_clients_);
+ if (num_deleted_clients_ == num_deletion_requested_clients_) {
+ num_deletion_requested_clients_ = 0;
+ num_deleted_clients_ = 0;
+
+ // TODO(dmikurube): Get usage, quota and physical space and then callback.
kinuko 2011/05/17 09:48:55 This comment is obsoleted?
Dai Mikurube (NOT FULLTIME) 2011/05/18 04:34:48 Done.
+ callback->Run(kQuotaStatusOk);
+ delete callback;
+ }
+}
+
void QuotaManager::EvictOriginData(
const GURL& origin,
StorageType type,
EvictOriginDataCallback* callback) {
- // TODO(dmikurube): Implement it.
+ LOG(ERROR) << "QM::DeleteOriginData";
+ DCHECK(io_thread_->BelongsToCurrentThread());
+ LazyInitialize();
kinuko 2011/05/17 09:48:55 Eviction must run after temporary storage initiali
Dai Mikurube (NOT FULLTIME) 2011/05/18 04:34:48 Done.
+
+ int num_clients = clients_.size();
+
+ if (origin.is_empty() || num_clients == 0 || num_deleted_clients_ > 0) {
kinuko 2011/05/17 09:48:55 As michael pointed out please DCHECK on num_delete
Dai Mikurube (NOT FULLTIME) 2011/05/18 04:34:48 Done. I don't understand the second paragraph...
+ callback->Run(kQuotaStatusOk);
+ delete callback;
+ return;
+ }
+
+ num_deletion_requested_clients_ = num_clients;
+ num_deleted_clients_ = 0;
+
+ for (QuotaClientList::iterator p = clients_.begin();
+ p != clients_.end();
+ ++p) {
+ /*
+ p->DeleteOriginData(origin, kStorageTypeTemporary, NewRunnableMethod(
+ this, &QuotaManager::OnOriginDataDeleted));
+ */
+ OnOriginDataEvicted(kQuotaStatusOk, callback); // test.
+ }
}
void QuotaManager::GetUsageAndQuotaForEviction(
« no previous file with comments | « webkit/quota/quota_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698