Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Unified Diff: components/viz/frame_sinks/gpu_root_compositor_frame_sink.cc

Issue 2908783002: WIP Hittest Component.
Patch Set: change HitTestFlags to constants so we can mix and match and convert to struct naming convention Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 393f53fc2eb7d7d1b55226c84b1b895e1bfcf9d8..68a302df0b0c88984d0a39d76cee35ef35d986ee 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 {
@@ -44,6 +47,14 @@ GpuRootCompositorFrameSink::GpuRootCompositorFrameSink(
base::Unretained(this)));
display_->Initialize(this, surface_manager);
display_->SetVisible(true);
+
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ viz::switches::kUseVizHitTest)) {
+ auto display_hit_test_data_factory =
+ base::MakeUnique<viz::hit_test::DisplayHitTestDataFactoryLocal>();
+ hit_test_aggregator_ = base::MakeUnique<hit_test::HitTestAggregator>(
+ std::move(display_hit_test_data_factory));
+ }
}
GpuRootCompositorFrameSink::~GpuRootCompositorFrameSink() = default;
@@ -114,7 +125,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() {}
@@ -125,6 +139,8 @@ void GpuRootCompositorFrameSink::DidReceiveCompositorFrameAck(
}
void GpuRootCompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) {
+ if (hit_test_aggregator_)
+ hit_test_aggregator_->Swap();
if (client_)
client_->OnBeginFrame(args);
}

Powered by Google App Engine
This is Rietveld 408576698