OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_VIZ_HITTEST_HITTEST_AGGREGATOR_H_ | |
6 #define COMPONENTS_VIZ_HITTEST_HITTEST_AGGREGATOR_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <map> | |
11 #include <memory> | |
12 | |
13 #include "cc/surfaces/surface_id.h" | |
14 #include "cc/surfaces/surface_observer.h" | |
15 #include "components/viz/hittest/hittest_export.h" | |
16 #include "components/viz/hittest/public/interfaces/hittest_data.mojom.h" | |
17 #include "ui/gfx/geometry/quad_f.h" | |
18 | |
19 namespace viz { | |
20 | |
21 namespace test { | |
22 class HittestAggregatorTest; | |
23 } | |
24 | |
25 // Hittest maintains maping between display regions and associated surfaces | |
26 // in shared memory to enable efficient hit testing across processes. | |
27 // | |
28 // This is intended to be created in the viz or GPU process. For mus+ash this | |
29 // will be true after the mus process split. | |
30 | |
31 #define LAST_REGION -2 | |
32 | |
33 typedef std::map<cc::SurfaceId, hittest::mojom::HittestDataPtr> HittestDataMap; | |
rjkroege
2017/06/02 22:45:45
chrome style prefers using
is a HittestDataPtr a
| |
34 | |
35 class HITTEST_EXPORT HittestAggregator : public cc::SurfaceObserver { | |
rjkroege
2017/06/02 22:45:45
Note that since this is per display, you will need
| |
36 friend class test::HittestAggregatorTest; | |
37 | |
38 public: | |
39 HittestAggregator(); | |
40 ~HittestAggregator(); | |
41 | |
42 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
| |
43 const gfx::Point& point, | |
44 gfx::Point* transformed_point); | |
45 void SubmitHittestData(hittest::mojom::HittestDataPtr hittest_data); | |
46 void Aggregate(cc::SurfaceId display_surface_id); | |
47 | |
48 // SurfaceObserver | |
rjkroege
2017/06/02 22:45:45
overrides can be private
| |
49 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override {} | |
50 void OnSurfaceDestroyed(const cc::SurfaceId& surface_id) override {} | |
51 void OnSurfaceDamaged(const cc::SurfaceId& surface_id, | |
52 const cc::BeginFrameAck& ack, | |
53 bool* changed) override {} | |
54 void OnSurfaceDiscarded(const cc::SurfaceId& surface_id) override; | |
55 void OnSurfaceDamageExpected(const cc::SurfaceId& surface_id, | |
56 const cc::BeginFrameArgs& args) override {} | |
57 void OnSurfaceWillDraw(const cc::SurfaceId& surface_id) override; | |
58 | |
59 private: | |
60 std::map<cc::SurfaceId, hittest::mojom::HittestDataPtr> pending_; | |
rjkroege
2017/06/02 22:45:45
use your using aka typedef?
| |
61 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
| |
62 | |
63 struct Element { | |
64 int child_count_; | |
65 hittest::mojom::HittestRegion region_; | |
66 }; | |
67 | |
68 Element* regions_[2]; | |
69 Element* current_regions_; | |
70 | |
71 void swap(); | |
72 }; | |
73 | |
74 } // namespace viz | |
75 | |
76 #endif // COMPONENTS_VIZ_HITTEST_HITTEST_AGGREGATOR_H_ | |
OLD | NEW |