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 "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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 weak_factory_.GetWeakPtr()))) | 203 weak_factory_.GetWeakPtr()))) |
204 return PP_ERROR_FAILED; | 204 return PP_ERROR_FAILED; |
205 | 205 |
206 RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, NULL); | 206 RegisterCallback(OPERATION_EXCLUSIVE, callback, NULL, NULL); |
207 return PP_OK_COMPLETIONPENDING; | 207 return PP_OK_COMPLETIONPENDING; |
208 } | 208 } |
209 | 209 |
210 void PPB_FileIO_Impl::Close() { | 210 void PPB_FileIO_Impl::Close() { |
211 PluginDelegate* plugin_delegate = GetPluginDelegate(); | 211 PluginDelegate* plugin_delegate = GetPluginDelegate(); |
212 if (file_ != base::kInvalidPlatformFileValue && plugin_delegate) { | 212 if (file_ != base::kInvalidPlatformFileValue && plugin_delegate) { |
213 base::FileUtilProxy::StatusCallback callback; | |
214 if (!file_system_url_.is_empty()) { | |
zel
2012/06/26 01:42:18
file_system_url_ is going to be set only for local
kinaba
2012/06/26 04:19:22
Fmm, is it?
I thought the code pass (not HasValidF
kinuko
2012/06/26 11:13:36
EXTERNAL file could be created without file system
zel
2012/06/26 23:51:57
Yeah, that seems correct. NaCl has two inconsisten
kinaba
2012/06/27 03:47:42
And I believe it is meant for read-only file open
| |
215 callback = plugin_delegate->GetCloseFileSystemURLCallback( | |
216 file_system_url_); | |
217 } | |
213 base::FileUtilProxy::Close( | 218 base::FileUtilProxy::Close( |
214 plugin_delegate->GetFileThreadMessageLoopProxy(), file_, | 219 plugin_delegate->GetFileThreadMessageLoopProxy(), file_, callback); |
215 base::FileUtilProxy::StatusCallback()); | |
216 file_ = base::kInvalidPlatformFileValue; | 220 file_ = base::kInvalidPlatformFileValue; |
217 quota_file_io_.reset(); | 221 quota_file_io_.reset(); |
218 } | 222 } |
219 } | 223 } |
220 | 224 |
221 int32_t PPB_FileIO_Impl::GetOSFileDescriptor() { | 225 int32_t PPB_FileIO_Impl::GetOSFileDescriptor() { |
222 #if defined(OS_POSIX) | 226 #if defined(OS_POSIX) |
223 return file_; | 227 return file_; |
224 #elif defined(OS_WIN) | 228 #elif defined(OS_WIN) |
225 return reinterpret_cast<uintptr_t>(file_); | 229 return reinterpret_cast<uintptr_t>(file_); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 if (error_code != base::PLATFORM_FILE_OK) { | 343 if (error_code != base::PLATFORM_FILE_OK) { |
340 RunAndRemoveFirstPendingCallback( | 344 RunAndRemoveFirstPendingCallback( |
341 ::ppapi::PlatformFileErrorToPepperError(error_code)); | 345 ::ppapi::PlatformFileErrorToPepperError(error_code)); |
342 } else { | 346 } else { |
343 RunAndRemoveFirstPendingCallback(bytes_written); | 347 RunAndRemoveFirstPendingCallback(bytes_written); |
344 } | 348 } |
345 } | 349 } |
346 | 350 |
347 } // namespace ppapi | 351 } // namespace ppapi |
348 } // namespace webkit | 352 } // namespace webkit |
OLD | NEW |