Commit 788dba55 authored by boliu@chromium.org's avatar boliu@chromium.org

Add ContextProvider overrides to SynchronousCompositorFactory

SynchronousCompositorFactory does not create the main thread
one since we have not figured out how to get its clients
(video/webgl/canvas) to work in this architecture. This will
cause dynamic but graceful failures when trying to load these
type of contents.

For compositor thread one, create ContextProviderInProcess.

BUG=230197,239760
NOTRY=true

Review URL: https://chromiumcodereview.appspot.com/16235005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204941 0039d316-1c4b-4281-b951-d872f2087c98
parent deadc49b
......@@ -12,6 +12,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/renderer/android/synchronous_compositor_factory.h"
#include "webkit/common/gpu/context_provider_in_process.h"
namespace content {
......@@ -59,8 +60,26 @@ class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory {
return &synchronous_input_event_filter_;
}
virtual scoped_refptr<cc::ContextProvider>
GetOffscreenContextProviderForMainThread() OVERRIDE {
NOTIMPLEMENTED()
<< "Synchronous compositor does not support main thread context yet.";
return scoped_refptr<cc::ContextProvider>();
}
virtual scoped_refptr<cc::ContextProvider>
GetOffscreenContextProviderForCompositorThread() OVERRIDE {
if (!offscreen_context_for_compositor_thread_ ||
offscreen_context_for_compositor_thread_->DestroyedOnMainThread()) {
offscreen_context_for_compositor_thread_ =
webkit::gpu::ContextProviderInProcess::Create();
}
return offscreen_context_for_compositor_thread_;
}
private:
SynchronousInputEventFilter synchronous_input_event_filter_;
scoped_refptr<cc::ContextProvider> offscreen_context_for_compositor_thread_;
};
base::LazyInstance<SynchronousCompositorFactoryImpl>::Leaky g_factory =
......
......@@ -13,6 +13,7 @@ class MessageLoopProxy;
}
namespace cc {
class ContextProvider;
class OutputSurface;
}
......@@ -39,6 +40,11 @@ class SynchronousCompositorFactory {
// The factory maintains ownership of the returned interface.
virtual InputHandlerManagerClient* GetInputHandlerManagerClient() = 0;
virtual scoped_refptr<cc::ContextProvider>
GetOffscreenContextProviderForMainThread() = 0;
virtual scoped_refptr<cc::ContextProvider>
GetOffscreenContextProviderForCompositorThread() = 0;
protected:
SynchronousCompositorFactory() {}
~SynchronousCompositorFactory() {}
......
......@@ -1026,10 +1026,17 @@ RenderThreadImpl::CreateOffscreenContext3d() {
GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d")));
}
scoped_refptr<ContextProviderCommandBuffer>
scoped_refptr<cc::ContextProvider>
RenderThreadImpl::OffscreenContextProviderForMainThread() {
DCHECK(IsMainThread());
#if defined(OS_ANDROID)
if (SynchronousCompositorFactory* factory =
SynchronousCompositorFactory::GetInstance()) {
return factory->GetOffscreenContextProviderForMainThread();
}
#endif
if (!shared_contexts_main_thread_.get() ||
shared_contexts_main_thread_->DestroyedOnMainThread()) {
shared_contexts_main_thread_ =
......@@ -1041,10 +1048,17 @@ RenderThreadImpl::OffscreenContextProviderForMainThread() {
return shared_contexts_main_thread_;
}
scoped_refptr<ContextProviderCommandBuffer>
scoped_refptr<cc::ContextProvider>
RenderThreadImpl::OffscreenContextProviderForCompositorThread() {
DCHECK(IsMainThread());
#if defined(OS_ANDROID)
if (SynchronousCompositorFactory* factory =
SynchronousCompositorFactory::GetInstance()) {
return factory->GetOffscreenContextProviderForCompositorThread();
}
#endif
if (!shared_contexts_compositor_thread_.get() ||
shared_contexts_compositor_thread_->DestroyedOnMainThread()) {
shared_contexts_compositor_thread_ =
......
......@@ -278,9 +278,9 @@ class CONTENT_EXPORT RenderThreadImpl : public RenderThread,
// Handle loss of the shared GpuVDAContext3D context above.
static void OnGpuVDAContextLoss();
scoped_refptr<ContextProviderCommandBuffer>
scoped_refptr<cc::ContextProvider>
OffscreenContextProviderForMainThread();
scoped_refptr<ContextProviderCommandBuffer>
scoped_refptr<cc::ContextProvider>
OffscreenContextProviderForCompositorThread();
// AudioRendererMixerManager instance which manages renderer side mixer
......
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