Chromium Code Reviews| 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 "base/files/file_util_proxy.h" | 5 #include "base/files/file_util_proxy.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
| 12 #include "base/task_runner.h" | 12 #include "base/task_runner.h" |
| 13 #include "base/task_runner_util.h" | 13 #include "base/task_runner_util.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 void CallWithTranslatedParameter(const FileUtilProxy::StatusCallback& callback, | 19 void CallWithTranslatedParameter(const FileUtilProxy::StatusCallback& callback, |
| 20 bool value) { | 20 bool value) { |
| 21 DCHECK(!callback.is_null()); | 21 DCHECK(!callback.is_null()); |
| 22 callback.Run(value ? PLATFORM_FILE_OK : PLATFORM_FILE_ERROR_FAILED); | 22 callback.Run(value ? PLATFORM_FILE_OK : PLATFORM_FILE_ERROR_FAILED); |
| 23 } | 23 } |
| 24 | 24 |
| 25 #if !defined(OS_NACL) | |
| 25 // Helper classes or routines for individual methods. | 26 // Helper classes or routines for individual methods. |
| 26 class CreateOrOpenHelper { | 27 class CreateOrOpenHelper { |
| 27 public: | 28 public: |
| 28 CreateOrOpenHelper(TaskRunner* task_runner, | 29 CreateOrOpenHelper(TaskRunner* task_runner, |
| 29 const FileUtilProxy::CloseTask& close_task) | 30 const FileUtilProxy::CloseTask& close_task) |
| 30 : task_runner_(task_runner), | 31 : task_runner_(task_runner), |
| 31 close_task_(close_task), | 32 close_task_(close_task), |
| 32 file_handle_(kInvalidPlatformFileValue), | 33 file_handle_(kInvalidPlatformFileValue), |
| 33 created_(false), | 34 created_(false), |
| 34 error_(PLATFORM_FILE_OK) {} | 35 error_(PLATFORM_FILE_OK) {} |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 callback.Run(error_, PassPlatformFile(&file_handle_), file_path_); | 94 callback.Run(error_, PassPlatformFile(&file_handle_), file_path_); |
| 94 } | 95 } |
| 95 | 96 |
| 96 private: | 97 private: |
| 97 scoped_refptr<TaskRunner> task_runner_; | 98 scoped_refptr<TaskRunner> task_runner_; |
| 98 PlatformFile file_handle_; | 99 PlatformFile file_handle_; |
| 99 FilePath file_path_; | 100 FilePath file_path_; |
| 100 PlatformFileError error_; | 101 PlatformFileError error_; |
| 101 DISALLOW_COPY_AND_ASSIGN(CreateTemporaryHelper); | 102 DISALLOW_COPY_AND_ASSIGN(CreateTemporaryHelper); |
| 102 }; | 103 }; |
| 104 #endif // !defined(OS_NACL) | |
| 103 | 105 |
| 104 class GetFileInfoHelper { | 106 class GetFileInfoHelper { |
| 105 public: | 107 public: |
| 106 GetFileInfoHelper() | 108 GetFileInfoHelper() |
| 107 : error_(PLATFORM_FILE_OK) {} | 109 : error_(PLATFORM_FILE_OK) {} |
| 108 | 110 |
| 111 #if !defined(OS_NACL) | |
| 109 void RunWorkForFilePath(const FilePath& file_path) { | 112 void RunWorkForFilePath(const FilePath& file_path) { |
| 110 if (!file_util::PathExists(file_path)) { | 113 if (!file_util::PathExists(file_path)) { |
| 111 error_ = PLATFORM_FILE_ERROR_NOT_FOUND; | 114 error_ = PLATFORM_FILE_ERROR_NOT_FOUND; |
| 112 return; | 115 return; |
| 113 } | 116 } |
| 114 if (!file_util::GetFileInfo(file_path, &file_info_)) | 117 if (!file_util::GetFileInfo(file_path, &file_info_)) |
| 115 error_ = PLATFORM_FILE_ERROR_FAILED; | 118 error_ = PLATFORM_FILE_ERROR_FAILED; |
| 116 } | 119 } |
| 120 #endif // !defined(OS_NACL) | |
| 117 | 121 |
| 118 void RunWorkForPlatformFile(PlatformFile file) { | 122 void RunWorkForPlatformFile(PlatformFile file) { |
| 119 if (!GetPlatformFileInfo(file, &file_info_)) | 123 if (!GetPlatformFileInfo(file, &file_info_)) |
| 120 error_ = PLATFORM_FILE_ERROR_FAILED; | 124 error_ = PLATFORM_FILE_ERROR_FAILED; |
| 121 } | 125 } |
| 122 | 126 |
| 123 void Reply(const FileUtilProxy::GetFileInfoCallback& callback) { | 127 void Reply(const FileUtilProxy::GetFileInfoCallback& callback) { |
| 124 if (!callback.is_null()) { | 128 if (!callback.is_null()) { |
| 125 callback.Run(error_, file_info_); | 129 callback.Run(error_, file_info_); |
| 126 } | 130 } |
| 127 } | 131 } |
| 128 | 132 |
| 129 private: | 133 private: |
| 130 PlatformFileError error_; | 134 PlatformFileError error_; |
| 131 PlatformFileInfo file_info_; | 135 PlatformFileInfo file_info_; |
| 132 DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper); | 136 DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper); |
| 133 }; | 137 }; |
| 134 | 138 |
| 135 class ReadHelper { | 139 class ReadHelper { |
| 136 public: | 140 public: |
| 137 explicit ReadHelper(int bytes_to_read) | 141 explicit ReadHelper(int bytes_to_read) |
| 138 : buffer_(new char[bytes_to_read]), | 142 : buffer_(new char[bytes_to_read]), |
| 139 bytes_to_read_(bytes_to_read), | 143 bytes_to_read_(bytes_to_read), |
| 140 bytes_read_(0) {} | 144 bytes_read_(0) {} |
| 141 | 145 |
| 142 void RunWork(PlatformFile file, int64 offset) { | 146 void RunWork(PlatformFile file, int64 offset) { |
| 147 #if !defined(OS_NACL) | |
| 143 bytes_read_ = ReadPlatformFile(file, offset, buffer_.get(), bytes_to_read_); | 148 bytes_read_ = ReadPlatformFile(file, offset, buffer_.get(), bytes_to_read_); |
| 149 #else | |
| 150 // TODO(bbudge) Eliminate this when NaCl supports pread. | |
| 151 SeekPlatformFile(file, PLATFORM_FILE_FROM_BEGIN, offset); | |
|
brettw
2013/07/09 20:05:37
Does it make more sense to implement ReadPlatformF
bbudge
2013/07/09 21:54:54
Yeah, it looks like it does. Done.
| |
| 152 bytes_read_ = ReadPlatformFileAtCurrentPos(file, buffer_.get(), | |
| 153 bytes_to_read_); | |
| 154 #endif | |
| 144 } | 155 } |
| 145 | 156 |
| 146 void Reply(const FileUtilProxy::ReadCallback& callback) { | 157 void Reply(const FileUtilProxy::ReadCallback& callback) { |
| 147 if (!callback.is_null()) { | 158 if (!callback.is_null()) { |
| 148 PlatformFileError error = | 159 PlatformFileError error = |
| 149 (bytes_read_ < 0) ? PLATFORM_FILE_ERROR_FAILED : PLATFORM_FILE_OK; | 160 (bytes_read_ < 0) ? PLATFORM_FILE_ERROR_FAILED : PLATFORM_FILE_OK; |
| 150 callback.Run(error, buffer_.get(), bytes_read_); | 161 callback.Run(error, buffer_.get(), bytes_read_); |
| 151 } | 162 } |
| 152 } | 163 } |
| 153 | 164 |
| 154 private: | 165 private: |
| 155 scoped_ptr<char[]> buffer_; | 166 scoped_ptr<char[]> buffer_; |
| 156 int bytes_to_read_; | 167 int bytes_to_read_; |
| 157 int bytes_read_; | 168 int bytes_read_; |
| 158 DISALLOW_COPY_AND_ASSIGN(ReadHelper); | 169 DISALLOW_COPY_AND_ASSIGN(ReadHelper); |
| 159 }; | 170 }; |
| 160 | 171 |
| 161 class WriteHelper { | 172 class WriteHelper { |
| 162 public: | 173 public: |
| 163 WriteHelper(const char* buffer, int bytes_to_write) | 174 WriteHelper(const char* buffer, int bytes_to_write) |
| 164 : buffer_(new char[bytes_to_write]), | 175 : buffer_(new char[bytes_to_write]), |
| 165 bytes_to_write_(bytes_to_write), | 176 bytes_to_write_(bytes_to_write), |
| 166 bytes_written_(0) { | 177 bytes_written_(0) { |
| 167 memcpy(buffer_.get(), buffer, bytes_to_write); | 178 memcpy(buffer_.get(), buffer, bytes_to_write); |
| 168 } | 179 } |
| 169 | 180 |
| 170 void RunWork(PlatformFile file, int64 offset) { | 181 void RunWork(PlatformFile file, int64 offset) { |
| 182 #if !defined(OS_NACL) | |
| 171 bytes_written_ = WritePlatformFile(file, offset, buffer_.get(), | 183 bytes_written_ = WritePlatformFile(file, offset, buffer_.get(), |
| 172 bytes_to_write_); | 184 bytes_to_write_); |
| 185 #else | |
| 186 // TODO(bbudge) Eliminate this when NaCl supports pwrite. | |
| 187 SeekPlatformFile(file, PLATFORM_FILE_FROM_BEGIN, offset); | |
| 188 bytes_written_ = WritePlatformFileAtCurrentPos(file, buffer_.get(), | |
| 189 bytes_to_write_); | |
| 190 #endif | |
| 173 } | 191 } |
| 174 | 192 |
| 175 void Reply(const FileUtilProxy::WriteCallback& callback) { | 193 void Reply(const FileUtilProxy::WriteCallback& callback) { |
| 176 if (!callback.is_null()) { | 194 if (!callback.is_null()) { |
| 177 PlatformFileError error = | 195 PlatformFileError error = |
| 178 (bytes_written_ < 0) ? PLATFORM_FILE_ERROR_FAILED : PLATFORM_FILE_OK; | 196 (bytes_written_ < 0) ? PLATFORM_FILE_ERROR_FAILED : PLATFORM_FILE_OK; |
| 179 callback.Run(error, bytes_written_); | 197 callback.Run(error, bytes_written_); |
| 180 } | 198 } |
| 181 } | 199 } |
| 182 | 200 |
| 183 private: | 201 private: |
| 184 scoped_ptr<char[]> buffer_; | 202 scoped_ptr<char[]> buffer_; |
| 185 int bytes_to_write_; | 203 int bytes_to_write_; |
| 186 int bytes_written_; | 204 int bytes_written_; |
| 187 DISALLOW_COPY_AND_ASSIGN(WriteHelper); | 205 DISALLOW_COPY_AND_ASSIGN(WriteHelper); |
| 188 }; | 206 }; |
| 189 | 207 |
| 190 | 208 #if !defined(OS_NACL) |
| 191 PlatformFileError CreateOrOpenAdapter( | 209 PlatformFileError CreateOrOpenAdapter( |
| 192 const FilePath& file_path, int file_flags, | 210 const FilePath& file_path, int file_flags, |
| 193 PlatformFile* file_handle, bool* created) { | 211 PlatformFile* file_handle, bool* created) { |
| 194 DCHECK(file_handle); | 212 DCHECK(file_handle); |
| 195 DCHECK(created); | 213 DCHECK(created); |
| 196 if (!file_util::DirectoryExists(file_path.DirName())) { | 214 if (!file_util::DirectoryExists(file_path.DirName())) { |
| 197 // If its parent does not exist, should return NOT_FOUND error. | 215 // If its parent does not exist, should return NOT_FOUND error. |
| 198 return PLATFORM_FILE_ERROR_NOT_FOUND; | 216 return PLATFORM_FILE_ERROR_NOT_FOUND; |
| 199 } | 217 } |
| 200 PlatformFileError error = PLATFORM_FILE_OK; | 218 PlatformFileError error = PLATFORM_FILE_OK; |
| 201 *file_handle = CreatePlatformFile(file_path, file_flags, created, &error); | 219 *file_handle = CreatePlatformFile(file_path, file_flags, created, &error); |
| 202 return error; | 220 return error; |
| 203 } | 221 } |
| 204 | 222 |
| 223 #endif // !defined(OS_NACL) | |
| 205 PlatformFileError CloseAdapter(PlatformFile file_handle) { | 224 PlatformFileError CloseAdapter(PlatformFile file_handle) { |
| 206 if (!ClosePlatformFile(file_handle)) { | 225 if (!ClosePlatformFile(file_handle)) { |
| 207 return PLATFORM_FILE_ERROR_FAILED; | 226 return PLATFORM_FILE_ERROR_FAILED; |
| 208 } | 227 } |
| 209 return PLATFORM_FILE_OK; | 228 return PLATFORM_FILE_OK; |
| 210 } | 229 } |
| 211 | 230 |
| 231 #if !defined(OS_NACL) | |
| 212 PlatformFileError DeleteAdapter(const FilePath& file_path, bool recursive) { | 232 PlatformFileError DeleteAdapter(const FilePath& file_path, bool recursive) { |
| 213 if (!file_util::PathExists(file_path)) { | 233 if (!file_util::PathExists(file_path)) { |
| 214 return PLATFORM_FILE_ERROR_NOT_FOUND; | 234 return PLATFORM_FILE_ERROR_NOT_FOUND; |
| 215 } | 235 } |
| 216 if (!base::Delete(file_path, recursive)) { | 236 if (!base::Delete(file_path, recursive)) { |
| 217 if (!recursive && !file_util::IsDirectoryEmpty(file_path)) { | 237 if (!recursive && !file_util::IsDirectoryEmpty(file_path)) { |
| 218 return PLATFORM_FILE_ERROR_NOT_EMPTY; | 238 return PLATFORM_FILE_ERROR_NOT_EMPTY; |
| 219 } | 239 } |
| 220 return PLATFORM_FILE_ERROR_FAILED; | 240 return PLATFORM_FILE_ERROR_FAILED; |
| 221 } | 241 } |
| 222 return PLATFORM_FILE_OK; | 242 return PLATFORM_FILE_OK; |
| 223 } | 243 } |
| 244 #endif // !defined(OS_NACL) | |
| 224 | 245 |
| 225 } // namespace | 246 } // namespace |
| 226 | 247 |
| 248 #if !defined(OS_NACL) | |
| 227 // static | 249 // static |
| 228 bool FileUtilProxy::CreateOrOpen( | 250 bool FileUtilProxy::CreateOrOpen( |
| 229 TaskRunner* task_runner, | 251 TaskRunner* task_runner, |
| 230 const FilePath& file_path, int file_flags, | 252 const FilePath& file_path, int file_flags, |
| 231 const CreateOrOpenCallback& callback) { | 253 const CreateOrOpenCallback& callback) { |
| 232 return RelayCreateOrOpen( | 254 return RelayCreateOrOpen( |
| 233 task_runner, | 255 task_runner, |
| 234 base::Bind(&CreateOrOpenAdapter, file_path, file_flags), | 256 base::Bind(&CreateOrOpenAdapter, file_path, file_flags), |
| 235 base::Bind(&CloseAdapter), | 257 base::Bind(&CloseAdapter), |
| 236 callback); | 258 callback); |
| 237 } | 259 } |
| 238 | 260 |
| 239 // static | 261 // static |
| 240 bool FileUtilProxy::CreateTemporary( | 262 bool FileUtilProxy::CreateTemporary( |
| 241 TaskRunner* task_runner, | 263 TaskRunner* task_runner, |
| 242 int additional_file_flags, | 264 int additional_file_flags, |
| 243 const CreateTemporaryCallback& callback) { | 265 const CreateTemporaryCallback& callback) { |
| 244 CreateTemporaryHelper* helper = new CreateTemporaryHelper(task_runner); | 266 CreateTemporaryHelper* helper = new CreateTemporaryHelper(task_runner); |
| 245 return task_runner->PostTaskAndReply( | 267 return task_runner->PostTaskAndReply( |
| 246 FROM_HERE, | 268 FROM_HERE, |
| 247 Bind(&CreateTemporaryHelper::RunWork, Unretained(helper), | 269 Bind(&CreateTemporaryHelper::RunWork, Unretained(helper), |
| 248 additional_file_flags), | 270 additional_file_flags), |
| 249 Bind(&CreateTemporaryHelper::Reply, Owned(helper), callback)); | 271 Bind(&CreateTemporaryHelper::Reply, Owned(helper), callback)); |
| 250 } | 272 } |
| 273 #endif // !defined(OS_NACL) | |
| 251 | 274 |
| 252 // static | 275 // static |
| 253 bool FileUtilProxy::Close( | 276 bool FileUtilProxy::Close( |
| 254 TaskRunner* task_runner, | 277 TaskRunner* task_runner, |
| 255 base::PlatformFile file_handle, | 278 base::PlatformFile file_handle, |
| 256 const StatusCallback& callback) { | 279 const StatusCallback& callback) { |
| 257 return RelayClose( | 280 return RelayClose( |
| 258 task_runner, | 281 task_runner, |
| 259 base::Bind(&CloseAdapter), | 282 base::Bind(&CloseAdapter), |
| 260 file_handle, callback); | 283 file_handle, callback); |
| 261 } | 284 } |
| 262 | 285 |
| 286 #if !defined(OS_NACL) | |
| 263 // Retrieves the information about a file. It is invalid to pass NULL for the | 287 // Retrieves the information about a file. It is invalid to pass NULL for the |
| 264 // callback. | 288 // callback. |
| 265 bool FileUtilProxy::GetFileInfo( | 289 bool FileUtilProxy::GetFileInfo( |
| 266 TaskRunner* task_runner, | 290 TaskRunner* task_runner, |
| 267 const FilePath& file_path, | 291 const FilePath& file_path, |
| 268 const GetFileInfoCallback& callback) { | 292 const GetFileInfoCallback& callback) { |
| 269 GetFileInfoHelper* helper = new GetFileInfoHelper; | 293 GetFileInfoHelper* helper = new GetFileInfoHelper; |
| 270 return task_runner->PostTaskAndReply( | 294 return task_runner->PostTaskAndReply( |
| 271 FROM_HERE, | 295 FROM_HERE, |
| 272 Bind(&GetFileInfoHelper::RunWorkForFilePath, | 296 Bind(&GetFileInfoHelper::RunWorkForFilePath, |
| 273 Unretained(helper), file_path), | 297 Unretained(helper), file_path), |
| 274 Bind(&GetFileInfoHelper::Reply, Owned(helper), callback)); | 298 Bind(&GetFileInfoHelper::Reply, Owned(helper), callback)); |
| 275 } | 299 } |
| 300 #endif // !defined(OS_NACL) | |
| 276 | 301 |
| 277 // static | 302 // static |
| 278 bool FileUtilProxy::GetFileInfoFromPlatformFile( | 303 bool FileUtilProxy::GetFileInfoFromPlatformFile( |
| 279 TaskRunner* task_runner, | 304 TaskRunner* task_runner, |
| 280 PlatformFile file, | 305 PlatformFile file, |
| 281 const GetFileInfoCallback& callback) { | 306 const GetFileInfoCallback& callback) { |
| 282 GetFileInfoHelper* helper = new GetFileInfoHelper; | 307 GetFileInfoHelper* helper = new GetFileInfoHelper; |
| 283 return task_runner->PostTaskAndReply( | 308 return task_runner->PostTaskAndReply( |
| 284 FROM_HERE, | 309 FROM_HERE, |
| 285 Bind(&GetFileInfoHelper::RunWorkForPlatformFile, | 310 Bind(&GetFileInfoHelper::RunWorkForPlatformFile, |
| 286 Unretained(helper), file), | 311 Unretained(helper), file), |
| 287 Bind(&GetFileInfoHelper::Reply, Owned(helper), callback)); | 312 Bind(&GetFileInfoHelper::Reply, Owned(helper), callback)); |
| 288 } | 313 } |
| 289 | 314 |
| 315 #if !defined(OS_NACL) | |
| 290 // static | 316 // static |
| 291 bool FileUtilProxy::Delete(TaskRunner* task_runner, | 317 bool FileUtilProxy::Delete(TaskRunner* task_runner, |
| 292 const FilePath& file_path, | 318 const FilePath& file_path, |
| 293 bool recursive, | 319 bool recursive, |
| 294 const StatusCallback& callback) { | 320 const StatusCallback& callback) { |
| 295 return base::PostTaskAndReplyWithResult( | 321 return base::PostTaskAndReplyWithResult( |
| 296 task_runner, FROM_HERE, | 322 task_runner, FROM_HERE, |
| 297 Bind(&DeleteAdapter, file_path, recursive), | 323 Bind(&DeleteAdapter, file_path, recursive), |
| 298 callback); | 324 callback); |
| 299 } | 325 } |
| 300 | 326 |
| 301 // static | 327 // static |
| 302 bool FileUtilProxy::RecursiveDelete( | 328 bool FileUtilProxy::RecursiveDelete( |
| 303 TaskRunner* task_runner, | 329 TaskRunner* task_runner, |
| 304 const FilePath& file_path, | 330 const FilePath& file_path, |
| 305 const StatusCallback& callback) { | 331 const StatusCallback& callback) { |
| 306 return base::PostTaskAndReplyWithResult( | 332 return base::PostTaskAndReplyWithResult( |
| 307 task_runner, FROM_HERE, | 333 task_runner, FROM_HERE, |
| 308 Bind(&DeleteAdapter, file_path, true /* recursive */), | 334 Bind(&DeleteAdapter, file_path, true /* recursive */), |
| 309 callback); | 335 callback); |
| 310 } | 336 } |
| 337 #endif // !defined(OS_NACL) | |
| 311 | 338 |
| 312 // static | 339 // static |
| 313 bool FileUtilProxy::Read( | 340 bool FileUtilProxy::Read( |
| 314 TaskRunner* task_runner, | 341 TaskRunner* task_runner, |
| 315 PlatformFile file, | 342 PlatformFile file, |
| 316 int64 offset, | 343 int64 offset, |
| 317 int bytes_to_read, | 344 int bytes_to_read, |
| 318 const ReadCallback& callback) { | 345 const ReadCallback& callback) { |
| 319 if (bytes_to_read < 0) { | 346 if (bytes_to_read < 0) { |
| 320 return false; | 347 return false; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 337 if (bytes_to_write <= 0 || buffer == NULL) { | 364 if (bytes_to_write <= 0 || buffer == NULL) { |
| 338 return false; | 365 return false; |
| 339 } | 366 } |
| 340 WriteHelper* helper = new WriteHelper(buffer, bytes_to_write); | 367 WriteHelper* helper = new WriteHelper(buffer, bytes_to_write); |
| 341 return task_runner->PostTaskAndReply( | 368 return task_runner->PostTaskAndReply( |
| 342 FROM_HERE, | 369 FROM_HERE, |
| 343 Bind(&WriteHelper::RunWork, Unretained(helper), file, offset), | 370 Bind(&WriteHelper::RunWork, Unretained(helper), file, offset), |
| 344 Bind(&WriteHelper::Reply, Owned(helper), callback)); | 371 Bind(&WriteHelper::Reply, Owned(helper), callback)); |
| 345 } | 372 } |
| 346 | 373 |
| 374 #if !defined(OS_NACL) | |
| 347 // static | 375 // static |
| 348 bool FileUtilProxy::Touch( | 376 bool FileUtilProxy::Touch( |
| 349 TaskRunner* task_runner, | 377 TaskRunner* task_runner, |
| 350 PlatformFile file, | 378 PlatformFile file, |
| 351 const Time& last_access_time, | 379 const Time& last_access_time, |
| 352 const Time& last_modified_time, | 380 const Time& last_modified_time, |
| 353 const StatusCallback& callback) { | 381 const StatusCallback& callback) { |
| 354 return base::PostTaskAndReplyWithResult( | 382 return base::PostTaskAndReplyWithResult( |
| 355 task_runner, | 383 task_runner, |
| 356 FROM_HERE, | 384 FROM_HERE, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 405 const CreateOrOpenTask& open_task, | 433 const CreateOrOpenTask& open_task, |
| 406 const CloseTask& close_task, | 434 const CloseTask& close_task, |
| 407 const CreateOrOpenCallback& callback) { | 435 const CreateOrOpenCallback& callback) { |
| 408 CreateOrOpenHelper* helper = new CreateOrOpenHelper( | 436 CreateOrOpenHelper* helper = new CreateOrOpenHelper( |
| 409 task_runner, close_task); | 437 task_runner, close_task); |
| 410 return task_runner->PostTaskAndReply( | 438 return task_runner->PostTaskAndReply( |
| 411 FROM_HERE, | 439 FROM_HERE, |
| 412 Bind(&CreateOrOpenHelper::RunWork, Unretained(helper), open_task), | 440 Bind(&CreateOrOpenHelper::RunWork, Unretained(helper), open_task), |
| 413 Bind(&CreateOrOpenHelper::Reply, Owned(helper), callback)); | 441 Bind(&CreateOrOpenHelper::Reply, Owned(helper), callback)); |
| 414 } | 442 } |
| 443 #endif // !defined(OS_NACL) | |
| 415 | 444 |
| 416 // static | 445 // static |
| 417 bool FileUtilProxy::RelayClose( | 446 bool FileUtilProxy::RelayClose( |
| 418 TaskRunner* task_runner, | 447 TaskRunner* task_runner, |
| 419 const CloseTask& close_task, | 448 const CloseTask& close_task, |
| 420 PlatformFile file_handle, | 449 PlatformFile file_handle, |
| 421 const StatusCallback& callback) { | 450 const StatusCallback& callback) { |
| 422 return base::PostTaskAndReplyWithResult( | 451 return base::PostTaskAndReplyWithResult( |
| 423 task_runner, FROM_HERE, Bind(close_task, file_handle), callback); | 452 task_runner, FROM_HERE, Bind(close_task, file_handle), callback); |
| 424 } | 453 } |
| 425 | 454 |
| 426 } // namespace base | 455 } // namespace base |
| OLD | NEW |