| 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..54bd584fb5b6751592f141abf7b5f8d4295bef62
|
| --- /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"
|
| +#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
|
| +// 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.
|
| +
|
| +class HITTEST_EXPORT Hittest {
|
| + public:
|
| + static cc::SurfaceId SurfaceIdAtPoint(cc::SurfaceId root_surface_id,
|
| + 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,
|
| + const cc::RenderPassList& render_passes) {
|
| + GetInstance()->Aggregate();
|
| + }
|
| +
|
| + private:
|
| + static Hittest* instance_;
|
| +
|
| + static Hittest* GetInstance() {
|
| + if (instance_ == NULL) {
|
| + instance_ = new Hittest();
|
| + }
|
| + return instance_;
|
| + }
|
| +
|
| + Hittest();
|
| + ~Hittest();
|
| +
|
| + std::map<cc::SurfaceId, hittest::mojom::HittestData> pending_;
|
| +
|
| + struct Region;
|
| + std::vector<Region> regions_[2];
|
| + std::vector<Region>* current_regions_;
|
| +
|
| + cc::SurfaceId InternalGetSurfaceIdAtPoint(cc::SurfaceId root_surface_id,
|
| + const gfx::Point& point,
|
| + gfx::Point* transformed_point);
|
| +
|
| + void SubmitHittestData(const hittest::mojom::HittestData& hittest_data);
|
| +
|
| + void Aggregate();
|
| +
|
| + void swap();
|
| +};
|
| +
|
| +} // namespace viz
|
| +
|
| +#endif // COMPONENTS_VIZ_HITTEST_HITTEST_H_
|
|
|