summaryrefslogtreecommitdiff
path: root/chromium/ui/latency
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-06 12:48:11 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:33:43 +0000
commit7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (patch)
treefa14ba0ca8d2683ba2efdabd246dc9b18a1229c6 /chromium/ui/latency
parent79b4f909db1049fca459c07cca55af56a9b54fe3 (diff)
downloadqtwebengine-chromium-7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3.tar.gz
BASELINE: Update Chromium to 84.0.4147.141
Change-Id: Ib85eb4cfa1cbe2b2b81e5022c8cad5c493969535 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/ui/latency')
-rw-r--r--chromium/ui/latency/latency_info.cc93
-rw-r--r--chromium/ui/latency/latency_info.h20
-rw-r--r--chromium/ui/latency/latency_tracker.h1
-rw-r--r--chromium/ui/latency/mojom/BUILD.gn19
-rw-r--r--chromium/ui/latency/mojom/OWNERS4
-rw-r--r--chromium/ui/latency/mojom/latency_info.mojom2
-rw-r--r--chromium/ui/latency/mojom/latency_info.typemap21
-rw-r--r--chromium/ui/latency/mojom/latency_info_mojom_traits.cc8
-rw-r--r--chromium/ui/latency/mojom/latency_info_mojom_traits.h1
-rw-r--r--chromium/ui/latency/mojom/typemaps.gni5
10 files changed, 88 insertions, 86 deletions
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<base::trace_event::ConvertableToTraceFormat>
-LatencyInfo::AsTraceableData() {
- std::unique_ptr<base::DictionaryValue> record_data(
- new base::DictionaryValue());
- for (const auto& lc : latency_components_) {
- std::unique_ptr<base::DictionaryValue> component_info(
- new base::DictionaryValue());
- component_info->SetDouble(
- "time", static_cast<double>(lc.second.since_origin().InMicroseconds()));
- record_data->Set(GetComponentName(lc.first), std::move(component_info));
- }
- record_data->SetDouble("trace_id", static_cast<double>(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<base::trace_event::ConvertableToTraceFormat>
- 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<ui::LatencyInfo>;
friend struct mojo::StructTraits<ui::mojom::LatencyInfoDataView,
diff --git a/chromium/ui/latency/latency_tracker.h b/chromium/ui/latency/latency_tracker.h
index 37de25db729..cb3898ba5d5 100644
--- a/chromium/ui/latency/latency_tracker.h
+++ b/chromium/ui/latency/latency_tracker.h
@@ -5,6 +5,7 @@
#ifndef UI_LATENCY_LATENCY_TRACKER_H_
#define UI_LATENCY_LATENCY_TRACKER_H_
+#include "base/callback_forward.h"
#include "base/macros.h"
#include "ui/latency/average_lag_tracker.h"
#include "ui/latency/latency_info.h"
diff --git a/chromium/ui/latency/mojom/BUILD.gn b/chromium/ui/latency/mojom/BUILD.gn
index 607bc5e2346..f8aeb4c757e 100644
--- a/chromium/ui/latency/mojom/BUILD.gn
+++ b/chromium/ui/latency/mojom/BUILD.gn
@@ -9,6 +9,25 @@ mojom("mojom") {
sources = [ "latency_info.mojom" ]
public_deps = [ "//mojo/public/mojom/base" ]
+
+ cpp_typemaps = [
+ {
+ types = [
+ {
+ mojom = "ui.mojom.LatencyComponentType"
+ cpp = "::ui::LatencyComponentType"
+ },
+ {
+ mojom = "ui.mojom.LatencyInfo"
+ cpp = "::ui::LatencyInfo"
+ },
+ ]
+ traits_sources = [ "latency_info_mojom_traits.cc" ]
+ traits_headers = [ "latency_info_mojom_traits.h" ]
+ traits_public_deps = [ "//ui/latency" ]
+ traits_deps = [ "//ipc:param_traits" ]
+ },
+ ]
}
mojom("test_interfaces") {
diff --git a/chromium/ui/latency/mojom/OWNERS b/chromium/ui/latency/mojom/OWNERS
index 743855d259f..1feb5149750 100644
--- a/chromium/ui/latency/mojom/OWNERS
+++ b/chromium/ui/latency/mojom/OWNERS
@@ -1,8 +1,4 @@
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
-
-per-file *.typemap=set noparent
-per-file *.typemap=file://ipc/SECURITY_OWNERS
-
per-file *_mojom_traits*.*=set noparent
per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS
diff --git a/chromium/ui/latency/mojom/latency_info.mojom b/chromium/ui/latency/mojom/latency_info.mojom
index b4d84409ec1..77a5c42e6cc 100644
--- a/chromium/ui/latency/mojom/latency_info.mojom
+++ b/chromium/ui/latency/mojom/latency_info.mojom
@@ -67,4 +67,6 @@ struct LatencyInfo {
SourceEventType source_event_type;
float scroll_update_delta;
float predicted_scroll_update_delta;
+ // optional: only valid on GestureScroll events.
+ int64 gesture_scroll_id;
};
diff --git a/chromium/ui/latency/mojom/latency_info.typemap b/chromium/ui/latency/mojom/latency_info.typemap
deleted file mode 100644
index 304e600b9a0..00000000000
--- a/chromium/ui/latency/mojom/latency_info.typemap
+++ /dev/null
@@ -1,21 +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.
-
-mojom = "//ui/latency/mojom/latency_info.mojom"
-public_headers = [ "//ui/latency/latency_info.h" ]
-traits_headers = [ "//ui/latency/mojom/latency_info_mojom_traits.h" ]
-sources = [
- "latency_info_mojom_traits.cc",
- "latency_info_mojom_traits.h",
-]
-public_deps = [
- "//ui/latency",
-]
-deps = [
- "//ipc:param_traits",
-]
-type_mappings = [
- "ui.mojom.LatencyComponentType=::ui::LatencyComponentType",
- "ui.mojom.LatencyInfo=::ui::LatencyInfo",
-]
diff --git a/chromium/ui/latency/mojom/latency_info_mojom_traits.cc b/chromium/ui/latency/mojom/latency_info_mojom_traits.cc
index 11fc916fd6e..4760725e9f2 100644
--- a/chromium/ui/latency/mojom/latency_info_mojom_traits.cc
+++ b/chromium/ui/latency/mojom/latency_info_mojom_traits.cc
@@ -121,6 +121,13 @@ float StructTraits<ui::mojom::LatencyInfoDataView, ui::LatencyInfo>::
}
// static
+int64_t
+StructTraits<ui::mojom::LatencyInfoDataView,
+ ui::LatencyInfo>::gesture_scroll_id(const ui::LatencyInfo& info) {
+ return info.gesture_scroll_id();
+}
+
+// static
bool StructTraits<ui::mojom::LatencyInfoDataView, ui::LatencyInfo>::Read(
ui::mojom::LatencyInfoDataView data,
ui::LatencyInfo* out) {
@@ -134,6 +141,7 @@ bool StructTraits<ui::mojom::LatencyInfoDataView, ui::LatencyInfo>::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<ui::mojom::LatencyInfoDataView, ui::LatencyInfo> {
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" ]