OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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 CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER |
| 6 #define CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/synchronization/lock.h" |
| 10 #include "cc/context_provider.h" |
| 11 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 12 |
| 13 namespace webkit { |
| 14 namespace gpu { |
| 15 class GrContextForWebGraphicsContext3D; |
| 16 } |
| 17 } |
| 18 |
| 19 namespace content { |
| 20 |
| 21 // Implementation of cc::ContextProvider that provides a |
| 22 // WebGraphicsContext3DCommandBufferImpl context and a GrContext. |
| 23 class ContextProviderCommandBuffer : public cc::ContextProvider { |
| 24 public: |
| 25 ContextProviderCommandBuffer(); |
| 26 |
| 27 virtual bool InitializeOnMainThread() OVERRIDE; |
| 28 virtual bool BindToCurrentThread() OVERRIDE; |
| 29 virtual WebGraphicsContext3DCommandBufferImpl* Context3d() OVERRIDE; |
| 30 virtual class GrContext* GrContext() OVERRIDE; |
| 31 virtual void VerifyContexts() OVERRIDE; |
| 32 |
| 33 bool DestroyedOnMainThread(); |
| 34 |
| 35 protected: |
| 36 virtual ~ContextProviderCommandBuffer(); |
| 37 |
| 38 // Subclass must provide an implementation to create an offscreen context. |
| 39 virtual scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
| 40 CreateOffscreenContext3d() = 0; |
| 41 |
| 42 virtual void OnLostContext(); |
| 43 virtual void OnMemoryAllocationChanged(bool nonzero_allocation); |
| 44 |
| 45 private: |
| 46 |
| 47 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_; |
| 48 scoped_ptr<webkit::gpu::GrContextForWebGraphicsContext3D> gr_context_; |
| 49 |
| 50 base::Lock destroyed_lock_; |
| 51 bool destroyed_; |
| 52 |
| 53 class LostContextCallbackProxy; |
| 54 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; |
| 55 |
| 56 class MemoryAllocationCallbackProxy; |
| 57 scoped_ptr<MemoryAllocationCallbackProxy> memory_allocation_callback_proxy_; |
| 58 }; |
| 59 |
| 60 } // namespace content |
| 61 |
| 62 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER |
OLD | NEW |