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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 return; | 292 return; |
293 } | 293 } |
294 | 294 |
295 timer_.Start(FROM_HERE, | 295 timer_.Start(FROM_HERE, |
296 base::TimeDelta::FromSeconds(kCloseDelaySeconds), | 296 base::TimeDelta::FromSeconds(kCloseDelaySeconds), |
297 base::Bind(&FileSystemUsageCache::CloseCacheFiles, | 297 base::Bind(&FileSystemUsageCache::CloseCacheFiles, |
298 weak_factory_.GetWeakPtr())); | 298 weak_factory_.GetWeakPtr())); |
299 } | 299 } |
300 | 300 |
301 bool FileSystemUsageCache::CalledOnValidThread() { | 301 bool FileSystemUsageCache::CalledOnValidThread() { |
302 return !task_runner_ || task_runner_->RunsTasksOnCurrentThread(); | 302 return !task_runner_.get() || task_runner_->RunsTasksOnCurrentThread(); |
303 } | 303 } |
304 | 304 |
305 bool FileSystemUsageCache::HasCacheFileHandle(const base::FilePath& file_path) { | 305 bool FileSystemUsageCache::HasCacheFileHandle(const base::FilePath& file_path) { |
306 DCHECK(CalledOnValidThread()); | 306 DCHECK(CalledOnValidThread()); |
307 DCHECK_LE(cache_files_.size(), kMaxHandleCacheSize); | 307 DCHECK_LE(cache_files_.size(), kMaxHandleCacheSize); |
308 return ContainsKey(cache_files_, file_path); | 308 return ContainsKey(cache_files_, file_path); |
309 } | 309 } |
310 | 310 |
311 } // namespace fileapi | 311 } // namespace fileapi |
OLD | NEW |