| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 class CreateTemporaryHelper { | 62 class CreateTemporaryHelper { |
| 63 public: | 63 public: |
| 64 explicit CreateTemporaryHelper(TaskRunner* task_runner) | 64 explicit CreateTemporaryHelper(TaskRunner* task_runner) |
| 65 : task_runner_(task_runner), | 65 : task_runner_(task_runner), |
| 66 file_handle_(kInvalidPlatformFileValue), | 66 file_handle_(kInvalidPlatformFileValue), |
| 67 error_(PLATFORM_FILE_OK) {} | 67 error_(PLATFORM_FILE_OK) {} |
| 68 | 68 |
| 69 ~CreateTemporaryHelper() { | 69 ~CreateTemporaryHelper() { |
| 70 if (file_handle_ != kInvalidPlatformFileValue) { | 70 if (file_handle_ != kInvalidPlatformFileValue) { |
| 71 FileUtilProxy::Close(task_runner_, file_handle_, | 71 FileUtilProxy::Close( |
| 72 FileUtilProxy::StatusCallback()); | 72 task_runner_.get(), file_handle_, FileUtilProxy::StatusCallback()); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 void RunWork(int additional_file_flags) { | 76 void RunWork(int additional_file_flags) { |
| 77 // TODO(darin): file_util should have a variant of CreateTemporaryFile | 77 // TODO(darin): file_util should have a variant of CreateTemporaryFile |
| 78 // that returns a FilePath and a PlatformFile. | 78 // that returns a FilePath and a PlatformFile. |
| 79 file_util::CreateTemporaryFile(&file_path_); | 79 file_util::CreateTemporaryFile(&file_path_); |
| 80 | 80 |
| 81 int file_flags = | 81 int file_flags = |
| 82 PLATFORM_FILE_WRITE | | 82 PLATFORM_FILE_WRITE | |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 bool FileUtilProxy::RelayClose( | 417 bool FileUtilProxy::RelayClose( |
| 418 TaskRunner* task_runner, | 418 TaskRunner* task_runner, |
| 419 const CloseTask& close_task, | 419 const CloseTask& close_task, |
| 420 PlatformFile file_handle, | 420 PlatformFile file_handle, |
| 421 const StatusCallback& callback) { | 421 const StatusCallback& callback) { |
| 422 return base::PostTaskAndReplyWithResult( | 422 return base::PostTaskAndReplyWithResult( |
| 423 task_runner, FROM_HERE, Bind(close_task, file_handle), callback); | 423 task_runner, FROM_HERE, Bind(close_task, file_handle), callback); |
| 424 } | 424 } |
| 425 | 425 |
| 426 } // namespace base | 426 } // namespace base |
| OLD | NEW |