Commit cc074e85 authored by Matt Falkenhagen's avatar Matt Falkenhagen Committed by Commit Bot

Add trace events around URLLoader/URLLoaderClient.

These can help figure out what happens in the life of a request, as
otherwise it can be hard to figure out which implementation of the
Mojo interfaces are being used.

Change-Id: I24e2e33cd45cf80e936b2feba62c0dab62463e62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2147162Reviewed-by: default avatarTakashi Toyoshima <toyoshim@chromium.org>
Commit-Queue: Matt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759145}
parent 34ded98d
...@@ -238,6 +238,9 @@ void URLLoaderClientImpl::Bind( ...@@ -238,6 +238,9 @@ void URLLoaderClientImpl::Bind(
void URLLoaderClientImpl::OnReceiveResponse( void URLLoaderClientImpl::OnReceiveResponse(
network::mojom::URLResponseHeadPtr response_head) { network::mojom::URLResponseHeadPtr response_head) {
has_received_response_head_ = true; has_received_response_head_ = true;
TRACE_EVENT1("loading", "URLLoaderClientImpl::OnReceiveResponse", "url",
last_loaded_url_.possibly_invalid_spec());
if (NeedsStoringMessage()) { if (NeedsStoringMessage()) {
StoreAndDispatch( StoreAndDispatch(
std::make_unique<DeferredOnReceiveResponse>(std::move(response_head))); std::make_unique<DeferredOnReceiveResponse>(std::move(response_head)));
......
...@@ -773,6 +773,10 @@ void WebURLLoaderImpl::Context::OnStartLoadingResponseBody( ...@@ -773,6 +773,10 @@ void WebURLLoaderImpl::Context::OnStartLoadingResponseBody(
mojo::ScopedDataPipeConsumerHandle body) { mojo::ScopedDataPipeConsumerHandle body) {
if (client_) if (client_)
client_->DidStartLoadingResponseBody(std::move(body)); client_->DidStartLoadingResponseBody(std::move(body));
TRACE_EVENT_WITH_FLOW0(
"loading", "WebURLLoaderImpl::Context::OnStartLoadingResponseBody", this,
TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT);
} }
void WebURLLoaderImpl::Context::OnTransferSizeUpdated(int transfer_size_diff) { void WebURLLoaderImpl::Context::OnTransferSizeUpdated(int transfer_size_diff) {
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "base/task/thread_pool.h" #include "base/task/thread_pool.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "mojo/public/cpp/system/simple_watcher.h" #include "mojo/public/cpp/system/simple_watcher.h"
#include "net/base/elements_upload_data_stream.h" #include "net/base/elements_upload_data_stream.h"
#include "net/base/ip_endpoint.h" #include "net/base/ip_endpoint.h"
...@@ -1676,6 +1677,8 @@ void URLLoader::DeleteSelf() { ...@@ -1676,6 +1677,8 @@ void URLLoader::DeleteSelf() {
} }
void URLLoader::SendResponseToClient() { void URLLoader::SendResponseToClient() {
TRACE_EVENT1("loading", "network::URLLoader::SendResponseToClient", "url",
url_request_->url().possibly_invalid_spec());
url_loader_client_->OnReceiveResponse(std::move(response_)); url_loader_client_->OnReceiveResponse(std::move(response_));
net::IOBufferWithSize* metadata = net::IOBufferWithSize* metadata =
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
#include "net/http/http_status_code.h" #include "net/http/http_status_code.h"
#include "net/http/http_util.h" #include "net/http/http_util.h"
#include "net/url_request/redirect_util.h" #include "net/url_request/redirect_util.h"
...@@ -529,6 +530,8 @@ void ThrottlingURLLoader::OnReceiveResponse( ...@@ -529,6 +530,8 @@ void ThrottlingURLLoader::OnReceiveResponse(
DCHECK_EQ(DEFERRED_NONE, deferred_stage_); DCHECK_EQ(DEFERRED_NONE, deferred_stage_);
DCHECK(!loader_completed_); DCHECK(!loader_completed_);
DCHECK(deferring_throttles_.empty()); DCHECK(deferring_throttles_.empty());
TRACE_EVENT1("loading", "ThrottlingURLLoader::OnReceiveResponse", "url",
response_url_.possibly_invalid_spec());
// Dispatch BeforeWillProcessResponse(). // Dispatch BeforeWillProcessResponse().
if (!throttles_.empty()) { if (!throttles_.empty()) {
...@@ -672,6 +675,8 @@ void ThrottlingURLLoader::OnStartLoadingResponseBody( ...@@ -672,6 +675,8 @@ void ThrottlingURLLoader::OnStartLoadingResponseBody(
mojo::ScopedDataPipeConsumerHandle body) { mojo::ScopedDataPipeConsumerHandle body) {
DCHECK_EQ(DEFERRED_NONE, deferred_stage_); DCHECK_EQ(DEFERRED_NONE, deferred_stage_);
DCHECK(!loader_completed_); DCHECK(!loader_completed_);
TRACE_EVENT1("loading", "ThrottlingURLLoader::OnStartLoadingResponseBody",
"url", response_url_.possibly_invalid_spec());
forwarding_client_->OnStartLoadingResponseBody(std::move(body)); forwarding_client_->OnStartLoadingResponseBody(std::move(body));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment