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..790cbb4010a19a9b7ad8b46dd86723407b04ff47 100644 |
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc |
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc |
@@ -855,8 +855,12 @@ class AsyncOpenFileSystemURLCallbackTranslator |
: public fileapi::FileSystemCallbackDispatcher { |
public: |
AsyncOpenFileSystemURLCallbackTranslator( |
- const webkit::ppapi::PluginDelegate::AsyncOpenFileCallback& callback) |
- : callback_(callback) { |
+ const webkit::ppapi::PluginDelegate::AsyncOpenFileSystemURLCallback& |
+ callback, |
+ const webkit::ppapi::PluginDelegate::NotifyCloseFileCallback& |
+ close_file_callback) |
+ : callback_(callback), |
+ close_file_callback_(close_file_callback) { |
} |
virtual ~AsyncOpenFileSystemURLCallbackTranslator() {} |
@@ -881,7 +885,9 @@ class AsyncOpenFileSystemURLCallbackTranslator |
virtual void DidFail(base::PlatformFileError error_code) { |
base::PlatformFile invalid_file = base::kInvalidPlatformFileValue; |
- callback_.Run(error_code, base::PassPlatformFile(&invalid_file)); |
+ callback_.Run(error_code, |
+ base::PassPlatformFile(&invalid_file), |
+ close_file_callback_); |
yzshen1
2012/06/29 17:15:52
[optional] Is it better to pass a no-op as the thi
kinaba
2012/07/03 06:46:35
Done.
|
} |
virtual void DidWrite(int64 bytes, bool complete) { |
@@ -890,26 +896,41 @@ class AsyncOpenFileSystemURLCallbackTranslator |
virtual void DidOpenFile( |
base::PlatformFile file) { |
- callback_.Run(base::PLATFORM_FILE_OK, base::PassPlatformFile(&file)); |
+ callback_.Run(base::PLATFORM_FILE_OK, |
+ base::PassPlatformFile(&file), |
+ close_file_callback_); |
// Make sure we won't leak file handle if the requester has died. |
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_; |
+ private: |
+ webkit::ppapi::PluginDelegate::AsyncOpenFileSystemURLCallback callback_; |
+ webkit::ppapi::PluginDelegate::NotifyCloseFileCallback close_file_callback_; |
}; |
bool PepperPluginDelegateImpl::AsyncOpenFileSystemURL( |
- const GURL& path, int flags, const AsyncOpenFileCallback& callback) { |
+ const GURL& path, |
+ int flags, |
+ const AsyncOpenFileSystemURLCallback& callback) { |
FileSystemDispatcher* file_system_dispatcher = |
ChildThread::current()->file_system_dispatcher(); |
return file_system_dispatcher->OpenFile(path, flags, |
- new AsyncOpenFileSystemURLCallbackTranslator(callback)); |
+ new AsyncOpenFileSystemURLCallbackTranslator( |
+ callback, |
+ base::Bind(&PepperPluginDelegateImpl::DoNotifyCloseFile, |
+ AsWeakPtr(), |
+ path))); |
dmichael (off chromium)
2012/06/29 16:06:40
nit: indentation is off
kinaba
2012/07/03 06:46:35
Done.
|
+} |
+ |
+void PepperPluginDelegateImpl::DoNotifyCloseFile( |
yzshen1
2012/06/29 17:15:52
- please keep the definitions in the same order as
kinaba
2012/07/03 06:46:35
Good point, I haven't realized.
Moved the function
|
+ const GURL& path, |
+ base::PlatformFileError /* unused */) { |
+ ChildThread::current()->file_system_dispatcher()->NotifyCloseFile(path); |
} |
base::PlatformFileError PepperPluginDelegateImpl::OpenFile( |