| Index: components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.cc
|
| diff --git a/components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.cc b/components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.cc
|
| index 2da7aa1e5e7e6d33c08aa8593037e300b45b1a8f..a2506050b8eab285c7490bb83bb44b8c532798e9 100644
|
| --- a/components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.cc
|
| +++ b/components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.cc
|
| @@ -4,8 +4,11 @@
|
|
|
| #include "components/viz/service/frame_sinks/gpu_root_compositor_frame_sink.h"
|
|
|
| +#include "base/command_line.h"
|
| #include "cc/surfaces/compositor_frame_sink_support.h"
|
| #include "cc/surfaces/display.h"
|
| +#include "components/viz/common/switches.h"
|
| +#include "components/viz/hit_test/display_hit_test_data_factory_local.h"
|
|
|
| namespace viz {
|
|
|
| @@ -46,6 +49,14 @@ GpuRootCompositorFrameSink::GpuRootCompositorFrameSink(
|
| surface_manager->RegisterBeginFrameSource(display_begin_frame_source_.get(),
|
| frame_sink_id);
|
| display_->Initialize(this, surface_manager);
|
| +
|
| + if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kUseVizHitTest)) {
|
| + auto display_hit_test_data_factory =
|
| + base::MakeUnique<hit_test::DisplayHitTestDataFactoryLocal>();
|
| + hit_test_aggregator_ = base::MakeUnique<hit_test::HitTestAggregator>(
|
| + std::move(display_hit_test_data_factory));
|
| + }
|
| }
|
|
|
| GpuRootCompositorFrameSink::~GpuRootCompositorFrameSink() {
|
| @@ -115,7 +126,10 @@ void GpuRootCompositorFrameSink::DisplayOutputSurfaceLost() {
|
|
|
| void GpuRootCompositorFrameSink::DisplayWillDrawAndSwap(
|
| bool will_draw_and_swap,
|
| - const cc::RenderPassList& render_pass) {}
|
| + const cc::RenderPassList& render_pass) {
|
| + if (hit_test_aggregator_)
|
| + hit_test_aggregator_->PostTaskAggregate(display_->CurrentSurfaceId());
|
| +}
|
|
|
| void GpuRootCompositorFrameSink::DisplayDidDrawAndSwap() {}
|
|
|
| @@ -126,6 +140,8 @@ void GpuRootCompositorFrameSink::DidReceiveCompositorFrameAck(
|
| }
|
|
|
| void GpuRootCompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) {
|
| + if (hit_test_aggregator_)
|
| + hit_test_aggregator_->Swap();
|
| if (client_)
|
| client_->OnBeginFrame(args);
|
| }
|
|
|