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

Unified Diff: components/viz/hittest/hittest_aggregator.cc

Issue 2908783002: WIP Hittest Component.
Patch Set: surface observer and test setup Created 3 years, 7 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/hittest/hittest_aggregator.cc
diff --git a/components/viz/hittest/hittest_aggregator.cc b/components/viz/hittest/hittest_aggregator.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d2beafab308aaba7baf175ec748495c13f59ff39
--- /dev/null
+++ b/components/viz/hittest/hittest_aggregator.cc
@@ -0,0 +1,55 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/viz/hittest/hittest_aggregator.h"
+#include "base/logging.h"
+
+namespace viz {
+
+namespace {
+
+#define INITIAL_COUNT 128
+}
+
+HittestAggregator::HittestAggregator() {
+ regions_[0] = (Element*)malloc(INITIAL_COUNT * sizeof(Element));
rjkroege 2017/06/02 22:45:45 this is most certainly not how you want to do it i
+ regions_[1] = (Element*)malloc(INITIAL_COUNT * sizeof(Element));
+ regions_[0][0].child_count_ = LAST_REGION;
+ regions_[1][0].child_count_ = LAST_REGION;
+
+ current_regions_ = regions_[0];
+}
+HittestAggregator::~HittestAggregator() {}
+
+cc::SurfaceId HittestAggregator::SurfaceIdAtPoint(
+ cc::SurfaceId root_surface_id,
+ const gfx::Point& point,
+ gfx::Point* transformed_point) {
+ return root_surface_id;
rjkroege 2017/06/02 22:45:45 that's not right.
+}
+
+void HittestAggregator::SubmitHittestData(
+ hittest::mojom::HittestDataPtr hittest_data) {
+ pending_[hittest_data->surface_id_] = std::move(hittest_data);
rjkroege 2017/06/02 22:45:45 not sufficient. one surface may have multiple hitt
gklassen 2017/06/05 21:32:14 I'd like to understand this better. If there are
+}
+
+void HittestAggregator::Aggregate(cc::SurfaceId display_surface_id) {}
+
+void HittestAggregator::swap() {
rjkroege 2017/06/02 22:45:45 how is this connected up to BeginFrame?
+ if (current_regions_ == regions_[0]) {
+ current_regions_ = regions_[1];
+ } else {
+ current_regions_ = regions_[0];
+ }
+}
+
+void HittestAggregator::OnSurfaceDiscarded(const cc::SurfaceId& surface_id) {
+ pending_.erase(surface_id);
+ active_.erase(surface_id);
+}
+void HittestAggregator::OnSurfaceWillDraw(const cc::SurfaceId& surface_id) {
+ active_[surface_id] = std::move(pending_[surface_id]);
+}
+
+} // namespace viz

Powered by Google App Engine
This is Rietveld 408576698