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

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

Issue 23247002: Remove base::Callback from ContextProvider creation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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') | no next file » | 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 9b4352fc0f0bb10ff3ee7c21f9ed43ade270433c..b7e3cc47140a31ce61bcfb13e8b2cb2767b7a805 100644
--- a/webkit/common/gpu/context_provider_in_process.cc
+++ b/webkit/common/gpu/context_provider_in_process.cc
@@ -78,16 +78,15 @@ class ContextProviderInProcess::MemoryAllocationCallbackProxy
// static
scoped_refptr<ContextProviderInProcess> ContextProviderInProcess::Create(
- const CreateCallback& create_callback) {
- scoped_refptr<ContextProviderInProcess> provider =
- new ContextProviderInProcess;
- if (!provider->InitializeOnMainThread(create_callback))
+ scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d) {
+ if (!context3d)
return NULL;
- return provider;
+ return new ContextProviderInProcess(context3d.Pass());
}
-static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
-CreateOffscreenContext() {
+// static
+scoped_refptr<ContextProviderInProcess>
+ContextProviderInProcess::CreateOffscreen() {
WebKit::WebGraphicsContext3D::Attributes attributes;
attributes.depth = false;
attributes.stencil = true;
@@ -95,19 +94,17 @@ CreateOffscreenContext() {
attributes.shareResources = true;
attributes.noAutomaticFlushes = true;
- return WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext(
- attributes).Pass();
+ return Create(
+ WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext(
+ attributes));
}
-// static
-scoped_refptr<ContextProviderInProcess>
-ContextProviderInProcess::CreateOffscreen() {
- return Create(base::Bind(&CreateOffscreenContext));
-}
-
-ContextProviderInProcess::ContextProviderInProcess()
- : destroyed_(false) {
+ContextProviderInProcess::ContextProviderInProcess(
+ scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d)
+ : context3d_(context3d.Pass()),
+ destroyed_(false) {
DCHECK(main_thread_checker_.CalledOnValidThread());
+ DCHECK(context3d_);
context_thread_checker_.DetachFromThread();
}
@@ -116,16 +113,6 @@ ContextProviderInProcess::~ContextProviderInProcess() {
context_thread_checker_.CalledOnValidThread());
}
-bool ContextProviderInProcess::InitializeOnMainThread(
- const CreateCallback& create_callback) {
- DCHECK(!context3d_);
- DCHECK(main_thread_checker_.CalledOnValidThread());
- DCHECK(!create_callback.is_null());
-
- context3d_ = create_callback.Run();
- return context3d_;
-}
-
bool ContextProviderInProcess::BindToCurrentThread() {
DCHECK(context3d_);
« no previous file with comments | « webkit/common/gpu/context_provider_in_process.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698