Chromium Code Reviews| Index: content/renderer/pepper/pepper_plugin_delegate_impl.cc |
| diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc |
| index 39401e8849e737bd56ea69648b51cd0e19de3492..21645ae22df4af2d037f7f4e719e1304dd16aa98 100644 |
| --- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc |
| +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc |
| @@ -855,8 +855,10 @@ class AsyncOpenFileSystemURLCallbackTranslator |
| : public fileapi::FileSystemCallbackDispatcher { |
| public: |
| AsyncOpenFileSystemURLCallbackTranslator( |
| - const webkit::ppapi::PluginDelegate::AsyncOpenFileCallback& callback) |
| - : callback_(callback) { |
| + const webkit::ppapi::PluginDelegate::AsyncOpenFileCallback& callback, |
| + const base::FileUtilProxy::StatusCallback& close_file_callback) |
| + : callback_(callback), |
| + close_file_callback_(close_file_callback) { |
| } |
| virtual ~AsyncOpenFileSystemURLCallbackTranslator() {} |
| @@ -895,12 +897,13 @@ class AsyncOpenFileSystemURLCallbackTranslator |
| if (file != base::kInvalidPlatformFileValue) { |
| base::FileUtilProxy::Close( |
| RenderThreadImpl::current()->GetFileThreadMessageLoopProxy(), file, |
| - base::FileUtilProxy::StatusCallback()); |
| + close_file_callback_); |
| } |
| } |
| private: // TODO(ericu): Delete this? |
|
kinuko
2012/06/26 11:13:36
nit: can you delete this comment (and fix indent)
kinaba
2012/06/27 03:47:42
Done.
|
| webkit::ppapi::PluginDelegate::AsyncOpenFileCallback callback_; |
| + base::FileUtilProxy::StatusCallback close_file_callback_; |
| }; |
| bool PepperPluginDelegateImpl::AsyncOpenFileSystemURL( |
| @@ -909,7 +912,21 @@ bool PepperPluginDelegateImpl::AsyncOpenFileSystemURL( |
| FileSystemDispatcher* file_system_dispatcher = |
| ChildThread::current()->file_system_dispatcher(); |
| return file_system_dispatcher->OpenFile(path, flags, |
| - new AsyncOpenFileSystemURLCallbackTranslator(callback)); |
| + new AsyncOpenFileSystemURLCallbackTranslator( |
| + callback, GetCloseFileSystemURLCallback(path))); |
| +} |
| + |
| +base::Callback<void (base::PlatformFileError)> |
| +PepperPluginDelegateImpl::GetCloseFileSystemURLCallback(const GURL& path) { |
| + return base::Bind(&PepperPluginDelegateImpl::DoNotifyCloseFile, |
| + AsWeakPtr(), |
| + path); |
| +} |
| + |
| +void PepperPluginDelegateImpl::DoNotifyCloseFile( |
| + const GURL& path, |
| + base::PlatformFileError /* unused */) { |
| + ChildThread::current()->file_system_dispatcher()->NotifyCloseFile(path); |
| } |
| base::PlatformFileError PepperPluginDelegateImpl::OpenFile( |