| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_util_proxy.h" | 5 #include "base/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/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 const FileUtilProxy::CloseTask& close_task) | 105 const FileUtilProxy::CloseTask& close_task) |
| 106 : message_loop_proxy_(message_loop_proxy), | 106 : message_loop_proxy_(message_loop_proxy), |
| 107 close_task_(close_task), | 107 close_task_(close_task), |
| 108 file_handle_(kInvalidPlatformFileValue), | 108 file_handle_(kInvalidPlatformFileValue), |
| 109 created_(false), | 109 created_(false), |
| 110 error_(PLATFORM_FILE_OK) {} | 110 error_(PLATFORM_FILE_OK) {} |
| 111 | 111 |
| 112 ~CreateOrOpenHelper() { | 112 ~CreateOrOpenHelper() { |
| 113 if (file_handle_ != kInvalidPlatformFileValue) { | 113 if (file_handle_ != kInvalidPlatformFileValue) { |
| 114 message_loop_proxy_->PostTask( | 114 message_loop_proxy_->PostTask( |
| 115 FROM_HERE, base::Bind(close_task_, file_handle_)); | 115 FROM_HERE, |
| 116 base::Bind(base::IgnoreResult(close_task_), file_handle_)); |
| 116 } | 117 } |
| 117 } | 118 } |
| 118 | 119 |
| 119 void RunWork(const FileUtilProxy::CreateOrOpenTask& task) { | 120 void RunWork(const FileUtilProxy::CreateOrOpenTask& task) { |
| 120 error_ = task.Run(&file_handle_, &created_); | 121 error_ = task.Run(&file_handle_, &created_); |
| 121 } | 122 } |
| 122 | 123 |
| 123 void Reply(const FileUtilProxy::CreateOrOpenCallback& callback) { | 124 void Reply(const FileUtilProxy::CreateOrOpenCallback& callback) { |
| 124 DCHECK(!callback.is_null()); | 125 DCHECK(!callback.is_null()); |
| 125 callback.Run(error_, PassPlatformFile(&file_handle_), created_); | 126 callback.Run(error_, PassPlatformFile(&file_handle_), created_); |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 PlatformFile file_handle, | 506 PlatformFile file_handle, |
| 506 const StatusCallback& callback) { | 507 const StatusCallback& callback) { |
| 507 PlatformFileError* result = new PlatformFileError; | 508 PlatformFileError* result = new PlatformFileError; |
| 508 return message_loop_proxy->PostTaskAndReply( | 509 return message_loop_proxy->PostTaskAndReply( |
| 509 FROM_HERE, | 510 FROM_HERE, |
| 510 ReturnAsParam(close_task, file_handle, result), | 511 ReturnAsParam(close_task, file_handle, result), |
| 511 ReplyHelper(callback, Owned(result))); | 512 ReplyHelper(callback, Owned(result))); |
| 512 } | 513 } |
| 513 | 514 |
| 514 } // namespace base | 515 } // namespace base |
| OLD | NEW |