Index: content/common/gpu/client/offscreen_context_command_buffer.h |
diff --git a/content/common/gpu/client/offscreen_context_command_buffer.h b/content/common/gpu/client/offscreen_context_command_buffer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5808a30149d403004fa8ea21347b830f28a32d76 |
--- /dev/null |
+++ b/content/common/gpu/client/offscreen_context_command_buffer.h |
@@ -0,0 +1,53 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_COMMON_GPU_CLIENT_OFFSCREEN_CONTEXT_COMMAND_BUFFER_H_ |
+#define CONTENT_COMMON_GPU_CLIENT_OFFSCREEN_CONTEXT_COMMAND_BUFFER_H_ |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "content/common/gpu/client/offscreen_context.h" |
+#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
+#include "skia/ext/refptr.h" |
+ |
+namespace content { |
+class OffscreenContextCommandBuffer; |
+ |
+class OffscreenContextCommandBufferClient { |
+ public: |
+ virtual WebGraphicsContext3DCommandBufferImpl* CreateOffscreenContext() = 0; |
+ |
+ virtual void DidLoseContext( |
+ OffscreenContextCommandBuffer* offscreen_context) = 0; |
+ virtual void DidCreateContext( |
+ OffscreenContextCommandBuffer* offscreen_context, |
+ bool success) = 0; |
+}; |
+ |
+// This class lazily creates an offscreen context with a command buffer. |
+class OffscreenContextCommandBuffer |
+ : public OffscreenContext, |
+ public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback, |
+ public WebKit::WebGraphicsContext3D:: |
+ WebGraphicsMemoryAllocationChangedCallbackCHROMIUM { |
+ public: |
+ explicit OffscreenContextCommandBuffer( |
+ OffscreenContextCommandBufferClient* client); |
+ virtual ~OffscreenContextCommandBuffer(); |
+ |
+ virtual WebGraphicsContext3DCommandBufferImpl* Context3d() OVERRIDE; |
+ |
+ private: |
+ // WebGraphicsContextLostCallback implementation. |
+ virtual void onContextLost() OVERRIDE; |
+ // WebGraphicsMemoryAllocationChangedCallbackCHROMIUM implementation. |
+ virtual void onMemoryAllocationChanged( |
+ WebKit::WebGraphicsMemoryAllocation allocation) OVERRIDE; |
+ |
+ OffscreenContextCommandBufferClient* client_; |
+ scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_; |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_COMMON_GPU_CLIENT_OFFSCREEN_CONTEXT_COMMAND_BUFFER_H_ |