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

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

Issue 8991001: base::Bind: Convert most of webkit/appcache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix 2. Created 9 years 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
« no previous file with comments | « webkit/appcache/appcache_storage_impl.h ('k') | webkit/appcache/appcache_update_job.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 } 1201 }
1202 1202
1203 1203
1204 // AppCacheStorageImpl --------------------------------------------------- 1204 // AppCacheStorageImpl ---------------------------------------------------
1205 1205
1206 AppCacheStorageImpl::AppCacheStorageImpl(AppCacheService* service) 1206 AppCacheStorageImpl::AppCacheStorageImpl(AppCacheService* service)
1207 : AppCacheStorage(service), is_incognito_(false), 1207 : AppCacheStorage(service), is_incognito_(false),
1208 is_response_deletion_scheduled_(false), 1208 is_response_deletion_scheduled_(false),
1209 did_start_deleting_responses_(false), 1209 did_start_deleting_responses_(false),
1210 last_deletable_response_rowid_(0), 1210 last_deletable_response_rowid_(0),
1211 ALLOW_THIS_IN_INITIALIZER_LIST(doom_callback_(
1212 this, &AppCacheStorageImpl::OnDeletedOneResponse)),
1213 ALLOW_THIS_IN_INITIALIZER_LIST(init_callback_(
1214 this, &AppCacheStorageImpl::OnDiskCacheInitialized)),
1215 database_(NULL), is_disabled_(false), 1211 database_(NULL), is_disabled_(false),
1216 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { 1212 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
1217 } 1213 }
1218 1214
1219 AppCacheStorageImpl::~AppCacheStorageImpl() { 1215 AppCacheStorageImpl::~AppCacheStorageImpl() {
1220 std::for_each(pending_quota_queries_.begin(), 1216 std::for_each(pending_quota_queries_.begin(),
1221 pending_quota_queries_.end(), 1217 pending_quota_queries_.end(),
1222 std::mem_fun(&DatabaseTask::CancelCompletion)); 1218 std::mem_fun(&DatabaseTask::CancelCompletion));
1223 std::for_each(scheduled_database_tasks_.begin(), 1219 std::for_each(scheduled_database_tasks_.begin(),
1224 scheduled_database_tasks_.end(), 1220 scheduled_database_tasks_.end(),
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 if (!disk_cache()) { 1585 if (!disk_cache()) {
1590 DCHECK(is_disabled_); 1586 DCHECK(is_disabled_);
1591 deletable_response_ids_.clear(); 1587 deletable_response_ids_.clear();
1592 deleted_response_ids_.clear(); 1588 deleted_response_ids_.clear();
1593 is_response_deletion_scheduled_ = false; 1589 is_response_deletion_scheduled_ = false;
1594 return; 1590 return;
1595 } 1591 }
1596 1592
1597 // TODO(michaeln): add group_id to DoomEntry args 1593 // TODO(michaeln): add group_id to DoomEntry args
1598 int64 id = deletable_response_ids_.front(); 1594 int64 id = deletable_response_ids_.front();
1599 int rv = disk_cache_->DoomEntry(id, &doom_callback_); 1595 int rv = disk_cache_->DoomEntry(
1596 id, base::Bind(&AppCacheStorageImpl::OnDeletedOneResponse,
1597 base::Unretained(this)));
1600 if (rv != net::ERR_IO_PENDING) 1598 if (rv != net::ERR_IO_PENDING)
1601 OnDeletedOneResponse(rv); 1599 OnDeletedOneResponse(rv);
1602 } 1600 }
1603 1601
1604 void AppCacheStorageImpl::OnDeletedOneResponse(int rv) { 1602 void AppCacheStorageImpl::OnDeletedOneResponse(int rv) {
1605 is_response_deletion_scheduled_ = false; 1603 is_response_deletion_scheduled_ = false;
1606 if (is_disabled_) 1604 if (is_disabled_)
1607 return; 1605 return;
1608 1606
1609 int64 id = deletable_response_ids_.front(); 1607 int64 id = deletable_response_ids_.front();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 DCHECK(IsInitTaskComplete()); 1673 DCHECK(IsInitTaskComplete());
1676 1674
1677 if (is_disabled_) 1675 if (is_disabled_)
1678 return NULL; 1676 return NULL;
1679 1677
1680 if (!disk_cache_.get()) { 1678 if (!disk_cache_.get()) {
1681 int rv = net::OK; 1679 int rv = net::OK;
1682 disk_cache_.reset(new AppCacheDiskCache); 1680 disk_cache_.reset(new AppCacheDiskCache);
1683 if (is_incognito_) { 1681 if (is_incognito_) {
1684 rv = disk_cache_->InitWithMemBackend( 1682 rv = disk_cache_->InitWithMemBackend(
1685 kMaxMemDiskCacheSize, &init_callback_); 1683 kMaxMemDiskCacheSize,
1684 base::Bind(&AppCacheStorageImpl::OnDiskCacheInitialized,
1685 base::Unretained(this)));
1686 } else { 1686 } else {
1687 rv = disk_cache_->InitWithDiskBackend( 1687 rv = disk_cache_->InitWithDiskBackend(
1688 cache_directory_.Append(kDiskCacheDirectoryName), 1688 cache_directory_.Append(kDiskCacheDirectoryName),
1689 kMaxDiskCacheSize, false, cache_thread_, &init_callback_); 1689 kMaxDiskCacheSize, false, cache_thread_,
1690 base::Bind(&AppCacheStorageImpl::OnDiskCacheInitialized,
1691 base::Unretained(this)));
1690 } 1692 }
1691 1693
1692 // We should not keep this reference around. 1694 // We should not keep this reference around.
1693 cache_thread_ = NULL; 1695 cache_thread_ = NULL;
1694 1696
1695 if (rv != net::ERR_IO_PENDING) 1697 if (rv != net::ERR_IO_PENDING)
1696 OnDiskCacheInitialized(rv); 1698 OnDiskCacheInitialized(rv);
1697 } 1699 }
1698 return disk_cache_.get(); 1700 return disk_cache_.get();
1699 } 1701 }
(...skipping 10 matching lines...) Expand all
1710 Disable(); 1712 Disable();
1711 if (!is_incognito_) { 1713 if (!is_incognito_) {
1712 VLOG(1) << "Deleting existing appcache data and starting over."; 1714 VLOG(1) << "Deleting existing appcache data and starting over.";
1713 db_thread_->PostTask( 1715 db_thread_->PostTask(
1714 FROM_HERE, base::Bind(&DeleteDirectory, cache_directory_)); 1716 FROM_HERE, base::Bind(&DeleteDirectory, cache_directory_));
1715 } 1717 }
1716 } 1718 }
1717 } 1719 }
1718 1720
1719 } // namespace appcache 1721 } // namespace appcache
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_storage_impl.h ('k') | webkit/appcache/appcache_update_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698