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

Side by Side Diff: webkit/quota/quota_manager.cc

Issue 7029009: Add an interface QuotaEvictionHandler. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Just rebased. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/quota/quota_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/quota/quota_manager.h" 5 #include "webkit/quota/quota_manager.h"
6 6
7 #include <deque> 7 #include <deque>
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 } 683 }
684 684
685 void QuotaManager::NotifyOriginNoLongerInUse(const GURL& origin) { 685 void QuotaManager::NotifyOriginNoLongerInUse(const GURL& origin) {
686 DCHECK(io_thread_->BelongsToCurrentThread()); 686 DCHECK(io_thread_->BelongsToCurrentThread());
687 DCHECK(IsOriginInUse(origin)); 687 DCHECK(IsOriginInUse(origin));
688 int& count = origins_in_use_[origin]; 688 int& count = origins_in_use_[origin];
689 if (--count == 0) 689 if (--count == 0)
690 origins_in_use_.erase(origin); 690 origins_in_use_.erase(origin);
691 } 691 }
692 692
693 void QuotaManager::GetLRUOrigin(
694 StorageType type,
695 GetLRUOriginCallback* callback) {
696 LazyInitialize();
697 if (db_disabled_) {
698 callback->Run(GURL());
699 delete callback;
700 return;
701 }
702 scoped_refptr<GetLRUOriginTask> task(new GetLRUOriginTask(
703 this, database_.get(), db_thread_, type, origins_in_use_, callback));
704 task->Start();
705 }
706
707 UsageTracker* QuotaManager::GetUsageTracker(StorageType type) const { 693 UsageTracker* QuotaManager::GetUsageTracker(StorageType type) const {
708 switch (type) { 694 switch (type) {
709 case kStorageTypeTemporary: 695 case kStorageTypeTemporary:
710 return temporary_usage_tracker_.get(); 696 return temporary_usage_tracker_.get();
711 case kStorageTypePersistent: 697 case kStorageTypePersistent:
712 return persistent_usage_tracker_.get(); 698 return persistent_usage_tracker_.get();
713 default: 699 default:
714 NOTREACHED(); 700 NOTREACHED();
715 } 701 }
716 return NULL; 702 return NULL;
(...skipping 11 matching lines...) Expand all
728 const GURL& origin, StorageType type) { 714 const GURL& origin, StorageType type) {
729 LazyInitialize(); 715 LazyInitialize();
730 if (db_disabled_) 716 if (db_disabled_)
731 return; 717 return;
732 scoped_refptr<OriginDeletionDatabaseTask> task = 718 scoped_refptr<OriginDeletionDatabaseTask> task =
733 new OriginDeletionDatabaseTask( 719 new OriginDeletionDatabaseTask(
734 this, database_.get(), db_thread_, origin, type); 720 this, database_.get(), db_thread_, origin, type);
735 task->Start(); 721 task->Start();
736 } 722 }
737 723
724 void QuotaManager::GetLRUOrigin(
725 StorageType type,
726 GetLRUOriginCallback* callback) {
727 LazyInitialize();
728 if (db_disabled_) {
729 callback->Run(GURL());
730 delete callback;
731 return;
732 }
733 scoped_refptr<GetLRUOriginTask> task(new GetLRUOriginTask(
734 this, database_.get(), db_thread_, type, origins_in_use_, callback));
735 task->Start();
736 }
737
738 void QuotaManager::EvictOriginData(
739 const GURL& origin,
740 StorageType type,
741 EvictOriginDataCallback* callback) {
742 // TODO(dmikurube): Implement it.
743 }
744
745 void QuotaManager::GetUsageAndQuotaForEviction(
746 GetUsageAndQuotaForEvictionCallback* callback) {
747 // TODO(dmikurube): Implement it.
748 }
749
738 void QuotaManager::DeleteOnCorrectThread() const { 750 void QuotaManager::DeleteOnCorrectThread() const {
739 if (!io_thread_->BelongsToCurrentThread()) { 751 if (!io_thread_->BelongsToCurrentThread()) {
740 io_thread_->DeleteSoon(FROM_HERE, this); 752 io_thread_->DeleteSoon(FROM_HERE, this);
741 return; 753 return;
742 } 754 }
743 delete this; 755 delete this;
744 } 756 }
745 757
746 void QuotaManager::GetGlobalUsage( 758 void QuotaManager::GetGlobalUsage(
747 StorageType type, 759 StorageType type,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 840
829 QuotaManagerProxy::QuotaManagerProxy( 841 QuotaManagerProxy::QuotaManagerProxy(
830 QuotaManager* manager, base::MessageLoopProxy* io_thread) 842 QuotaManager* manager, base::MessageLoopProxy* io_thread)
831 : manager_(manager), io_thread_(io_thread) { 843 : manager_(manager), io_thread_(io_thread) {
832 } 844 }
833 845
834 QuotaManagerProxy::~QuotaManagerProxy() { 846 QuotaManagerProxy::~QuotaManagerProxy() {
835 } 847 }
836 848
837 } // namespace quota 849 } // namespace quota
OLDNEW
« 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