Index: components/viz/frame_sinks/gpu_root_compositor_frame_sink.cc |
diff --git a/components/viz/frame_sinks/gpu_root_compositor_frame_sink.cc b/components/viz/frame_sinks/gpu_root_compositor_frame_sink.cc |
index 2804a0f34af0167b191ffee05cba9380cea82b8f..80ad7e79862c3aea05368d55deb8cc196f2ab709 100644 |
--- a/components/viz/frame_sinks/gpu_root_compositor_frame_sink.cc |
+++ b/components/viz/frame_sinks/gpu_root_compositor_frame_sink.cc |
@@ -4,8 +4,11 @@ |
#include "components/viz/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/base/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( |
Fady Samuel
2017/06/15 15:02:40
We are about to introduce a bunch of flags. I sug
gklassen
2017/06/15 19:40:17
Ok. Can you send me a pointer to a pattern to fol
|
+ 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); |
} |