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

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

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.h
diff --git a/components/viz/hittest/hittest_aggregator.h b/components/viz/hittest/hittest_aggregator.h
new file mode 100644
index 0000000000000000000000000000000000000000..6a21cfe9ba6349c369fe0398ff990a29f16850ef
--- /dev/null
+++ b/components/viz/hittest/hittest_aggregator.h
@@ -0,0 +1,76 @@
+// Copyright 2015 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.
+
+#ifndef COMPONENTS_VIZ_HITTEST_HITTEST_AGGREGATOR_H_
+#define COMPONENTS_VIZ_HITTEST_HITTEST_AGGREGATOR_H_
+
+#include <stdint.h>
+
+#include <map>
+#include <memory>
+
+#include "cc/surfaces/surface_id.h"
+#include "cc/surfaces/surface_observer.h"
+#include "components/viz/hittest/hittest_export.h"
+#include "components/viz/hittest/public/interfaces/hittest_data.mojom.h"
+#include "ui/gfx/geometry/quad_f.h"
+
+namespace viz {
+
+namespace test {
+class HittestAggregatorTest;
+}
+
+// Hittest maintains maping between display regions and associated surfaces
+// in shared memory to enable efficient hit testing across processes.
+//
+// This is intended to be created in the viz or GPU process. For mus+ash this
+// will be true after the mus process split.
+
+#define LAST_REGION -2
+
+typedef std::map<cc::SurfaceId, hittest::mojom::HittestDataPtr> HittestDataMap;
rjkroege 2017/06/02 22:45:45 chrome style prefers using is a HittestDataPtr a
+
+class HITTEST_EXPORT HittestAggregator : public cc::SurfaceObserver {
rjkroege 2017/06/02 22:45:45 Note that since this is per display, you will need
+ friend class test::HittestAggregatorTest;
+
+ public:
+ HittestAggregator();
+ ~HittestAggregator();
+
+ cc::SurfaceId SurfaceIdAtPoint(cc::SurfaceId root_surface_id,
rjkroege 2017/06/02 22:45:45 we argued about this. Am not convinced that you ne
+ const gfx::Point& point,
+ gfx::Point* transformed_point);
+ void SubmitHittestData(hittest::mojom::HittestDataPtr hittest_data);
+ void Aggregate(cc::SurfaceId display_surface_id);
+
+ // SurfaceObserver
rjkroege 2017/06/02 22:45:45 overrides can be private
+ void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override {}
+ void OnSurfaceDestroyed(const cc::SurfaceId& surface_id) override {}
+ void OnSurfaceDamaged(const cc::SurfaceId& surface_id,
+ const cc::BeginFrameAck& ack,
+ bool* changed) override {}
+ void OnSurfaceDiscarded(const cc::SurfaceId& surface_id) override;
+ void OnSurfaceDamageExpected(const cc::SurfaceId& surface_id,
+ const cc::BeginFrameArgs& args) override {}
+ void OnSurfaceWillDraw(const cc::SurfaceId& surface_id) override;
+
+ private:
+ std::map<cc::SurfaceId, hittest::mojom::HittestDataPtr> pending_;
rjkroege 2017/06/02 22:45:45 use your using aka typedef?
+ std::map<cc::SurfaceId, hittest::mojom::HittestDataPtr> active_;
rjkroege 2017/06/02 22:45:45 active_ are ones that have been marked as in the d
+
+ struct Element {
+ int child_count_;
+ hittest::mojom::HittestRegion region_;
+ };
+
+ Element* regions_[2];
+ Element* current_regions_;
+
+ void swap();
+};
+
+} // namespace viz
+
+#endif // COMPONENTS_VIZ_HITTEST_HITTEST_AGGREGATOR_H_

Powered by Google App Engine
This is Rietveld 408576698