Commit 680bd682 authored by kbr@chromium.org's avatar kbr@chromium.org

Revert 244383 "Use ContextProvider subclass to provide WGC3D poi..."

Likely cause of WebGL conformance test crashes on Android GPU bot.

BUG=333761,181120

> Use ContextProvider subclass to provide WGC3D pointers
> 
> Some cc::ContextProvider instances will also need to provide WebGraphicsContext3D*
> interfaces to the underlying GL context, but not all. This adds a subclass of ContextProvider
> in content:: to use for these users. The compositor itself doesn't need the WGC3D
> accessor so it just uses the base class.
> 
> BUG=181120
> 
> Review URL: https://codereview.chromium.org/126093010

TBR=jamesr@chromium.org

Review URL: https://codereview.chromium.org/136273002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244470 0039d316-1c4b-4281-b951-d872f2087c98
parent bcf30dae
......@@ -12,8 +12,6 @@
#include "webkit/common/gpu/context_provider_in_process.h"
#include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
using webkit::gpu::ContextProviderWebContext;
namespace content {
namespace {
......@@ -75,7 +73,7 @@ SynchronousCompositorFactoryImpl::GetInputHandlerManagerClient() {
return synchronous_input_event_filter();
}
scoped_refptr<ContextProviderWebContext>
scoped_refptr<cc::ContextProvider>
SynchronousCompositorFactoryImpl::GetOffscreenContextProviderForMainThread() {
// This check only guarantees the main thread context is created after
// a compositor did successfully initialize hardware draw in the past.
......
......@@ -9,7 +9,6 @@
#include "content/browser/android/in_process/synchronous_input_event_filter.h"
#include "content/renderer/android/synchronous_compositor_factory.h"
#include "content/renderer/media/android/stream_texture_factory_android_synchronous_impl.h"
#include "webkit/common/gpu/context_provider_web_context.h"
namespace gpu {
class GLInProcessContext;
......@@ -34,7 +33,7 @@ class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory {
virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(int routing_id)
OVERRIDE;
virtual InputHandlerManagerClient* GetInputHandlerManagerClient() OVERRIDE;
virtual scoped_refptr<webkit::gpu::ContextProviderWebContext>
virtual scoped_refptr<cc::ContextProvider>
GetOffscreenContextProviderForMainThread() OVERRIDE;
// This is called on both renderer main thread (offscreen context creation
// path shared between cross-process and in-process platforms) and renderer
......@@ -67,8 +66,7 @@ class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory {
// Only guards construction and destruction of
// |offscreen_context_for_compositor_thread_|, not usage.
base::Lock offscreen_context_for_compositor_thread_lock_;
scoped_refptr<webkit::gpu::ContextProviderWebContext>
offscreen_context_for_main_thread_;
scoped_refptr<cc::ContextProvider> offscreen_context_for_main_thread_;
// This is a pointer to the context owned by
// |offscreen_context_for_main_thread_|.
gpu::GLInProcessContext* wrapped_gl_context_for_main_thread_;
......
......@@ -87,15 +87,6 @@ int ContextProviderCommandBuffer::GetGPUProcessID() {
return context3d_->GetGPUProcessID();
}
WebGraphicsContext3DCommandBufferImpl*
ContextProviderCommandBuffer::WebContext3D() {
DCHECK(context3d_);
DCHECK(lost_context_callback_proxy_); // Is bound to thread.
DCHECK(context_thread_checker_.CalledOnValidThread());
return context3d_.get();
}
bool ContextProviderCommandBuffer::BindToCurrentThread() {
// This is called on the thread the context will be used.
DCHECK(context_thread_checker_.CalledOnValidThread());
......@@ -119,8 +110,12 @@ bool ContextProviderCommandBuffer::BindToCurrentThread() {
return true;
}
blink::WebGraphicsContext3D* ContextProviderCommandBuffer::Context3d() {
return NULL;
WebGraphicsContext3DCommandBufferImpl*
ContextProviderCommandBuffer::Context3d() {
DCHECK(lost_context_callback_proxy_); // Is bound to thread.
DCHECK(context_thread_checker_.CalledOnValidThread());
return context3d_.get();
}
gpu::gles2::GLES2Interface* ContextProviderCommandBuffer::ContextGL() {
......
......@@ -12,7 +12,6 @@
#include "cc/output/context_provider.h"
#include "content/common/content_export.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "webkit/common/gpu/context_provider_web_context.h"
namespace webkit {
namespace gpu {
......@@ -25,7 +24,7 @@ namespace content {
// Implementation of cc::ContextProvider that provides a
// WebGraphicsContext3DCommandBufferImpl context and a GrContext.
class CONTENT_EXPORT ContextProviderCommandBuffer
: NON_EXPORTED_BASE(public webkit::gpu::ContextProviderWebContext) {
: NON_EXPORTED_BASE(public cc::ContextProvider) {
public:
static scoped_refptr<ContextProviderCommandBuffer> Create(
scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d,
......@@ -39,12 +38,9 @@ class CONTENT_EXPORT ContextProviderCommandBuffer
leak_on_destroy_ = true;
}
// ContextProviderWebContext implementation.
virtual WebGraphicsContext3DCommandBufferImpl* WebContext3D() OVERRIDE;
// cc::ContextProvider implementation.
virtual bool BindToCurrentThread() OVERRIDE;
virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE;
virtual WebGraphicsContext3DCommandBufferImpl* Context3d() OVERRIDE;
virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE;
virtual gpu::ContextSupport* ContextSupport() OVERRIDE;
virtual class GrContext* GrContext() OVERRIDE;
......
......@@ -519,8 +519,6 @@
'renderer/webcrypto/webcrypto_impl_openssl.cc',
'renderer/webcrypto/webcrypto_util.cc',
'renderer/webcrypto/webcrypto_util.h',
'renderer/webgraphicscontext3d_provider_impl.cc',
'renderer/webgraphicscontext3d_provider_impl.h',
'renderer/webpublicsuffixlist_impl.cc',
'renderer/webpublicsuffixlist_impl.h',
'renderer/websharedworker_proxy.cc',
......
......@@ -17,12 +17,6 @@ class ContextProvider;
class OutputSurface;
}
namespace webkit {
namespace gpu {
class ContextProviderWebContext;
}
}
namespace content {
class InputHandlerManagerClient;
......@@ -47,7 +41,7 @@ class SynchronousCompositorFactory {
// The factory maintains ownership of the returned interface.
virtual InputHandlerManagerClient* GetInputHandlerManagerClient() = 0;
virtual scoped_refptr<webkit::gpu::ContextProviderWebContext>
virtual scoped_refptr<cc::ContextProvider>
GetOffscreenContextProviderForMainThread() = 0;
virtual scoped_refptr<cc::ContextProvider>
GetOffscreenContextProviderForCompositorThread() = 0;
......
......@@ -58,12 +58,14 @@ RendererGpuVideoAcceleratorFactories::GetContext3d() {
DCHECK(task_runner_->BelongsToCurrentThread());
if (!context_provider_)
return NULL;
if (context_provider_->IsContextLost()) {
WebGraphicsContext3DCommandBufferImpl* context =
context_provider_->Context3d();
if (context->isContextLost()) {
context_provider_->VerifyContexts();
context_provider_ = NULL;
return NULL;
}
return context_provider_->WebContext3D();
return context;
}
void RendererGpuVideoAcceleratorFactories::AsyncBindContext() {
......
......@@ -949,7 +949,7 @@ RenderThreadImpl::OffscreenCompositorContextProvider() {
return offscreen_compositor_contexts_;
}
scoped_refptr<webkit::gpu::ContextProviderWebContext>
scoped_refptr<cc::ContextProvider>
RenderThreadImpl::SharedMainThreadContextProvider() {
DCHECK(IsMainThread());
#if defined(OS_ANDROID)
......
......@@ -58,7 +58,6 @@ class Extension;
namespace webkit {
namespace gpu {
class ContextProviderWebContext;
class GrContextForWebGraphicsContext3D;
}
}
......@@ -264,8 +263,7 @@ class CONTENT_EXPORT RenderThreadImpl : public RenderThread,
scoped_refptr<RendererGpuVideoAcceleratorFactories> GetGpuFactories();
scoped_refptr<cc::ContextProvider> OffscreenCompositorContextProvider();
scoped_refptr<webkit::gpu::ContextProviderWebContext>
SharedMainThreadContextProvider();
scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider();
// AudioRendererMixerManager instance which manages renderer side mixer
// instances shared based on configured audio parameters. Lazily created on
......
......@@ -48,7 +48,6 @@
#include "content/renderer/renderer_clipboard_client.h"
#include "content/renderer/webclipboard_impl.h"
#include "content/renderer/webcrypto/webcrypto_impl.h"
#include "content/renderer/webgraphicscontext3d_provider_impl.h"
#include "content/renderer/webpublicsuffixlist_impl.h"
#include "gpu/config/gpu_info.h"
#include "ipc/ipc_sync_message_filter.h"
......@@ -71,7 +70,7 @@
#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
#include "ui/gfx/color_profile.h"
#include "url/gurl.h"
#include "webkit/common/gpu/context_provider_web_context.h"
#include "webkit/common/gpu/webgraphicscontext3d_provider_impl.h"
#include "webkit/common/quota/quota_types.h"
#include "webkit/glue/simple_webmimeregistry_impl.h"
#include "webkit/glue/webfileutilities_impl.h"
......@@ -969,11 +968,11 @@ RendererWebKitPlatformSupportImpl::createOffscreenGraphicsContext3D(
blink::WebGraphicsContext3DProvider* RendererWebKitPlatformSupportImpl::
createSharedOffscreenGraphicsContext3DProvider() {
scoped_refptr<webkit::gpu::ContextProviderWebContext> provider =
scoped_refptr<cc::ContextProvider> provider =
RenderThreadImpl::current()->SharedMainThreadContextProvider();
if (!provider)
return NULL;
return new WebGraphicsContext3DProviderImpl(provider);
return new webkit::gpu::WebGraphicsContext3DProviderImpl(provider);
}
//------------------------------------------------------------------------------
......
......@@ -77,13 +77,6 @@ ContextProviderInProcess::~ContextProviderInProcess() {
context_thread_checker_.CalledOnValidThread());
}
blink::WebGraphicsContext3D* ContextProviderInProcess::WebContext3D() {
DCHECK(lost_context_callback_proxy_); // Is bound to thread.
DCHECK(context_thread_checker_.CalledOnValidThread());
return context3d_.get();
}
bool ContextProviderInProcess::BindToCurrentThread() {
DCHECK(context3d_);
......
......@@ -9,7 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
#include "base/threading/thread_checker.h"
#include "webkit/common/gpu/context_provider_web_context.h"
#include "cc/output/context_provider.h"
#include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
#include "webkit/common/gpu/webkit_gpu_export.h"
......@@ -20,7 +20,7 @@ namespace gpu {
class GrContextForWebGraphicsContext3D;
class WEBKIT_GPU_EXPORT ContextProviderInProcess
: NON_EXPORTED_BASE(public ContextProviderWebContext) {
: NON_EXPORTED_BASE(public cc::ContextProvider) {
public:
static scoped_refptr<ContextProviderInProcess> Create(
scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d,
......@@ -30,7 +30,6 @@ class WEBKIT_GPU_EXPORT ContextProviderInProcess
// context.
static scoped_refptr<ContextProviderInProcess> CreateOffscreen();
virtual blink::WebGraphicsContext3D* WebContext3D() OVERRIDE;
virtual bool BindToCurrentThread() OVERRIDE;
virtual Capabilities ContextCapabilities() OVERRIDE;
virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE;
......
// Copyright 2014 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 WEBKIT_COMMON_GPU_CONTEXT_PROVIDER_WEB_CONTEXT_H_
#define WEBKIT_COMMON_GPU_CONTEXT_PROVIDER_WEB_CONTEXT_H_
#include "cc/output/context_provider.h"
namespace blink { class WebGraphicsContext3D; }
namespace webkit {
namespace gpu {
class ContextProviderWebContext : public cc::ContextProvider {
public:
virtual blink::WebGraphicsContext3D* WebContext3D() = 0;
protected:
virtual ~ContextProviderWebContext() {}
};
} // namespace gpu
} // namespace webkit
#endif // WEBKIT_COMMON_GPU_CONTEXT_PROVIDER_WEB_CONTEXT_H_
// Copyright 2014 The Chromium Authors. All rights reserved.
// 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.
#include "content/renderer/webgraphicscontext3d_provider_impl.h"
#include "webkit/common/gpu/webgraphicscontext3d_provider_impl.h"
#include "webkit/common/gpu/context_provider_web_context.h"
#include "cc/output/context_provider.h"
namespace content {
namespace webkit {
namespace gpu {
WebGraphicsContext3DProviderImpl::WebGraphicsContext3DProviderImpl(
scoped_refptr<webkit::gpu::ContextProviderWebContext> provider)
scoped_refptr<cc::ContextProvider> provider)
: provider_(provider) {}
WebGraphicsContext3DProviderImpl::~WebGraphicsContext3DProviderImpl() {}
blink::WebGraphicsContext3D* WebGraphicsContext3DProviderImpl::context3d() {
return provider_->WebContext3D();
return provider_->Context3d();
}
GrContext* WebGraphicsContext3DProviderImpl::grContext() {
return provider_->GrContext();
}
} // namespace content
} // namespace gpu
} // namespace webkit
// Copyright 2014 The Chromium Authors. All rights reserved.
// 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_RENDERER_WEBGRAPHICSCONTEXT3D_PROVIDER_IMPL_H_
#define CONTENT_RENDERER_WEBGRAPHICSCONTEXT3D_PROVIDER_IMPL_H_
#ifndef WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_PROVIDER_IMPL_H_
#define WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_PROVIDER_IMPL_H_
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "content/common/content_export.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3DProvider.h"
#include "webkit/common/gpu/webkit_gpu_export.h"
namespace cc { class ContextProvider; }
namespace webkit {
namespace gpu {
class ContextProviderWebContext;
} // namespace webkit
} // namespace gpu
namespace content {
class CONTENT_EXPORT WebGraphicsContext3DProviderImpl
class WEBKIT_GPU_EXPORT WebGraphicsContext3DProviderImpl
: public NON_EXPORTED_BASE(blink::WebGraphicsContext3DProvider) {
public:
explicit WebGraphicsContext3DProviderImpl(
scoped_refptr<webkit::gpu::ContextProviderWebContext> provider);
scoped_refptr<cc::ContextProvider> provider);
virtual ~WebGraphicsContext3DProviderImpl();
// WebGraphicsContext3DProvider implementation.
......@@ -30,9 +27,10 @@ class CONTENT_EXPORT WebGraphicsContext3DProviderImpl
virtual GrContext* grContext() OVERRIDE;
private:
scoped_refptr<webkit::gpu::ContextProviderWebContext> provider_;
scoped_refptr<cc::ContextProvider> provider_;
};
} // namespace content
} // namespace gpu
} // namespace webkit
#endif // CONTENT_RENDERER_WEBGRAPHICSCONTEXT3D_PROVIDER_IMPL_H_
#endif // WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_PROVIDER_IMPL_H_
......@@ -33,13 +33,14 @@
# This list contains all .h and .cc in gpu except for test code.
'context_provider_in_process.cc',
'context_provider_in_process.h',
'context_provider_web_context.h',
'grcontext_for_webgraphicscontext3d.cc',
'grcontext_for_webgraphicscontext3d.h',
'test_context_provider_factory.cc',
'test_context_provider_factory.h',
'webgraphicscontext3d_in_process_command_buffer_impl.cc',
'webgraphicscontext3d_in_process_command_buffer_impl.h',
'webgraphicscontext3d_provider_impl.cc',
'webgraphicscontext3d_provider_impl.h',
],
'defines': [
'WEBKIT_GPU_IMPLEMENTATION',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment