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