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_OFFSCREEN_CONTEXT_COMMAND_BUFFER_H_ |
| 6 #define CONTENT_COMMON_GPU_CLIENT_OFFSCREEN_CONTEXT_COMMAND_BUFFER_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/common/gpu/client/offscreen_context.h" |
| 10 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 11 #include "skia/ext/refptr.h" |
| 12 |
| 13 namespace content { |
| 14 class OffscreenContextCommandBuffer; |
| 15 |
| 16 class OffscreenContextCommandBufferClient { |
| 17 public: |
| 18 virtual WebGraphicsContext3DCommandBufferImpl* CreateOffscreenContext() = 0; |
| 19 |
| 20 virtual void DidLoseContext( |
| 21 OffscreenContextCommandBuffer* offscreen_context) = 0; |
| 22 virtual void DidCreateContext( |
| 23 OffscreenContextCommandBuffer* offscreen_context, |
| 24 bool success) = 0; |
| 25 }; |
| 26 |
| 27 // This class lazily creates an offscreen context with a command buffer. |
| 28 class OffscreenContextCommandBuffer |
| 29 : public OffscreenContext, |
| 30 public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback, |
| 31 public WebKit::WebGraphicsContext3D:: |
| 32 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM { |
| 33 public: |
| 34 explicit OffscreenContextCommandBuffer( |
| 35 OffscreenContextCommandBufferClient* client); |
| 36 virtual ~OffscreenContextCommandBuffer(); |
| 37 |
| 38 virtual WebGraphicsContext3DCommandBufferImpl* Context3d() OVERRIDE; |
| 39 |
| 40 private: |
| 41 // WebGraphicsContextLostCallback implementation. |
| 42 virtual void onContextLost() OVERRIDE; |
| 43 // WebGraphicsMemoryAllocationChangedCallbackCHROMIUM implementation. |
| 44 virtual void onMemoryAllocationChanged( |
| 45 WebKit::WebGraphicsMemoryAllocation allocation) OVERRIDE; |
| 46 |
| 47 OffscreenContextCommandBufferClient* client_; |
| 48 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_; |
| 49 }; |
| 50 |
| 51 } // namespace content |
| 52 |
| 53 #endif // CONTENT_COMMON_GPU_CLIENT_OFFSCREEN_CONTEXT_COMMAND_BUFFER_H_ |
OLD | NEW |