| Index: content/browser/loader/navigation_resource_handler.cc
|
| diff --git a/content/browser/loader/navigation_resource_handler.cc b/content/browser/loader/navigation_resource_handler.cc
|
| index 94e046dbf0c74bf8044e6cd93484c3cab38563fa..74373c87c8346030f049d97f7b985b7e1ff8cdfe 100644
|
| --- a/content/browser/loader/navigation_resource_handler.cc
|
| +++ b/content/browser/loader/navigation_resource_handler.cc
|
| @@ -7,10 +7,12 @@
|
| #include "base/logging.h"
|
| #include "content/browser/devtools/devtools_netlog_observer.h"
|
| #include "content/browser/loader/navigation_url_loader_impl_core.h"
|
| +#include "content/browser/loader/resource_message_filter.h"
|
| #include "content/browser/loader/resource_request_info_impl.h"
|
| #include "content/browser/resource_context_impl.h"
|
| #include "content/browser/streams/stream.h"
|
| #include "content/browser/streams/stream_context.h"
|
| +#include "content/common/resource_messages.h"
|
| #include "content/public/browser/resource_controller.h"
|
| #include "content/public/browser/stream_handle.h"
|
| #include "content/public/common/resource_response.h"
|
| @@ -25,7 +27,6 @@ NavigationResourceHandler::NavigationResourceHandler(
|
| : ResourceHandler(request),
|
| core_(core) {
|
| core_->set_resource_handler(this);
|
| - writer_.set_immediate_mode(true);
|
| }
|
|
|
| NavigationResourceHandler::~NavigationResourceHandler() {
|
| @@ -60,14 +61,37 @@ bool NavigationResourceHandler::OnRequestRedirected(
|
| DevToolsNetLogObserver::PopulateResponseInfo(request(), response);
|
| core_->NotifyRequestRedirected(redirect_info, response);
|
| *defer = true;
|
| +
|
| return true;
|
| }
|
|
|
| bool NavigationResourceHandler::OnResponseStarted(ResourceResponse* response,
|
| bool* defer) {
|
| + // TODO(carlosk): review the TODO below. :) When I wrote it I thought we
|
| + // needed to send ResourceMsg_ReceivedResponse from here but it seems we
|
| + // don't.
|
| + // TODO(carlosk): More "work" is done in
|
| + // AsyncResourceHandler::OnResponseStarted than here. Now that this is the
|
| + // resource handler actually carrying out the navigation load, some of that
|
| + // has to be done here to. I'm adding TODOs below for some that but I'm not
|
| + // fully sure of what's needed and what's not and further investigation is
|
| + // need.
|
| + // I'm assuming anything mentioning "upload", RDH delegate (we don't have one
|
| + // in this class), "download", InliningHelper (I don't think we need one) are
|
| + // not needed here.
|
| + // TODO(carlosk): The same as above should affect other methods existing in
|
| + // both classes.
|
| DCHECK(core_);
|
|
|
| + // TODO(carlosk): see if we need the time recording in
|
| + // response_started_ticks_ used later for UMA metrics.
|
| +
|
| ResourceRequestInfoImpl* info = GetRequestInfo();
|
| + LOG(ERROR)
|
| + << "*** NavigationResourceHandler::OnResponseStarted frame_tree_node_id: "
|
| + << info->frame_tree_node_id();
|
| +
|
| + // TODO(carlosk): see if we need the filter check.
|
|
|
| // If the MimeTypeResourceHandler intercepted this request and converted it
|
| // into a download, it will still call OnResponseStarted and immediately
|
| @@ -79,16 +103,27 @@ bool NavigationResourceHandler::OnResponseStarted(ResourceResponse* response,
|
| if (info->IsDownload() || info->is_stream())
|
| return true;
|
|
|
| - StreamContext* stream_context =
|
| - GetStreamContextForResourceContext(info->GetContext());
|
| - writer_.InitializeStream(stream_context->registry(),
|
| - request()->url().GetOrigin());
|
| + mojo::ScopedDataPipeConsumerHandle data_consumer_handle;
|
| + writer_.InitializeStream(&data_consumer_handle);
|
|
|
| // Detach from the loader; at this point, the request is now owned by the
|
| // StreamHandle.
|
| DevToolsNetLogObserver::PopulateResponseInfo(request(), response);
|
| - core_->NotifyResponseStarted(response, writer_.stream()->CreateHandle());
|
| + // MAYBE SHOULD SEND THE CONSUMER HANDLE REFERENCE DIRECTLY FROM HERE?
|
| + core_->NotifyResponseStarted(response, std::move(data_consumer_handle),
|
| + GetRequestID());
|
| DetachFromCore();
|
| +
|
| + // TODO(carlosk): see if we need the zoom level control here (I assume we do).
|
| +
|
| + response->head.request_start = request()->creation_time();
|
| + response->head.response_start = base::TimeTicks::Now();
|
| +
|
| + // TODO(carlosk): see if we need the guard for http://crbug.com/124680 using
|
| + // sent_received_response_msg_.
|
| +
|
| + // TODO(carlosk): see if we need to send ResourceMsg_ReceivedCachedMetadata.
|
| +
|
| return true;
|
| }
|
|
|
| @@ -121,8 +156,12 @@ void NavigationResourceHandler::OnResponseCompleted(
|
| //
|
| // TODO(davidben): The net error code should be passed through StreamWriter
|
| // down to the stream's consumer. See https://crbug.com/426162.
|
| - if (writer_.stream()) {
|
| + if (writer_.has_stream()) {
|
| writer_.Finalize();
|
| + ResourceRequestInfoImpl* info = GetRequestInfo();
|
| + LOG(ERROR) << "*** NavigationResourceHandler::OnResponseCompleted "
|
| + "frame_tree_node_id: "
|
| + << info->frame_tree_node_id();
|
| return;
|
| }
|
|
|
|
|