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

Side by Side Diff: components/viz/hittest/hittest.h

Issue 2908783002: WIP Hittest Component.
Patch Set: rebase 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 unified diff | Download patch
OLDNEW
(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_H_
6 #define COMPONENTS_VIZ_HITTEST_HITTEST_H_
7
8 #include <stdint.h>
9
10 #include <map>
11 #include <memory>
12
13 #include "cc/output/compositor_frame.h"
14 #include "cc/surfaces/surface_id.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 // Hittest
22 // Maintains maping between display regions and associated surfaces
23 // in shared memory to enable efficient hit testing across processes.
24 //
25 // This is intended to be created in the viz or GPU process. For mus+ash this
26 // will be true after the mus process split.
27
28 class HITTEST_EXPORT Hittest {
29 public:
30 static cc::SurfaceId SurfaceIdAtPoint(cc::SurfaceId root_surface_id,
31 const gfx::Point& point,
32 gfx::Point* transformed_point) {
33 return GetInstance()->InternalGetSurfaceIdAtPoint(root_surface_id, point,
34 transformed_point);
35 }
36
37 static void DisplayWillDrawAndSwap(bool will_draw_and_swap,
38 const cc::RenderPassList& render_passes) {
39 GetInstance()->Aggregate();
40 }
41
42 private:
43 static Hittest* instance_;
44
45 static Hittest* GetInstance() {
46 if (instance_ == NULL) {
47 instance_ = new Hittest();
48 }
49 return instance_;
50 }
51
52 Hittest();
53 ~Hittest();
54
55 std::map<cc::SurfaceId, viz::hittest::mojom::HittestData> pending_;
56
57 struct Region;
58 std::vector<Region> regions_[2];
59 std::vector<Region>* current_regions_;
60
61 cc::SurfaceId InternalGetSurfaceIdAtPoint(cc::SurfaceId root_surface_id,
62 const gfx::Point& point,
63 gfx::Point* transformed_point);
64
65 void SubmitHittestData(viz::hittest::mojom::HittestData& hittest_data);
66
67 void Aggregate();
68
69 void swap();
70 };
71
72 } // namespace viz
73
74 #endif // COMPONENTS_VIZ_HITTEST_HITTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698