Index: content/browser/in_process_webkit/indexed_db_quota_client.cc |
diff --git a/content/browser/in_process_webkit/indexed_db_quota_client.cc b/content/browser/in_process_webkit/indexed_db_quota_client.cc |
index 4c3aaac2312071e613e8a82fe403add1dd012af4..ebe9d83465351344ac960b49bfaeb1383fbf8e9e 100644 |
--- a/content/browser/in_process_webkit/indexed_db_quota_client.cc |
+++ b/content/browser/in_process_webkit/indexed_db_quota_client.cc |
@@ -31,6 +31,26 @@ class IndexedDBQuotaClient::HelperTask : public quota::QuotaThreadTask { |
scoped_refptr<IndexedDBContext> indexed_db_context_; |
}; |
+class IndexedDBQuotaClient::DeleteOriginTask : public HelperTask { |
+ public: |
+ DeleteOriginTask(IndexedDBQuotaClient* client, |
+ base::MessageLoopProxy* webkit_thread_message_loop, |
+ const GURL& origin_url, |
+ DeletionCallback* callback) |
+ : HelperTask(client, webkit_thread_message_loop), |
+ origin_url_(origin_url), callback_(callback) { |
+ } |
+ private: |
+ virtual void RunOnTargetThread() OVERRIDE { |
+ indexed_db_context_->EvictOriginIfNotInUse(origin_url_); |
+ } |
+ virtual void Completed() OVERRIDE { |
+ callback_->Run(quota::kQuotaStatusOk); |
+ } |
+ GURL origin_url_; |
+ scoped_ptr<DeletionCallback> callback_; |
michaeln
2011/08/03 03:40:40
It would be good to ensure that this callback obje
dgrogan
2011/08/03 21:45:47
Done.
|
+}; |
+ |
class IndexedDBQuotaClient::GetOriginUsageTask : public HelperTask { |
public: |
GetOriginUsageTask( |
@@ -43,12 +63,10 @@ class IndexedDBQuotaClient::GetOriginUsageTask : public HelperTask { |
private: |
virtual void RunOnTargetThread() OVERRIDE { |
- string16 origin_id = DatabaseUtil::GetOriginIdentifier(origin_url_); |
- FilePath file_path = indexed_db_context_->GetIndexedDBFilePath(origin_id); |
- usage_ = 0; |
- usage_ = file_util::ComputeDirectorySize(file_path); |
+ usage_ = indexed_db_context_->InitializeDiskUsage(origin_url_); |
} |
virtual void Completed() OVERRIDE { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
client_->DidGetOriginUsage(origin_url_, usage_); |
} |
GURL origin_url_; |
@@ -202,9 +220,16 @@ void IndexedDBQuotaClient::GetOriginsForHost( |
void IndexedDBQuotaClient::DeleteOriginData(const GURL& origin, |
quota::StorageType type, |
DeletionCallback* callback) { |
- // TODO(tzik): implement me |
- callback->Run(quota::kQuotaErrorNotSupported); |
- delete callback; |
+ if (type != quota::kStorageTypeTemporary) { |
+ callback->Run(quota::kQuotaErrorNotSupported); |
+ return; |
+ } |
+ scoped_refptr<DeleteOriginTask> task( |
+ new DeleteOriginTask(this, |
+ webkit_thread_message_loop_, |
+ origin, |
+ callback)); |
+ task->Start(); |
} |
void IndexedDBQuotaClient::DidGetOriginUsage( |