| Index: base/task_scheduler/task_tracker.cc
|
| diff --git a/base/task_scheduler/task_tracker.cc b/base/task_scheduler/task_tracker.cc
|
| index da21d5ea8ef510c33636cc993b34e3501aa09101..b9b89cba9ea7a27f0483cf142009a7d98a0bfe47 100644
|
| --- a/base/task_scheduler/task_tracker.cc
|
| +++ b/base/task_scheduler/task_tracker.cc
|
| @@ -241,9 +241,11 @@ bool TaskTracker::RunTask(std::unique_ptr<Task> task,
|
| task->traits.shutdown_behavior();
|
| const bool can_run_task = BeforeRunTask(shutdown_behavior);
|
| const bool is_delayed = !task->delayed_run_time.is_null();
|
| + const bool is_normal_task = task->task_type == Task::TaskType::NORMAL;
|
|
|
| if (can_run_task) {
|
| - RecordTaskLatencyHistogram(task.get());
|
| + if (is_normal_task)
|
| + RecordTaskLatencyHistogram(task.get());
|
|
|
| const bool previous_singleton_allowed =
|
| ThreadRestrictions::SetSingletonAllowed(
|
| @@ -273,21 +275,28 @@ bool TaskTracker::RunTask(std::unique_ptr<Task> task,
|
| new ThreadTaskRunnerHandle(task->single_thread_task_runner_ref));
|
| }
|
|
|
| - TRACE_TASK_EXECUTION(kRunFunctionName, *task);
|
| -
|
| - const char* const execution_mode =
|
| - task->single_thread_task_runner_ref
|
| - ? kSingleThreadExecutionMode
|
| - : (task->sequenced_task_runner_ref ? kSequencedExecutionMode
|
| - : kParallelExecutionMode);
|
| - // TODO(gab): In a better world this would be tacked on as an extra arg
|
| - // to the trace event generated above. This is not possible however until
|
| - // http://crbug.com/652692 is resolved.
|
| - TRACE_EVENT1("task_scheduler", "TaskTracker::RunTask", "task_info",
|
| - MakeUnique<TaskTracingInfo>(task->traits, execution_mode,
|
| - sequence_token));
|
| -
|
| - PerformRunTask(std::move(task));
|
| + if (is_normal_task) {
|
| + TRACE_TASK_EXECUTION(kRunFunctionName, *task);
|
| +
|
| + const char* const execution_mode =
|
| + task->single_thread_task_runner_ref
|
| + ? kSingleThreadExecutionMode
|
| + : (task->sequenced_task_runner_ref ? kSequencedExecutionMode
|
| + : kParallelExecutionMode);
|
| + // TODO(gab): In a better world this would be tacked on as an extra arg
|
| + // to the trace event generated above. This is not possible however
|
| + // until
|
| + // http://crbug.com/652692 is resolved.
|
| + TRACE_EVENT1("task_scheduler", "TaskTracker::RunTask", "task_info",
|
| + MakeUnique<TaskTracingInfo>(task->traits, execution_mode,
|
| + sequence_token));
|
| +
|
| + PerformRunTask(std::move(task));
|
| + } else {
|
| + // To avoid polluting Chrome traces with internal tasks, we simply just
|
| + // execute the task here.
|
| + std::move(task->task).Run();
|
| + }
|
| }
|
|
|
| ThreadRestrictions::SetWaitAllowed(previous_wait_allowed);
|
| @@ -297,7 +306,7 @@ bool TaskTracker::RunTask(std::unique_ptr<Task> task,
|
| AfterRunTask(shutdown_behavior);
|
| }
|
|
|
| - if (!is_delayed)
|
| + if (!is_delayed && is_normal_task)
|
| DecrementNumPendingUndelayedTasks();
|
|
|
| return can_run_task;
|
|
|