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

Unified Diff: content/browser/renderer_host/blob_message_filter.cc

Issue 7974011: Break large blobs into multiple ipcs during creation. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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/browser/renderer_host/blob_message_filter.cc
===================================================================
--- content/browser/renderer_host/blob_message_filter.cc (revision 102629)
+++ content/browser/renderer_host/blob_message_filter.cc (working copy)
@@ -38,7 +38,10 @@
bool handled = true;
IPC_BEGIN_MESSAGE_MAP_EX(BlobMessageFilter, message, *message_was_ok)
- IPC_MESSAGE_HANDLER(BlobHostMsg_RegisterBlobUrl, OnRegisterBlobUrl)
+ IPC_MESSAGE_HANDLER(BlobHostMsg_RegisterUnfinalizedBlobUrl,
+ OnRegisterUnfinalizedBlobUrl)
+ IPC_MESSAGE_HANDLER(BlobHostMsg_AppendBlobDataItem, OnAppendBlobDataItem)
+ IPC_MESSAGE_HANDLER(BlobHostMsg_FinalizeBlob, OnFinalizeBlob)
IPC_MESSAGE_HANDLER(BlobHostMsg_RegisterBlobUrlFrom, OnRegisterBlobUrlFrom)
IPC_MESSAGE_HANDLER(BlobHostMsg_UnregisterBlobUrl, OnUnregisterBlobUrl)
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -46,31 +49,30 @@
return handled;
}
-// Check if the child process has been granted permission to register the files.
-bool BlobMessageFilter::CheckPermission(
- webkit_blob::BlobData* blob_data) const {
- ChildProcessSecurityPolicy* policy =
- ChildProcessSecurityPolicy::GetInstance();
- for (std::vector<webkit_blob::BlobData::Item>::const_iterator iter =
- blob_data->items().begin();
- iter != blob_data->items().end(); ++iter) {
- if (iter->type() == webkit_blob::BlobData::TYPE_FILE) {
- if (!policy->CanReadFile(process_id_, iter->file_path()))
- return false;
- }
- }
- return true;
+void BlobMessageFilter::OnRegisterUnfinalizedBlobUrl(const GURL& url) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ blob_storage_context_->controller()->RegisterUnfinalizedBlobUrl(url);
+ blob_urls_.insert(url.spec());
}
-void BlobMessageFilter::OnRegisterBlobUrl(
- const GURL& url, const scoped_refptr<webkit_blob::BlobData>& blob_data) {
+void BlobMessageFilter::OnAppendBlobDataItem(
+ const GURL& url, const webkit_blob::BlobData::Item& item) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- if (!CheckPermission(blob_data.get()))
+ if (item.type() == webkit_blob::BlobData::TYPE_FILE &&
+ !ChildProcessSecurityPolicy::GetInstance()->CanReadFile(
+ process_id_, item.file_path())) {
+ OnUnregisterBlobUrl(url);
return;
- blob_storage_context_->controller()->RegisterBlobUrl(url, blob_data);
- blob_urls_.insert(url.spec());
+ }
+ blob_storage_context_->controller()->AppendBlobDataItem(url, item);
}
+void BlobMessageFilter::OnFinalizeBlob(
+ const GURL& url, const std::string& content_type) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ blob_storage_context_->controller()->FinalizeBlob(url, content_type);
+}
+
void BlobMessageFilter::OnRegisterBlobUrlFrom(
const GURL& url, const GURL& src_url) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));

Powered by Google App Engine
This is Rietveld 408576698