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

Side by Side Diff: webkit/appcache/appcache_storage_impl.cc

Issue 8070001: Use base::Callback in Quota related code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/appcache/appcache_storage_impl.h" 5 #include "webkit/appcache/appcache_storage_impl.h"
6 6
7 #include <algorithm>
8 #include <functional>
7 #include <set> 9 #include <set>
10 #include <vector>
8 11
12 #include "base/bind.h"
9 #include "base/file_util.h" 13 #include "base/file_util.h"
10 #include "base/logging.h" 14 #include "base/logging.h"
11 #include "base/message_loop.h" 15 #include "base/message_loop.h"
12 #include "base/stl_util.h" 16 #include "base/stl_util.h"
13 #include "base/string_util.h" 17 #include "base/string_util.h"
14 #include "net/base/cache_type.h" 18 #include "net/base/cache_type.h"
15 #include "net/base/net_errors.h" 19 #include "net/base/net_errors.h"
16 #include "sql/connection.h" 20 #include "sql/connection.h"
17 #include "sql/transaction.h" 21 #include "sql/transaction.h"
18 #include "webkit/appcache/appcache.h" 22 #include "webkit/appcache/appcache.h"
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 space_available_ = kint64max; 546 space_available_ = kint64max;
543 Schedule(); 547 Schedule();
544 return; 548 return;
545 } 549 }
546 550
547 // We have to ask the quota manager for the value. 551 // We have to ask the quota manager for the value.
548 AddRef(); // balanced in the OnQuotaCallback 552 AddRef(); // balanced in the OnQuotaCallback
549 storage_->pending_quota_queries_.insert(this); 553 storage_->pending_quota_queries_.insert(this);
550 quota_manager->GetUsageAndQuota( 554 quota_manager->GetUsageAndQuota(
551 group_record_.origin, quota::kStorageTypeTemporary, 555 group_record_.origin, quota::kStorageTypeTemporary,
552 NewCallback(this, &StoreGroupAndCacheTask::OnQuotaCallback)); 556 base::Bind(&StoreGroupAndCacheTask::OnQuotaCallback,
557 base::Unretained(this)));
553 } 558 }
554 559
555 void AppCacheStorageImpl::StoreGroupAndCacheTask::OnQuotaCallback( 560 void AppCacheStorageImpl::StoreGroupAndCacheTask::OnQuotaCallback(
556 quota::QuotaStatusCode status, int64 usage, int64 quota) { 561 quota::QuotaStatusCode status, int64 usage, int64 quota) {
557 if (storage_) { 562 if (storage_) {
558 if (status == quota::kQuotaStatusOk) 563 if (status == quota::kQuotaStatusOk)
559 space_available_ = std::max(static_cast<int64>(0), quota - usage); 564 space_available_ = std::max(static_cast<int64>(0), quota - usage);
560 else 565 else
561 space_available_ = 0; 566 space_available_ = 0;
562 storage_->pending_quota_queries_.erase(this); 567 storage_->pending_quota_queries_.erase(this);
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
1647 Disable(); 1652 Disable();
1648 if (!is_incognito_) { 1653 if (!is_incognito_) {
1649 VLOG(1) << "Deleting existing appcache data and starting over."; 1654 VLOG(1) << "Deleting existing appcache data and starting over.";
1650 db_thread_->PostTask(FROM_HERE, 1655 db_thread_->PostTask(FROM_HERE,
1651 NewRunnableFunction(DeleteDirectory, cache_directory_)); 1656 NewRunnableFunction(DeleteDirectory, cache_directory_));
1652 } 1657 }
1653 } 1658 }
1654 } 1659 }
1655 1660
1656 } // namespace appcache 1661 } // namespace appcache
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_storage_impl.h ('k') | webkit/appcache/appcache_storage_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698