deferred_gpu_command_service.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2014 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. #ifndef ANDROID_WEBVIEW_BROWSER_GFX_DEFERRED_GPU_COMMAND_SERVICE_H_
  5. #define ANDROID_WEBVIEW_BROWSER_GFX_DEFERRED_GPU_COMMAND_SERVICE_H_
  6. #include "base/memory/raw_ptr.h"
  7. #include "gpu/command_buffer/service/command_buffer_task_executor.h"
  8. namespace gl {
  9. class GLShareGroup;
  10. }
  11. namespace android_webview {
  12. class GpuServiceWebView;
  13. class TaskQueueWebView;
  14. // Implementation for gpu service objects accessor for command buffer WebView.
  15. class DeferredGpuCommandService : public gpu::CommandBufferTaskExecutor {
  16. public:
  17. static DeferredGpuCommandService* GetInstance();
  18. DeferredGpuCommandService(const DeferredGpuCommandService&) = delete;
  19. DeferredGpuCommandService& operator=(const DeferredGpuCommandService&) =
  20. delete;
  21. // gpu::CommandBufferTaskExecutor implementation.
  22. bool ForceVirtualizedGLContexts() const override;
  23. bool ShouldCreateMemoryTracker() const override;
  24. std::unique_ptr<gpu::SingleTaskSequence> CreateSequence() override;
  25. void ScheduleOutOfOrderTask(base::OnceClosure task) override;
  26. void ScheduleDelayedWork(base::OnceClosure task) override;
  27. void PostNonNestableToClient(base::OnceClosure callback) override;
  28. scoped_refptr<gpu::SharedContextState> GetSharedContextState() override;
  29. scoped_refptr<gl::GLShareGroup> GetShareGroup() override;
  30. protected:
  31. ~DeferredGpuCommandService() override;
  32. private:
  33. friend class TaskForwardingSequence;
  34. DeferredGpuCommandService(TaskQueueWebView* task_queue,
  35. GpuServiceWebView* gpu_service);
  36. static DeferredGpuCommandService* CreateDeferredGpuCommandService();
  37. raw_ptr<TaskQueueWebView> task_queue_;
  38. raw_ptr<GpuServiceWebView> gpu_service_;
  39. scoped_refptr<gl::GLShareGroup> share_group_;
  40. };
  41. } // namespace android_webview
  42. #endif // ANDROID_WEBVIEW_BROWSER_GFX_DEFERRED_GPU_COMMAND_SERVICE_H_