summaryrefslogtreecommitdiffstats
path: root/webkit/gpu
diff options
context:
space:
mode:
authorkbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-19 16:59:31 +0000
committerkbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-19 16:59:31 +0000
commitf296411da3e9a63ae37058d918a4f0d8af84eff5 (patch)
tree343d6dc52c7f7008cf214a30285c0f8adf622e7e /webkit/gpu
parent9d6c2cec54d2f8c28f7d482b9129514fc6aa5cbc (diff)
downloadchromium_src-f296411da3e9a63ae37058d918a4f0d8af84eff5.zip
chromium_src-f296411da3e9a63ae37058d918a4f0d8af84eff5.tar.gz
chromium_src-f296411da3e9a63ae37058d918a4f0d8af84eff5.tar.bz2
Revert 189019 "Remove support for WebGraphicsContext3DInProcessI..."
Caused assertion failures in compositor and WebGL layout tests on debug bots. > Remove support for WebGraphicsContext3DInProcessImpl. > > This drops support for the InProcessImpl version from the offscreen > context provider, as well as the compositor context creation methods > for DumpRenderTree. > > R=jamesr,piman > BUG= > > > Review URL: https://chromiumcodereview.appspot.com/12545044 TBR=danakj@chromium.org Review URL: https://codereview.chromium.org/12938003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189045 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/gpu')
-rw-r--r--webkit/gpu/context_provider_in_process.cc58
-rw-r--r--webkit/gpu/context_provider_in_process.h17
-rw-r--r--webkit/gpu/test_context_provider_factory.cc29
-rw-r--r--webkit/gpu/test_context_provider_factory.h4
4 files changed, 83 insertions, 25 deletions
diff --git a/webkit/gpu/context_provider_in_process.cc b/webkit/gpu/context_provider_in_process.cc
index b7a98be..94c3767 100644
--- a/webkit/gpu/context_provider_in_process.cc
+++ b/webkit/gpu/context_provider_in_process.cc
@@ -5,6 +5,8 @@
#include "webkit/gpu/context_provider_in_process.h"
#include "webkit/gpu/grcontext_for_webgraphicscontext3d.h"
+#include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
+#include "webkit/gpu/webgraphicscontext3d_in_process_impl.h"
namespace webkit {
namespace gpu {
@@ -43,28 +45,17 @@ class ContextProviderInProcess::MemoryAllocationCallbackProxy
ContextProviderInProcess* provider_;
};
-ContextProviderInProcess::ContextProviderInProcess()
- : destroyed_(false) {
+ContextProviderInProcess::ContextProviderInProcess(InProcessType type)
+ : type_(type),
+ destroyed_(false) {
}
ContextProviderInProcess::~ContextProviderInProcess() {}
bool ContextProviderInProcess::InitializeOnMainThread() {
DCHECK(!context3d_);
-
- WebKit::WebGraphicsContext3D::Attributes attributes;
- attributes.depth = false;
- attributes.stencil = true;
- attributes.antialias = false;
- attributes.shareResources = true;
- attributes.noAutomaticFlushes = true;
-
- context3d_.reset(
- new webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl());
- if (!context3d_->Initialize(attributes, NULL))
- context3d_.reset();
-
- return context3d_;
+ context3d_ = CreateOffscreenContext3d().Pass();
+ return !!context3d_;
}
bool ContextProviderInProcess::BindToCurrentThread() {
@@ -130,5 +121,40 @@ void ContextProviderInProcess::OnMemoryAllocationChanged(
gr_context_->SetMemoryLimit(nonzero_allocation);
}
+static scoped_ptr<WebKit::WebGraphicsContext3D> CreateInProcessImpl(
+ const WebKit::WebGraphicsContext3D::Attributes& attributes) {
+ return make_scoped_ptr(
+ webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView(
+ attributes, false)).PassAs<WebKit::WebGraphicsContext3D>();
+}
+
+static scoped_ptr<WebKit::WebGraphicsContext3D> CreateCommandBufferImpl(
+ const WebKit::WebGraphicsContext3D::Attributes& attributes) {
+ scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl> ctx(
+ new webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl());
+ if (!ctx->Initialize(attributes, NULL))
+ return scoped_ptr<WebKit::WebGraphicsContext3D>();
+ return ctx.PassAs<WebKit::WebGraphicsContext3D>();
+}
+
+scoped_ptr<WebKit::WebGraphicsContext3D>
+ContextProviderInProcess::CreateOffscreenContext3d() {
+ WebKit::WebGraphicsContext3D::Attributes attributes;
+ attributes.depth = false;
+ attributes.stencil = true;
+ attributes.antialias = false;
+ attributes.shareResources = true;
+ attributes.noAutomaticFlushes = true;
+
+ switch (type_) {
+ case IN_PROCESS:
+ return CreateInProcessImpl(attributes).Pass();
+ case IN_PROCESS_COMMAND_BUFFER:
+ return CreateCommandBufferImpl(attributes).Pass();
+ }
+ NOTREACHED();
+ return CreateInProcessImpl(attributes).Pass();
+}
+
} // namespace gpu
} // namespace webkit
diff --git a/webkit/gpu/context_provider_in_process.h b/webkit/gpu/context_provider_in_process.h
index fd9c5f0..99ebdbf 100644
--- a/webkit/gpu/context_provider_in_process.h
+++ b/webkit/gpu/context_provider_in_process.h
@@ -9,7 +9,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
#include "cc/output/context_provider.h"
-#include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
#include "webkit/gpu/webkit_gpu_export.h"
namespace webkit {
@@ -19,9 +18,13 @@ class GrContextForWebGraphicsContext3D;
class WEBKIT_GPU_EXPORT ContextProviderInProcess
: NON_EXPORTED_BASE(public cc::ContextProvider) {
public:
- static scoped_refptr<ContextProviderInProcess> Create() {
+ enum InProcessType {
+ IN_PROCESS,
+ IN_PROCESS_COMMAND_BUFFER,
+ };
+ static scoped_refptr<ContextProviderInProcess> Create(InProcessType type) {
scoped_refptr<ContextProviderInProcess> provider =
- new ContextProviderInProcess;
+ new ContextProviderInProcess(type);
if (!provider->InitializeOnMainThread())
return NULL;
return provider;
@@ -34,18 +37,20 @@ class WEBKIT_GPU_EXPORT ContextProviderInProcess
virtual bool DestroyedOnMainThread() OVERRIDE;
protected:
- ContextProviderInProcess();
+ explicit ContextProviderInProcess(InProcessType type);
virtual ~ContextProviderInProcess();
bool InitializeOnMainThread();
+ scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext3d();
+
void OnLostContextInternal();
virtual void OnLostContext() {}
virtual void OnMemoryAllocationChanged(bool nonzero_allocation);
private:
- scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl>
- context3d_;
+ InProcessType type_;
+ scoped_ptr<WebKit::WebGraphicsContext3D> context3d_;
scoped_ptr<webkit::gpu::GrContextForWebGraphicsContext3D> gr_context_;
base::Lock destroyed_lock_;
diff --git a/webkit/gpu/test_context_provider_factory.cc b/webkit/gpu/test_context_provider_factory.cc
index 16f72aa..d86c950 100644
--- a/webkit/gpu/test_context_provider_factory.cc
+++ b/webkit/gpu/test_context_provider_factory.cc
@@ -14,9 +14,30 @@ namespace gpu {
#ifndef NDEBUG
static bool factory_set_up = false;
#endif
+static ContextProviderInProcess::InProcessType context_provider_type;
static TestContextProviderFactory* context_provider_instance = NULL;
// static
+void TestContextProviderFactory::SetUpFactoryForTesting(
+ webkit_support::GraphicsContext3DImplementation implementation) {
+#ifndef NDEBUG
+ factory_set_up = true;
+#endif
+
+ switch (implementation) {
+ case webkit_support::IN_PROCESS:
+ context_provider_type = webkit::gpu::ContextProviderInProcess::IN_PROCESS;
+ return;
+ case webkit_support::IN_PROCESS_COMMAND_BUFFER:
+ context_provider_type =
+ webkit::gpu::ContextProviderInProcess::IN_PROCESS_COMMAND_BUFFER;
+ return;
+ }
+ NOTREACHED();
+ context_provider_type = webkit::gpu::ContextProviderInProcess::IN_PROCESS;
+}
+
+// static
TestContextProviderFactory* TestContextProviderFactory::GetInstance() {
#ifndef NDEBUG
DCHECK(factory_set_up);
@@ -33,7 +54,7 @@ TestContextProviderFactory::~TestContextProviderFactory() {}
scoped_refptr<cc::ContextProvider> TestContextProviderFactory::
OffscreenContextProviderForMainThread() {
if (!main_thread_ || main_thread_->DestroyedOnMainThread()) {
- main_thread_ = ContextProviderInProcess::Create();
+ main_thread_ = ContextProviderInProcess::Create(context_provider_type);
if (main_thread_ && !main_thread_->BindToCurrentThread())
main_thread_ = NULL;
}
@@ -43,8 +64,10 @@ scoped_refptr<cc::ContextProvider> TestContextProviderFactory::
scoped_refptr<cc::ContextProvider> TestContextProviderFactory::
OffscreenContextProviderForCompositorThread() {
if (!compositor_thread_ ||
- compositor_thread_->DestroyedOnMainThread())
- compositor_thread_ = ContextProviderInProcess::Create();
+ compositor_thread_->DestroyedOnMainThread()) {
+ compositor_thread_ = ContextProviderInProcess::Create(
+ context_provider_type);
+ }
return compositor_thread_;
}
diff --git a/webkit/gpu/test_context_provider_factory.h b/webkit/gpu/test_context_provider_factory.h
index e6effbd..db1258d 100644
--- a/webkit/gpu/test_context_provider_factory.h
+++ b/webkit/gpu/test_context_provider_factory.h
@@ -19,6 +19,10 @@ class ContextProviderInProcess;
class WEBKIT_GPU_EXPORT TestContextProviderFactory {
public:
+ static void SetUpFactoryForTesting(
+ webkit_support::GraphicsContext3DImplementation implementation);
+
+ // SetUpFactoryForTesting() must be called before GetInstance can be called.
// The returned pointer is static and should not be deleted by the caller.
static TestContextProviderFactory* GetInstance();