Chromium Code Reviews| Index: components/viz/hittest/hittest.h |
| diff --git a/components/viz/hittest/hittest.h b/components/viz/hittest/hittest.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..86b927e8ade49b9522b10020322e2a0985d19958 |
| --- /dev/null |
| +++ b/components/viz/hittest/hittest.h |
| @@ -0,0 +1,74 @@ |
| +// Copyright 2015 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_H_ |
| +#define COMPONENTS_VIZ_HITTEST_HITTEST_H_ |
| + |
| +#include <stdint.h> |
| + |
| +#include <map> |
| +#include <memory> |
| + |
| +#include "cc/output/compositor_frame.h" |
|
rjkroege
2017/05/29 15:58:02
not a correct dependency in my opinion.
|
| +#include "cc/surfaces/surface_id.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 { |
| + |
| +// Hittest |
|
rjkroege
2017/05/29 15:58:03
you could merge this line with the one below
|
| +// 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/05/29 15:58:03
no space? git cl format?
|
| +class HITTEST_EXPORT Hittest { |
| + public: |
| + static cc::SurfaceId SurfaceIdAtPoint(cc::SurfaceId root_surface_id, |
|
rjkroege
2017/05/29 15:58:03
i'm not sure that this is right.
gklassen
2017/06/05 21:32:13
what would you change?
|
| + const gfx::Point& point, |
| + gfx::Point* transformed_point) { |
| + return GetInstance()->InternalGetSurfaceIdAtPoint(root_surface_id, point, |
| + transformed_point); |
| + } |
| + |
| + static void DisplayWillDrawAndSwap(bool will_draw_and_swap, |
|
rjkroege
2017/05/29 15:58:03
seems not right.
hittest component should provide
|
| + const cc::RenderPassList& render_passes) { |
| + GetInstance()->Aggregate(); |
| + } |
| + |
| + private: |
| + static Hittest* instance_; |
| + |
| + static Hittest* GetInstance() { |
|
rjkroege
2017/05/29 15:58:03
are you trying to create a singleton? I'd argue th
|
| + if (instance_ == NULL) { |
| + instance_ = new Hittest(); |
| + } |
| + return instance_; |
| + } |
| + |
| + Hittest(); |
| + ~Hittest(); |
| + |
| + std::map<cc::SurfaceId, viz::hittest::mojom::HittestData> pending_; |
| + |
| + struct Region; |
| + std::vector<Region> regions_[2]; |
|
rjkroege
2017/05/29 15:58:03
this is the shared memory? AFAIK: vector is not a
|
| + std::vector<Region>* current_regions_; |
| + |
| + cc::SurfaceId InternalGetSurfaceIdAtPoint(cc::SurfaceId root_surface_id, |
|
rjkroege
2017/05/29 15:58:02
these all need method comments?
|
| + const gfx::Point& point, |
| + gfx::Point* transformed_point); |
| + |
| + void SubmitHittestData(viz::hittest::mojom::HittestData& hittest_data); |
| + |
| + void Aggregate(); |
| + |
| + void swap(); |
| +}; |
| + |
| +} // namespace viz |
| + |
| +#endif // COMPONENTS_VIZ_HITTEST_HITTEST_H_ |