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

Unified Diff: content/browser/loader/mojo_async_resource_handler.cc

Issue 2561743003: Use associated interface on DownloadedTempFile (Closed)
Patch Set: +NOTREACHED on non frame trasfer Created 3 years, 11 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/loader/mojo_async_resource_handler.cc
diff --git a/content/browser/loader/mojo_async_resource_handler.cc b/content/browser/loader/mojo_async_resource_handler.cc
index 8792cd59f8cbce7db2ba30b73037942fb993b52a..75abb83a1c563f4c14d44aa0e84ea234540a5bc2 100644
--- a/content/browser/loader/mojo_async_resource_handler.cc
+++ b/content/browser/loader/mojo_async_resource_handler.cc
@@ -7,6 +7,7 @@
#include <utility>
#include <vector>
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/containers/hash_tables.h"
#include "base/logging.h"
@@ -57,6 +58,11 @@ void InitializeResourceBufferConstants() {
GetNumericArg("resource-buffer-size", &g_allocation_size);
}
+void NotReached(mojom::URLLoaderAssociatedRequest mojo_request,
+ mojom::URLLoaderClientAssociatedPtr url_loader_client) {
+ NOTREACHED();
+}
+
} // namespace
// This class is for sharing the ownership of a ScopedDataPipeProducerHandle
@@ -108,7 +114,8 @@ MojoAsyncResourceHandler::MojoAsyncResourceHandler(
net::URLRequest* request,
ResourceDispatcherHostImpl* rdh,
mojom::URLLoaderAssociatedRequest mojo_request,
- mojom::URLLoaderClientAssociatedPtr url_loader_client)
+ mojom::URLLoaderClientAssociatedPtr url_loader_client,
+ ResourceType resource_type)
: ResourceHandler(request),
rdh_(rdh),
binding_(this, std::move(mojo_request)),
@@ -121,8 +128,12 @@ MojoAsyncResourceHandler::MojoAsyncResourceHandler(
binding_.set_connection_error_handler(
base::Bind(&MojoAsyncResourceHandler::Cancel, base::Unretained(this)));
- GetRequestInfo()->set_on_transfer(base::Bind(
- &MojoAsyncResourceHandler::OnTransfer, weak_factory_.GetWeakPtr()));
+ if (IsResourceTypeFrame(resource_type)) {
+ GetRequestInfo()->set_on_transfer(base::Bind(
+ &MojoAsyncResourceHandler::OnTransfer, weak_factory_.GetWeakPtr()));
+ } else {
+ GetRequestInfo()->set_on_transfer(base::Bind(&NotReached));
+ }
}
MojoAsyncResourceHandler::~MojoAsyncResourceHandler() {
@@ -171,10 +182,10 @@ bool MojoAsyncResourceHandler::OnResponseStarted(ResourceResponse* response,
response->head.response_start = base::TimeTicks::Now();
sent_received_response_message_ = true;
- mojom::DownloadedTempFilePtr downloaded_file_ptr;
+ mojom::DownloadedTempFileAssociatedPtrInfo downloaded_file_ptr;
if (!response->head.download_file_path.empty()) {
- downloaded_file_ptr = DownloadedTempFileImpl::Create(info->GetChildID(),
- info->GetRequestID());
+ downloaded_file_ptr = DownloadedTempFileImpl::Create(
+ binding_.associated_group(), info->GetChildID(), info->GetRequestID());
rdh_->RegisterDownloadedTempFile(info->GetChildID(), info->GetRequestID(),
response->head.download_file_path);
}
« no previous file with comments | « content/browser/loader/mojo_async_resource_handler.h ('k') | content/browser/loader/mojo_async_resource_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698