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

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

Issue 2908783002: WIP Hittest Component.
Patch Set: improvements from reviewer comments 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/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..f212c2177b5c03e754ed4b353af06416d792cb47
--- /dev/null
+++ b/components/viz/hittest/hittest_aggregator.h
@@ -0,0 +1,70 @@
+// 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.
+
+#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;
+}
+
+class DisplayHittestData;
+
+// 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.
+
+typedef std::map<cc::SurfaceId, hittest::mojom::HittestDataPtr> HittestDataMap;
rjkroege 2017/06/07 17:16:45 use using
gklassen 2017/06/07 20:04:44 the compiler reports "error: using declaration can
rjkroege 2017/06/07 20:22:56 This doesn't compile? using HittestDataMap = std:
gklassen 2017/06/08 17:09:22 ( gklassen@ would like to recall this statement on
+
+class HITTEST_EXPORT HittestAggregator : public cc::SurfaceObserver {
+ friend class test::HittestAggregatorTest;
rjkroege 2017/06/07 17:16:45 grumble.
gklassen 2017/06/07 20:04:44 Suggestions welcome. The test code requires acces
rjkroege 2017/06/07 20:22:56 https://cs.chromium.org/chromium/src/base/gtest_pr
gklassen 2017/06/08 17:09:22 This seems to require a MACRO per method and a fri
+
+ public:
+ HittestAggregator();
+ ~HittestAggregator();
+
+ cc::SurfaceId SurfaceIdAtPoint(cc::SurfaceId root_surface_id,
rjkroege 2017/06/07 17:16:45 Method comments please
gklassen 2017/06/07 20:04:44 Done.
+ const gfx::Point& point,
+ gfx::Point* transformed_point);
+ void SubmitHittestData(hittest::mojom::HittestDataPtr hittest_data);
+ void Aggregate(cc::SurfaceId display_surface_id);
+
+ // SurfaceObserver
+ 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:
+ HittestDataMap pending_;
+ HittestDataMap active_;
+
+ DisplayHittestData* display_hittest_data_;
+
+ void swap();
+};
+
+} // namespace viz
+
+#endif // COMPONENTS_VIZ_HITTEST_HITTEST_AGGREGATOR_H_

Powered by Google App Engine
This is Rietveld 408576698