OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/fileapi/file_system_usage_cache.h" | 5 #include "webkit/browser/fileapi/file_system_usage_cache.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 bool FileSystemUsageCache::UpdateUsage(const base::FilePath& usage_file_path, | 141 bool FileSystemUsageCache::UpdateUsage(const base::FilePath& usage_file_path, |
142 int64 fs_usage) { | 142 int64 fs_usage) { |
143 TRACE_EVENT0("FileSystem", "UsageCache::UpdateUsage"); | 143 TRACE_EVENT0("FileSystem", "UsageCache::UpdateUsage"); |
144 DCHECK(CalledOnValidThread()); | 144 DCHECK(CalledOnValidThread()); |
145 return Write(usage_file_path, true, 0, fs_usage); | 145 return Write(usage_file_path, true, 0, fs_usage); |
146 } | 146 } |
147 | 147 |
148 bool FileSystemUsageCache::Exists(const base::FilePath& usage_file_path) { | 148 bool FileSystemUsageCache::Exists(const base::FilePath& usage_file_path) { |
149 TRACE_EVENT0("FileSystem", "UsageCache::Exists"); | 149 TRACE_EVENT0("FileSystem", "UsageCache::Exists"); |
150 DCHECK(CalledOnValidThread()); | 150 DCHECK(CalledOnValidThread()); |
151 return file_util::PathExists(usage_file_path); | 151 return base::PathExists(usage_file_path); |
152 } | 152 } |
153 | 153 |
154 bool FileSystemUsageCache::Delete(const base::FilePath& usage_file_path) { | 154 bool FileSystemUsageCache::Delete(const base::FilePath& usage_file_path) { |
155 TRACE_EVENT0("FileSystem", "UsageCache::Delete"); | 155 TRACE_EVENT0("FileSystem", "UsageCache::Delete"); |
156 DCHECK(CalledOnValidThread()); | 156 DCHECK(CalledOnValidThread()); |
157 CloseCacheFiles(); | 157 CloseCacheFiles(); |
158 return base::Delete(usage_file_path, true); | 158 return base::Delete(usage_file_path, true); |
159 } | 159 } |
160 | 160 |
161 void FileSystemUsageCache::CloseCacheFiles() { | 161 void FileSystemUsageCache::CloseCacheFiles() { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 return !task_runner_.get() || task_runner_->RunsTasksOnCurrentThread(); | 306 return !task_runner_.get() || task_runner_->RunsTasksOnCurrentThread(); |
307 } | 307 } |
308 | 308 |
309 bool FileSystemUsageCache::HasCacheFileHandle(const base::FilePath& file_path) { | 309 bool FileSystemUsageCache::HasCacheFileHandle(const base::FilePath& file_path) { |
310 DCHECK(CalledOnValidThread()); | 310 DCHECK(CalledOnValidThread()); |
311 DCHECK_LE(cache_files_.size(), kMaxHandleCacheSize); | 311 DCHECK_LE(cache_files_.size(), kMaxHandleCacheSize); |
312 return ContainsKey(cache_files_, file_path); | 312 return ContainsKey(cache_files_, file_path); |
313 } | 313 } |
314 | 314 |
315 } // namespace fileapi | 315 } // namespace fileapi |
OLD | NEW |