Commit 7bc3878b 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=422516
TBR=mmenke@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#299210}
parent a19d5560
......@@ -8,6 +8,7 @@
#include "base/bind_helpers.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/profiler/scoped_profile.h"
#include "base/single_thread_task_runner.h"
#include "net/base/net_errors.h"
#include "net/disk_cache/blockfile/backend_impl.h"
......@@ -64,9 +65,15 @@ void BackendIO::OnDone(bool cancel) {
if (result() == net::OK) {
static_cast<EntryImpl*>(*entry_ptr_)->OnEntryCreated(backend_);
if (cancel)
if (cancel) {
// TODO(vadimt): Remove ScopedProfile below once crbug.com/422516 is
// fixed.
tracked_objects::ScopedProfile tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION("422516 BackendIO::OnDone"));
(*entry_ptr_)->Close();
}
}
}
bool BackendIO::IsEntryOperation() {
......@@ -496,8 +503,14 @@ void InFlightBackendIO::OnOperationComplete(BackgroundIO* operation,
BackendIO* op = static_cast<BackendIO*>(operation);
op->OnDone(cancel);
if (!op->callback().is_null() && (!cancel || op->IsEntryOperation()))
if (!op->callback().is_null() && (!cancel || op->IsEntryOperation())) {
// TODO(vadimt): Remove ScopedProfile below once crbug.com/422516 is fixed.
tracked_objects::ScopedProfile tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"422516 InFlightBackendIO::OnOperationComplete"));
op->callback().Run(op->result());
}
}
void InFlightBackendIO::PostOperation(BackendIO* operation) {
......
......@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/profiler/scoped_profile.h"
#include "base/single_thread_task_runner.h"
#include "base/task_runner.h"
#include "base/thread_task_runner_handle.h"
......@@ -87,6 +88,10 @@ void InFlightIO::OnIOComplete(BackgroundIO* operation) {
// Runs on the primary thread.
void InFlightIO::InvokeCallback(BackgroundIO* operation, bool cancel_task) {
{
// TODO(vadimt): Remove ScopedProfile below once crbug.com/422516 is fixed.
tracked_objects::ScopedProfile tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION("422516 InFlightIO::InvokeCallback"));
// http://crbug.com/74623
base::ThreadRestrictions::ScopedAllowWait allow_wait;
operation->io_completed()->Wait();
......
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