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..557c91c6f3f02edadaf910dd85ea05f3900ff1df 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,27 @@ 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 { |
+ string16 origin_id = DatabaseUtil::GetOriginIdentifier(origin_url_); |
+ indexed_db_context_->EvictOrigin(origin_id); |
+ } |
+ virtual void Completed() OVERRIDE { |
+ callback_->Run(quota::kQuotaStatusOk); |
+ } |
+ GURL origin_url_; |
+ scoped_ptr<DeletionCallback> callback_; |
michaeln
2011/07/27 01:31:35
It would be good to ensure that this callback obje
|
+}; |
+ |
class IndexedDBQuotaClient::GetOriginUsageTask : public HelperTask { |
public: |
GetOriginUsageTask( |
@@ -202,9 +223,18 @@ void IndexedDBQuotaClient::GetOriginsForHost( |
void IndexedDBQuotaClient::DeleteOriginData(const GURL& origin, |
quota::StorageType type, |
DeletionCallback* callback) { |
- // TODO(tzik): implement me |
- callback->Run(quota::kQuotaErrorNotSupported); |
- delete callback; |
+ // DeleteOriginData is only called on origins that are not in use, so we can |
+ // safely delete them here. |
dgrogan
2011/07/26 02:02:16
Kinuko, can you confirm that this is true?
kinuko
2011/07/26 06:35:28
It's half true-- it won't be called while it is in
dgrogan
2011/07/26 17:46:15
That would be great for IDB.
michaeln
2011/07/27 01:31:35
I think we want to support deleting resources whil
kinuko
2011/07/27 10:09:20
Currently the filesystem impl doesn't fully suppor
dgrogan
2011/07/27 22:56:01
Sorry, I only meant it would be great for IDB beca
|
+ 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( |