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

Unified Diff: webkit/common/gpu/context_provider_in_process.cc

Issue 23072008: aura: Allow in process ContextProvider to hold onscreen contexts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: inprocesscreatecallback: nit Created 7 years, 4 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
« no previous file with comments | « webkit/common/gpu/context_provider_in_process.h ('k') | webkit/common/gpu/test_context_provider_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/common/gpu/context_provider_in_process.cc
diff --git a/webkit/common/gpu/context_provider_in_process.cc b/webkit/common/gpu/context_provider_in_process.cc
index e56da80fd0ae71b120a026573cae1697f05b0a1a..1e42ab04d6bf2dfeae5aeb7d1056ef2b7b38bb44 100644
--- a/webkit/common/gpu/context_provider_in_process.cc
+++ b/webkit/common/gpu/context_provider_in_process.cc
@@ -4,6 +4,7 @@
#include "webkit/common/gpu/context_provider_in_process.h"
+#include "base/bind.h"
#include "base/callback_helpers.h"
#include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h"
#include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
@@ -53,6 +54,35 @@ class ContextProviderInProcess::MemoryAllocationCallbackProxy
ContextProviderInProcess* provider_;
};
+// static
+scoped_refptr<ContextProviderInProcess> ContextProviderInProcess::Create(
+ const CreateCallback& create_callback) {
+ scoped_refptr<ContextProviderInProcess> provider =
+ new ContextProviderInProcess;
+ if (!provider->InitializeOnMainThread(create_callback))
+ return NULL;
+ return provider;
+}
+
+static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
+CreateOffscreenContext() {
+ WebKit::WebGraphicsContext3D::Attributes attributes;
+ attributes.depth = false;
+ attributes.stencil = true;
+ attributes.antialias = false;
+ attributes.shareResources = true;
+ attributes.noAutomaticFlushes = true;
+
+ return WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext(
+ attributes).Pass();
+}
+
+// static
+scoped_refptr<ContextProviderInProcess>
+ContextProviderInProcess::CreateOffscreen() {
+ return Create(base::Bind(&CreateOffscreenContext));
+}
+
ContextProviderInProcess::ContextProviderInProcess()
: destroyed_(false) {
DCHECK(main_thread_checker_.CalledOnValidThread());
@@ -64,22 +94,13 @@ ContextProviderInProcess::~ContextProviderInProcess() {
context_thread_checker_.CalledOnValidThread());
}
-bool ContextProviderInProcess::InitializeOnMainThread() {
+bool ContextProviderInProcess::InitializeOnMainThread(
+ const CreateCallback& create_callback) {
DCHECK(!context3d_);
DCHECK(main_thread_checker_.CalledOnValidThread());
+ DCHECK(!create_callback.is_null());
- WebKit::WebGraphicsContext3D::Attributes attributes;
- attributes.depth = false;
- attributes.stencil = true;
- attributes.antialias = false;
- attributes.shareResources = true;
- attributes.noAutomaticFlushes = true;
-
- using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
- context3d_ =
- WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext(
- attributes);
-
+ context3d_ = create_callback.Run();
return context3d_;
}
« no previous file with comments | « webkit/common/gpu/context_provider_in_process.h ('k') | webkit/common/gpu/test_context_provider_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698