Commit b0c92575 authored by Gabriel Marin's avatar Gabriel Marin Committed by Commit Bot

Run the collectors on the UI thread temporarily

The perf collector issues dbus commands to run perf as root but the dbus client
is not thread safe.
Temporarily, map the collector task runner to the current thread (UI), until we
can implement a fix in the dbus client.

BUG=b:139816773

Change-Id: I02766ed512a10f1868dda7bd58205397997ef9e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1764319Reviewed-by: default avatarGabriel Marin <gmx@chromium.org>
Reviewed-by: default avatarMike Wittman <wittman@chromium.org>
Commit-Queue: Gabriel Marin <gmx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689163}
parent f068a76f
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/task/task_traits.h" #include "base/task/task_traits.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "third_party/metrics_proto/sampled_profile.pb.h" #include "third_party/metrics_proto/sampled_profile.pb.h"
...@@ -31,15 +32,12 @@ using MetricCollector = internal::MetricCollector; ...@@ -31,15 +32,12 @@ using MetricCollector = internal::MetricCollector;
MetricProvider::MetricProvider(std::unique_ptr<MetricCollector> collector) MetricProvider::MetricProvider(std::unique_ptr<MetricCollector> collector)
: upload_uma_histogram_(std::string(kUploadCountHistogramPrefix) + : upload_uma_histogram_(std::string(kUploadCountHistogramPrefix) +
collector->ToolName()), collector->ToolName()),
// Run the collector at a higher priority to enable fast triggering of // Run the collectors on the UI thread temporarily, because the perf
// profile collections. In particular, we want fast triggering when // collector must issues dbus commands and the dbus client is not thread
// jankiness is detected, but even random based periodic collection // safe.
// benefits from a higher priority, to avoid biasing the collection to // TODO(b/139818457): Move back to a dedicated sequence once the dbus
// times when the system is not busy. The work performed on the dedicated // client is thread safe.
// sequence is short and infrequent. Expensive parsing operations are collector_task_runner_(base::SequencedTaskRunnerHandle::Get()),
// executed asynchronously on the thread pool.
collector_task_runner_(base::CreateSequencedTaskRunner(
{base::ThreadPool(), base::TaskPriority::USER_VISIBLE})),
metric_collector_(std::move(collector)), metric_collector_(std::move(collector)),
weak_factory_(this) { weak_factory_(this) {
metric_collector_->set_profile_done_callback(base::BindRepeating( metric_collector_->set_profile_done_callback(base::BindRepeating(
......
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