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

Side by Side Diff: components/viz/hittest/display_hittest_data.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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 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_DATA_H_
rjkroege 2017/06/07 17:16:45 HIT_TEST now Or... use Targeting
gklassen 2017/06/07 20:04:44 Interesting... are you suggesting replacing HitTes
6 #define COMPONENTS_VIZ_HITTEST_HITTEST_DATA_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 "hittest_aggregator.h"
18 #include "ui/gfx/geometry/quad_f.h"
19
20 namespace viz {
21
22 // DiplayHittestData contains the hittest data for the Display.
23 //
24 // It is designed to be in shared memory so that
25 // - the viz process can collect and write the hittest data, and
26 // - other processes can access without process hops or mojo calls
27 //
28 // One instance of this class contains a double buffer of entries -
29 // the viz process will write into one half while client processes read from
30 // the other. front_offset_ is used to swap buffers atomically.
31
32 class DisplayHittestData {
33 public:
34 static DisplayHittestData* Create();
rjkroege 2017/06/07 17:16:45 embed the cast here? align with the buffer code th
35 static DisplayHittestData* Create(int size);
36
37 // Build regions from map of active hittest data objects
38 void Build(const HittestDataMap& map, cc::SurfaceId root_surface_id);
39 void Swap();
40
41 private:
42 DisplayHittestData();
43 ~DisplayHittestData();
44
45 void Append(const HittestDataMap& map, cc::SurfaceId root_surface_id);
46 void Append(const HittestDataMap& map,
47 const hittest::mojom::HittestRegionPtr& region);
48
49 struct Element {
rjkroege 2017/06/07 17:16:45 the client side code needs to walk this tree. yes?
gklassen 2017/06/07 20:04:44 Yes. This has been changed to be a structure so t
50 cc::SurfaceId surface_id_;
51 hittest::mojom::HittestRegionFlags flags_;
52 gfx::Rect rect_;
53 gfx::Transform transform_;
54 int child_count_;
55 };
56
57 base::subtle::Atomic32 front_offset_;
rjkroege 2017/06/07 17:16:45 what's front and what's back?
gklassen 2017/06/07 20:04:44 Front is the portion currently in use for targetti
58 int size_;
59 int count_;
60 Element regions_[];
61 };
62
63 } // namespace viz
rjkroege 2017/06/07 17:16:45 suppose to be 1 space I think. But I could be wron
gklassen 2017/06/07 20:04:44 Done.
64
65 #endif // COMPONENTS_VIZ_HITTEST_HITTEST_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698