summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/platform/widget/input/widget_base_input_handler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/platform/widget/input/widget_base_input_handler.cc')
-rw-r--r--chromium/third_party/blink/renderer/platform/widget/input/widget_base_input_handler.cc42
1 files changed, 21 insertions, 21 deletions
diff --git a/chromium/third_party/blink/renderer/platform/widget/input/widget_base_input_handler.cc b/chromium/third_party/blink/renderer/platform/widget/input/widget_base_input_handler.cc
index c6628c6acc2..71396e624f2 100644
--- a/chromium/third_party/blink/renderer/platform/widget/input/widget_base_input_handler.cc
+++ b/chromium/third_party/blink/renderer/platform/widget/input/widget_base_input_handler.cc
@@ -339,15 +339,19 @@ void WidgetBaseInputHandler::HandleInputEvent(
ui::LatencyComponentType::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT);
cc::LatencyInfoSwapPromiseMonitor swap_promise_monitor(
&swap_latency_info, widget_->LayerTreeHost()->GetSwapPromiseManager());
- base::Optional<base::TimeTicks> metrics_timestamp;
+ std::unique_ptr<cc::EventMetrics> cloned_metrics;
cc::EventsMetricsManager::ScopedMonitor::DoneCallback done_callback;
if (metrics) {
- // Get the timestamp of `metrics` before moving it to the following
- // callback. This timestamp would later be useful in creating
- // `cc::EventMetrics` objects for injected scroll events.
- metrics_timestamp = metrics->time_stamp();
+ // Create a clone of `metrics` before moving it to the following callback.
+ // This would later be useful in creating `cc::EventMetrics` objects for
+ // injected scroll events.
+ cloned_metrics = metrics->Clone();
+ metrics->SetDispatchStageTimestamp(
+ cc::EventMetrics::DispatchStage::kRendererMainStarted);
done_callback = base::BindOnce(
[](std::unique_ptr<cc::EventMetrics> metrics, bool handled) {
+ metrics->SetDispatchStageTimestamp(
+ cc::EventMetrics::DispatchStage::kRendererMainFinished);
std::unique_ptr<cc::EventMetrics> result =
handled ? std::move(metrics) : nullptr;
return result;
@@ -465,7 +469,7 @@ void WidgetBaseInputHandler::HandleInputEvent(
if (handling_state.injected_scroll_params().size()) {
HandleInjectedScrollGestures(
std::move(handling_state.injected_scroll_params()), input_event,
- coalesced_event.latency_info(), metrics_timestamp);
+ coalesced_event.latency_info(), cloned_metrics.get());
}
// Send gesture scroll events and their dispositions to the compositor thread,
@@ -595,7 +599,7 @@ void WidgetBaseInputHandler::HandleInjectedScrollGestures(
std::vector<InjectScrollGestureParams> injected_scroll_params,
const WebInputEvent& input_event,
const ui::LatencyInfo& original_latency_info,
- base::Optional<base::TimeTicks> original_metrics_timestamp) {
+ const cc::EventMetrics* original_metrics) {
DCHECK(injected_scroll_params.size());
base::TimeTicks original_timestamp;
@@ -665,28 +669,24 @@ void WidgetBaseInputHandler::HandleInjectedScrollGestures(
cc::LatencyInfoSwapPromiseMonitor swap_promise_monitor(
&scrollbar_latency_info,
widget_->LayerTreeHost()->GetSwapPromiseManager());
- // For latency metrics, we need the original timestamp of the
- // `input_event` as its current timestamp might have changed due to
- // coalescing in the pipeline. `original_metrics_timestamp` which is the
- // timestamp from the metrics object for the `input_event` contains this
- // original timestamp. We could have used `original_timestamp` for this
- // purpose, but we don't do that as `original_timestamp` is extracted from
- // `ui::LatencyInfo` of `input_event` which we hope to be able to get rid
- // of. Moreover, we plan to add more breakdown timestamps to
- // `EventMetrcis` which are not available in `ui::LatencyInfo`.
- base::TimeTicks time_stamp =
- original_metrics_timestamp.value_or(gesture_event->TimeStamp());
- std::unique_ptr<cc::EventMetrics> metrics = cc::EventMetrics::Create(
- gesture_event->GetTypeAsUiEventType(), scroll_update_type, time_stamp,
- gesture_event->GetScrollInputType());
+ std::unique_ptr<cc::EventMetrics> metrics =
+ cc::EventMetrics::CreateFromExisting(
+ gesture_event->GetTypeAsUiEventType(), scroll_update_type,
+ gesture_event->GetScrollInputType(),
+ cc::EventMetrics::DispatchStage::kRendererCompositorFinished,
+ original_metrics);
cc::EventsMetricsManager::ScopedMonitor::DoneCallback done_callback;
if (metrics) {
+ metrics->SetDispatchStageTimestamp(
+ cc::EventMetrics::DispatchStage::kRendererMainStarted);
// Since we don't need `metrics` for this event beyond this point (i.e.
// we don't intend to add further breakdowns to the metrics while
// processing the event, at least for now), it is safe to move the
// metrics object to the callback.
done_callback = base::BindOnce(
[](std::unique_ptr<cc::EventMetrics> metrics, bool handled) {
+ metrics->SetDispatchStageTimestamp(
+ cc::EventMetrics::DispatchStage::kRendererMainFinished);
std::unique_ptr<cc::EventMetrics> result =
handled ? std::move(metrics) : nullptr;
return result;