Index: storage/browser/quota/quota_manager.cc |
diff --git a/storage/browser/quota/quota_manager.cc b/storage/browser/quota/quota_manager.cc |
index 13b84c74106b217e77f4d68b99c9842808339a9e..ac6e4dbc5d4d394924730c6c5f2d7c2fafb4267a 100644 |
--- a/storage/browser/quota/quota_manager.cc |
+++ b/storage/browser/quota/quota_manager.cc |
@@ -150,6 +150,13 @@ bool GetLRUOriginOnDBThread(StorageType type, |
return true; |
} |
+bool GetDurableOnDBThread(const GURL& origin, |
+ bool* durable, |
+ QuotaDatabase* database) { |
+ DCHECK(database); |
+ return database->GetDurabilityForOrigin(origin, durable); |
+} |
+ |
bool DeleteOriginInfoOnDBThread(const GURL& origin, |
StorageType type, |
QuotaDatabase* database) { |
@@ -716,6 +723,7 @@ class QuotaManager::GetModifiedSinceHelper { |
return database->GetOriginsModifiedSince(type, &origins_, modified_since); |
} |
+ |
void DidGetModifiedSince(const base::WeakPtr<QuotaManager>& manager, |
const GetOriginsCallback& callback, |
StorageType type, |
@@ -832,6 +840,7 @@ void QuotaManager::GetUsageAndQuotaForWebApps( |
"477117 QuotaManager::GetUsageAndQuotaForWebApps")); |
if (type != kStorageTypeTemporary && |
type != kStorageTypePersistent && |
+ type != kStorageTypeDurable && |
type != kStorageTypeSyncable) { |
callback.Run(kQuotaErrorNotSupported, 0, 0); |
return; |
@@ -1049,6 +1058,7 @@ void QuotaManager::SetPersistentHostQuota(const std::string& host, |
const QuotaCallback& callback) { |
LazyInitialize(); |
if (host.empty()) { |
+ LOG(ERROR) << "Calling with kQuotaErrorNotSupported"; |
// This could happen if we are called on file:///. |
callback.Run(kQuotaErrorNotSupported, 0); |
return; |
@@ -1143,6 +1153,25 @@ bool QuotaManager::IsStorageUnlimited(const GURL& origin, |
special_storage_policy_->IsStorageUnlimited(origin); |
} |
+void QuotaManager::GetDurability(const GURL& origin, |
+ const GetDurabilityCallback& callback) { |
+ LazyInitialize(); |
+ LOG(ERROR) << "Got into QuotaManager::GetDurability"; |
+ |
+ // if db is hosed, do something with callback |
+ |
+ bool* is_durable = new bool; |
+ PostTaskAndReplyWithResultForDBThread( |
+ FROM_HERE, |
+ base::Bind(&GetDurableOnDBThread, |
+ origin, |
+ base::Unretained(is_durable)), |
+ base::Bind(&QuotaManager::DidGetDurability, |
+ weak_factory_.GetWeakPtr(), |
+ callback, |
+ base::Owned(is_durable))); |
+} |
+ |
void QuotaManager::GetOriginsModifiedSince(StorageType type, |
base::Time modified_since, |
const GetOriginsCallback& callback) { |
@@ -1269,6 +1298,7 @@ UsageTracker* QuotaManager::GetUsageTracker(StorageType type) const { |
case kStorageTypeQuotaNotManaged: |
return NULL; |
case kStorageTypeUnknown: |
+ case kStorageTypeDurable: |
NOTREACHED(); |
} |
return NULL; |
@@ -1606,6 +1636,18 @@ void QuotaManager::DidDatabaseWork(bool success) { |
db_disabled_ = !success; |
} |
+void QuotaManager::DidGetDurability(const GetDurabilityCallback& callback, |
+ const bool* durable, |
+ bool success) { |
+ DidDatabaseWork(success); |
+ if (!success) { |
+ NOTREACHED() << "Add a test for this"; |
+ callback.Run(kQuotaErrorInvalidAccess, false /*durability*/); |
+ return; |
+ } |
+ callback.Run(kQuotaStatusOk, *durable); |
+} |
+ |
void QuotaManager::DeleteOnCorrectThread() const { |
if (!io_thread_->BelongsToCurrentThread() && |
io_thread_->DeleteSoon(FROM_HERE, this)) { |