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

Side by Side Diff: net/disk_cache/simple/simple_backend_impl.cc

Issue 100573002: Move directory creation functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « net/disk_cache/cache_util_unittest.cc ('k') | net/disk_cache/simple/simple_index_file.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/simple/simple_backend_impl.h" 5 #include "net/disk_cache/simple/simple_backend_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstdlib> 8 #include <cstdlib>
9 #include <functional> 9 #include <functional>
10 10
(...skipping 26 matching lines...) Expand all
37 #include "net/disk_cache/simple/simple_version_upgrade.h" 37 #include "net/disk_cache/simple/simple_version_upgrade.h"
38 38
39 using base::Callback; 39 using base::Callback;
40 using base::Closure; 40 using base::Closure;
41 using base::FilePath; 41 using base::FilePath;
42 using base::MessageLoopProxy; 42 using base::MessageLoopProxy;
43 using base::SequencedWorkerPool; 43 using base::SequencedWorkerPool;
44 using base::SingleThreadTaskRunner; 44 using base::SingleThreadTaskRunner;
45 using base::Time; 45 using base::Time;
46 using base::DirectoryExists; 46 using base::DirectoryExists;
47 using file_util::CreateDirectory; 47 using base::CreateDirectory;
48 48
49 namespace disk_cache { 49 namespace disk_cache {
50 50
51 namespace { 51 namespace {
52 52
53 // Maximum number of concurrent worker pool threads, which also is the limit 53 // Maximum number of concurrent worker pool threads, which also is the limit
54 // on concurrent IO (as we use one thread per IO request). 54 // on concurrent IO (as we use one thread per IO request).
55 const int kDefaultMaxWorkerThreads = 50; 55 const int kDefaultMaxWorkerThreads = 50;
56 56
57 const char kThreadNamePrefix[] = "SimpleCache"; 57 const char kThreadNamePrefix[] = "SimpleCache";
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 "FileDescriptorLimitHard", cache_type, hard_fd_limit); 117 "FileDescriptorLimitHard", cache_type, hard_fd_limit);
118 } 118 }
119 119
120 g_fd_limit_histogram_has_been_populated = true; 120 g_fd_limit_histogram_has_been_populated = true;
121 } 121 }
122 122
123 // Detects if the files in the cache directory match the current disk cache 123 // Detects if the files in the cache directory match the current disk cache
124 // backend type and version. If the directory contains no cache, occupies it 124 // backend type and version. If the directory contains no cache, occupies it
125 // with the fresh structure. 125 // with the fresh structure.
126 bool FileStructureConsistent(const base::FilePath& path) { 126 bool FileStructureConsistent(const base::FilePath& path) {
127 if (!base::PathExists(path) && !file_util::CreateDirectory(path)) { 127 if (!base::PathExists(path) && !base::CreateDirectory(path)) {
128 LOG(ERROR) << "Failed to create directory: " << path.LossyDisplayName(); 128 LOG(ERROR) << "Failed to create directory: " << path.LossyDisplayName();
129 return false; 129 return false;
130 } 130 }
131 return disk_cache::UpgradeSimpleCacheOnDisk(path); 131 return disk_cache::UpgradeSimpleCacheOnDisk(path);
132 } 132 }
133 133
134 // A context used by a BarrierCompletionCallback to track state. 134 // A context used by a BarrierCompletionCallback to track state.
135 struct BarrierContext { 135 struct BarrierContext {
136 BarrierContext(int expected) 136 BarrierContext(int expected)
137 : expected(expected), 137 : expected(expected),
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 this)); 702 this));
703 callback.Run(result); 703 callback.Run(result);
704 } 704 }
705 705
706 void SimpleBackendImpl::FlushWorkerPoolForTesting() { 706 void SimpleBackendImpl::FlushWorkerPoolForTesting() {
707 if (g_sequenced_worker_pool) 707 if (g_sequenced_worker_pool)
708 g_sequenced_worker_pool->FlushForTesting(); 708 g_sequenced_worker_pool->FlushForTesting();
709 } 709 }
710 710
711 } // namespace disk_cache 711 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/cache_util_unittest.cc ('k') | net/disk_cache/simple/simple_index_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698