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 COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_SKIA_OUTPUT_SURFACE_DEPENDENCY_IMPL_H_ 6 #define COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_SKIA_OUTPUT_SURFACE_DEPENDENCY_IMPL_H_ 7 8 #include <memory> 9 10 #include "base/macros.h" 11 #include "build/build_config.h" 12 #include "components/viz/service/display_embedder/skia_output_surface_dependency.h" 13 14 namespace base { 15 class SingleThreadTaskRunner; 16 } 17 18 namespace viz { 19 20 class GpuServiceImpl; 21 22 class VIZ_SERVICE_EXPORT SkiaOutputSurfaceDependencyImpl 23 : public SkiaOutputSurfaceDependency { 24 public: 25 SkiaOutputSurfaceDependencyImpl(GpuServiceImpl* gpu_service_impl, 26 gpu::SurfaceHandle surface_handle); 27 ~SkiaOutputSurfaceDependencyImpl() override; 28 29 std::unique_ptr<gpu::SingleTaskSequence> CreateSequence() override; 30 gpu::SharedImageManager* GetSharedImageManager() override; 31 gpu::SyncPointManager* GetSyncPointManager() override; 32 const gpu::GpuDriverBugWorkarounds& GetGpuDriverBugWorkarounds() override; 33 scoped_refptr<gpu::SharedContextState> GetSharedContextState() override; 34 gpu::raster::GrShaderCache* GetGrShaderCache() override; 35 VulkanContextProvider* GetVulkanContextProvider() override; 36 DawnContextProvider* GetDawnContextProvider() override; 37 const gpu::GpuPreferences& GetGpuPreferences() const override; 38 const gpu::GpuFeatureInfo& GetGpuFeatureInfo() override; 39 gpu::MailboxManager* GetMailboxManager() override; 40 gpu::ImageFactory* GetGpuImageFactory() override; 41 bool IsOffscreen() override; 42 gpu::SurfaceHandle GetSurfaceHandle() override; 43 scoped_refptr<gl::GLSurface> CreateGLSurface( 44 base::WeakPtr<gpu::ImageTransportSurfaceDelegate> stub, 45 gl::GLSurfaceFormat format) override; 46 base::ScopedClosureRunner CacheGLSurface(gl::GLSurface* surface) override; 47 void PostTaskToClientThread(base::OnceClosure closure) override; 48 void ScheduleGrContextCleanup() override; 49 void ScheduleDelayedGPUTaskFromGPUThread(base::OnceClosure task) override; 50 51 #if defined(OS_WIN) 52 void DidCreateAcceleratedSurfaceChildWindow( 53 gpu::SurfaceHandle parent_window, 54 gpu::SurfaceHandle child_window) override; 55 #endif 56 57 void RegisterDisplayContext(gpu::DisplayContext* display_context) override; 58 void UnregisterDisplayContext(gpu::DisplayContext* display_context) override; 59 void DidLoseContext(gpu::error::ContextLostReason reason, 60 const GURL& active_url) override; 61 62 base::TimeDelta GetGpuBlockedTimeSinceLastSwap() override; 63 bool NeedsSupportForExternalStencil() override; 64 65 private: 66 GpuServiceImpl* const gpu_service_impl_; 67 const gpu::SurfaceHandle surface_handle_; 68 scoped_refptr<base::SingleThreadTaskRunner> client_thread_task_runner_; 69 70 DISALLOW_COPY_AND_ASSIGN(SkiaOutputSurfaceDependencyImpl); 71 }; 72 73 } // namespace viz 74 75 #endif // COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_SKIA_OUTPUT_SURFACE_DEPENDENCY_IMPL_H_ 76