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..8ad3fa9bd90c9e2f99b9d2387e8c91cc29498038 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? |
webkit::ppapi::PluginDelegate::AsyncOpenFileCallback callback_; |
+ base::FileUtilProxy::StatusCallback close_file_callback_; |
}; |
bool PepperPluginDelegateImpl::AsyncOpenFileSystemURL( |
@@ -909,7 +912,25 @@ 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::DoNotifyFileClosed, |
+ AsWeakPtr(), |
+ path); |
+} |
+ |
+void PepperPluginDelegateImpl::DoNotifyFileClosed( |
+ const GURL& path, base::PlatformFileError error) { |
+ if (error != base::PLATFORM_FILE_OK) |
+ return; |
+ |
+ FileSystemDispatcher* file_system_dispatcher = |
+ ChildThread::current()->file_system_dispatcher(); |
+ file_system_dispatcher->NotifyFileClosed(path); |
} |
base::PlatformFileError PepperPluginDelegateImpl::OpenFile( |