Chromium Code Reviews| Index: components/viz/hit_test/hit_test_aggregator.h |
| diff --git a/components/viz/hit_test/hit_test_aggregator.h b/components/viz/hit_test/hit_test_aggregator.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ead3b417da82fc298619ad56d7826f1422fc4470 |
| --- /dev/null |
| +++ b/components/viz/hit_test/hit_test_aggregator.h |
| @@ -0,0 +1,91 @@ |
| +// 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_HIT_TEST_HIT_TEST_AGGREGATOR_H_ |
| +#define COMPONENTS_VIZ_HIT_TEST_HIT_TEST_AGGREGATOR_H_ |
| + |
| +#include <stdint.h> |
| + |
| +#include <map> |
| +#include <memory> |
| + |
| +#include "cc/surfaces/surface_id.h" |
| +#include "cc/surfaces/surface_observer.h" |
| +#include "components/viz/hit_test/display_hit_test_data.h" |
| +#include "components/viz/hit_test/hit_test_export.h" |
| +#include "components/viz/hit_test/public/interfaces/hit_test_data.mojom.h" |
| +#include "ui/gfx/geometry/quad_f.h" |
| + |
| +namespace viz { |
| + |
| +namespace hit_test { |
| +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. |
| + |
|
rjkroege
2017/06/07 21:19:06
nit: remove blank?
And: since when can you preser
gklassen
2017/06/08 20:33:21
Yes - although I believe it may be possible to mov
|
| +typedef std::map<cc::SurfaceId, hit_test::mojom::HitTestDataPtr> HitTestDataMap; |
| + |
| +class HIT_TEST_EXPORT HitTestAggregator : public cc::SurfaceObserver { |
| + friend class hit_test::test::HitTestAggregatorTest; |
| + |
| + public: |
| + HitTestAggregator(); |
| + ~HitTestAggregator(); |
| + |
| + // Called when HitTestData is submitted along with every call |
| + // to SubmitCompositorFrame. This is collected in pending_ until |
| + // surfaces are aggregated and put on screen. |
| + void SubmitHitTestData(hit_test::mojom::HitTestDataPtr hit_test_data); |
|
rjkroege
2017/06/07 21:19:06
Need a TODO for what to do if the submitted data i
gklassen
2017/06/08 20:33:21
Good call. TODO added to the implementaiton. Done.
|
| + |
| + // Called when surfaces have been aggregated. Used to aggregate |
| + // HitTestData into the tree structure in shared memory and used |
| + // for event targetting. |
| + void Aggregate(cc::SurfaceId display_surface_id); |
| + |
| + // Called at BeginFrame to swap buffers in shared memory. |
| + void Swap(); |
| + |
| + // 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 {} |
| + |
|
rjkroege
2017/06/07 21:19:06
remove blank
gklassen
2017/06/08 20:33:21
Done.
|
| + // Called when a surface has been aggregated and added to the |
| + // display frame. HitTestData objects are held but ignored until |
| + // this happens. HitTestData for the surface is copied from pending_ |
| + // to active_ in this method. |
| + void OnSurfaceWillDraw(const cc::SurfaceId& surface_id) override; |
| + |
| + DisplayHitTestData* display_hit_test_data_; |
|
rjkroege
2017/06/07 21:19:05
Does it need to be public? Have an accessor?
gklassen
2017/06/08 20:33:21
Good call. Done.
|
| + |
| + DisplayHitTestRegion* GetCurrentRegions(); |
| + |
| + private: |
| + HitTestDataMap pending_; |
| + HitTestDataMap active_; |
| + |
| + void AllocateDisplayHitTestData(); |
|
rjkroege
2017/06/07 21:19:05
method comments would be convenient for people unf
gklassen
2017/06/08 20:33:21
Agreed. Done.
|
| + void AllocateDisplayHitTestData(int size); |
| + |
| + int GetBackIndex(); |
| + |
| + int Append(cc::SurfaceId surface_id, int index); |
| + int Append(const hit_test::mojom::HitTestRegionPtr& region, int index); |
| +}; |
| + |
| +} // namespace viz |
| + |
| +#endif // COMPONENTS_VIZ_HIT_TEST_HIT_TEST_AGGREGATOR_H_ |