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

Unified Diff: content/common/gpu/client/context_provider_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: Fix typo 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/context_provider_command_buffer.h
diff --git a/content/common/gpu/client/context_provider_command_buffer.h b/content/common/gpu/client/context_provider_command_buffer.h
new file mode 100644
index 0000000000000000000000000000000000000000..c415e0ff2de577df30d2a0a53a80455b0f31ba41
--- /dev/null
+++ b/content/common/gpu/client/context_provider_command_buffer.h
@@ -0,0 +1,62 @@
+// 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_CONTEXT_PROVIDER_COMMAND_BUFFER
+#define CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER
+
+#include "base/memory/scoped_ptr.h"
+#include "base/synchronization/lock.h"
+#include "cc/context_provider.h"
+#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
+
+namespace webkit {
+namespace gpu {
+class GrContextForWebGraphicsContext3D;
+}
+}
+
+namespace content {
+
+// Implementation of cc::ContextProvider that provides a
+// WebGraphicsContext3DCommandBufferImpl context and a GrContext.
+class ContextProviderCommandBuffer : public cc::ContextProvider {
+ public:
+ ContextProviderCommandBuffer();
+
+ virtual bool InitializeOnMainThread() OVERRIDE;
+ virtual bool BindToCurrentThread() OVERRIDE;
+ virtual WebGraphicsContext3DCommandBufferImpl* Context3d() OVERRIDE;
+ virtual class GrContext* GrContext() OVERRIDE;
+ virtual void VerifyContexts() OVERRIDE;
+
+ bool DestroyedOnMainThread();
+
+ protected:
+ virtual ~ContextProviderCommandBuffer();
+
+ // Subclass must provide an implementation to create an offscreen context.
+ virtual scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
+ CreateOffscreenContext3d() = 0;
+
+ virtual void OnLostContext();
+ virtual void OnMemoryAllocationChanged(bool nonzero_allocation);
+
+ private:
+
+ scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_;
+ scoped_ptr<webkit::gpu::GrContextForWebGraphicsContext3D> gr_context_;
+
+ base::Lock destroyed_lock_;
+ bool destroyed_;
+
+ class LostContextCallbackProxy;
+ scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_;
+
+ class MemoryAllocationCallbackProxy;
+ scoped_ptr<MemoryAllocationCallbackProxy> memory_allocation_callback_proxy_;
+};
+
+} // namespace content
+
+#endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER

Powered by Google App Engine
This is Rietveld 408576698