OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 CC_OUTPUT_IN_PROCESS_CONTEXT_PROVIDER_H_ |
| 6 #define CC_OUTPUT_IN_PROCESS_CONTEXT_PROVIDER_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <memory> |
| 11 |
| 12 #include "base/synchronization/lock.h" |
| 13 #include "cc/output/context_cache_controller.h" |
| 14 #include "cc/output/context_provider.h" |
| 15 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 16 #include "gpu/ipc/in_process_command_buffer.h" |
| 17 #include "ui/gfx/native_widget_types.h" |
| 18 |
| 19 class GrContext; |
| 20 |
| 21 namespace gpu { |
| 22 class GLInProcessContext; |
| 23 class GpuMemoryBufferManager; |
| 24 class ImageFactory; |
| 25 struct SharedMemoryLimits; |
| 26 class SyncPointManager; |
| 27 namespace gles2 { |
| 28 class MailboxManager; |
| 29 } |
| 30 } |
| 31 |
| 32 namespace skia_bindings { |
| 33 class GrContextForGLES2Interface; |
| 34 } |
| 35 |
| 36 namespace cc { |
| 37 |
| 38 class InProcessContextProvider : public ContextProvider { |
| 39 public: |
| 40 InProcessContextProvider( |
| 41 scoped_refptr<gpu::InProcessCommandBuffer::Service> service, |
| 42 gpu::SurfaceHandle widget, |
| 43 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 44 gpu::ImageFactory* image_factory, |
| 45 const gpu::SharedMemoryLimits& limits, |
| 46 InProcessContextProvider* shared_context); |
| 47 |
| 48 bool BindToCurrentThread() override; |
| 49 gpu::gles2::GLES2Interface* ContextGL() override; |
| 50 gpu::ContextSupport* ContextSupport() override; |
| 51 class GrContext* GrContext() override; |
| 52 ContextCacheController* CacheController() override; |
| 53 void InvalidateGrContext(uint32_t state) override; |
| 54 base::Lock* GetLock() override; |
| 55 gpu::Capabilities ContextCapabilities() override; |
| 56 void SetLostContextCallback( |
| 57 const LostContextCallback& lost_context_callback) override; |
| 58 |
| 59 uint32_t GetCopyTextureInternalFormat(); |
| 60 |
| 61 void SetSwapBuffersCompletionCallback( |
| 62 const gpu::InProcessCommandBuffer::SwapBuffersCompletionCallback& |
| 63 callback); |
| 64 |
| 65 void SetUpdateVSyncParametersCallback( |
| 66 const gpu::InProcessCommandBuffer::UpdateVSyncParametersCallback& |
| 67 callback); |
| 68 |
| 69 protected: |
| 70 friend class base::RefCountedThreadSafe<InProcessContextProvider>; |
| 71 ~InProcessContextProvider() override; |
| 72 |
| 73 private: |
| 74 const gpu::gles2::ContextCreationAttribHelper attributes_; |
| 75 |
| 76 base::Lock context_lock_; |
| 77 std::unique_ptr<gpu::GLInProcessContext> context_; |
| 78 std::unique_ptr<skia_bindings::GrContextForGLES2Interface> gr_context_; |
| 79 std::unique_ptr<ContextCacheController> cache_controller_; |
| 80 }; |
| 81 |
| 82 } // namespace cc |
| 83 |
| 84 #endif // CC_OUTPUT_IN_PROCESS_CONTEXT_PROVIDER_H_ |
OLD | NEW |