OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/file_system_provider/throttled_file_system.h" | 5 #include "chrome/browser/chromeos/file_system_provider/throttled_file_system.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 |
7 #include <limits> | 9 #include <limits> |
8 #include <vector> | 10 #include <vector> |
9 | 11 |
10 #include "base/files/file.h" | 12 #include "base/files/file.h" |
11 #include "chrome/browser/chromeos/file_system_provider/queue.h" | 13 #include "chrome/browser/chromeos/file_system_provider/queue.h" |
12 | 14 |
13 namespace chromeos { | 15 namespace chromeos { |
14 namespace file_system_provider { | 16 namespace file_system_provider { |
15 | 17 |
16 ThrottledFileSystem::ThrottledFileSystem( | 18 ThrottledFileSystem::ThrottledFileSystem( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 55 |
54 AbortCallback ThrottledFileSystem::ReadDirectory( | 56 AbortCallback ThrottledFileSystem::ReadDirectory( |
55 const base::FilePath& directory_path, | 57 const base::FilePath& directory_path, |
56 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) { | 58 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) { |
57 return file_system_->ReadDirectory(directory_path, callback); | 59 return file_system_->ReadDirectory(directory_path, callback); |
58 } | 60 } |
59 | 61 |
60 AbortCallback ThrottledFileSystem::ReadFile( | 62 AbortCallback ThrottledFileSystem::ReadFile( |
61 int file_handle, | 63 int file_handle, |
62 net::IOBuffer* buffer, | 64 net::IOBuffer* buffer, |
63 int64 offset, | 65 int64_t offset, |
64 int length, | 66 int length, |
65 const ReadChunkReceivedCallback& callback) { | 67 const ReadChunkReceivedCallback& callback) { |
66 return file_system_->ReadFile(file_handle, buffer, offset, length, callback); | 68 return file_system_->ReadFile(file_handle, buffer, offset, length, callback); |
67 } | 69 } |
68 | 70 |
69 AbortCallback ThrottledFileSystem::OpenFile(const base::FilePath& file_path, | 71 AbortCallback ThrottledFileSystem::OpenFile(const base::FilePath& file_path, |
70 OpenFileMode mode, | 72 OpenFileMode mode, |
71 const OpenFileCallback& callback) { | 73 const OpenFileCallback& callback) { |
72 const size_t task_token = open_queue_->NewToken(); | 74 const size_t task_token = open_queue_->NewToken(); |
73 open_queue_->Enqueue( | 75 open_queue_->Enqueue( |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 AbortCallback ThrottledFileSystem::CopyEntry( | 116 AbortCallback ThrottledFileSystem::CopyEntry( |
115 const base::FilePath& source_path, | 117 const base::FilePath& source_path, |
116 const base::FilePath& target_path, | 118 const base::FilePath& target_path, |
117 const storage::AsyncFileUtil::StatusCallback& callback) { | 119 const storage::AsyncFileUtil::StatusCallback& callback) { |
118 return file_system_->CopyEntry(source_path, target_path, callback); | 120 return file_system_->CopyEntry(source_path, target_path, callback); |
119 } | 121 } |
120 | 122 |
121 AbortCallback ThrottledFileSystem::WriteFile( | 123 AbortCallback ThrottledFileSystem::WriteFile( |
122 int file_handle, | 124 int file_handle, |
123 net::IOBuffer* buffer, | 125 net::IOBuffer* buffer, |
124 int64 offset, | 126 int64_t offset, |
125 int length, | 127 int length, |
126 const storage::AsyncFileUtil::StatusCallback& callback) { | 128 const storage::AsyncFileUtil::StatusCallback& callback) { |
127 return file_system_->WriteFile(file_handle, buffer, offset, length, callback); | 129 return file_system_->WriteFile(file_handle, buffer, offset, length, callback); |
128 } | 130 } |
129 | 131 |
130 AbortCallback ThrottledFileSystem::MoveEntry( | 132 AbortCallback ThrottledFileSystem::MoveEntry( |
131 const base::FilePath& source_path, | 133 const base::FilePath& source_path, |
132 const base::FilePath& target_path, | 134 const base::FilePath& target_path, |
133 const storage::AsyncFileUtil::StatusCallback& callback) { | 135 const storage::AsyncFileUtil::StatusCallback& callback) { |
134 return file_system_->MoveEntry(source_path, target_path, callback); | 136 return file_system_->MoveEntry(source_path, target_path, callback); |
135 } | 137 } |
136 | 138 |
137 AbortCallback ThrottledFileSystem::Truncate( | 139 AbortCallback ThrottledFileSystem::Truncate( |
138 const base::FilePath& file_path, | 140 const base::FilePath& file_path, |
139 int64 length, | 141 int64_t length, |
140 const storage::AsyncFileUtil::StatusCallback& callback) { | 142 const storage::AsyncFileUtil::StatusCallback& callback) { |
141 return file_system_->Truncate(file_path, length, callback); | 143 return file_system_->Truncate(file_path, length, callback); |
142 } | 144 } |
143 | 145 |
144 AbortCallback ThrottledFileSystem::AddWatcher( | 146 AbortCallback ThrottledFileSystem::AddWatcher( |
145 const GURL& origin, | 147 const GURL& origin, |
146 const base::FilePath& entry_path, | 148 const base::FilePath& entry_path, |
147 bool recursive, | 149 bool recursive, |
148 bool persistent, | 150 bool persistent, |
149 const storage::AsyncFileUtil::StatusCallback& callback, | 151 const storage::AsyncFileUtil::StatusCallback& callback, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 237 |
236 const int queue_token = it->second; | 238 const int queue_token = it->second; |
237 open_queue_->Complete(queue_token); | 239 open_queue_->Complete(queue_token); |
238 opened_files_.erase(file_handle); | 240 opened_files_.erase(file_handle); |
239 | 241 |
240 callback.Run(result); | 242 callback.Run(result); |
241 } | 243 } |
242 | 244 |
243 } // namespace file_system_provider | 245 } // namespace file_system_provider |
244 } // namespace chromeos | 246 } // namespace chromeos |
OLD | NEW |