Index: content/browser/fileapi/fileapi_message_filter.cc |
diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc |
index 5258fbffd541a9015b580ed36a18ee9c8c53a99d..7beb5c6fc0f0be22fc36f3b468843b63952aca8a 100644 |
--- a/content/browser/fileapi/fileapi_message_filter.cc |
+++ b/content/browser/fileapi/fileapi_message_filter.cc |
@@ -119,6 +119,22 @@ void FileAPIMessageFilter::OnChannelClosing() { |
iter != blob_urls_.end(); ++iter) { |
blob_storage_context_->controller()->RemoveBlob(GURL(*iter)); |
} |
+ |
+ // Close all files that are previously OpenFile()'ed in this process. |
+ if (!open_filesystem_urls_.empty()) { |
+ DLOG(INFO) |
+ << "File API: Renderer process shut down before NotifyCloseFile" |
+ << " for " << open_filesystem_urls_.size() << " files opened in PPAPI"; |
+ } |
+ for (std::multiset<GURL>::const_iterator iter = |
+ open_filesystem_urls_.begin(); |
+ iter != open_filesystem_urls_.end(); ++iter) { |
+ FileSystemOperationInterface* operation = |
+ context_->CreateFileSystemOperation(*iter); |
+ if (operation) |
+ operation->NotifyFileClosed( |
+ *iter, fileapi::FileSystemOperationInterface::StatusCallback()); |
+ } |
} |
void FileAPIMessageFilter::OverrideThreadForMessage( |
@@ -146,6 +162,7 @@ bool FileAPIMessageFilter::OnMessageReceived( |
IPC_MESSAGE_HANDLER(FileSystemHostMsg_TouchFile, OnTouchFile) |
IPC_MESSAGE_HANDLER(FileSystemHostMsg_CancelWrite, OnCancel) |
IPC_MESSAGE_HANDLER(FileSystemHostMsg_OpenFile, OnOpenFile) |
+ IPC_MESSAGE_HANDLER(FileSystemHostMsg_NotifyFileClosed, OnNotifyFileClosed) |
IPC_MESSAGE_HANDLER(FileSystemHostMsg_CreateSnapshotFile, |
OnCreateSnapshotFile) |
IPC_MESSAGE_HANDLER(FileSystemHostMsg_WillUpdate, OnWillUpdate) |
@@ -393,6 +410,16 @@ void FileAPIMessageFilter::OnOpenFile( |
base::Bind(&FileAPIMessageFilter::DidOpenFile, this, request_id)); |
} |
+void FileAPIMessageFilter::OnNotifyFileClosed(const GURL& path) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
+ |
+ FileSystemOperationInterface* operation = |
+ context_->CreateFileSystemOperation(path); |
+ if (operation) |
+ operation->NotifyFileClosed(path, |
+ FileSystemOperationInterface::StatusCallback()); |
+} |
+ |
void FileAPIMessageFilter::OnWillUpdate(const GURL& path) { |
GURL origin_url; |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |