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

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

Issue 8960011: base::Bind: Remove NewRunnableFunction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win build fix. Created 8 years, 12 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
« no previous file with comments | « tools/valgrind/common.py ('k') | no next file » | 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 26 matching lines...) Expand all
37 // Hard coded default when not using quota management. 37 // Hard coded default when not using quota management.
38 static const int kDefaultQuota = 5 * 1024 * 1024; 38 static const int kDefaultQuota = 5 * 1024 * 1024;
39 39
40 static const int kMaxDiskCacheSize = 250 * 1024 * 1024; 40 static const int kMaxDiskCacheSize = 250 * 1024 * 1024;
41 static const int kMaxMemDiskCacheSize = 10 * 1024 * 1024; 41 static const int kMaxMemDiskCacheSize = 10 * 1024 * 1024;
42 static const FilePath::CharType kDiskCacheDirectoryName[] = 42 static const FilePath::CharType kDiskCacheDirectoryName[] =
43 FILE_PATH_LITERAL("Cache"); 43 FILE_PATH_LITERAL("Cache");
44 44
45 namespace { 45 namespace {
46 46
47 // Helper with no return value for use with NewRunnableFunction.
48 void DeleteDirectory(const FilePath& path) {
49 file_util::Delete(path, true);
50 }
51
52 // Helpers for clearing data from the AppCacheDatabase. 47 // Helpers for clearing data from the AppCacheDatabase.
53 bool DeleteGroupAndRelatedRecords(AppCacheDatabase* database, 48 bool DeleteGroupAndRelatedRecords(AppCacheDatabase* database,
54 int64 group_id, 49 int64 group_id,
55 std::vector<int64>* deletable_response_ids) { 50 std::vector<int64>* deletable_response_ids) {
56 AppCacheDatabase::CacheRecord cache_record; 51 AppCacheDatabase::CacheRecord cache_record;
57 bool success = false; 52 bool success = false;
58 if (database->FindCacheForGroup(group_id, &cache_record)) { 53 if (database->FindCacheForGroup(group_id, &cache_record)) {
59 database->FindResponseIdsForCacheAsVector(cache_record.cache_id, 54 database->FindResponseIdsForCacheAsVector(cache_record.cache_id,
60 deletable_response_ids); 55 deletable_response_ids);
61 success = 56 success =
(...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after
1706 AppCacheHistograms::CountInitResult(AppCacheHistograms::DISK_CACHE_ERROR); 1701 AppCacheHistograms::CountInitResult(AppCacheHistograms::DISK_CACHE_ERROR);
1707 1702
1708 // We're unable to open the disk cache, this is a fatal error that we can't 1703 // We're unable to open the disk cache, this is a fatal error that we can't
1709 // really recover from. We handle it by disabling the appcache for this 1704 // really recover from. We handle it by disabling the appcache for this
1710 // browser session and deleting the directory on disk. The next browser 1705 // browser session and deleting the directory on disk. The next browser
1711 // session should start with a clean slate. 1706 // session should start with a clean slate.
1712 Disable(); 1707 Disable();
1713 if (!is_incognito_) { 1708 if (!is_incognito_) {
1714 VLOG(1) << "Deleting existing appcache data and starting over."; 1709 VLOG(1) << "Deleting existing appcache data and starting over.";
1715 db_thread_->PostTask( 1710 db_thread_->PostTask(
1716 FROM_HERE, base::Bind(&DeleteDirectory, cache_directory_)); 1711 FROM_HERE, base::Bind(base::IgnoreResult<bool>(&file_util::Delete),
awong 2011/12/27 22:24:15 Do you need the <bool>? here? That surprises me..
James Hawkins 2012/01/01 00:11:46 Yeah, I'm not sure why I wrote that.
1712 cache_directory_, true));
1717 } 1713 }
1718 } 1714 }
1719 } 1715 }
1720 1716
1721 } // namespace appcache 1717 } // namespace appcache
OLDNEW
« no previous file with comments | « tools/valgrind/common.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698