| 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 "storage/browser/fileapi/file_system_usage_cache.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/pickle.h" | 13 #include "base/pickle.h" |
| 14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 15 #include "webkit/browser/fileapi/timed_task_helper.h" | 15 #include "storage/browser/fileapi/timed_task_helper.h" |
| 16 | 16 |
| 17 namespace storage { | 17 namespace storage { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 const int64 kCloseDelaySeconds = 5; | 20 const int64 kCloseDelaySeconds = 5; |
| 21 const size_t kMaxHandleCacheSize = 2; | 21 const size_t kMaxHandleCacheSize = 2; |
| 22 } // namespace | 22 } // namespace |
| 23 | 23 |
| 24 FileSystemUsageCache::FileSystemUsageCache( | 24 FileSystemUsageCache::FileSystemUsageCache( |
| 25 base::SequencedTaskRunner* task_runner) | 25 base::SequencedTaskRunner* task_runner) |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 return !task_runner_.get() || task_runner_->RunsTasksOnCurrentThread(); | 298 return !task_runner_.get() || task_runner_->RunsTasksOnCurrentThread(); |
| 299 } | 299 } |
| 300 | 300 |
| 301 bool FileSystemUsageCache::HasCacheFileHandle(const base::FilePath& file_path) { | 301 bool FileSystemUsageCache::HasCacheFileHandle(const base::FilePath& file_path) { |
| 302 DCHECK(CalledOnValidThread()); | 302 DCHECK(CalledOnValidThread()); |
| 303 DCHECK_LE(cache_files_.size(), kMaxHandleCacheSize); | 303 DCHECK_LE(cache_files_.size(), kMaxHandleCacheSize); |
| 304 return ContainsKey(cache_files_, file_path); | 304 return ContainsKey(cache_files_, file_path); |
| 305 } | 305 } |
| 306 | 306 |
| 307 } // namespace storage | 307 } // namespace storage |
| OLD | NEW |