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

Unified Diff: content/browser/fileapi/fileapi_message_filter.cc

Issue 1234813004: [BlobAsync] Asynchronous Blob Construction Final Patch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blob-protocol-change
Patch Set: comments and rebase Created 4 years, 9 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/fileapi/fileapi_message_filter.cc
diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc
index e52a4b2597cb9b46aa9bd31ca0b7914813adfb10..318d9566448ae9eca368caf434c75492a03577cf 100644
--- a/content/browser/fileapi/fileapi_message_filter.cc
+++ b/content/browser/fileapi/fileapi_message_filter.cc
@@ -20,7 +20,6 @@
#include "build/build_config.h"
#include "content/browser/bad_message.h"
#include "content/browser/child_process_security_policy_impl.h"
-#include "content/browser/fileapi/blob_storage_host.h"
#include "content/browser/fileapi/browser_file_system_helper.h"
#include "content/browser/fileapi/chrome_blob_storage_context.h"
#include "content/browser/streams/stream_registry.h"
@@ -56,9 +55,7 @@ namespace content {
namespace {
-const uint32_t kFilteredMessageClasses[] = {
- BlobMsgStart, FileSystemMsgStart,
-};
+const uint32_t kFilteredMessageClasses[] = {FileSystemMsgStart, BlobMsgStart};
void RevokeFilePermission(int child_id, const base::FilePath& path) {
ChildProcessSecurityPolicyImpl::GetInstance()->RevokeAllPermissionsForFile(
@@ -118,18 +115,13 @@ void FileAPIMessageFilter::OnChannelConnected(int32_t peer_pid) {
DCHECK(request_context_);
}
- blob_storage_host_.reset(
- new BlobStorageHost(blob_storage_context_->context()));
-
operation_runner_ = context_->CreateFileSystemOperationRunner();
}
void FileAPIMessageFilter::OnChannelClosing() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- // Unregister all the blob and stream URLs that are previously registered in
- // this process.
- blob_storage_host_.reset();
+ // Unregister all stream URLs that are previously registered in this process.
for (base::hash_set<std::string>::const_iterator iter = stream_urls_.begin();
iter != stream_urls_.end(); ++iter) {
stream_context_->registry()->UnregisterStream(GURL(*iter));
@@ -171,19 +163,6 @@ bool FileAPIMessageFilter::OnMessageReceived(const IPC::Message& message) {
OnDidReceiveSnapshotFile)
IPC_MESSAGE_HANDLER(FileSystemHostMsg_SyncGetPlatformPath,
OnSyncGetPlatformPath)
- IPC_MESSAGE_HANDLER(BlobHostMsg_StartBuilding, OnStartBuildingBlob)
- IPC_MESSAGE_HANDLER(BlobHostMsg_AppendBlobDataItem,
- OnAppendBlobDataItemToBlob)
- IPC_MESSAGE_HANDLER(BlobHostMsg_SyncAppendSharedMemory,
- OnAppendSharedMemoryToBlob)
- IPC_MESSAGE_HANDLER(BlobHostMsg_FinishBuilding, OnFinishBuildingBlob)
- IPC_MESSAGE_HANDLER(BlobHostMsg_IncrementRefCount,
- OnIncrementBlobRefCount)
- IPC_MESSAGE_HANDLER(BlobHostMsg_DecrementRefCount,
- OnDecrementBlobRefCount)
- IPC_MESSAGE_HANDLER(BlobHostMsg_RegisterPublicURL,
- OnRegisterPublicBlobURL)
- IPC_MESSAGE_HANDLER(BlobHostMsg_RevokePublicURL, OnRevokePublicBlobURL)
IPC_MESSAGE_HANDLER(StreamHostMsg_StartBuilding, OnStartBuildingStream)
IPC_MESSAGE_HANDLER(StreamHostMsg_AppendBlobDataItem,
OnAppendBlobDataItemToStream)
@@ -514,86 +493,6 @@ void FileAPIMessageFilter::OnDidReceiveSnapshotFile(int request_id) {
in_transit_snapshot_files_.erase(request_id);
}
-void FileAPIMessageFilter::OnStartBuildingBlob(const std::string& uuid) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
- ignore_result(blob_storage_host_->StartBuildingBlob(uuid));
-}
-
-void FileAPIMessageFilter::OnAppendBlobDataItemToBlob(
- const std::string& uuid,
- const storage::DataElement& item) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
- if (item.type() == storage::DataElement::TYPE_FILE_FILESYSTEM) {
- FileSystemURL filesystem_url(context_->CrackURL(item.filesystem_url()));
- if (!FileSystemURLIsValid(context_, filesystem_url) ||
- !security_policy_->CanReadFileSystemFile(process_id_, filesystem_url)) {
- ignore_result(blob_storage_host_->CancelBuildingBlob(uuid));
- return;
- }
- }
- if (item.type() == storage::DataElement::TYPE_FILE &&
- !security_policy_->CanReadFile(process_id_, item.path())) {
- ignore_result(blob_storage_host_->CancelBuildingBlob(uuid));
- return;
- }
- if (item.length() == 0) {
- bad_message::ReceivedBadMessage(this,
- bad_message::FAMF_APPEND_ITEM_TO_BLOB);
- return;
- }
- ignore_result(blob_storage_host_->AppendBlobDataItem(uuid, item));
-}
-
-void FileAPIMessageFilter::OnAppendSharedMemoryToBlob(
- const std::string& uuid,
- base::SharedMemoryHandle handle,
- uint32_t buffer_size) {
- DCHECK(base::SharedMemory::IsHandleValid(handle));
- if (!buffer_size) {
- bad_message::ReceivedBadMessage(
- this, bad_message::FAMF_APPEND_SHARED_MEMORY_TO_BLOB);
- return;
- }
- base::SharedMemory shared_memory(handle, true);
- if (!shared_memory.Map(buffer_size)) {
- ignore_result(blob_storage_host_->CancelBuildingBlob(uuid));
- return;
- }
-
- storage::DataElement item;
- item.SetToSharedBytes(static_cast<char*>(shared_memory.memory()),
- buffer_size);
- ignore_result(blob_storage_host_->AppendBlobDataItem(uuid, item));
-}
-
-void FileAPIMessageFilter::OnFinishBuildingBlob(
- const std::string& uuid, const std::string& content_type) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
- ignore_result(blob_storage_host_->FinishBuildingBlob(uuid, content_type));
- // TODO(michaeln): check return values once blink has migrated, crbug/174200
-}
-
-void FileAPIMessageFilter::OnIncrementBlobRefCount(const std::string& uuid) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
- ignore_result(blob_storage_host_->IncrementBlobRefCount(uuid));
-}
-
-void FileAPIMessageFilter::OnDecrementBlobRefCount(const std::string& uuid) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
- ignore_result(blob_storage_host_->DecrementBlobRefCount(uuid));
-}
-
-void FileAPIMessageFilter::OnRegisterPublicBlobURL(
- const GURL& public_url, const std::string& uuid) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
- ignore_result(blob_storage_host_->RegisterPublicBlobURL(public_url, uuid));
-}
-
-void FileAPIMessageFilter::OnRevokePublicBlobURL(const GURL& public_url) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
- ignore_result(blob_storage_host_->RevokePublicBlobURL(public_url));
-}
-
void FileAPIMessageFilter::OnStartBuildingStream(
const GURL& url, const std::string& content_type) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
« no previous file with comments | « content/browser/fileapi/fileapi_message_filter.h ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698