| Index: ui/compositor/compositor.cc
|
| diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
|
| index 5739bbf233c88e6c092d041a8217e36ea2cef794..6defa978a49f665f7a6b797f556f3252eabf4441 100644
|
| --- a/ui/compositor/compositor.cc
|
| +++ b/ui/compositor/compositor.cc
|
| @@ -16,6 +16,7 @@
|
| #include "base/threading/thread.h"
|
| #include "base/threading/thread_restrictions.h"
|
| #include "cc/base/switches.h"
|
| +#include "cc/debug/fake_context_provider.h"
|
| #include "cc/input/input_handler.h"
|
| #include "cc/layers/layer.h"
|
| #include "cc/output/context_provider.h"
|
| @@ -24,7 +25,6 @@
|
| #include "third_party/skia/include/core/SkBitmap.h"
|
| #include "ui/compositor/compositor_observer.h"
|
| #include "ui/compositor/compositor_switches.h"
|
| -#include "ui/compositor/context_provider_from_context_factory.h"
|
| #include "ui/compositor/dip_util.h"
|
| #include "ui/compositor/layer.h"
|
| #include "ui/compositor/reflector.h"
|
| @@ -33,6 +33,7 @@
|
| #include "ui/gl/gl_implementation.h"
|
| #include "ui/gl/gl_surface.h"
|
| #include "ui/gl/gl_switches.h"
|
| +#include "webkit/common/gpu/context_provider_in_process.h"
|
| #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h"
|
| #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
|
|
|
| @@ -108,13 +109,17 @@ bool DefaultContextFactory::Initialize() {
|
|
|
| scoped_ptr<cc::OutputSurface> DefaultContextFactory::CreateOutputSurface(
|
| Compositor* compositor) {
|
| - return make_scoped_ptr(new cc::OutputSurface(
|
| - CreateContextCommon(compositor, false)));
|
| -}
|
| + WebKit::WebGraphicsContext3D::Attributes attrs;
|
| + attrs.depth = false;
|
| + attrs.stencil = false;
|
| + attrs.antialias = false;
|
| + attrs.shareResources = true;
|
|
|
| -scoped_ptr<WebKit::WebGraphicsContext3D>
|
| -DefaultContextFactory::CreateOffscreenContext() {
|
| - return CreateContextCommon(NULL, true);
|
| + using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
|
| + scoped_ptr<WebKit::WebGraphicsContext3D> context(
|
| + WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext(
|
| + attrs, compositor->widget()));
|
| + return make_scoped_ptr(new cc::OutputSurface(context.Pass()));
|
| }
|
|
|
| scoped_refptr<Reflector> DefaultContextFactory::CreateReflector(
|
| @@ -132,7 +137,7 @@ DefaultContextFactory::OffscreenContextProviderForMainThread() {
|
| if (!offscreen_contexts_main_thread_.get() ||
|
| !offscreen_contexts_main_thread_->DestroyedOnMainThread()) {
|
| offscreen_contexts_main_thread_ =
|
| - ContextProviderFromContextFactory::CreateForOffscreen(this);
|
| + webkit::gpu::ContextProviderInProcess::Create();
|
| if (offscreen_contexts_main_thread_.get() &&
|
| !offscreen_contexts_main_thread_->BindToCurrentThread())
|
| offscreen_contexts_main_thread_ = NULL;
|
| @@ -145,7 +150,7 @@ DefaultContextFactory::OffscreenContextProviderForCompositorThread() {
|
| if (!offscreen_contexts_compositor_thread_.get() ||
|
| !offscreen_contexts_compositor_thread_->DestroyedOnMainThread()) {
|
| offscreen_contexts_compositor_thread_ =
|
| - ContextProviderFromContextFactory::CreateForOffscreen(this);
|
| + webkit::gpu::ContextProviderInProcess::Create();
|
| }
|
| return offscreen_contexts_compositor_thread_;
|
| }
|
| @@ -155,24 +160,6 @@ void DefaultContextFactory::RemoveCompositor(Compositor* compositor) {
|
|
|
| bool DefaultContextFactory::DoesCreateTestContexts() { return false; }
|
|
|
| -scoped_ptr<WebKit::WebGraphicsContext3D>
|
| -DefaultContextFactory::CreateContextCommon(Compositor* compositor,
|
| - bool offscreen) {
|
| - DCHECK(offscreen || compositor);
|
| - WebKit::WebGraphicsContext3D::Attributes attrs;
|
| - attrs.depth = false;
|
| - attrs.stencil = false;
|
| - attrs.antialias = false;
|
| - attrs.shareResources = true;
|
| - using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
|
| - if (offscreen) {
|
| - return WebGraphicsContext3DInProcessCommandBufferImpl::
|
| - CreateOffscreenContext(attrs);
|
| - }
|
| - return WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext(
|
| - attrs, compositor->widget());
|
| -}
|
| -
|
| TestContextFactory::TestContextFactory() {}
|
|
|
| TestContextFactory::~TestContextFactory() {}
|
| @@ -182,14 +169,6 @@ scoped_ptr<cc::OutputSurface> TestContextFactory::CreateOutputSurface(
|
| return make_scoped_ptr(new cc::OutputSurface(CreateOffscreenContext()));
|
| }
|
|
|
| -scoped_ptr<WebKit::WebGraphicsContext3D>
|
| -TestContextFactory::CreateOffscreenContext() {
|
| - scoped_ptr<ui::TestWebGraphicsContext3D> context(
|
| - new ui::TestWebGraphicsContext3D);
|
| - context->Initialize();
|
| - return context.PassAs<WebKit::WebGraphicsContext3D>();
|
| -}
|
| -
|
| scoped_refptr<Reflector> TestContextFactory::CreateReflector(
|
| Compositor* mirrored_compositor,
|
| Layer* mirroring_layer) {
|
| @@ -203,8 +182,8 @@ scoped_refptr<cc::ContextProvider>
|
| TestContextFactory::OffscreenContextProviderForMainThread() {
|
| if (!offscreen_contexts_main_thread_.get() ||
|
| offscreen_contexts_main_thread_->DestroyedOnMainThread()) {
|
| - offscreen_contexts_main_thread_ =
|
| - ContextProviderFromContextFactory::CreateForOffscreen(this);
|
| + offscreen_contexts_main_thread_ = cc::FakeContextProvider::Create(
|
| + base::Bind(&TestContextFactory::CreateOffscreenContext));
|
| CHECK(offscreen_contexts_main_thread_->BindToCurrentThread());
|
| }
|
| return offscreen_contexts_main_thread_;
|
| @@ -214,8 +193,8 @@ scoped_refptr<cc::ContextProvider>
|
| TestContextFactory::OffscreenContextProviderForCompositorThread() {
|
| if (!offscreen_contexts_compositor_thread_.get() ||
|
| offscreen_contexts_compositor_thread_->DestroyedOnMainThread()) {
|
| - offscreen_contexts_compositor_thread_ =
|
| - ContextProviderFromContextFactory::CreateForOffscreen(this);
|
| + offscreen_contexts_compositor_thread_ = cc::FakeContextProvider::Create(
|
| + base::Bind(&TestContextFactory::CreateOffscreenContext));
|
| }
|
| return offscreen_contexts_compositor_thread_;
|
| }
|
| @@ -225,6 +204,15 @@ void TestContextFactory::RemoveCompositor(Compositor* compositor) {
|
|
|
| bool TestContextFactory::DoesCreateTestContexts() { return true; }
|
|
|
| +// static
|
| +scoped_ptr<WebKit::WebGraphicsContext3D>
|
| +TestContextFactory::CreateOffscreenContext() {
|
| + scoped_ptr<ui::TestWebGraphicsContext3D> context(
|
| + new ui::TestWebGraphicsContext3D);
|
| + context->Initialize();
|
| + return context.PassAs<WebKit::WebGraphicsContext3D>();
|
| +}
|
| +
|
| Texture::Texture(bool flipped, const gfx::Size& size, float device_scale_factor)
|
| : size_(size),
|
| flipped_(flipped),
|
|
|