Commit 910cb95d authored by vadimt's avatar vadimt Committed by Commit bot

Adding instrumentation to locate the source of jankiness.

Mechanical change that adds instrumentation required to locate the source of jankiness (i.e. a long-running fragment of code executed as a part of the task that causes jank) in the code. See the bug for details on what kind of jank we are after.
A number of similar CLs were landed, and none of them caused issues. The code of the instrumentation is highly optimized and is not expected to affect performance. The code simply creates a diagnostic task which is identical to ones created by PostTask or IPC message handlers.
Landing as TBR since this is a mechanical, safe and temporary change.

BUG=422489
TBR=asanka@chromium.org

Review URL: https://codereview.chromium.org/654683002

Cr-Commit-Position: refs/heads/master@{#299365}
parent 093e4d52
......@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/message_loop/message_loop.h"
#include "base/profiler/scoped_profile.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/http/http_request_headers.h"
......@@ -60,6 +61,11 @@ void URLRequestSimpleJob::StartAsync() {
return;
if (ranges().size() > 1) {
// TODO(vadimt): Remove ScopedProfile below once crbug.com/422489 is fixed.
tracked_objects::ScopedProfile tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"422489 URLRequestSimpleJob::StartAsync 1"));
NotifyDone(URLRequestStatus(URLRequestStatus::FAILED,
ERR_REQUEST_RANGE_NOT_SATISFIABLE));
return;
......@@ -68,11 +74,29 @@ void URLRequestSimpleJob::StartAsync() {
if (!ranges().empty() && range_parse_result() == OK)
byte_range_ = ranges().front();
int result = GetData(&mime_type_, &charset_, &data_,
base::Bind(&URLRequestSimpleJob::OnGetDataCompleted,
weak_factory_.GetWeakPtr()));
if (result != ERR_IO_PENDING)
int result;
{
// TODO(vadimt): Remove ScopedProfile below once crbug.com/422489 is fixed.
// Remove the block and assign 'result' in its declaration.
tracked_objects::ScopedProfile tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"422489 URLRequestSimpleJob::StartAsync 2"));
result = GetData(&mime_type_,
&charset_,
&data_,
base::Bind(&URLRequestSimpleJob::OnGetDataCompleted,
weak_factory_.GetWeakPtr()));
}
if (result != ERR_IO_PENDING) {
// TODO(vadimt): Remove ScopedProfile below once crbug.com/422489 is fixed.
tracked_objects::ScopedProfile tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"422489 URLRequestSimpleJob::StartAsync 3"));
OnGetDataCompleted(result);
}
}
void URLRequestSimpleJob::OnGetDataCompleted(int result) {
......
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