Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1272)

Unified Diff: content/common/gpu/client/offscreen_context_command_buffer.h

Issue 12212007: cc: Route offscreen context creation for compositor to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Put OffscreenContext class in content/common/gpu/client for renderer Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698