| 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" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 int bytes_written_; | 190 int bytes_written_; |
| 191 DISALLOW_COPY_AND_ASSIGN(WriteHelper); | 191 DISALLOW_COPY_AND_ASSIGN(WriteHelper); |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 #if !defined(OS_NACL) | 194 #if !defined(OS_NACL) |
| 195 PlatformFileError CreateOrOpenAdapter( | 195 PlatformFileError CreateOrOpenAdapter( |
| 196 const FilePath& file_path, int file_flags, | 196 const FilePath& file_path, int file_flags, |
| 197 PlatformFile* file_handle, bool* created) { | 197 PlatformFile* file_handle, bool* created) { |
| 198 DCHECK(file_handle); | 198 DCHECK(file_handle); |
| 199 DCHECK(created); | 199 DCHECK(created); |
| 200 if (!file_util::DirectoryExists(file_path.DirName())) { | 200 if (!DirectoryExists(file_path.DirName())) { |
| 201 // If its parent does not exist, should return NOT_FOUND error. | 201 // If its parent does not exist, should return NOT_FOUND error. |
| 202 return PLATFORM_FILE_ERROR_NOT_FOUND; | 202 return PLATFORM_FILE_ERROR_NOT_FOUND; |
| 203 } | 203 } |
| 204 PlatformFileError error = PLATFORM_FILE_OK; | 204 PlatformFileError error = PLATFORM_FILE_OK; |
| 205 *file_handle = CreatePlatformFile(file_path, file_flags, created, &error); | 205 *file_handle = CreatePlatformFile(file_path, file_flags, created, &error); |
| 206 return error; | 206 return error; |
| 207 } | 207 } |
| 208 #endif // !defined(OS_NACL) | 208 #endif // !defined(OS_NACL) |
| 209 | 209 |
| 210 PlatformFileError CloseAdapter(PlatformFile file_handle) { | 210 PlatformFileError CloseAdapter(PlatformFile file_handle) { |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 bool FileUtilProxy::RelayClose( | 432 bool FileUtilProxy::RelayClose( |
| 433 TaskRunner* task_runner, | 433 TaskRunner* task_runner, |
| 434 const CloseTask& close_task, | 434 const CloseTask& close_task, |
| 435 PlatformFile file_handle, | 435 PlatformFile file_handle, |
| 436 const StatusCallback& callback) { | 436 const StatusCallback& callback) { |
| 437 return base::PostTaskAndReplyWithResult( | 437 return base::PostTaskAndReplyWithResult( |
| 438 task_runner, FROM_HERE, Bind(close_task, file_handle), callback); | 438 task_runner, FROM_HERE, Bind(close_task, file_handle), callback); |
| 439 } | 439 } |
| 440 | 440 |
| 441 } // namespace base | 441 } // namespace base |
| OLD | NEW |