| Index: webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc
|
| diff --git a/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc b/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc
|
| index 5dd58feeee7903744b080ae17009f12b2e43cd2e..57fe98ac50c064b108ee6a180f938c755b09ec5b 100644
|
| --- a/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc
|
| +++ b/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc
|
| @@ -23,23 +23,27 @@
|
| #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h"
|
| #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewClient.h"
|
| #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h"
|
| -#include "third_party/WebKit/Source/Platform/chromium/public/WebSharedGraphicsContext3D.h"
|
| #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
|
| #include "webkit/compositor_bindings/web_compositor_support_impl.h"
|
| #include "webkit/compositor_bindings/web_compositor_support_software_output_device.h"
|
| #include "webkit/compositor_bindings/web_layer_impl.h"
|
| #include "webkit/compositor_bindings/web_rendering_stats_impl.h"
|
| #include "webkit/compositor_bindings/web_to_ccinput_handler_adapter.h"
|
| -#include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
|
| +#include "webkit/gpu/test_context_provider_factory.h"
|
| +#include "webkit/support/test_webkit_platform_support.h"
|
|
|
| namespace WebKit {
|
|
|
| WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting(
|
| RenderingType type, WebKit::WebLayerTreeViewClient* client)
|
| : type_(type),
|
| - client_(client) {}
|
| + client_(client),
|
| + context_provider_factory_(NULL) {}
|
|
|
| -WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {}
|
| +WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {
|
| + if (context_provider_factory_)
|
| + webkit::gpu::TestContextProviderFactory::DestroyInstance();
|
| +}
|
|
|
| bool WebLayerTreeViewImplForTesting::initialize(
|
| scoped_ptr<cc::Thread> compositor_thread) {
|
| @@ -225,77 +229,23 @@ void WebLayerTreeViewImplForTesting::scheduleComposite() {
|
| client_->scheduleComposite();
|
| }
|
|
|
| -class WebLayerTreeViewImplForTesting::MainThreadContextProvider
|
| - : public cc::ContextProvider {
|
| - public:
|
| - virtual bool InitializeOnMainThread() OVERRIDE { return true; }
|
| - virtual bool BindToCurrentThread() OVERRIDE { return true; }
|
| -
|
| - virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE {
|
| - return WebSharedGraphicsContext3D::mainThreadContext();
|
| - }
|
| - virtual class GrContext* GrContext() OVERRIDE {
|
| - return WebSharedGraphicsContext3D::mainThreadGrContext();
|
| - }
|
| -
|
| - virtual void VerifyContexts() OVERRIDE {}
|
| -
|
| - protected:
|
| - virtual ~MainThreadContextProvider() {}
|
| -};
|
| -
|
| scoped_refptr<cc::ContextProvider>
|
| WebLayerTreeViewImplForTesting::OffscreenContextProviderForMainThread() {
|
| - if (!contexts_main_thread_)
|
| - contexts_main_thread_ = new MainThreadContextProvider;
|
| - return contexts_main_thread_;
|
| -}
|
| -
|
| -class WebLayerTreeViewImplForTesting::CompositorThreadContextProvider
|
| - : public cc::ContextProvider {
|
| - public:
|
| - CompositorThreadContextProvider() : destroyed_(false) {}
|
| -
|
| - virtual bool InitializeOnMainThread() OVERRIDE {
|
| - return WebSharedGraphicsContext3D::createCompositorThreadContext();
|
| - }
|
| - virtual bool BindToCurrentThread() OVERRIDE {
|
| - return Context3d()->makeContextCurrent();
|
| + if (!context_provider_factory_) {
|
| + context_provider_factory_ =
|
| + webkit::gpu::TestContextProviderFactory::GetInstance();
|
| }
|
| -
|
| - virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE {
|
| - return WebSharedGraphicsContext3D::compositorThreadContext();
|
| - }
|
| - virtual class GrContext* GrContext() OVERRIDE {
|
| - return WebSharedGraphicsContext3D::compositorThreadGrContext();
|
| - }
|
| -
|
| - virtual void VerifyContexts() OVERRIDE {
|
| - if (Context3d() && !Context3d()->isContextLost())
|
| - return;
|
| - base::AutoLock lock(destroyed_lock_);
|
| - destroyed_ = true;
|
| - }
|
| -
|
| - bool DestroyedOnMainThread() {
|
| - base::AutoLock lock(destroyed_lock_);
|
| - return destroyed_;
|
| - }
|
| -
|
| - protected:
|
| - virtual ~CompositorThreadContextProvider() {}
|
| -
|
| - private:
|
| - base::Lock destroyed_lock_;
|
| - bool destroyed_;
|
| -};
|
| + return context_provider_factory_->OffscreenContextProviderForMainThread();
|
| +}
|
|
|
| scoped_refptr<cc::ContextProvider>
|
| WebLayerTreeViewImplForTesting::OffscreenContextProviderForCompositorThread() {
|
| - if (!contexts_compositor_thread_ ||
|
| - contexts_compositor_thread_->DestroyedOnMainThread())
|
| - contexts_compositor_thread_ = new CompositorThreadContextProvider;
|
| - return contexts_compositor_thread_;
|
| + if (!context_provider_factory_) {
|
| + context_provider_factory_ =
|
| + webkit::gpu::TestContextProviderFactory::GetInstance();
|
| + }
|
| + return
|
| + context_provider_factory_->OffscreenContextProviderForCompositorThread();
|
| }
|
|
|
| } // namespace WebKit
|
|
|