1 // Copyright 2019 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 UI_OZONE_PLATFORM_DRM_GPU_DRM_OVERLAY_MANAGER_GPU_H_ 6 #define UI_OZONE_PLATFORM_DRM_GPU_DRM_OVERLAY_MANAGER_GPU_H_ 7 8 #include <vector> 9 10 #include "base/macros.h" 11 #include "base/memory/weak_ptr.h" 12 #include "ui/ozone/platform/drm/gpu/drm_overlay_manager.h" 13 14 namespace ui { 15 class DrmThreadProxy; 16 17 // DrmOverlayManager implementation that runs in the GPU process. PostTasks 18 // overlay validations requests to the DRM thread. 19 class DrmOverlayManagerGpu : public DrmOverlayManager { 20 public: 21 explicit DrmOverlayManagerGpu(DrmThreadProxy* drm_thread_proxy); 22 ~DrmOverlayManagerGpu() override; 23 24 private: 25 // DrmOverlayManager: 26 void SendOverlayValidationRequest( 27 const std::vector<OverlaySurfaceCandidate>& candidates, 28 gfx::AcceleratedWidget widget) override; 29 std::vector<OverlayStatus> SendOverlayValidationRequestSync( 30 const std::vector<OverlaySurfaceCandidate>& candidates, 31 gfx::AcceleratedWidget widget) override; 32 33 void SetClearCacheCallbackIfNecessary(); 34 35 void ReceiveOverlayValidationResponse( 36 gfx::AcceleratedWidget widget, 37 const std::vector<OverlaySurfaceCandidate>& candidates, 38 const std::vector<OverlayStatus>& status); 39 40 DrmThreadProxy* const drm_thread_proxy_; 41 42 bool has_set_clear_cache_callback_ = false; 43 44 base::WeakPtrFactory<DrmOverlayManagerGpu> weak_ptr_factory_{this}; 45 46 DISALLOW_COPY_AND_ASSIGN(DrmOverlayManagerGpu); 47 }; 48 49 } // namespace ui 50 51 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_OVERLAY_MANAGER_GPU_H_ 52