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

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

Issue 10600013: Wired support for file truncating with RemoteFileSystemOperation::OpenFile() method (case when base… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 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(

Powered by Google App Engine
This is Rietveld 408576698