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

Unified Diff: webkit/quota/quota_manager.cc

Issue 10826270: QuotaManager: Return the remaining free disk space as quota. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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') | webkit/quota/quota_manager_unittest.cc » ('j') | 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 730ec8dae37b4c44c5ed73a44f6190f8dbdce816..9607f6d509ee4c8e65ba76f4012630b3cbeef035 100644
--- a/webkit/quota/quota_manager.cc
+++ b/webkit/quota/quota_manager.cc
@@ -77,11 +77,15 @@ const int QuotaManager::kEvictionIntervalInMilliSeconds =
void CallGetUsageAndQuotaCallback(
const QuotaManager::GetUsageAndQuotaCallback& callback,
bool unlimited,
+ const FilePath& path,
QuotaStatusCode status,
const QuotaAndUsage& quota_and_usage) {
int64 usage =
unlimited ? quota_and_usage.unlimited_usage : quota_and_usage.usage;
- int64 quota = unlimited ? QuotaManager::kNoLimit : quota_and_usage.quota;
+ printf("unlimited: %d\n", unlimited);
+ int64 quota = unlimited ? quota_and_usage.available_disk_space :
kinuko 2012/08/13 14:07:52 (You might be changing this but to make sure) I th
James Hawkins 2012/08/17 21:33:22 I'm attempting to add support for this check now,
+ quota_and_usage.quota;
+ printf("quota: %ld\n", quota);
callback.Run(status, usage, quota);
}
@@ -406,6 +410,7 @@ class QuotaManager::UsageAndQuotaDispatcherTaskForPersistent
host(), NewWaitableHostUsageCallback());
manager()->GetPersistentHostQuota(
host(), NewWaitableHostQuotaCallback());
+ manager()->GetAvailableSpace(NewWaitableAvailableSpaceCallback());
}
virtual void DispatchCallbacks() OVERRIDE {
@@ -955,7 +960,7 @@ class QuotaManager::AvailableSpaceQueryTask : public QuotaThreadTask {
QuotaManager* manager,
const AvailableSpaceCallback& callback)
: QuotaThreadTask(manager, manager->db_thread_),
- profile_path_(manager->profile_path_),
+ quota_manager_(manager),
space_(-1),
callback_(callback) {
}
@@ -965,7 +970,7 @@ class QuotaManager::AvailableSpaceQueryTask : public QuotaThreadTask {
// QuotaThreadTask:
virtual void RunOnTargetThread() OVERRIDE {
- space_ = base::SysInfo::AmountOfFreeDiskSpace(profile_path_);
+ space_ = quota_manager_->GetAvailableDiskSpace();
}
virtual void Aborted() OVERRIDE {
@@ -977,7 +982,7 @@ class QuotaManager::AvailableSpaceQueryTask : public QuotaThreadTask {
}
private:
- FilePath profile_path_;
+ scoped_refptr<QuotaManager> quota_manager_;
int64 space_;
AvailableSpaceCallback callback_;
};
@@ -1212,9 +1217,10 @@ void QuotaManager::GetUsageInfo(const GetUsageInfoCallback& callback) {
void QuotaManager::GetUsageAndQuota(
const GURL& origin, StorageType type,
const GetUsageAndQuotaCallback& callback) {
- GetUsageAndQuotaInternal(origin, type, false /* global */,
- base::Bind(&CallGetUsageAndQuotaCallback,
- callback, IsStorageUnlimited(origin)));
+ GetUsageAndQuotaInternal(
+ origin, type, false /* global */,
+ base::Bind(&CallGetUsageAndQuotaCallback, callback,
+ IsStorageUnlimited(origin), profile_path_));
}
void QuotaManager::GetAvailableSpace(const AvailableSpaceCallback& callback) {
@@ -1334,6 +1340,7 @@ void QuotaManager::GetOriginsModifiedSince(StorageType type,
}
QuotaManager::~QuotaManager() {
+ printf("~QuotaManager\n");
proxy_->manager_ = NULL;
std::for_each(clients_.begin(), clients_.end(),
std::mem_fun(&QuotaClient::OnQuotaManagerDestroyed));
@@ -1341,6 +1348,10 @@ QuotaManager::~QuotaManager() {
db_thread_->DeleteSoon(FROM_HERE, database_.release());
}
+int64 QuotaManager::GetAvailableDiskSpace() const {
+ return base::SysInfo::AmountOfFreeDiskSpace(profile_path_);
kinuko 2012/08/13 14:07:52 Hmm. How about using a static function pointer (w
+}
+
void QuotaManager::LazyInitialize() {
DCHECK(io_thread_->BelongsToCurrentThread());
if (database_.get()) {
« no previous file with comments | « webkit/quota/quota_manager.h ('k') | webkit/quota/quota_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698