Chromium Code Reviews| 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 "webkit/plugins/ppapi/ppb_file_io_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/file_util_proxy.h" | 10 #include "base/file_util_proxy.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, NULL); | 198 RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, NULL); |
| 199 return PP_OK_COMPLETIONPENDING; | 199 return PP_OK_COMPLETIONPENDING; |
| 200 } | 200 } |
| 201 | 201 |
| 202 void PPB_FileIO_Impl::Close() { | 202 void PPB_FileIO_Impl::Close() { |
| 203 PluginDelegate* plugin_delegate = GetPluginDelegate(); | 203 PluginDelegate* plugin_delegate = GetPluginDelegate(); |
| 204 if (file_ != base::kInvalidPlatformFileValue && plugin_delegate) { | 204 if (file_ != base::kInvalidPlatformFileValue && plugin_delegate) { |
| 205 base::FileUtilProxy::Close( | 205 base::FileUtilProxy::Close( |
| 206 plugin_delegate->GetFileThreadMessageLoopProxy(), file_, | 206 plugin_delegate->GetFileThreadMessageLoopProxy(), file_, |
| 207 base::FileUtilProxy::StatusCallback()); | 207 base::FileUtilProxy::StatusCallback()); |
| 208 if (!file_system_url_.is_empty()) | |
| 209 plugin_delegate->AsyncNotifyCloseFileSystemURL(file_system_url_); | |
|
kinuko
2012/06/13 06:38:29
It looks like we can call this in Close's callback
kinaba
2012/06/25 11:14:02
Done.
The tricky thing here is that in the callbac
| |
| 208 file_ = base::kInvalidPlatformFileValue; | 210 file_ = base::kInvalidPlatformFileValue; |
| 209 quota_file_io_.reset(); | 211 quota_file_io_.reset(); |
| 210 } | 212 } |
| 211 } | 213 } |
| 212 | 214 |
| 213 int32_t PPB_FileIO_Impl::GetOSFileDescriptor() { | 215 int32_t PPB_FileIO_Impl::GetOSFileDescriptor() { |
| 214 #if defined(OS_POSIX) | 216 #if defined(OS_POSIX) |
| 215 return file_; | 217 return file_; |
| 216 #elif defined(OS_WIN) | 218 #elif defined(OS_WIN) |
| 217 return reinterpret_cast<uintptr_t>(file_); | 219 return reinterpret_cast<uintptr_t>(file_); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 330 if (error_code != base::PLATFORM_FILE_OK) { | 332 if (error_code != base::PLATFORM_FILE_OK) { |
| 331 RunAndRemoveFirstPendingCallback( | 333 RunAndRemoveFirstPendingCallback( |
| 332 ::ppapi::PlatformFileErrorToPepperError(error_code)); | 334 ::ppapi::PlatformFileErrorToPepperError(error_code)); |
| 333 } else { | 335 } else { |
| 334 RunAndRemoveFirstPendingCallback(bytes_written); | 336 RunAndRemoveFirstPendingCallback(bytes_written); |
| 335 } | 337 } |
| 336 } | 338 } |
| 337 | 339 |
| 338 } // namespace ppapi | 340 } // namespace ppapi |
| 339 } // namespace webkit | 341 } // namespace webkit |
| OLD | NEW |