summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/modules/xr/xr_hit_test_source.h
blob: 672909b3adddc1854297cbce1a96c6b03c6ae591 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2019 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 THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_HIT_TEST_SOURCE_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_HIT_TEST_SOURCE_H_

#include <memory>

#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"

#include "device/vr/public/mojom/vr_service.mojom-blink-forward.h"

namespace blink {

class ExceptionState;
class XRHitTestResult;
class XRSession;

class XRHitTestSource : public ScriptWrappable {
  DEFINE_WRAPPERTYPEINFO();

 public:
  XRHitTestSource(uint64_t id, XRSession* xr_session);

  uint64_t id() const;

  void cancel(ExceptionState& exception_state);

  // Returns a vector of XRHitTestResults that were obtained during last frame
  // update. This method is not exposed to JavaScript.
  HeapVector<Member<XRHitTestResult>> Results();

  void Update(
      const Vector<device::mojom::blink::XRHitResultPtr>& hit_test_results);

  void Trace(Visitor*) override;

 private:
  const uint64_t id_;
  Member<XRSession> xr_session_;

  Vector<device::mojom::blink::XRHitResult> last_frame_results_;
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_HIT_TEST_SOURCE_H_