Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1926)

Unified Diff: content/renderer/pepper/pepper_plugin_delegate_impl.cc

Issue 14472008: [FileAPI] Add file open ID and close callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 42bcf50a8dea5fb176b833c6b13df64b1193fbd0..ecde1faf7042ecf9991cf6897588eb924ddc6d64 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
@@ -255,16 +255,18 @@ class PluginInstanceLockTarget : public MouseLockDispatcher::LockTarget {
webkit::ppapi::PluginInstance* plugin_;
};
+void DoNotifyCloseFile(int file_open_id, base::PlatformFileError /* unused */) {
+ ChildThread::current()->file_system_dispatcher()->NotifyCloseFile(
+ file_open_id);
+}
+
class AsyncOpenFileSystemURLCallbackTranslator
: public fileapi::FileSystemCallbackDispatcher {
public:
AsyncOpenFileSystemURLCallbackTranslator(
const webkit::ppapi::PluginDelegate::AsyncOpenFileSystemURLCallback&
- callback,
- const webkit::ppapi::PluginDelegate::NotifyCloseFileCallback&
- close_file_callback)
- : callback_(callback),
- close_file_callback_(close_file_callback) {
+ callback)
+ : callback_(callback) {
}
virtual ~AsyncOpenFileSystemURLCallbackTranslator() {}
@@ -305,28 +307,24 @@ class AsyncOpenFileSystemURLCallbackTranslator
}
virtual void DidOpenFile(base::PlatformFile file,
+ int file_open_id,
quota::QuotaLimitType quota_policy) OVERRIDE {
callback_.Run(base::PLATFORM_FILE_OK,
base::PassPlatformFile(&file),
quota_policy,
- close_file_callback_);
+ base::Bind(&DoNotifyCloseFile, file_open_id));
// Make sure we won't leak file handle if the requester has died.
if (file != base::kInvalidPlatformFileValue) {
base::FileUtilProxy::Close(
RenderThreadImpl::current()->GetFileThreadMessageLoopProxy(), file,
- close_file_callback_);
+ base::Bind(&DoNotifyCloseFile, file_open_id));
}
}
private:
webkit::ppapi::PluginDelegate::AsyncOpenFileSystemURLCallback callback_;
- webkit::ppapi::PluginDelegate::NotifyCloseFileCallback close_file_callback_;
};
-void DoNotifyCloseFile(const GURL& path, base::PlatformFileError /* unused */) {
- ChildThread::current()->file_system_dispatcher()->NotifyCloseFile(path);
-}
-
void CreateHostForInProcessModule(RenderViewImpl* render_view,
webkit::ppapi::PluginModule* module,
const webkit::WebPluginInfo& webplugin_info) {
@@ -1139,8 +1137,7 @@ bool PepperPluginDelegateImpl::AsyncOpenFileSystemURL(
ChildThread::current()->file_system_dispatcher();
return file_system_dispatcher->OpenFile(path, flags,
new AsyncOpenFileSystemURLCallbackTranslator(
- callback,
- base::Bind(&DoNotifyCloseFile, path)));
+ callback));
}
void PepperPluginDelegateImpl::SyncGetFileSystemPlatformPath(

Powered by Google App Engine
This is Rietveld 408576698