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

Side by Side Diff: net/disk_cache/backend_impl.cc

Issue 6079009: Move some misc thread-related stuff from base to base/thread and into the bas... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | « net/base/test_completion_callback_unittest.cc ('k') | net/disk_cache/file_posix.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "net/disk_cache/backend_impl.h" 5 #include "net/disk_cache/backend_impl.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
15 #include "base/sys_info.h" 15 #include "base/sys_info.h"
16 #include "base/threading/worker_pool.h"
16 #include "base/thread_restrictions.h" 17 #include "base/thread_restrictions.h"
17 #include "base/time.h" 18 #include "base/time.h"
18 #include "base/timer.h" 19 #include "base/timer.h"
19 #include "base/worker_pool.h"
20 #include "net/base/net_errors.h" 20 #include "net/base/net_errors.h"
21 #include "net/disk_cache/cache_util.h" 21 #include "net/disk_cache/cache_util.h"
22 #include "net/disk_cache/entry_impl.h" 22 #include "net/disk_cache/entry_impl.h"
23 #include "net/disk_cache/errors.h" 23 #include "net/disk_cache/errors.h"
24 #include "net/disk_cache/experiments.h" 24 #include "net/disk_cache/experiments.h"
25 #include "net/disk_cache/file.h" 25 #include "net/disk_cache/file.h"
26 #include "net/disk_cache/hash.h" 26 #include "net/disk_cache/hash.h"
27 #include "net/disk_cache/mem_backend_impl.h" 27 #include "net/disk_cache/mem_backend_impl.h"
28 28
29 // This has to be defined before including histogram_macros.h from this file. 29 // This has to be defined before including histogram_macros.h from this file.
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 if (to_delete.empty()) { 135 if (to_delete.empty()) {
136 LOG(ERROR) << "Unable to get another cache folder"; 136 LOG(ERROR) << "Unable to get another cache folder";
137 return false; 137 return false;
138 } 138 }
139 139
140 if (!disk_cache::MoveCache(full_path, to_delete)) { 140 if (!disk_cache::MoveCache(full_path, to_delete)) {
141 LOG(ERROR) << "Unable to move cache folder"; 141 LOG(ERROR) << "Unable to move cache folder";
142 return false; 142 return false;
143 } 143 }
144 144
145 WorkerPool::PostTask(FROM_HERE, new CleanupTask(path, name_str), true); 145 base::WorkerPool::PostTask(FROM_HERE, new CleanupTask(path, name_str), true);
146 return true; 146 return true;
147 } 147 }
148 148
149 // Sets group for the current experiment. Returns false if the files should be 149 // Sets group for the current experiment. Returns false if the files should be
150 // discarded. 150 // discarded.
151 bool InitExperiment(disk_cache::IndexHeader* header) { 151 bool InitExperiment(disk_cache::IndexHeader* header) {
152 if (header->experiment == disk_cache::EXPERIMENT_OLD_FILE1 || 152 if (header->experiment == disk_cache::EXPERIMENT_OLD_FILE1 ||
153 header->experiment == disk_cache::EXPERIMENT_OLD_FILE2) { 153 header->experiment == disk_cache::EXPERIMENT_OLD_FILE2) {
154 // Discard current cache. 154 // Discard current cache.
155 return false; 155 return false;
(...skipping 1911 matching lines...) Expand 10 before | Expand all | Expand 10 after
2067 if (total_memory > kMaxBuffersSize || total_memory <= 0) 2067 if (total_memory > kMaxBuffersSize || total_memory <= 0)
2068 total_memory = kMaxBuffersSize; 2068 total_memory = kMaxBuffersSize;
2069 2069
2070 done = true; 2070 done = true;
2071 } 2071 }
2072 2072
2073 return static_cast<int>(total_memory); 2073 return static_cast<int>(total_memory);
2074 } 2074 }
2075 2075
2076 } // namespace disk_cache 2076 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/base/test_completion_callback_unittest.cc ('k') | net/disk_cache/file_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698