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

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

Issue 2908783002: WIP Hittest Component.
Patch Set: reviewer comments and handling of memory re-allocation 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..a517bb0480f5734132cf96d46fd2191a903e9530 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,10 @@
#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"
namespace viz {
@@ -44,6 +46,11 @@ GpuRootCompositorFrameSink::GpuRootCompositorFrameSink(
base::Unretained(this)));
display_->Initialize(this, surface_manager);
display_->SetVisible(true);
+
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ viz::switches::kUseVizHitTest)) {
+ hit_test_aggregator_ = base::MakeUnique<hit_test::HitTestAggregator>();
+ }
}
GpuRootCompositorFrameSink::~GpuRootCompositorFrameSink() = default;
@@ -114,7 +121,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 +135,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