summaryrefslogtreecommitdiff
path: root/chromium/ui/ozone/platform/drm/gpu/drm_overlay_manager_gpu.h
blob: da66930887fa399bbabee2597a4afb83be4b974d (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
// 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 UI_OZONE_PLATFORM_DRM_GPU_DRM_OVERLAY_MANAGER_GPU_H_
#define UI_OZONE_PLATFORM_DRM_GPU_DRM_OVERLAY_MANAGER_GPU_H_

#include <vector>

#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "ui/ozone/platform/drm/common/drm_overlay_manager.h"

namespace ui {
class DrmThreadProxy;

// DrmOverlayManager implementation that runs in the GPU process. PostTasks
// overlay validations requests to the DRM thread.
class DrmOverlayManagerGpu : public DrmOverlayManager {
 public:
  explicit DrmOverlayManagerGpu(DrmThreadProxy* drm_thread_proxy);
  ~DrmOverlayManagerGpu() override;

 private:
  // DrmOverlayManager:
  void SendOverlayValidationRequest(
      const std::vector<OverlaySurfaceCandidate>& candidates,
      gfx::AcceleratedWidget widget) override;

  void ReceiveOverlayValidationResponse(
      gfx::AcceleratedWidget widget,
      const std::vector<OverlaySurfaceCandidate>& candidates,
      const std::vector<OverlayStatus>& status);

  DrmThreadProxy* const drm_thread_proxy_;

  bool has_set_clear_cache_callback_ = false;

  base::WeakPtrFactory<DrmOverlayManagerGpu> weak_ptr_factory_{this};

  DISALLOW_COPY_AND_ASSIGN(DrmOverlayManagerGpu);
};

}  // namespace ui

#endif  // UI_OZONE_PLATFORM_DRM_GPU_DRM_OVERLAY_MANAGER_GPU_H_