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 "chrome/browser/chromeos/drive/file_cache.h" | 5 #include "chrome/browser/chromeos/drive/file_cache.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 | 65 |
66 void FileCache::AssertOnSequencedWorkerPool() { | 66 void FileCache::AssertOnSequencedWorkerPool() { |
67 DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread()); | 67 DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread()); |
68 } | 68 } |
69 | 69 |
70 bool FileCache::IsUnderFileCacheDirectory(const base::FilePath& path) const { | 70 bool FileCache::IsUnderFileCacheDirectory(const base::FilePath& path) const { |
71 return cache_file_directory_.IsParent(path); | 71 return cache_file_directory_.IsParent(path); |
72 } | 72 } |
73 | 73 |
74 bool FileCache::GetCacheEntry(const std::string& id, FileCacheEntry* entry) { | 74 FileError FileCache::GetCacheEntry(const std::string& id, |
| 75 FileCacheEntry* entry) { |
75 DCHECK(entry); | 76 DCHECK(entry); |
76 AssertOnSequencedWorkerPool(); | 77 AssertOnSequencedWorkerPool(); |
77 return storage_->GetCacheEntry(id, entry) == FILE_ERROR_OK; | 78 return storage_->GetCacheEntry(id, entry); |
78 } | 79 } |
79 | 80 |
80 scoped_ptr<FileCache::Iterator> FileCache::GetIterator() { | 81 scoped_ptr<FileCache::Iterator> FileCache::GetIterator() { |
81 AssertOnSequencedWorkerPool(); | 82 AssertOnSequencedWorkerPool(); |
82 return storage_->GetCacheEntryIterator(); | 83 return storage_->GetCacheEntryIterator(); |
83 } | 84 } |
84 | 85 |
85 bool FileCache::FreeDiskSpaceIfNeededFor(int64 num_bytes) { | 86 bool FileCache::FreeDiskSpaceIfNeededFor(int64 num_bytes) { |
86 AssertOnSequencedWorkerPool(); | 87 AssertOnSequencedWorkerPool(); |
87 | 88 |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 return; | 597 return; |
597 | 598 |
598 DCHECK_LT(0, it->second); | 599 DCHECK_LT(0, it->second); |
599 --it->second; | 600 --it->second; |
600 if (it->second == 0) | 601 if (it->second == 0) |
601 write_opened_files_.erase(it); | 602 write_opened_files_.erase(it); |
602 } | 603 } |
603 | 604 |
604 } // namespace internal | 605 } // namespace internal |
605 } // namespace drive | 606 } // namespace drive |
OLD | NEW |