Chromium Code Reviews| Index: content/browser/in_process_webkit/indexed_db_context.cc |
| diff --git a/content/browser/in_process_webkit/indexed_db_context.cc b/content/browser/in_process_webkit/indexed_db_context.cc |
| index 9da8ca626f35aa3a49d89ea5f2200322c64d013c..9804d5267ff598def189681f0c569a79b65ce3b7 100644 |
| --- a/content/browser/in_process_webkit/indexed_db_context.cc |
| +++ b/content/browser/in_process_webkit/indexed_db_context.cc |
| @@ -4,6 +4,7 @@ |
| #include "content/browser/in_process_webkit/indexed_db_context.h" |
| +#include "base/bind.h" |
| #include "base/command_line.h" |
| #include "base/file_util.h" |
| #include "base/logging.h" |
| @@ -87,41 +88,6 @@ const FilePath::CharType IndexedDBContext::kIndexedDBDirectory[] = |
| const FilePath::CharType IndexedDBContext::kIndexedDBExtension[] = |
| FILE_PATH_LITERAL(".leveldb"); |
| -class IndexedDBContext::IndexedDBGetUsageAndQuotaCallback : |
| - public quota::QuotaManager::GetUsageAndQuotaCallback { |
| - public: |
| - IndexedDBGetUsageAndQuotaCallback(IndexedDBContext* context, |
| - const GURL& origin_url) |
| - : context_(context), |
| - origin_url_(origin_url) { |
| - } |
| - |
| - void Run(quota::QuotaStatusCode status, int64 usage, int64 quota) { |
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| - DCHECK(status == quota::kQuotaStatusOk || status == quota::kQuotaErrorAbort) |
| - << "status was " << status; |
| - if (status == quota::kQuotaErrorAbort) { |
| - // We seem to no longer care to wait around for the answer. |
| - return; |
| - } |
| - BrowserThread::PostTask(BrowserThread::WEBKIT, FROM_HERE, |
| - NewRunnableMethod(context_.get(), |
| - &IndexedDBContext::GotUpdatedQuota, |
| - origin_url_, |
| - usage, |
| - quota)); |
| - } |
| - |
| - virtual void RunWithParams( |
| - const Tuple3<quota::QuotaStatusCode, int64, int64>& params) { |
| - Run(params.a, params.b, params.c); |
| - } |
| - |
| - private: |
| - scoped_refptr<IndexedDBContext> context_; |
| - const GURL origin_url_; |
| -}; |
| - |
| IndexedDBContext::IndexedDBContext( |
| WebKitContext* webkit_context, |
| quota::SpecialStoragePolicy* special_storage_policy, |
| @@ -316,6 +282,25 @@ void IndexedDBContext::QueryDiskAndUpdateQuotaUsage(const GURL& origin_url) { |
| } |
| } |
| +void IndexedDBContext::GotUsageAndQuota(const GURL& origin_url, |
| + quota::QuotaStatusCode status, |
| + int64 usage, int64 quota) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| + DCHECK(status == quota::kQuotaStatusOk || status == quota::kQuotaErrorAbort) |
| + << "status was " << status; |
| + if (status == quota::kQuotaErrorAbort) { |
| + // We seem to no longer care to wait around for the answer. |
| + return; |
| + } |
| + BrowserThread::PostTask( |
| + BrowserThread::WEBKIT, FROM_HERE, |
| + NewRunnableMethod(this, |
|
awong
2011/09/29 18:05:15
Use Base::Bind here as well?
tzik
2011/10/11 04:53:57
Will be done later.
|
| + &IndexedDBContext::GotUpdatedQuota, |
| + origin_url, |
| + usage, |
| + quota)); |
| +} |
| + |
| void IndexedDBContext::GotUpdatedQuota(const GURL& origin_url, int64 usage, |
| int64 quota) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| @@ -334,12 +319,11 @@ void IndexedDBContext::QueryAvailableQuota(const GURL& origin_url) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| if (!quota_manager_proxy()->quota_manager()) |
| return; |
| - IndexedDBGetUsageAndQuotaCallback* callback = |
| - new IndexedDBGetUsageAndQuotaCallback(this, origin_url); |
| quota_manager_proxy()->quota_manager()->GetUsageAndQuota( |
| origin_url, |
| quota::kStorageTypeTemporary, |
| - callback); |
| + base::Bind(&IndexedDBContext::GotUsageAndQuota, |
| + this, origin_url)); |
| } |
| std::set<GURL>* IndexedDBContext::GetOriginSet() { |