From 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 6 Oct 2020 12:48:11 +0200 Subject: BASELINE: Update Chromium to 84.0.4147.141 Change-Id: Ib85eb4cfa1cbe2b2b81e5022c8cad5c493969535 Reviewed-by: Allan Sandfeld Jensen --- chromium/ui/latency/latency_info.cc | 93 +++++++++++----------- chromium/ui/latency/latency_info.h | 20 ++--- chromium/ui/latency/latency_tracker.h | 1 + chromium/ui/latency/mojom/BUILD.gn | 19 +++++ chromium/ui/latency/mojom/OWNERS | 4 - chromium/ui/latency/mojom/latency_info.mojom | 2 + chromium/ui/latency/mojom/latency_info.typemap | 21 ----- .../ui/latency/mojom/latency_info_mojom_traits.cc | 8 ++ .../ui/latency/mojom/latency_info_mojom_traits.h | 1 + chromium/ui/latency/mojom/typemaps.gni | 5 -- 10 files changed, 88 insertions(+), 86 deletions(-) delete mode 100644 chromium/ui/latency/mojom/latency_info.typemap delete mode 100644 chromium/ui/latency/mojom/typemaps.gni (limited to 'chromium/ui/latency') diff --git a/chromium/ui/latency/latency_info.cc b/chromium/ui/latency/latency_info.cc index 540a91ab19f..8be273a5529 100644 --- a/chromium/ui/latency/latency_info.cc +++ b/chromium/ui/latency/latency_info.cc @@ -17,6 +17,7 @@ #include "base/trace_event/trace_event.h" #include "services/tracing/public/cpp/perfetto/flow_event_utils.h" #include "services/tracing/public/cpp/perfetto/macros.h" +#include "third_party/perfetto/protos/perfetto/trace/track_event/chrome_latency_info.pbzero.h" namespace { @@ -25,25 +26,28 @@ using perfetto::protos::pbzero::TrackEvent; const size_t kMaxLatencyInfoNumber = 100; -const char* GetComponentName(ui::LatencyComponentType type) { -#define CASE_TYPE(t) case ui::t: return #t +ChromeLatencyInfo::LatencyComponentType GetComponentProtoEnum( + ui::LatencyComponentType type) { +#define CASE_TYPE(t) \ + case ui::t##_COMPONENT: \ + return ChromeLatencyInfo::COMPONENT_##t switch (type) { - CASE_TYPE(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT); - CASE_TYPE(INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT); - CASE_TYPE(INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT); - CASE_TYPE(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT); - CASE_TYPE(INPUT_EVENT_LATENCY_UI_COMPONENT); - CASE_TYPE(INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT); - CASE_TYPE(INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT); - CASE_TYPE(INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT_COMPONENT); - CASE_TYPE(INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT); - CASE_TYPE(INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT); - CASE_TYPE(DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT); - CASE_TYPE(INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT); - CASE_TYPE(INPUT_EVENT_LATENCY_FRAME_SWAP_COMPONENT); + CASE_TYPE(INPUT_EVENT_LATENCY_BEGIN_RWH); + CASE_TYPE(INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL); + CASE_TYPE(INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL); + CASE_TYPE(INPUT_EVENT_LATENCY_ORIGINAL); + CASE_TYPE(INPUT_EVENT_LATENCY_UI); + CASE_TYPE(INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN); + CASE_TYPE(INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL); + CASE_TYPE(INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT); + CASE_TYPE(INPUT_EVENT_LATENCY_RENDERER_MAIN); + CASE_TYPE(INPUT_EVENT_LATENCY_RENDERER_SWAP); + CASE_TYPE(DISPLAY_COMPOSITOR_RECEIVED_FRAME); + CASE_TYPE(INPUT_EVENT_GPU_SWAP_BUFFER); + CASE_TYPE(INPUT_EVENT_LATENCY_FRAME_SWAP); default: NOTREACHED() << "Unhandled LatencyComponentType: " << type; - return "unknown"; + return ChromeLatencyInfo::COMPONENT_UNSPECIFIED; } #undef CASE_TYPE } @@ -118,7 +122,8 @@ LatencyInfo::LatencyInfo(SourceEventType type) terminated_(false), source_event_type_(type), scroll_update_delta_(0), - predicted_scroll_update_delta_(0) {} + predicted_scroll_update_delta_(0), + gesture_scroll_id_(0) {} LatencyInfo::LatencyInfo(const LatencyInfo& other) = default; LatencyInfo::LatencyInfo(LatencyInfo&& other) = default; @@ -133,7 +138,8 @@ LatencyInfo::LatencyInfo(int64_t trace_id, bool terminated) terminated_(terminated), source_event_type_(SourceEventType::UNKNOWN), scroll_update_delta_(0), - predicted_scroll_update_delta_(0) {} + predicted_scroll_update_delta_(0), + gesture_scroll_id_(0) {} LatencyInfo& LatencyInfo::operator=(const LatencyInfo& other) = default; @@ -188,6 +194,7 @@ void LatencyInfo::CopyLatencyFrom(const LatencyInfo& other, } coalesced_ = other.coalesced(); + gesture_scroll_id_ = other.gesture_scroll_id(); scroll_update_delta_ = other.scroll_update_delta(); // TODO(tdresser): Ideally we'd copy |began_| here as well, but |began_| // isn't very intuitive, and we can actually begin multiple times across @@ -212,6 +219,7 @@ void LatencyInfo::AddNewLatencyFrom(const LatencyInfo& other) { } coalesced_ = other.coalesced(); + gesture_scroll_id_ = other.gesture_scroll_id(); scroll_update_delta_ = other.scroll_update_delta(); // TODO(tdresser): Ideally we'd copy |began_| here as well, but |began_| isn't // very intuitive, and we can actually begin multiple times across copied @@ -265,9 +273,8 @@ void LatencyInfo::AddLatencyNumberWithTimestampImpl( ts = base::TimeTicks::Now(); } - TRACE_EVENT_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0( - kTraceCategoriesForAsyncEvents, trace_name_str, - TRACE_ID_GLOBAL(trace_id_), ts); + TRACE_EVENT_BEGIN(kTraceCategoriesForAsyncEvents, trace_name_str, + perfetto::Track::Global(trace_id_), ts); } TRACE_EVENT("input,benchmark", "LatencyInfo.Flow", @@ -297,15 +304,25 @@ void LatencyInfo::Terminate() { terminated_ = true; if (*g_latency_info_enabled.Get().latency_info_enabled) { - // The name field is not needed for NESTABLE events because we only need the - // category to know which event to close. In fact the name will not be - // emitted internally. - // - // TODO(nuskos): Once we have the new TraceEvent macros that support Tracks - // we can migrate this macro to it (and the name will no longer be there). - TRACE_EVENT_NESTABLE_ASYNC_END1(kTraceCategoriesForAsyncEvents, - /* name = */ "", TRACE_ID_GLOBAL(trace_id_), - "data", AsTraceableData()); + TRACE_EVENT_END( + kTraceCategoriesForAsyncEvents, perfetto::Track::Global(trace_id_), + [this](perfetto::EventContext ctx) { + ChromeLatencyInfo* info = ctx.event()->set_chrome_latency_info(); + for (const auto& lc : latency_components_) { + ChromeLatencyInfo::ComponentInfo* component = + info->add_component_info(); + + component->set_component_type(GetComponentProtoEnum(lc.first)); + component->set_time_us(lc.second.since_origin().InMicroseconds()); + } + + if (gesture_scroll_id_ > 0) { + info->set_gesture_scroll_id(gesture_scroll_id_); + } + + info->set_trace_id(trace_id_); + info->set_is_coalesced(coalesced_); + }); } TRACE_EVENT("input,benchmark", "LatencyInfo.Flow", @@ -339,22 +356,6 @@ LatencyInfo LatencyInfo::ScaledBy(float scale) const { return scaled_latency_info; } -std::unique_ptr -LatencyInfo::AsTraceableData() { - std::unique_ptr record_data( - new base::DictionaryValue()); - for (const auto& lc : latency_components_) { - std::unique_ptr component_info( - new base::DictionaryValue()); - component_info->SetDouble( - "time", static_cast(lc.second.since_origin().InMicroseconds())); - record_data->Set(GetComponentName(lc.first), std::move(component_info)); - } - record_data->SetDouble("trace_id", static_cast(trace_id_)); - record_data->SetBoolean("is_coalesced", coalesced_); - return LatencyInfoTracedValue::FromValue(std::move(record_data)); -} - bool LatencyInfo::FindLatency(LatencyComponentType type, base::TimeTicks* output) const { auto it = latency_components_.find(type); diff --git a/chromium/ui/latency/latency_info.h b/chromium/ui/latency/latency_info.h index 1c8b1926362..ac41fa7750b 100644 --- a/chromium/ui/latency/latency_info.h +++ b/chromium/ui/latency/latency_info.h @@ -24,12 +24,6 @@ #include "mojo/public/cpp/bindings/struct_traits.h" // nogncheck #endif -namespace base { -namespace trace_event { -class ConvertableToTraceFormat; -} -} - namespace ui { #if !defined(OS_IOS) @@ -195,16 +189,14 @@ class LatencyInfo { float predicted_scroll_update_delta() const { return predicted_scroll_update_delta_; } + int64_t gesture_scroll_id() const { return gesture_scroll_id_; } + void set_gesture_scroll_id(int64_t id) { gesture_scroll_id_ = id; } private: void AddLatencyNumberWithTimestampImpl(LatencyComponentType component, base::TimeTicks time, const char* trace_name_str); - // Converts latencyinfo into format that can be dumped into trace buffer. - std::unique_ptr - AsTraceableData(); - LatencyMap latency_components_; // The unique id for matching the ASYNC_BEGIN/END trace event. @@ -224,6 +216,14 @@ class LatencyInfo { float scroll_update_delta_; float predicted_scroll_update_delta_; + // The unique id for denoting a scroll gesture. This is only set for + // GestureScrollBegin, GestureScrollUpdate, and GestureScrollEnd events, and + // allows easy grouping of these global async events into a single logical + // scroll in the sql interface of TBMv3 (Trace Based Metrics v3). As a current + // implementation detail this unique id comes from the |trace_id| of the + // associated GestureScrollBegin (-1 if there was none or it wasn't valid). + int64_t gesture_scroll_id_; + #if !defined(OS_IOS) friend struct IPC::ParamTraits; friend struct mojo::StructTraits:: return info.predicted_scroll_update_delta(); } +// static +int64_t +StructTraits::gesture_scroll_id(const ui::LatencyInfo& info) { + return info.gesture_scroll_id(); +} + // static bool StructTraits::Read( ui::mojom::LatencyInfoDataView data, @@ -134,6 +141,7 @@ bool StructTraits::Read( out->source_event_type_ = MojoSourceEventTypeToUI(data.source_event_type()); out->scroll_update_delta_ = data.scroll_update_delta(); out->predicted_scroll_update_delta_ = data.predicted_scroll_update_delta(); + out->gesture_scroll_id_ = data.gesture_scroll_id(); return true; } diff --git a/chromium/ui/latency/mojom/latency_info_mojom_traits.h b/chromium/ui/latency/mojom/latency_info_mojom_traits.h index ee88a55718b..5bc2a683060 100644 --- a/chromium/ui/latency/mojom/latency_info_mojom_traits.h +++ b/chromium/ui/latency/mojom/latency_info_mojom_traits.h @@ -55,6 +55,7 @@ struct StructTraits { const ui::LatencyInfo& info); static float scroll_update_delta(const ui::LatencyInfo& info); static float predicted_scroll_update_delta(const ui::LatencyInfo& info); + static int64_t gesture_scroll_id(const ui::LatencyInfo& info); static bool Read(ui::mojom::LatencyInfoDataView data, ui::LatencyInfo* out); }; diff --git a/chromium/ui/latency/mojom/typemaps.gni b/chromium/ui/latency/mojom/typemaps.gni deleted file mode 100644 index aa9d39aa638..00000000000 --- a/chromium/ui/latency/mojom/typemaps.gni +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -typemaps = [ "//ui/latency/mojom/latency_info.typemap" ] -- cgit v1.2.1