cc: Finish the rename from cc::GraphicsContext to cc::OutputSurface
It is far too confusing to deal with OutputSurface code when half the time it is called a GraphicsContext incorrectly. Cleaning this up so I can think about the code properly as I upstream the Ubercomp CL. R=jamesr,piman BUG=146080 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=171403 Review URL: https://codereview.chromium.org/11450019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171410 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
cc
DEPScc.gypcc_tests.gypdelegated_renderer_layer_impl.ccdelegated_renderer_layer_impl.hdelegated_renderer_layer_impl_unittest.ccgl_renderer.ccgl_renderer.hgl_renderer_unittest.ccgraphics_context.hheads_up_display_layer_impl.ccheads_up_display_layer_impl.hio_surface_layer_impl.ccio_surface_layer_impl.hlayer_impl.cclayer_impl.hlayer_tree_host.cclayer_tree_host.hlayer_tree_host_impl.cclayer_tree_host_impl.hlayer_tree_host_impl_unittest.cclayer_tree_host_unittest.ccnine_patch_layer_impl.ccnine_patch_layer_impl.hnine_patch_layer_unittest.ccoutput_surface.hprioritized_resource_unittest.ccproxy.hrenderer.hresource_provider.ccresource_provider.hresource_provider_unittest.ccresource_update_controller_unittest.ccscheduler.ccscheduler.hscheduler_state_machine.ccscheduler_state_machine.hscheduler_state_machine_unittest.ccscoped_resource_unittest.ccscrollbar_layer_impl.ccscrollbar_layer_impl.hsingle_thread_proxy.ccsingle_thread_proxy.hsoftware_renderer.ccsoftware_renderer_unittest.cc
test
fake_graphics_context.hfake_output_surface.hfake_proxy.ccfake_proxy.hfake_web_graphics_context_3d_unittest.cc
texture_layer.cctexture_layer_impl.cctexture_layer_impl.hthread_proxy.ccthread_proxy.htiled_layer_impl.cctiled_layer_impl.htiled_layer_unittest.ccvideo_layer_impl.ccvideo_layer_impl.hwebkit/compositor_bindings
5
cc/DEPS
5
cc/DEPS
@ -1,8 +1,11 @@
|
||||
include_rules = [
|
||||
"+media",
|
||||
"+skia/ext",
|
||||
"+third_party/skia/include",
|
||||
"+third_party/khronos/GLES2/gl2.h",
|
||||
"+third_party/khronos/GLES2/gl2ext.h",
|
||||
"+ui/gfx",
|
||||
"+media",
|
||||
# TODO(danakj): Drop dependencies on WebKit Platform API from cc.
|
||||
"+third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h",
|
||||
"+third_party/WebKit/Source/Platform/chromium/public/WebGraphicsMemoryAllocation.h",
|
||||
]
|
||||
|
@ -62,7 +62,6 @@
|
||||
'gl_renderer.h',
|
||||
'gl_renderer_draw_cache.cc',
|
||||
'gl_renderer_draw_cache.h',
|
||||
'graphics_context.h',
|
||||
'hash_pair.h',
|
||||
'heads_up_display_layer.cc',
|
||||
'heads_up_display_layer.h',
|
||||
@ -115,6 +114,7 @@
|
||||
'nine_patch_layer_impl.h',
|
||||
'occlusion_tracker.cc',
|
||||
'occlusion_tracker.h',
|
||||
'output_surface.h',
|
||||
'overdraw_metrics.cc',
|
||||
'overdraw_metrics.h',
|
||||
'page_scale_animation.cc',
|
||||
|
@ -57,6 +57,7 @@
|
||||
'tiled_layer_unittest.cc',
|
||||
'tree_synchronizer_unittest.cc',
|
||||
'timing_function_unittest.cc',
|
||||
'test/fake_web_graphics_context_3d_unittest.cc',
|
||||
],
|
||||
'cc_tests_support_files': [
|
||||
'test/animation_test_common.cc',
|
||||
@ -64,8 +65,7 @@
|
||||
'test/compositor_fake_web_graphics_context_3d.h',
|
||||
'test/fake_content_layer_client.cc',
|
||||
'test/fake_content_layer_client.h',
|
||||
'test/fake_graphics_context.h',
|
||||
'test/fake_graphics_context_3d_unittest.cc',
|
||||
'test/fake_output_surface.h',
|
||||
'test/fake_layer_tree_host_client.cc',
|
||||
'test/fake_layer_tree_host_client.h',
|
||||
'test/fake_picture_layer_tiling_client.cc',
|
||||
|
@ -65,7 +65,7 @@ void DelegatedRendererLayerImpl::clearRenderPasses()
|
||||
m_renderPassesInDrawOrder.clear();
|
||||
}
|
||||
|
||||
void DelegatedRendererLayerImpl::didLoseContext()
|
||||
void DelegatedRendererLayerImpl::didLoseOutputSurface()
|
||||
{
|
||||
clearRenderPasses();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
void setRenderPasses(ScopedPtrVector<RenderPass>&);
|
||||
void clearRenderPasses();
|
||||
|
||||
virtual void didLoseContext() OVERRIDE;
|
||||
virtual void didLoseOutputSurface() OVERRIDE;
|
||||
|
||||
virtual RenderPass::Id firstContributingRenderPassId() const OVERRIDE;
|
||||
virtual RenderPass::Id nextContributingRenderPassId(RenderPass::Id) const OVERRIDE;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "cc/single_thread_proxy.h"
|
||||
#include "cc/solid_color_draw_quad.h"
|
||||
#include "cc/solid_color_layer_impl.h"
|
||||
#include "cc/test/fake_output_surface.h"
|
||||
#include "cc/test/fake_proxy.h"
|
||||
#include "cc/test/fake_web_compositor_output_surface.h"
|
||||
#include "cc/test/fake_web_graphics_context_3d.h"
|
||||
@ -39,12 +40,12 @@ public:
|
||||
settings.minimumOcclusionTrackingSize = gfx::Size();
|
||||
|
||||
m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
|
||||
m_hostImpl->initializeRenderer(createContext());
|
||||
m_hostImpl->initializeRenderer(createFakeOutputSurface());
|
||||
m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
|
||||
}
|
||||
|
||||
// LayerTreeHostImplClient implementation.
|
||||
virtual void didLoseContextOnImplThread() OVERRIDE { }
|
||||
virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE { }
|
||||
virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { }
|
||||
virtual void onVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVERRIDE { }
|
||||
virtual void onCanDrawStateChanged(bool) OVERRIDE { }
|
||||
@ -56,11 +57,6 @@ public:
|
||||
virtual void sendManagedMemoryStats() OVERRIDE { }
|
||||
|
||||
protected:
|
||||
scoped_ptr<GraphicsContext> createContext()
|
||||
{
|
||||
return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<GraphicsContext>();
|
||||
}
|
||||
|
||||
FakeProxy m_proxy;
|
||||
DebugScopedSetImplThreadAndMainThreadBlocked m_alwaysImplThreadAndMainThreadBlocked;
|
||||
scoped_ptr<LayerTreeHostImpl> m_hostImpl;
|
||||
|
@ -102,9 +102,6 @@ bool GLRenderer::initialize()
|
||||
else
|
||||
m_capabilities.usingAcceleratedPainting = false;
|
||||
|
||||
|
||||
m_capabilities.contextHasCachedFrontBuffer = extensions.count("GL_CHROMIUM_front_buffer_cached");
|
||||
|
||||
m_capabilities.usingPartialSwap = settings().partialSwapEnabled && extensions.count("GL_CHROMIUM_post_sub_buffer");
|
||||
|
||||
// Use the swapBuffers callback only with the threaded proxy.
|
||||
@ -1353,7 +1350,7 @@ void GLRenderer::ensureFramebuffer()
|
||||
|
||||
void GLRenderer::onContextLost()
|
||||
{
|
||||
m_client->didLoseContext();
|
||||
m_client->didLoseOutputSurface();
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "cc/solid_color_draw_quad.h"
|
||||
#include "cc/tile_draw_quad.h"
|
||||
#include "cc/yuv_video_draw_quad.h"
|
||||
#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
|
||||
#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsMemoryAllocation.h"
|
||||
#include "ui/gfx/quad_f.h"
|
||||
|
||||
namespace WebKit {
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
// RendererClient methods.
|
||||
virtual const gfx::Size& deviceViewportSize() const OVERRIDE { static gfx::Size fakeSize(1, 1); return fakeSize; }
|
||||
virtual const LayerTreeSettings& settings() const OVERRIDE { static LayerTreeSettings fakeSettings; return fakeSettings; }
|
||||
virtual void didLoseContext() OVERRIDE { }
|
||||
virtual void didLoseOutputSurface() OVERRIDE { }
|
||||
virtual void onSwapBuffersComplete() OVERRIDE { }
|
||||
virtual void setFullRootLayerDamage() OVERRIDE { m_setFullRootLayerDamageCount++; }
|
||||
virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE { m_memoryAllocationLimitBytes = policy.bytesLimitWhenVisible; }
|
||||
@ -139,7 +139,7 @@ protected:
|
||||
WebGraphicsMemoryAllocation m_suggestHaveBackbufferYes;
|
||||
WebGraphicsMemoryAllocation m_suggestHaveBackbufferNo;
|
||||
|
||||
scoped_ptr<GraphicsContext> m_context;
|
||||
scoped_ptr<OutputSurface> m_context;
|
||||
FakeRendererClient m_mockClient;
|
||||
scoped_ptr<ResourceProvider> m_resourceProvider;
|
||||
FakeRendererGL m_renderer;
|
||||
@ -300,7 +300,7 @@ public:
|
||||
TEST(GLRendererTest2, initializationDoesNotMakeSynchronousCalls)
|
||||
{
|
||||
FakeRendererClient mockClient;
|
||||
scoped_ptr<GraphicsContext> context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ForbidSynchronousCallContext)));
|
||||
scoped_ptr<OutputSurface> context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ForbidSynchronousCallContext)));
|
||||
scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get()));
|
||||
FakeRendererGL renderer(&mockClient, resourceProvider.get());
|
||||
|
||||
@ -343,7 +343,7 @@ private:
|
||||
TEST(GLRendererTest2, initializationWithQuicklyLostContextDoesNotAssert)
|
||||
{
|
||||
FakeRendererClient mockClient;
|
||||
scoped_ptr<GraphicsContext> context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new LoseContextOnFirstGetContext)));
|
||||
scoped_ptr<OutputSurface> context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new LoseContextOnFirstGetContext)));
|
||||
scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get()));
|
||||
FakeRendererGL renderer(&mockClient, resourceProvider.get());
|
||||
|
||||
@ -365,8 +365,8 @@ public:
|
||||
TEST(GLRendererTest2, initializationWithoutGpuMemoryManagerExtensionSupportShouldDefaultToNonZeroAllocation)
|
||||
{
|
||||
FakeRendererClient mockClient;
|
||||
scoped_ptr<GraphicsContext> context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ContextThatDoesNotSupportMemoryManagmentExtensions)));
|
||||
scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get()));
|
||||
scoped_ptr<OutputSurface> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ContextThatDoesNotSupportMemoryManagmentExtensions)));
|
||||
scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(outputSurface.get()));
|
||||
FakeRendererGL renderer(&mockClient, resourceProvider.get());
|
||||
|
||||
renderer.initialize();
|
||||
@ -392,7 +392,7 @@ private:
|
||||
TEST(GLRendererTest2, opaqueBackground)
|
||||
{
|
||||
FakeRendererClient mockClient;
|
||||
scoped_ptr<GraphicsContext> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ClearCountingContext)));
|
||||
scoped_ptr<OutputSurface> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ClearCountingContext)));
|
||||
ClearCountingContext* context = static_cast<ClearCountingContext*>(outputSurface->context3D());
|
||||
scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(outputSurface.get()));
|
||||
FakeRendererGL renderer(&mockClient, resourceProvider.get());
|
||||
@ -415,7 +415,7 @@ TEST(GLRendererTest2, opaqueBackground)
|
||||
TEST(GLRendererTest2, transparentBackground)
|
||||
{
|
||||
FakeRendererClient mockClient;
|
||||
scoped_ptr<GraphicsContext> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ClearCountingContext)));
|
||||
scoped_ptr<OutputSurface> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ClearCountingContext)));
|
||||
ClearCountingContext* context = static_cast<ClearCountingContext*>(outputSurface->context3D());
|
||||
scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(outputSurface.get()));
|
||||
FakeRendererGL renderer(&mockClient, resourceProvider.get());
|
||||
@ -466,7 +466,7 @@ private:
|
||||
TEST(GLRendererTest2, visibilityChangeIsLastCall)
|
||||
{
|
||||
FakeRendererClient mockClient;
|
||||
scoped_ptr<GraphicsContext> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new VisibilityChangeIsLastCallTrackingContext)));
|
||||
scoped_ptr<OutputSurface> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new VisibilityChangeIsLastCallTrackingContext)));
|
||||
VisibilityChangeIsLastCallTrackingContext* context = static_cast<VisibilityChangeIsLastCallTrackingContext*>(outputSurface->context3D());
|
||||
scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(outputSurface.get()));
|
||||
FakeRendererGL renderer(&mockClient, resourceProvider.get());
|
||||
@ -518,7 +518,7 @@ private:
|
||||
TEST(GLRendererTest2, activeTextureState)
|
||||
{
|
||||
FakeRendererClient fakeClient;
|
||||
scoped_ptr<GraphicsContext> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new TextureStateTrackingContext)));
|
||||
scoped_ptr<OutputSurface> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new TextureStateTrackingContext)));
|
||||
TextureStateTrackingContext* context = static_cast<TextureStateTrackingContext*>(outputSurface->context3D());
|
||||
scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(outputSurface.get()));
|
||||
FakeRendererGL renderer(&fakeClient, resourceProvider.get());
|
||||
|
@ -1,18 +0,0 @@
|
||||
// Copyright 2012 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 CC_GRAPHICS_CONTEXT_H_
|
||||
#define CC_GRAPHICS_CONTEXT_H_
|
||||
|
||||
#include <public/WebCompositorOutputSurface.h>
|
||||
#include <public/WebGraphicsContext3D.h>
|
||||
|
||||
namespace cc {
|
||||
|
||||
// FIXME: rename fully to OutputSurface.
|
||||
typedef WebKit::WebCompositorOutputSurface GraphicsContext;
|
||||
|
||||
} // namespace cc
|
||||
|
||||
#endif // CC_GRAPHICS_CONTEXT_H_
|
@ -134,7 +134,7 @@ void HeadsUpDisplayLayerImpl::didDraw(ResourceProvider* resourceProvider)
|
||||
DCHECK(!resourceProvider->inUseByConsumer(m_hudTexture->id()));
|
||||
}
|
||||
|
||||
void HeadsUpDisplayLayerImpl::didLoseContext()
|
||||
void HeadsUpDisplayLayerImpl::didLoseOutputSurface()
|
||||
{
|
||||
m_hudTexture.reset();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
void updateHudTexture(ResourceProvider*);
|
||||
virtual void didDraw(ResourceProvider*) OVERRIDE;
|
||||
|
||||
virtual void didLoseContext() OVERRIDE;
|
||||
virtual void didLoseOutputSurface() OVERRIDE;
|
||||
|
||||
virtual bool layerIsAlwaysDamaged() const OVERRIDE;
|
||||
|
||||
|
@ -6,13 +6,13 @@
|
||||
|
||||
#include "base/stringprintf.h"
|
||||
#include "cc/gl_renderer.h" // For the GLC() macro.
|
||||
#include "cc/graphics_context.h"
|
||||
#include "cc/io_surface_draw_quad.h"
|
||||
#include "cc/layer_tree_host_impl.h"
|
||||
#include "cc/output_surface.h"
|
||||
#include "cc/quad_sink.h"
|
||||
#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
|
||||
#include "third_party/khronos/GLES2/gl2.h"
|
||||
#include "third_party/khronos/GLES2/gl2ext.h"
|
||||
#include <public/WebGraphicsContext3D.h>
|
||||
|
||||
namespace cc {
|
||||
|
||||
@ -29,9 +29,9 @@ IOSurfaceLayerImpl::~IOSurfaceLayerImpl()
|
||||
if (!m_ioSurfaceTextureId)
|
||||
return;
|
||||
|
||||
GraphicsContext* context = layerTreeHostImpl()->context();
|
||||
OutputSurface* outputSurface = layerTreeHostImpl()->outputSurface();
|
||||
// FIXME: Implement this path for software compositing.
|
||||
WebKit::WebGraphicsContext3D* context3d = context->context3D();
|
||||
WebKit::WebGraphicsContext3D* context3d = outputSurface->context3D();
|
||||
if (context3d)
|
||||
context3d->deleteTexture(m_ioSurfaceTextureId);
|
||||
}
|
||||
@ -91,7 +91,7 @@ void IOSurfaceLayerImpl::dumpLayerProperties(std::string* str, int indent) const
|
||||
LayerImpl::dumpLayerProperties(str, indent);
|
||||
}
|
||||
|
||||
void IOSurfaceLayerImpl::didLoseContext()
|
||||
void IOSurfaceLayerImpl::didLoseOutputSurface()
|
||||
{
|
||||
// We don't have a valid texture ID in the new context; however,
|
||||
// the IOSurface is still valid.
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE;
|
||||
|
||||
virtual void willDraw(ResourceProvider*) OVERRIDE;
|
||||
virtual void didLoseContext() OVERRIDE;
|
||||
virtual void didLoseOutputSurface() OVERRIDE;
|
||||
|
||||
virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;
|
||||
|
||||
|
@ -680,7 +680,7 @@ Region LayerImpl::visibleContentOpaqueRegion() const
|
||||
return Region();
|
||||
}
|
||||
|
||||
void LayerImpl::didLoseContext()
|
||||
void LayerImpl::didLoseOutputSurface()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -262,10 +262,10 @@ public:
|
||||
|
||||
virtual void didUpdateTransforms() { }
|
||||
|
||||
// Indicates that the context previously used to render this layer
|
||||
// Indicates that the surface previously used to render this layer
|
||||
// was lost and that a new one has been created. Won't be called
|
||||
// until the new context has been created successfully.
|
||||
virtual void didLoseContext();
|
||||
// until the new surface has been created successfully.
|
||||
virtual void didLoseOutputSurface();
|
||||
|
||||
ScrollbarAnimationController* scrollbarAnimationController() const { return m_scrollbarAnimationController.get(); }
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "base/message_loop.h"
|
||||
#include "base/string_number_conversions.h"
|
||||
#include "cc/font_atlas.h"
|
||||
#include "cc/graphics_context.h"
|
||||
#include "cc/heads_up_display_layer.h"
|
||||
#include "cc/heads_up_display_layer_impl.h"
|
||||
#include "cc/layer.h"
|
||||
@ -147,8 +146,7 @@ LayerTreeSettings::~LayerTreeSettings()
|
||||
|
||||
RendererCapabilities::RendererCapabilities()
|
||||
: bestTextureFormat(0)
|
||||
, contextHasCachedFrontBuffer(false)
|
||||
, usingPartialSwap(false)
|
||||
, usingPartialSwap(0)
|
||||
, usingAcceleratedPainting(false)
|
||||
, usingSetVisibility(false)
|
||||
, usingSwapCompleteCallback(false)
|
||||
@ -185,7 +183,7 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting
|
||||
, m_commitNumber(0)
|
||||
, m_renderingStats()
|
||||
, m_rendererInitialized(false)
|
||||
, m_contextLost(false)
|
||||
, m_outputSurfaceLost(false)
|
||||
, m_numTimesRecreateShouldFail(0)
|
||||
, m_numFailedRecreateAttempts(0)
|
||||
, m_settings(settings)
|
||||
@ -222,7 +220,7 @@ bool LayerTreeHost::initializeProxy(scoped_ptr<Proxy> proxy)
|
||||
|
||||
m_proxy = proxy.Pass();
|
||||
m_proxy->start();
|
||||
return m_proxy->initializeContext();
|
||||
return m_proxy->initializeOutputSurface();
|
||||
}
|
||||
|
||||
LayerTreeHost::~LayerTreeHost()
|
||||
@ -248,7 +246,7 @@ void LayerTreeHost::initializeRenderer()
|
||||
{
|
||||
TRACE_EVENT0("cc", "LayerTreeHost::initializeRenderer");
|
||||
if (!m_proxy->initializeRenderer()) {
|
||||
// Uh oh, better tell the client that we can't do anything with this context.
|
||||
// Uh oh, better tell the client that we can't do anything with this output surface.
|
||||
m_client->didRecreateOutputSurface(false);
|
||||
return;
|
||||
}
|
||||
@ -273,28 +271,28 @@ void LayerTreeHost::initializeRenderer()
|
||||
min(m_settings.maxUntiledLayerSize.height(), m_proxy->rendererCapabilities().maxTextureSize));
|
||||
}
|
||||
|
||||
LayerTreeHost::RecreateResult LayerTreeHost::recreateContext()
|
||||
LayerTreeHost::RecreateResult LayerTreeHost::recreateOutputSurface()
|
||||
{
|
||||
TRACE_EVENT0("cc", "LayerTreeHost::recreateContext");
|
||||
DCHECK(m_contextLost);
|
||||
TRACE_EVENT0("cc", "LayerTreeHost::recreateOutputSurface");
|
||||
DCHECK(m_outputSurfaceLost);
|
||||
|
||||
bool recreated = false;
|
||||
if (!m_numTimesRecreateShouldFail)
|
||||
recreated = m_proxy->recreateContext();
|
||||
recreated = m_proxy->recreateOutputSurface();
|
||||
else
|
||||
m_numTimesRecreateShouldFail--;
|
||||
|
||||
if (recreated) {
|
||||
m_client->didRecreateOutputSurface(true);
|
||||
m_contextLost = false;
|
||||
m_outputSurfaceLost = false;
|
||||
return RecreateSucceeded;
|
||||
}
|
||||
|
||||
// Tolerate a certain number of recreation failures to work around races
|
||||
// in the context-lost machinery.
|
||||
// in the output-surface-lost machinery.
|
||||
m_numFailedRecreateAttempts++;
|
||||
if (m_numFailedRecreateAttempts < 5) {
|
||||
// FIXME: The single thread does not self-schedule context
|
||||
// FIXME: The single thread does not self-schedule output surface
|
||||
// recreation. So force another recreation attempt to happen by requesting
|
||||
// another commit.
|
||||
if (!m_proxy->hasImplThread())
|
||||
@ -302,8 +300,8 @@ LayerTreeHost::RecreateResult LayerTreeHost::recreateContext()
|
||||
return RecreateFailedButTryAgain;
|
||||
}
|
||||
|
||||
// We have tried too many times to recreate the context. Tell the host to fall
|
||||
// back to software rendering.
|
||||
// We have tried too many times to recreate the output surface. Tell the
|
||||
// host to fall back to software rendering.
|
||||
m_client->didRecreateOutputSurface(false);
|
||||
return RecreateFailedAndGaveUp;
|
||||
}
|
||||
@ -429,7 +427,7 @@ void LayerTreeHost::commitComplete()
|
||||
m_client->didCommit();
|
||||
}
|
||||
|
||||
scoped_ptr<GraphicsContext> LayerTreeHost::createContext()
|
||||
scoped_ptr<OutputSurface> LayerTreeHost::createOutputSurface()
|
||||
{
|
||||
return m_client->createOutputSurface();
|
||||
}
|
||||
@ -444,11 +442,11 @@ scoped_ptr<LayerTreeHostImpl> LayerTreeHost::createLayerTreeHostImpl(LayerTreeHo
|
||||
return LayerTreeHostImpl::create(m_settings, client, m_proxy.get());
|
||||
}
|
||||
|
||||
void LayerTreeHost::didLoseContext()
|
||||
void LayerTreeHost::didLoseOutputSurface()
|
||||
{
|
||||
TRACE_EVENT0("cc", "LayerTreeHost::didLoseContext");
|
||||
TRACE_EVENT0("cc", "LayerTreeHost::didLoseOutputSurface");
|
||||
DCHECK(m_proxy->isMainThread());
|
||||
m_contextLost = true;
|
||||
m_outputSurfaceLost = true;
|
||||
m_numFailedRecreateAttempts = 0;
|
||||
setNeedsCommit();
|
||||
}
|
||||
@ -596,11 +594,11 @@ void LayerTreeHost::startPageScaleAnimation(gfx::Vector2d targetOffset, bool use
|
||||
m_proxy->startPageScaleAnimation(targetOffset, useAnchor, scale, duration);
|
||||
}
|
||||
|
||||
void LayerTreeHost::loseContext(int numTimes)
|
||||
void LayerTreeHost::loseOutputSurface(int numTimes)
|
||||
{
|
||||
TRACE_EVENT1("cc", "LayerTreeHost::loseCompositorContext", "numTimes", numTimes);
|
||||
TRACE_EVENT1("cc", "LayerTreeHost::loseCompositorOutputSurface", "numTimes", numTimes);
|
||||
m_numTimesRecreateShouldFail = numTimes - 1;
|
||||
m_proxy->loseContext();
|
||||
m_proxy->loseOutputSurface();
|
||||
}
|
||||
|
||||
PrioritizedResourceManager* LayerTreeHost::contentsTextureManager() const
|
||||
@ -629,8 +627,8 @@ bool LayerTreeHost::initializeRendererIfNeeded()
|
||||
if (!m_rendererInitialized)
|
||||
return false;
|
||||
}
|
||||
if (m_contextLost) {
|
||||
if (recreateContext() != RecreateSucceeded)
|
||||
if (m_outputSurfaceLost) {
|
||||
if (recreateOutputSurface() != RecreateSucceeded)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -15,10 +15,10 @@
|
||||
#include "base/time.h"
|
||||
#include "cc/animation_events.h"
|
||||
#include "cc/cc_export.h"
|
||||
#include "cc/graphics_context.h"
|
||||
#include "cc/layer_tree_host_client.h"
|
||||
#include "cc/layer_tree_host_common.h"
|
||||
#include "cc/occlusion_tracker.h"
|
||||
#include "cc/output_surface.h"
|
||||
#include "cc/prioritized_resource_manager.h"
|
||||
#include "cc/proxy.h"
|
||||
#include "cc/rate_limiter.h"
|
||||
@ -102,7 +102,6 @@ struct CC_EXPORT RendererCapabilities {
|
||||
~RendererCapabilities();
|
||||
|
||||
GLenum bestTextureFormat;
|
||||
bool contextHasCachedFrontBuffer;
|
||||
bool usingPartialSwap;
|
||||
bool usingAcceleratedPainting;
|
||||
bool usingSetVisibility;
|
||||
@ -137,16 +136,16 @@ public:
|
||||
void finishCommitOnImplThread(LayerTreeHostImpl*);
|
||||
void willCommit();
|
||||
void commitComplete();
|
||||
scoped_ptr<GraphicsContext> createContext();
|
||||
scoped_ptr<OutputSurface> createOutputSurface();
|
||||
scoped_ptr<InputHandler> createInputHandler();
|
||||
virtual scoped_ptr<LayerTreeHostImpl> createLayerTreeHostImpl(LayerTreeHostImplClient*);
|
||||
void didLoseContext();
|
||||
void didLoseOutputSurface();
|
||||
enum RecreateResult {
|
||||
RecreateSucceeded,
|
||||
RecreateFailedButTryAgain,
|
||||
RecreateFailedAndGaveUp,
|
||||
};
|
||||
RecreateResult recreateContext();
|
||||
RecreateResult recreateOutputSurface();
|
||||
void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); }
|
||||
void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); }
|
||||
void deleteContentsTexturesOnImplThread(ResourceProvider*);
|
||||
@ -181,7 +180,7 @@ public:
|
||||
const RendererCapabilities& rendererCapabilities() const;
|
||||
|
||||
// Test only hook
|
||||
void loseContext(int numTimes);
|
||||
void loseOutputSurface(int numTimes);
|
||||
|
||||
void setNeedsAnimate();
|
||||
// virtual for testing
|
||||
@ -284,7 +283,7 @@ private:
|
||||
RenderingStats m_renderingStats;
|
||||
|
||||
bool m_rendererInitialized;
|
||||
bool m_contextLost;
|
||||
bool m_outputSurfaceLost;
|
||||
int m_numTimesRecreateShouldFail;
|
||||
int m_numFailedRecreateAttempts;
|
||||
|
||||
|
@ -279,9 +279,9 @@ bool LayerTreeHostImpl::canDraw()
|
||||
return true;
|
||||
}
|
||||
|
||||
GraphicsContext* LayerTreeHostImpl::context() const
|
||||
OutputSurface* LayerTreeHostImpl::outputSurface() const
|
||||
{
|
||||
return m_context.get();
|
||||
return m_outputSurface.get();
|
||||
}
|
||||
|
||||
void LayerTreeHostImpl::animate(base::TimeTicks monotonicTime, base::Time wallClockTime)
|
||||
@ -891,9 +891,9 @@ const LayerTreeSettings& LayerTreeHostImpl::settings() const
|
||||
return m_settings;
|
||||
}
|
||||
|
||||
void LayerTreeHostImpl::didLoseContext()
|
||||
void LayerTreeHostImpl::didLoseOutputSurface()
|
||||
{
|
||||
m_client->didLoseContextOnImplThread();
|
||||
m_client->didLoseOutputSurfaceOnImplThread();
|
||||
}
|
||||
|
||||
void LayerTreeHostImpl::onSwapBuffersComplete()
|
||||
@ -983,40 +983,40 @@ void LayerTreeHostImpl::setVisible(bool visible)
|
||||
setBackgroundTickingEnabled(!m_visible && m_needsAnimateLayers);
|
||||
}
|
||||
|
||||
bool LayerTreeHostImpl::initializeRenderer(scoped_ptr<GraphicsContext> context)
|
||||
bool LayerTreeHostImpl::initializeRenderer(scoped_ptr<OutputSurface> outputSurface)
|
||||
{
|
||||
// Since we will create a new resource provider, we cannot continue to use
|
||||
// the old resources (i.e. renderSurfaces and texture IDs). Clear them
|
||||
// before we destroy the old resource provider.
|
||||
if (m_rootLayerImpl) {
|
||||
clearRenderSurfaces();
|
||||
sendDidLoseContextRecursive(m_rootLayerImpl.get());
|
||||
sendDidLoseOutputSurfaceRecursive(m_rootLayerImpl.get());
|
||||
}
|
||||
// Note: order is important here.
|
||||
m_renderer.reset();
|
||||
m_tileManager.reset();
|
||||
m_resourceProvider.reset();
|
||||
m_context.reset();
|
||||
m_outputSurface.reset();
|
||||
|
||||
if (!context->bindToClient(this))
|
||||
if (!outputSurface->bindToClient(this))
|
||||
return false;
|
||||
|
||||
scoped_ptr<ResourceProvider> resourceProvider = ResourceProvider::create(context.get());
|
||||
scoped_ptr<ResourceProvider> resourceProvider = ResourceProvider::create(outputSurface.get());
|
||||
if (!resourceProvider)
|
||||
return false;
|
||||
|
||||
if (m_settings.implSidePainting)
|
||||
m_tileManager.reset(new TileManager(this, resourceProvider.get(), m_settings.numRasterThreads));
|
||||
|
||||
if (context->context3D())
|
||||
if (outputSurface->context3D())
|
||||
m_renderer = GLRenderer::create(this, resourceProvider.get());
|
||||
else if (context->softwareDevice())
|
||||
m_renderer = SoftwareRenderer::create(this, resourceProvider.get(), context->softwareDevice());
|
||||
else if (outputSurface->softwareDevice())
|
||||
m_renderer = SoftwareRenderer::create(this, resourceProvider.get(), outputSurface->softwareDevice());
|
||||
if (!m_renderer)
|
||||
return false;
|
||||
|
||||
m_resourceProvider = resourceProvider.Pass();
|
||||
m_context = context.Pass();
|
||||
m_outputSurface = outputSurface.Pass();
|
||||
|
||||
if (!m_visible)
|
||||
m_renderer->setVisible(m_visible);
|
||||
@ -1556,16 +1556,16 @@ base::TimeDelta LayerTreeHostImpl::lowFrequencyAnimationInterval() const
|
||||
return base::TimeDelta::FromSeconds(1);
|
||||
}
|
||||
|
||||
void LayerTreeHostImpl::sendDidLoseContextRecursive(LayerImpl* current)
|
||||
void LayerTreeHostImpl::sendDidLoseOutputSurfaceRecursive(LayerImpl* current)
|
||||
{
|
||||
DCHECK(current);
|
||||
current->didLoseContext();
|
||||
current->didLoseOutputSurface();
|
||||
if (current->maskLayer())
|
||||
sendDidLoseContextRecursive(current->maskLayer());
|
||||
sendDidLoseOutputSurfaceRecursive(current->maskLayer());
|
||||
if (current->replicaLayer())
|
||||
sendDidLoseContextRecursive(current->replicaLayer());
|
||||
sendDidLoseOutputSurfaceRecursive(current->replicaLayer());
|
||||
for (size_t i = 0; i < current->children().size(); ++i)
|
||||
sendDidLoseContextRecursive(current->children()[i]);
|
||||
sendDidLoseOutputSurfaceRecursive(current->children()[i]);
|
||||
}
|
||||
|
||||
static void clearRenderSurfacesOnLayerImplRecursive(LayerImpl* current)
|
||||
|
@ -37,7 +37,7 @@ struct RenderingStats;
|
||||
// LayerTreeHost->Proxy callback interface.
|
||||
class LayerTreeHostImplClient {
|
||||
public:
|
||||
virtual void didLoseContextOnImplThread() = 0;
|
||||
virtual void didLoseOutputSurfaceOnImplThread() = 0;
|
||||
virtual void onSwapBuffersCompleteOnImplThread() = 0;
|
||||
virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval) = 0;
|
||||
virtual void onCanDrawStateChanged(bool canDraw) = 0;
|
||||
@ -165,7 +165,7 @@ public:
|
||||
// RendererClient implementation
|
||||
virtual const gfx::Size& deviceViewportSize() const OVERRIDE;
|
||||
virtual const LayerTreeSettings& settings() const OVERRIDE;
|
||||
virtual void didLoseContext() OVERRIDE;
|
||||
virtual void didLoseOutputSurface() OVERRIDE;
|
||||
virtual void onSwapBuffersComplete() OVERRIDE;
|
||||
virtual void setFullRootLayerDamage() OVERRIDE;
|
||||
virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE;
|
||||
@ -181,14 +181,14 @@ public:
|
||||
|
||||
// Implementation
|
||||
bool canDraw();
|
||||
GraphicsContext* context() const;
|
||||
OutputSurface* outputSurface() const;
|
||||
|
||||
std::string layerTreeAsText() const;
|
||||
|
||||
void finishAllRendering();
|
||||
int sourceAnimationFrameNumber() const;
|
||||
|
||||
bool initializeRenderer(scoped_ptr<GraphicsContext>);
|
||||
bool initializeRenderer(scoped_ptr<OutputSurface>);
|
||||
bool isContextLost();
|
||||
TileManager* tileManager() { return m_tileManager.get(); }
|
||||
Renderer* renderer() { return m_renderer.get(); }
|
||||
@ -324,7 +324,7 @@ private:
|
||||
void setBackgroundTickingEnabled(bool);
|
||||
gfx::Size contentSize() const;
|
||||
|
||||
void sendDidLoseContextRecursive(LayerImpl*);
|
||||
void sendDidLoseOutputSurfaceRecursive(LayerImpl*);
|
||||
void clearRenderSurfaces();
|
||||
bool ensureRenderSurfaceLayerList();
|
||||
void clearCurrentlyScrollingLayer();
|
||||
@ -333,7 +333,7 @@ private:
|
||||
|
||||
void dumpRenderSurfaces(std::string*, int indent, const LayerImpl*) const;
|
||||
|
||||
scoped_ptr<GraphicsContext> m_context;
|
||||
scoped_ptr<OutputSurface> m_outputSurface;
|
||||
scoped_ptr<ResourceProvider> m_resourceProvider;
|
||||
scoped_ptr<Renderer> m_renderer;
|
||||
scoped_ptr<TileManager> m_tileManager;
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
settings.pageScalePinchZoomEnabled = GetParam();
|
||||
|
||||
m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
|
||||
m_hostImpl->initializeRenderer(createContext());
|
||||
m_hostImpl->initializeRenderer(createOutputSurface());
|
||||
m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void didLoseContextOnImplThread() OVERRIDE { }
|
||||
virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE { }
|
||||
virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { }
|
||||
virtual void onVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVERRIDE { }
|
||||
virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawStateChangedCalled = true; }
|
||||
@ -103,7 +103,7 @@ public:
|
||||
|
||||
void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult = reduceMemoryResult; }
|
||||
|
||||
scoped_ptr<LayerTreeHostImpl> createLayerTreeHost(bool partialSwap, scoped_ptr<GraphicsContext> graphicsContext, scoped_ptr<LayerImpl> root)
|
||||
scoped_ptr<LayerTreeHostImpl> createLayerTreeHost(bool partialSwap, scoped_ptr<OutputSurface> outputSurface, scoped_ptr<LayerImpl> root)
|
||||
{
|
||||
LayerTreeSettings settings;
|
||||
settings.minimumOcclusionTrackingSize = gfx::Size();
|
||||
@ -111,7 +111,7 @@ public:
|
||||
|
||||
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
|
||||
|
||||
myHostImpl->initializeRenderer(graphicsContext.Pass());
|
||||
myHostImpl->initializeRenderer(outputSurface.Pass());
|
||||
myHostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
|
||||
|
||||
root->setAnchorPoint(gfx::PointF(0, 0));
|
||||
@ -192,7 +192,7 @@ public:
|
||||
|
||||
void initializeRendererAndDrawFrame()
|
||||
{
|
||||
m_hostImpl->initializeRenderer(createContext());
|
||||
m_hostImpl->initializeRenderer(createOutputSurface());
|
||||
LayerTreeHostImpl::FrameData frame;
|
||||
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
|
||||
m_hostImpl->drawLayers(frame);
|
||||
@ -205,9 +205,9 @@ public:
|
||||
void pinchZoomPanViewportAndScrollBoundaryTest(const float deviceScaleFactor);
|
||||
|
||||
protected:
|
||||
scoped_ptr<GraphicsContext> createContext()
|
||||
scoped_ptr<OutputSurface> createOutputSurface()
|
||||
{
|
||||
return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<GraphicsContext>();
|
||||
return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<OutputSurface>();
|
||||
}
|
||||
|
||||
FakeProxy m_proxy;
|
||||
@ -376,7 +376,7 @@ TEST_P(LayerTreeHostImplTest, scrollWithoutRenderer)
|
||||
m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
|
||||
|
||||
// Initialization will fail here.
|
||||
m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<GraphicsContext>());
|
||||
m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<OutputSurface>());
|
||||
m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
|
||||
|
||||
setupScrollAndContentsLayers(gfx::Size(100, 100));
|
||||
@ -1885,7 +1885,7 @@ TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
|
||||
|
||||
TEST_P(LayerTreeHostImplTest, viewportCovered)
|
||||
{
|
||||
m_hostImpl->initializeRenderer(createContext());
|
||||
m_hostImpl->initializeRenderer(createOutputSurface());
|
||||
m_hostImpl->setBackgroundColor(SK_ColorGRAY);
|
||||
|
||||
gfx::Size viewportSize(1000, 1000);
|
||||
@ -1997,7 +1997,7 @@ protected:
|
||||
// viewport size is never set.
|
||||
TEST_P(LayerTreeHostImplTest, reshapeNotCalledUntilDraw)
|
||||
{
|
||||
scoped_ptr<GraphicsContext> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ReshapeTrackerContext)).PassAs<GraphicsContext>();
|
||||
scoped_ptr<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ReshapeTrackerContext)).PassAs<OutputSurface>();
|
||||
ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(outputSurface->context3D());
|
||||
m_hostImpl->initializeRenderer(outputSurface.Pass());
|
||||
|
||||
@ -2040,7 +2040,7 @@ private:
|
||||
// where it should request to swap only the subBuffer that is damaged.
|
||||
TEST_P(LayerTreeHostImplTest, partialSwapReceivesDamageRect)
|
||||
{
|
||||
scoped_ptr<GraphicsContext> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapTrackerContext)).PassAs<GraphicsContext>();
|
||||
scoped_ptr<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapTrackerContext)).PassAs<OutputSurface>();
|
||||
PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrackerContext*>(outputSurface->context3D());
|
||||
|
||||
// This test creates its own LayerTreeHostImpl, so
|
||||
@ -2255,12 +2255,12 @@ public:
|
||||
|
||||
TEST_P(LayerTreeHostImplTest, noPartialSwap)
|
||||
{
|
||||
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebGraphicsContext3D>(new MockContext)).PassAs<GraphicsContext>();
|
||||
MockContext* mockContext = static_cast<MockContext*>(context->context3D());
|
||||
scoped_ptr<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebGraphicsContext3D>(new MockContext)).PassAs<OutputSurface>();
|
||||
MockContext* mockContext = static_cast<MockContext*>(outputSurface->context3D());
|
||||
MockContextHarness harness(mockContext);
|
||||
|
||||
// Run test case
|
||||
scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context.Pass(), FakeLayerWithQuads::create(1));
|
||||
scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, outputSurface.Pass(), FakeLayerWithQuads::create(1));
|
||||
|
||||
// without partial swap, and no clipping, no scissor is set.
|
||||
harness.mustDrawSolidQuad();
|
||||
@ -2288,11 +2288,11 @@ TEST_P(LayerTreeHostImplTest, noPartialSwap)
|
||||
|
||||
TEST_P(LayerTreeHostImplTest, partialSwap)
|
||||
{
|
||||
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockContext)).PassAs<GraphicsContext>();
|
||||
MockContext* mockContext = static_cast<MockContext*>(context->context3D());
|
||||
scoped_ptr<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockContext)).PassAs<OutputSurface>();
|
||||
MockContext* mockContext = static_cast<MockContext*>(outputSurface->context3D());
|
||||
MockContextHarness harness(mockContext);
|
||||
|
||||
scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, context.Pass(), FakeLayerWithQuads::create(1));
|
||||
scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, outputSurface.Pass(), FakeLayerWithQuads::create(1));
|
||||
|
||||
// The first frame is not a partially-swapped one.
|
||||
harness.mustSetScissor(0, 0, 10, 10);
|
||||
@ -2344,12 +2344,12 @@ public:
|
||||
|
||||
static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, LayerTreeHostImplClient* client, Proxy* proxy)
|
||||
{
|
||||
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
|
||||
scoped_ptr<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>();
|
||||
|
||||
LayerTreeSettings settings;
|
||||
settings.partialSwapEnabled = partialSwap;
|
||||
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, client, proxy);
|
||||
myHostImpl->initializeRenderer(context.Pass());
|
||||
myHostImpl->initializeRenderer(outputSurface.Pass());
|
||||
myHostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
|
||||
|
||||
/*
|
||||
@ -2450,48 +2450,48 @@ TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorNoPartialSwap)
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure that context lost notifications are propagated through the tree.
|
||||
class ContextLostNotificationCheckLayer : public LayerImpl {
|
||||
// Make sure that output surface lost notifications are propagated through the tree.
|
||||
class OutputSurfaceLostNotificationCheckLayer : public LayerImpl {
|
||||
public:
|
||||
static scoped_ptr<LayerImpl> create(int id) { return scoped_ptr<LayerImpl>(new ContextLostNotificationCheckLayer(id)); }
|
||||
static scoped_ptr<LayerImpl> create(int id) { return scoped_ptr<LayerImpl>(new OutputSurfaceLostNotificationCheckLayer(id)); }
|
||||
|
||||
virtual void didLoseContext() OVERRIDE
|
||||
virtual void didLoseOutputSurface() OVERRIDE
|
||||
{
|
||||
m_didLoseContextCalled = true;
|
||||
m_didLoseOutputSurfaceCalled = true;
|
||||
}
|
||||
|
||||
bool didLoseContextCalled() const { return m_didLoseContextCalled; }
|
||||
bool didLoseOutputSurfaceCalled() const { return m_didLoseOutputSurfaceCalled; }
|
||||
|
||||
private:
|
||||
explicit ContextLostNotificationCheckLayer(int id)
|
||||
explicit OutputSurfaceLostNotificationCheckLayer(int id)
|
||||
: LayerImpl(id)
|
||||
, m_didLoseContextCalled(false)
|
||||
, m_didLoseOutputSurfaceCalled(false)
|
||||
{
|
||||
}
|
||||
|
||||
bool m_didLoseContextCalled;
|
||||
bool m_didLoseOutputSurfaceCalled;
|
||||
};
|
||||
|
||||
TEST_P(LayerTreeHostImplTest, contextLostAndRestoredNotificationSentToAllLayers)
|
||||
TEST_P(LayerTreeHostImplTest, outputSurfaceLostAndRestoredNotificationSentToAllLayers)
|
||||
{
|
||||
m_hostImpl->setRootLayer(ContextLostNotificationCheckLayer::create(1));
|
||||
ContextLostNotificationCheckLayer* root = static_cast<ContextLostNotificationCheckLayer*>(m_hostImpl->rootLayer());
|
||||
m_hostImpl->setRootLayer(OutputSurfaceLostNotificationCheckLayer::create(1));
|
||||
OutputSurfaceLostNotificationCheckLayer* root = static_cast<OutputSurfaceLostNotificationCheckLayer*>(m_hostImpl->rootLayer());
|
||||
|
||||
root->addChild(ContextLostNotificationCheckLayer::create(1));
|
||||
ContextLostNotificationCheckLayer* layer1 = static_cast<ContextLostNotificationCheckLayer*>(root->children()[0]);
|
||||
root->addChild(OutputSurfaceLostNotificationCheckLayer::create(1));
|
||||
OutputSurfaceLostNotificationCheckLayer* layer1 = static_cast<OutputSurfaceLostNotificationCheckLayer*>(root->children()[0]);
|
||||
|
||||
layer1->addChild(ContextLostNotificationCheckLayer::create(2));
|
||||
ContextLostNotificationCheckLayer* layer2 = static_cast<ContextLostNotificationCheckLayer*>(layer1->children()[0]);
|
||||
layer1->addChild(OutputSurfaceLostNotificationCheckLayer::create(2));
|
||||
OutputSurfaceLostNotificationCheckLayer* layer2 = static_cast<OutputSurfaceLostNotificationCheckLayer*>(layer1->children()[0]);
|
||||
|
||||
EXPECT_FALSE(root->didLoseContextCalled());
|
||||
EXPECT_FALSE(layer1->didLoseContextCalled());
|
||||
EXPECT_FALSE(layer2->didLoseContextCalled());
|
||||
EXPECT_FALSE(root->didLoseOutputSurfaceCalled());
|
||||
EXPECT_FALSE(layer1->didLoseOutputSurfaceCalled());
|
||||
EXPECT_FALSE(layer2->didLoseOutputSurfaceCalled());
|
||||
|
||||
m_hostImpl->initializeRenderer(createContext());
|
||||
m_hostImpl->initializeRenderer(createOutputSurface());
|
||||
|
||||
EXPECT_TRUE(root->didLoseContextCalled());
|
||||
EXPECT_TRUE(layer1->didLoseContextCalled());
|
||||
EXPECT_TRUE(layer2->didLoseContextCalled());
|
||||
EXPECT_TRUE(root->didLoseOutputSurfaceCalled());
|
||||
EXPECT_TRUE(layer1->didLoseOutputSurfaceCalled());
|
||||
EXPECT_TRUE(layer2->didLoseOutputSurfaceCalled());
|
||||
}
|
||||
|
||||
TEST_P(LayerTreeHostImplTest, finishAllRenderingAfterContextLost)
|
||||
@ -2500,7 +2500,7 @@ TEST_P(LayerTreeHostImplTest, finishAllRenderingAfterContextLost)
|
||||
m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
|
||||
|
||||
// The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects.
|
||||
m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<GraphicsContext>());
|
||||
m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<OutputSurface>());
|
||||
m_hostImpl->finishAllRendering();
|
||||
}
|
||||
|
||||
@ -2518,14 +2518,14 @@ private:
|
||||
unsigned m_succeedCount;
|
||||
};
|
||||
|
||||
TEST_P(LayerTreeHostImplTest, contextLostDuringInitialize)
|
||||
TEST_P(LayerTreeHostImplTest, context3DLostDuringInitialize)
|
||||
{
|
||||
LayerTreeSettings settings;
|
||||
m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
|
||||
|
||||
// Initialize into a known successful state.
|
||||
EXPECT_TRUE(m_hostImpl->initializeRenderer(createContext()));
|
||||
EXPECT_TRUE(m_hostImpl->context());
|
||||
EXPECT_TRUE(m_hostImpl->initializeRenderer(createOutputSurface()));
|
||||
EXPECT_TRUE(m_hostImpl->outputSurface());
|
||||
EXPECT_TRUE(m_hostImpl->renderer());
|
||||
EXPECT_TRUE(m_hostImpl->resourceProvider());
|
||||
|
||||
@ -2538,15 +2538,15 @@ TEST_P(LayerTreeHostImplTest, contextLostDuringInitialize)
|
||||
for (unsigned i = 0; i < kMakeCurrentSuccessesNeededForSuccessfulInitialization; ++i) {
|
||||
// The context will get lost during initialization, we shouldn't crash. We
|
||||
// should also be in a consistent state.
|
||||
EXPECT_FALSE(m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(i))).PassAs<GraphicsContext>()));
|
||||
EXPECT_EQ(0, m_hostImpl->context());
|
||||
EXPECT_FALSE(m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(i))).PassAs<OutputSurface>()));
|
||||
EXPECT_EQ(0, m_hostImpl->outputSurface());
|
||||
EXPECT_EQ(0, m_hostImpl->renderer());
|
||||
EXPECT_EQ(0, m_hostImpl->resourceProvider());
|
||||
EXPECT_TRUE(m_hostImpl->initializeRenderer(createContext()));
|
||||
EXPECT_TRUE(m_hostImpl->initializeRenderer(createOutputSurface()));
|
||||
}
|
||||
|
||||
EXPECT_TRUE(m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(kMakeCurrentSuccessesNeededForSuccessfulInitialization))).PassAs<GraphicsContext>()));
|
||||
EXPECT_TRUE(m_hostImpl->context());
|
||||
EXPECT_TRUE(m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(kMakeCurrentSuccessesNeededForSuccessfulInitialization))).PassAs<OutputSurface>()));
|
||||
EXPECT_TRUE(m_hostImpl->outputSurface());
|
||||
EXPECT_TRUE(m_hostImpl->renderer());
|
||||
EXPECT_TRUE(m_hostImpl->resourceProvider());
|
||||
}
|
||||
@ -2783,7 +2783,7 @@ static inline scoped_ptr<RenderPass> createRenderPassWithResource(ResourceProvid
|
||||
return pass.PassAs<RenderPass>();
|
||||
}
|
||||
|
||||
TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
|
||||
TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostOutputSurface)
|
||||
{
|
||||
int layerId = 1;
|
||||
|
||||
@ -2899,7 +2899,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
|
||||
rootLayer->addChild(delegatedRendererLayer.PassAs<LayerImpl>());
|
||||
|
||||
// Use a context that supports IOSurfaces
|
||||
m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DWithIOSurface)).PassAs<GraphicsContext>());
|
||||
m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DWithIOSurface)).PassAs<OutputSurface>());
|
||||
|
||||
FakeVideoFrame hwVideoFrame(
|
||||
VideoFrame::WrapNativeTexture(
|
||||
@ -2927,9 +2927,9 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
|
||||
|
||||
unsigned numResources = m_hostImpl->resourceProvider()->numResources();
|
||||
|
||||
// Lose the context, replacing it with a StrictWebGraphicsContext3DWithIOSurface,
|
||||
// Lose the WebGraphicsContext3D, replacing it with a StrictWebGraphicsContext3DWithIOSurface,
|
||||
// that will warn if any resource from the previous context gets used.
|
||||
m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new StrictWebGraphicsContext3DWithIOSurface)).PassAs<GraphicsContext>());
|
||||
m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new StrictWebGraphicsContext3DWithIOSurface)).PassAs<OutputSurface>());
|
||||
|
||||
// Create dummy resources so that looking up an old resource will get an
|
||||
// invalid texture id mapping.
|
||||
@ -2937,7 +2937,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
|
||||
m_hostImpl->resourceProvider()->createResourceFromExternalTexture(StrictWebGraphicsContext3D::kExternalTextureId);
|
||||
|
||||
// The WebVideoFrameProvider is expected to recreate its textures after a
|
||||
// lost context (or not serve a frame).
|
||||
// lost output surface (or not serve a frame).
|
||||
hwProvider.setFrame(0);
|
||||
providerScaled.setFrame(0);
|
||||
|
||||
@ -3047,9 +3047,9 @@ TEST_P(LayerTreeHostImplTest, layersFreeTextures)
|
||||
ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get());
|
||||
rootLayer->addChild(ioSurfaceLayer.PassAs<LayerImpl>());
|
||||
|
||||
// Lose the context, replacing it with a TrackingWebGraphicsContext3D (which the LayerTreeHostImpl takes ownership of).
|
||||
scoped_ptr<GraphicsContext> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new TrackingWebGraphicsContext3D)));
|
||||
TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<TrackingWebGraphicsContext3D*>(outputSurface->context3D());
|
||||
// Lose the WebGraphicsContext3D, replacing it with a TrackingWebGraphicsContext3D (which the LayerTreeHostImpl takes ownership of).
|
||||
scoped_ptr<OutputSurface> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new TrackingWebGraphicsContext3D)));
|
||||
TrackingWebGraphicsContext3D* trackingWebGraphicsContext3D = static_cast<TrackingWebGraphicsContext3D*>(outputSurface->context3D());
|
||||
m_hostImpl->initializeRenderer(outputSurface.Pass());
|
||||
|
||||
m_hostImpl->setRootLayer(rootLayer.Pass());
|
||||
@ -3060,12 +3060,12 @@ TEST_P(LayerTreeHostImplTest, layersFreeTextures)
|
||||
m_hostImpl->didDrawAllLayers(frame);
|
||||
m_hostImpl->swapBuffers();
|
||||
|
||||
EXPECT_GT(trackingWebGraphicsContext->numTextures(), 0u);
|
||||
EXPECT_GT(trackingWebGraphicsContext3D->numTextures(), 0u);
|
||||
|
||||
// Kill the layer tree.
|
||||
m_hostImpl->setRootLayer(LayerImpl::create(100));
|
||||
// There should be no textures left in use after.
|
||||
EXPECT_EQ(0u, trackingWebGraphicsContext->numTextures());
|
||||
EXPECT_EQ(0u, trackingWebGraphicsContext3D->numTextures());
|
||||
}
|
||||
|
||||
class MockDrawQuadsToFillScreenContext : public FakeWebGraphicsContext3D {
|
||||
@ -3076,11 +3076,11 @@ public:
|
||||
|
||||
TEST_P(LayerTreeHostImplTest, hasTransparentBackground)
|
||||
{
|
||||
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockDrawQuadsToFillScreenContext)).PassAs<GraphicsContext>();
|
||||
MockDrawQuadsToFillScreenContext* mockContext = static_cast<MockDrawQuadsToFillScreenContext*>(context->context3D());
|
||||
scoped_ptr<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockDrawQuadsToFillScreenContext)).PassAs<OutputSurface>();
|
||||
MockDrawQuadsToFillScreenContext* mockContext = static_cast<MockDrawQuadsToFillScreenContext*>(outputSurface->context3D());
|
||||
|
||||
// Run test case
|
||||
scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context.Pass(), LayerImpl::create(1));
|
||||
scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, outputSurface.Pass(), LayerImpl::create(1));
|
||||
myHostImpl->setBackgroundColor(SK_ColorWHITE);
|
||||
|
||||
// Verify one quad is drawn when transparent background set is not set.
|
||||
@ -3120,9 +3120,9 @@ static void addDrawingLayerTo(LayerImpl* parent, int id, const gfx::Rect& layerR
|
||||
|
||||
static void setupLayersForTextureCaching(LayerTreeHostImpl* layerTreeHostImpl, LayerImpl*& rootPtr, LayerImpl*& intermediateLayerPtr, LayerImpl*& surfaceLayerPtr, LayerImpl*& childPtr, const gfx::Size& rootSize)
|
||||
{
|
||||
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
|
||||
scoped_ptr<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>();
|
||||
|
||||
layerTreeHostImpl->initializeRenderer(context.Pass());
|
||||
layerTreeHostImpl->initializeRenderer(outputSurface.Pass());
|
||||
layerTreeHostImpl->setViewportSize(rootSize, rootSize);
|
||||
|
||||
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
|
||||
@ -3164,11 +3164,11 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithClipping)
|
||||
LayerImpl* rootPtr;
|
||||
LayerImpl* surfaceLayerPtr;
|
||||
|
||||
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
|
||||
scoped_ptr<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>();
|
||||
|
||||
gfx::Size rootSize(100, 100);
|
||||
|
||||
myHostImpl->initializeRenderer(context.Pass());
|
||||
myHostImpl->initializeRenderer(outputSurface.Pass());
|
||||
myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
|
||||
|
||||
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
|
||||
@ -3275,11 +3275,11 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusion)
|
||||
LayerImpl* layerS1Ptr;
|
||||
LayerImpl* layerS2Ptr;
|
||||
|
||||
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
|
||||
scoped_ptr<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>();
|
||||
|
||||
gfx::Size rootSize(1000, 1000);
|
||||
|
||||
myHostImpl->initializeRenderer(context.Pass());
|
||||
myHostImpl->initializeRenderer(outputSurface.Pass());
|
||||
myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
|
||||
|
||||
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
|
||||
@ -3386,11 +3386,11 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut)
|
||||
LayerImpl* layerS1Ptr;
|
||||
LayerImpl* layerS2Ptr;
|
||||
|
||||
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
|
||||
scoped_ptr<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>();
|
||||
|
||||
gfx::Size rootSize(1000, 1000);
|
||||
|
||||
myHostImpl->initializeRenderer(context.Pass());
|
||||
myHostImpl->initializeRenderer(outputSurface.Pass());
|
||||
myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
|
||||
|
||||
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
|
||||
@ -3498,11 +3498,11 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal)
|
||||
LayerImpl* layerS1Ptr;
|
||||
LayerImpl* layerS2Ptr;
|
||||
|
||||
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
|
||||
scoped_ptr<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>();
|
||||
|
||||
gfx::Size rootSize(1000, 1000);
|
||||
|
||||
myHostImpl->initializeRenderer(context.Pass());
|
||||
myHostImpl->initializeRenderer(outputSurface.Pass());
|
||||
myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
|
||||
|
||||
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
|
||||
@ -3579,11 +3579,11 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned)
|
||||
LayerImpl* rootPtr;
|
||||
LayerImpl* layerS1Ptr;
|
||||
|
||||
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
|
||||
scoped_ptr<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>();
|
||||
|
||||
gfx::Size rootSize(1000, 1000);
|
||||
|
||||
myHostImpl->initializeRenderer(context.Pass());
|
||||
myHostImpl->initializeRenderer(outputSurface.Pass());
|
||||
myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
|
||||
|
||||
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
|
||||
@ -3663,11 +3663,11 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap)
|
||||
LayerImpl* layerS1Ptr;
|
||||
LayerImpl* layerS2Ptr;
|
||||
|
||||
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
|
||||
scoped_ptr<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>();
|
||||
|
||||
gfx::Size rootSize(1000, 1000);
|
||||
|
||||
myHostImpl->initializeRenderer(context.Pass());
|
||||
myHostImpl->initializeRenderer(outputSurface.Pass());
|
||||
myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
|
||||
|
||||
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
|
||||
@ -3782,8 +3782,8 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithScissor)
|
||||
gfx::Rect childRect(10, 10, 50, 50);
|
||||
gfx::Rect grandChildRect(5, 5, 150, 150);
|
||||
|
||||
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
|
||||
myHostImpl->initializeRenderer(context.Pass());
|
||||
scoped_ptr<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>();
|
||||
myHostImpl->initializeRenderer(outputSurface.Pass());
|
||||
|
||||
root->setAnchorPoint(gfx::PointF(0, 0));
|
||||
root->setPosition(gfx::PointF(rootRect.x(), rootRect.y()));
|
||||
@ -4228,7 +4228,7 @@ public:
|
||||
// RendererClient implementation.
|
||||
virtual const gfx::Size& deviceViewportSize() const OVERRIDE { return m_viewportSize; }
|
||||
virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settings; }
|
||||
virtual void didLoseContext() OVERRIDE { }
|
||||
virtual void didLoseOutputSurface() OVERRIDE { }
|
||||
virtual void onSwapBuffersComplete() OVERRIDE { }
|
||||
virtual void setFullRootLayerDamage() OVERRIDE { }
|
||||
virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE { }
|
||||
@ -4523,9 +4523,9 @@ static void verifyRenderPassTestData(TestCase& testCase, RenderPassRemovalTestDa
|
||||
|
||||
TEST_P(LayerTreeHostImplTest, testRemoveRenderPasses)
|
||||
{
|
||||
scoped_ptr<GraphicsContext> context(createContext());
|
||||
ASSERT_TRUE(context->context3D());
|
||||
scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get()));
|
||||
scoped_ptr<OutputSurface> outputSurface(createOutputSurface());
|
||||
ASSERT_TRUE(outputSurface->context3D());
|
||||
scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(outputSurface.get()));
|
||||
|
||||
scoped_ptr<TestRenderer> renderer(TestRenderer::create(resourceProvider.get(), &m_proxy));
|
||||
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "cc/content_layer.h"
|
||||
#include "cc/content_layer_client.h"
|
||||
#include "cc/graphics_context.h"
|
||||
#include "cc/layer_tree_host_impl.h"
|
||||
#include "cc/output_surface.h"
|
||||
#include "cc/single_thread_proxy.h"
|
||||
#include "cc/test/fake_content_layer_client.h"
|
||||
#include "cc/test/fake_layer_tree_host_client.h"
|
||||
@ -1401,7 +1401,7 @@ public:
|
||||
|
||||
virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE
|
||||
{
|
||||
CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D());
|
||||
CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->outputSurface()->context3D());
|
||||
|
||||
switch (impl->sourceFrameNumber()) {
|
||||
case 0:
|
||||
@ -1435,7 +1435,7 @@ public:
|
||||
|
||||
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE
|
||||
{
|
||||
CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D());
|
||||
CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->outputSurface()->context3D());
|
||||
|
||||
// Number of textures used for draw should always be one.
|
||||
EXPECT_EQ(1, context->numUsedTextures());
|
||||
@ -1505,7 +1505,7 @@ public:
|
||||
|
||||
virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE
|
||||
{
|
||||
CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D());
|
||||
CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->outputSurface()->context3D());
|
||||
|
||||
switch (impl->sourceFrameNumber()) {
|
||||
case 0:
|
||||
@ -1557,7 +1557,7 @@ public:
|
||||
|
||||
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE
|
||||
{
|
||||
CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D());
|
||||
CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->outputSurface()->context3D());
|
||||
|
||||
// Number of textures used for drawing should two except for frame 4
|
||||
// where the viewport only contains one layer.
|
||||
@ -1958,7 +1958,7 @@ public:
|
||||
|
||||
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestManySurfaces)
|
||||
|
||||
// A loseContext(1) should lead to a didRecreateOutputSurface(true)
|
||||
// A loseOutputSurface(1) should lead to a didRecreateOutputSurface(true)
|
||||
class LayerTreeHostTestSetSingleLostContext : public LayerTreeHostTest {
|
||||
public:
|
||||
LayerTreeHostTestSetSingleLostContext()
|
||||
@ -1972,7 +1972,7 @@ public:
|
||||
|
||||
virtual void didCommitAndDrawFrame() OVERRIDE
|
||||
{
|
||||
m_layerTreeHost->loseContext(1);
|
||||
m_layerTreeHost->loseOutputSurface(1);
|
||||
}
|
||||
|
||||
virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE
|
||||
@ -1991,7 +1991,7 @@ TEST_F(LayerTreeHostTestSetSingleLostContext, runMultiThread)
|
||||
runTest(true);
|
||||
}
|
||||
|
||||
// A loseContext(10) should lead to a didRecreateOutputSurface(false), and
|
||||
// A loseOutputSurface(10) should lead to a didRecreateOutputSurface(false), and
|
||||
// a finishAllRendering() should not hang.
|
||||
class LayerTreeHostTestSetRepeatedLostContext : public LayerTreeHostTest {
|
||||
public:
|
||||
@ -2006,7 +2006,7 @@ public:
|
||||
|
||||
virtual void didCommitAndDrawFrame() OVERRIDE
|
||||
{
|
||||
m_layerTreeHost->loseContext(10);
|
||||
m_layerTreeHost->loseOutputSurface(10);
|
||||
}
|
||||
|
||||
virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE
|
||||
@ -2880,7 +2880,7 @@ public:
|
||||
EXPECT_TRUE(m_layer->haveBackingTexture());
|
||||
m_layerTreeHost->setVisible(false);
|
||||
postEvictTextures();
|
||||
m_layerTreeHost->loseContext(1);
|
||||
m_layerTreeHost->loseOutputSurface(1);
|
||||
m_layerTreeHost->setVisible(true);
|
||||
break;
|
||||
default:
|
||||
|
@ -146,7 +146,7 @@ void NinePatchLayerImpl::didDraw(ResourceProvider* resourceProvider)
|
||||
{
|
||||
}
|
||||
|
||||
void NinePatchLayerImpl::didLoseContext()
|
||||
void NinePatchLayerImpl::didLoseOutputSurface()
|
||||
{
|
||||
m_resourceId = 0;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
virtual void didDraw(ResourceProvider*) OVERRIDE;
|
||||
virtual ResourceProvider::ResourceId contentsResourceId() const OVERRIDE;
|
||||
virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;
|
||||
virtual void didLoseContext() OVERRIDE;
|
||||
virtual void didLoseOutputSurface() OVERRIDE;
|
||||
|
||||
protected:
|
||||
explicit NinePatchLayerImpl(int id);
|
||||
|
@ -12,8 +12,8 @@
|
||||
#include "cc/single_thread_proxy.h"
|
||||
#include "cc/resource_update_queue.h"
|
||||
#include "cc/texture_uploader.h"
|
||||
#include "cc/test/fake_graphics_context.h"
|
||||
#include "cc/test/fake_layer_tree_host_client.h"
|
||||
#include "cc/test/fake_output_surface.h"
|
||||
#include "cc/test/geometry_test_utils.h"
|
||||
#include "cc/test/layer_tree_test_common.h"
|
||||
#include "SkBitmap.h"
|
||||
@ -103,13 +103,13 @@ TEST_F(NinePatchLayerTest, triggerFullUploadOnceWhenChangingBitmap)
|
||||
m_layerTreeHost->contentsTextureManager()->setMaxMemoryLimitBytes(1024 * 1024);
|
||||
m_layerTreeHost->contentsTextureManager()->prioritizeTextures();
|
||||
|
||||
scoped_ptr<GraphicsContext> context;
|
||||
scoped_ptr<OutputSurface> outputSurface;
|
||||
scoped_ptr<ResourceProvider> resourceProvider;
|
||||
{
|
||||
DebugScopedSetImplThread implThread(proxy());
|
||||
DebugScopedSetMainThreadBlocked mainThreadBlocked(proxy());
|
||||
context = WebKit::createFakeGraphicsContext();
|
||||
resourceProvider = ResourceProvider::create(context.get());
|
||||
outputSurface = createFakeOutputSurface();
|
||||
resourceProvider = ResourceProvider::create(outputSurface.get());
|
||||
params.texture->acquireBackingTexture(resourceProvider.get());
|
||||
ASSERT_TRUE(params.texture->haveBackingTexture());
|
||||
}
|
||||
|
21
cc/output_surface.h
Normal file
21
cc/output_surface.h
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2012 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 CC_OUTPUT_SURFACE_H_
|
||||
#define CC_OUTPUT_SURFACE_H_
|
||||
|
||||
#include <public/WebCompositorOutputSurface.h>
|
||||
|
||||
namespace WebKit {
|
||||
class WebGraphicsContext3D;
|
||||
}
|
||||
|
||||
namespace cc {
|
||||
|
||||
// TODO(danakj): Move WebCompositorOutputSurface implementation to here.
|
||||
typedef WebKit::WebCompositorOutputSurface OutputSurface;
|
||||
|
||||
} // namespace cc
|
||||
|
||||
#endif // CC_OUTPUT_SURFACE_H_
|
@ -7,7 +7,7 @@
|
||||
#include "cc/prioritized_resource_manager.h"
|
||||
#include "cc/resource.h"
|
||||
#include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread
|
||||
#include "cc/test/fake_graphics_context.h"
|
||||
#include "cc/test/fake_output_surface.h"
|
||||
#include "cc/test/fake_proxy.h"
|
||||
#include "cc/test/tiled_layer_test_common.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
@ -22,10 +22,10 @@ public:
|
||||
: m_proxy(scoped_ptr<Thread>(NULL))
|
||||
, m_textureSize(256, 256)
|
||||
, m_textureFormat(GL_RGBA)
|
||||
, m_context(WebKit::createFakeGraphicsContext())
|
||||
, m_outputSurface(createFakeOutputSurface())
|
||||
{
|
||||
DebugScopedSetImplThread implThread(&m_proxy);
|
||||
m_resourceProvider = ResourceProvider::create(m_context.get());
|
||||
m_resourceProvider = ResourceProvider::create(m_outputSurface.get());
|
||||
}
|
||||
|
||||
virtual ~PrioritizedResourceTest()
|
||||
@ -98,7 +98,7 @@ protected:
|
||||
FakeProxy m_proxy;
|
||||
const gfx::Size m_textureSize;
|
||||
const GLenum m_textureFormat;
|
||||
scoped_ptr<GraphicsContext> m_context;
|
||||
scoped_ptr<OutputSurface> m_outputSurface;
|
||||
scoped_ptr<ResourceProvider> m_resourceProvider;
|
||||
};
|
||||
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
|
||||
// Attempts to initialize a context to use for rendering. Returns false if the context could not be created.
|
||||
// The context will not be used and no frames may be produced until initializeRenderer() is called.
|
||||
virtual bool initializeContext() = 0;
|
||||
virtual bool initializeOutputSurface() = 0;
|
||||
|
||||
// Indicates that the compositing surface associated with our context is ready to use.
|
||||
virtual void setSurfaceReady() = 0;
|
||||
@ -67,7 +67,7 @@ public:
|
||||
|
||||
// Attempts to recreate the context and layer renderer after a context lost. Returns false if the renderer couldn't be
|
||||
// reinitialized.
|
||||
virtual bool recreateContext() = 0;
|
||||
virtual bool recreateOutputSurface() = 0;
|
||||
|
||||
virtual void renderingStats(RenderingStats*) = 0;
|
||||
|
||||
@ -98,7 +98,7 @@ public:
|
||||
virtual void acquireLayerTextures() = 0;
|
||||
|
||||
// Testing hooks
|
||||
virtual void loseContext() = 0;
|
||||
virtual void loseOutputSurface() = 0;
|
||||
|
||||
protected:
|
||||
explicit Proxy(scoped_ptr<Thread> implThread);
|
||||
|
@ -19,7 +19,7 @@ class CC_EXPORT RendererClient {
|
||||
public:
|
||||
virtual const gfx::Size& deviceViewportSize() const = 0;
|
||||
virtual const LayerTreeSettings& settings() const = 0;
|
||||
virtual void didLoseContext() = 0;
|
||||
virtual void didLoseOutputSurface() = 0;
|
||||
virtual void onSwapBuffersComplete() = 0;
|
||||
virtual void setFullRootLayerDamage() = 0;
|
||||
virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) = 0;
|
||||
|
@ -109,7 +109,7 @@ ResourceProvider::Child::~Child()
|
||||
{
|
||||
}
|
||||
|
||||
scoped_ptr<ResourceProvider> ResourceProvider::create(GraphicsContext* context)
|
||||
scoped_ptr<ResourceProvider> ResourceProvider::create(OutputSurface* context)
|
||||
{
|
||||
scoped_ptr<ResourceProvider> resourceProvider(new ResourceProvider(context));
|
||||
if (!resourceProvider->initialize())
|
||||
@ -119,7 +119,7 @@ scoped_ptr<ResourceProvider> ResourceProvider::create(GraphicsContext* context)
|
||||
|
||||
ResourceProvider::~ResourceProvider()
|
||||
{
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
if (!context3d || !context3d->makeContextCurrent())
|
||||
return;
|
||||
m_textureUploader.reset();
|
||||
@ -129,7 +129,7 @@ ResourceProvider::~ResourceProvider()
|
||||
WebGraphicsContext3D* ResourceProvider::graphicsContext3D()
|
||||
{
|
||||
DCHECK(m_threadChecker.CalledOnValidThread());
|
||||
return m_context->context3D();
|
||||
return m_outputSurface->context3D();
|
||||
}
|
||||
|
||||
bool ResourceProvider::inUseByConsumer(ResourceId id)
|
||||
@ -162,7 +162,7 @@ ResourceProvider::ResourceId ResourceProvider::createGLTexture(int pool, const g
|
||||
|
||||
DCHECK(m_threadChecker.CalledOnValidThread());
|
||||
unsigned textureId = 0;
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
DCHECK(context3d);
|
||||
GLC(context3d, textureId = context3d->createTexture());
|
||||
GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, textureId));
|
||||
@ -201,7 +201,7 @@ ResourceProvider::ResourceId ResourceProvider::createResourceFromExternalTexture
|
||||
{
|
||||
DCHECK(m_threadChecker.CalledOnValidThread());
|
||||
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
DCHECK(context3d);
|
||||
GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, textureId));
|
||||
GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
|
||||
@ -237,12 +237,12 @@ void ResourceProvider::deleteResourceInternal(ResourceMap::iterator it)
|
||||
{
|
||||
Resource* resource = &it->second;
|
||||
if (resource->glId && !resource->external) {
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
DCHECK(context3d);
|
||||
GLC(context3d, context3d->deleteTexture(resource->glId));
|
||||
}
|
||||
if (resource->glPixelBufferId) {
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
DCHECK(context3d);
|
||||
GLC(context3d, context3d->deleteBuffer(resource->glPixelBufferId));
|
||||
}
|
||||
@ -286,7 +286,7 @@ void ResourceProvider::setPixels(ResourceId id, const uint8_t* image, const gfx:
|
||||
DCHECK(!resource->exported);
|
||||
|
||||
if (resource->glId) {
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
DCHECK(context3d);
|
||||
DCHECK(m_textureUploader.get());
|
||||
context3d->bindTexture(GL_TEXTURE_2D, resource->glId);
|
||||
@ -349,7 +349,7 @@ void ResourceProvider::flushUploads()
|
||||
void ResourceProvider::flush()
|
||||
{
|
||||
DCHECK(m_threadChecker.CalledOnValidThread());
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
if (context3d)
|
||||
context3d->flush();
|
||||
}
|
||||
@ -357,7 +357,7 @@ void ResourceProvider::flush()
|
||||
bool ResourceProvider::shallowFlushIfSupported()
|
||||
{
|
||||
DCHECK(m_threadChecker.CalledOnValidThread());
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
if (!context3d || !m_useShallowFlush)
|
||||
return false;
|
||||
|
||||
@ -479,8 +479,8 @@ ResourceProvider::ScopedWriteLockSoftware::~ScopedWriteLockSoftware()
|
||||
m_resourceProvider->unlockForWrite(m_resourceId);
|
||||
}
|
||||
|
||||
ResourceProvider::ResourceProvider(GraphicsContext* context)
|
||||
: m_context(context)
|
||||
ResourceProvider::ResourceProvider(OutputSurface* context)
|
||||
: m_outputSurface(context)
|
||||
, m_nextId(1)
|
||||
, m_nextChild(1)
|
||||
, m_defaultResourceType(GLTexture)
|
||||
@ -494,7 +494,7 @@ ResourceProvider::ResourceProvider(GraphicsContext* context)
|
||||
bool ResourceProvider::initialize()
|
||||
{
|
||||
DCHECK(m_threadChecker.CalledOnValidThread());
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
if (!context3d) {
|
||||
m_maxTextureSize = INT_MAX / 2;
|
||||
return true;
|
||||
@ -559,7 +559,7 @@ void ResourceProvider::prepareSendToParent(const ResourceIdArray& resources, Tra
|
||||
DCHECK(m_threadChecker.CalledOnValidThread());
|
||||
list->sync_point = 0;
|
||||
list->resources.clear();
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
if (!context3d || !context3d->makeContextCurrent()) {
|
||||
// FIXME: Implement this path for software compositing.
|
||||
return;
|
||||
@ -580,7 +580,7 @@ void ResourceProvider::prepareSendToChild(int child, const ResourceIdArray& reso
|
||||
DCHECK(m_threadChecker.CalledOnValidThread());
|
||||
list->sync_point = 0;
|
||||
list->resources.clear();
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
if (!context3d || !context3d->makeContextCurrent()) {
|
||||
// FIXME: Implement this path for software compositing.
|
||||
return;
|
||||
@ -604,7 +604,7 @@ void ResourceProvider::prepareSendToChild(int child, const ResourceIdArray& reso
|
||||
void ResourceProvider::receiveFromChild(int child, const TransferableResourceList& resources)
|
||||
{
|
||||
DCHECK(m_threadChecker.CalledOnValidThread());
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
if (!context3d || !context3d->makeContextCurrent()) {
|
||||
// FIXME: Implement this path for software compositing.
|
||||
return;
|
||||
@ -636,7 +636,7 @@ void ResourceProvider::receiveFromChild(int child, const TransferableResourceLis
|
||||
void ResourceProvider::receiveFromParent(const TransferableResourceList& resources)
|
||||
{
|
||||
DCHECK(m_threadChecker.CalledOnValidThread());
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
if (!context3d || !context3d->makeContextCurrent()) {
|
||||
// FIXME: Implement this path for software compositing.
|
||||
return;
|
||||
@ -660,7 +660,7 @@ void ResourceProvider::receiveFromParent(const TransferableResourceList& resourc
|
||||
bool ResourceProvider::transferResource(WebGraphicsContext3D* context, ResourceId id, TransferableResource* resource)
|
||||
{
|
||||
DCHECK(m_threadChecker.CalledOnValidThread());
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
ResourceMap::iterator it = m_resources.find(id);
|
||||
CHECK(it != m_resources.end());
|
||||
Resource* source = &it->second;
|
||||
@ -696,7 +696,7 @@ void ResourceProvider::acquirePixelBuffer(ResourceId id)
|
||||
DCHECK(!resource->exported);
|
||||
|
||||
if (resource->glId) {
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
DCHECK(context3d);
|
||||
if (!resource->glPixelBufferId)
|
||||
resource->glPixelBufferId = context3d->createBuffer();
|
||||
@ -731,7 +731,7 @@ void ResourceProvider::releasePixelBuffer(ResourceId id)
|
||||
|
||||
if (resource->glId) {
|
||||
DCHECK(resource->glPixelBufferId);
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
DCHECK(context3d);
|
||||
context3d->bindBuffer(
|
||||
GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM,
|
||||
@ -762,7 +762,7 @@ uint8_t* ResourceProvider::mapPixelBuffer(ResourceId id)
|
||||
DCHECK(!resource->exported);
|
||||
|
||||
if (resource->glId) {
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
DCHECK(context3d);
|
||||
DCHECK(resource->glPixelBufferId);
|
||||
context3d->bindBuffer(
|
||||
@ -792,7 +792,7 @@ void ResourceProvider::unmapPixelBuffer(ResourceId id)
|
||||
DCHECK(!resource->exported);
|
||||
|
||||
if (resource->glId) {
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
DCHECK(context3d);
|
||||
DCHECK(resource->glPixelBufferId);
|
||||
context3d->bindBuffer(
|
||||
@ -816,7 +816,7 @@ void ResourceProvider::setPixelsFromBuffer(ResourceId id)
|
||||
DCHECK(!resource->exported);
|
||||
|
||||
if (resource->glId) {
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
DCHECK(context3d);
|
||||
DCHECK(resource->glPixelBufferId);
|
||||
context3d->bindTexture(GL_TEXTURE_2D, resource->glId);
|
||||
@ -853,7 +853,7 @@ void ResourceProvider::setPixelsFromBuffer(ResourceId id)
|
||||
void ResourceProvider::bindForSampling(ResourceProvider::ResourceId resourceId, GLenum target, GLenum filter)
|
||||
{
|
||||
DCHECK(m_threadChecker.CalledOnValidThread());
|
||||
WebGraphicsContext3D* context3d = m_context->context3D();
|
||||
WebGraphicsContext3D* context3d = m_outputSurface->context3D();
|
||||
ResourceMap::iterator it = m_resources.find(resourceId);
|
||||
DCHECK(it != m_resources.end());
|
||||
Resource* resource = &it->second;
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/threading/thread_checker.h"
|
||||
#include "cc/cc_export.h"
|
||||
#include "cc/graphics_context.h"
|
||||
#include "cc/output_surface.h"
|
||||
#include "cc/texture_copier.h"
|
||||
#include "cc/transferable_resource.h"
|
||||
#include "third_party/khronos/GLES2/gl2.h"
|
||||
@ -46,7 +46,7 @@ public:
|
||||
Bitmap,
|
||||
};
|
||||
|
||||
static scoped_ptr<ResourceProvider> create(GraphicsContext*);
|
||||
static scoped_ptr<ResourceProvider> create(OutputSurface*);
|
||||
|
||||
virtual ~ResourceProvider();
|
||||
|
||||
@ -257,7 +257,7 @@ private:
|
||||
};
|
||||
typedef base::hash_map<int, Child> ChildMap;
|
||||
|
||||
explicit ResourceProvider(GraphicsContext*);
|
||||
explicit ResourceProvider(OutputSurface*);
|
||||
bool initialize();
|
||||
|
||||
const Resource* lockForRead(ResourceId);
|
||||
@ -269,7 +269,7 @@ private:
|
||||
bool transferResource(WebKit::WebGraphicsContext3D*, ResourceId, TransferableResource*);
|
||||
void deleteResourceInternal(ResourceMap::iterator it);
|
||||
|
||||
GraphicsContext* m_context;
|
||||
OutputSurface* m_outputSurface;
|
||||
ResourceId m_nextId;
|
||||
ResourceMap m_resources;
|
||||
int m_nextChild;
|
||||
|
@ -5,17 +5,17 @@
|
||||
#include "cc/resource_provider.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "cc/graphics_context.h"
|
||||
#include "cc/output_surface.h"
|
||||
#include "cc/scoped_ptr_deque.h"
|
||||
#include "cc/scoped_ptr_hash_map.h"
|
||||
#include "cc/test/compositor_fake_web_graphics_context_3d.h"
|
||||
#include "cc/test/fake_web_compositor_output_surface.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
|
||||
#include "third_party/khronos/GLES2/gl2.h"
|
||||
#include "third_party/khronos/GLES2/gl2ext.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
#include <public/WebGraphicsContext3D.h>
|
||||
|
||||
using namespace WebKit;
|
||||
|
||||
@ -272,13 +272,13 @@ class ResourceProviderTest : public testing::TestWithParam<ResourceProvider::Res
|
||||
public:
|
||||
ResourceProviderTest()
|
||||
: m_sharedData(ContextSharedData::create())
|
||||
, m_context(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>().PassAs<WebKit::WebGraphicsContext3D>()))
|
||||
, m_resourceProvider(ResourceProvider::create(m_context.get()))
|
||||
, m_outputSurface(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>().PassAs<WebKit::WebGraphicsContext3D>()))
|
||||
, m_resourceProvider(ResourceProvider::create(m_outputSurface.get()))
|
||||
{
|
||||
m_resourceProvider->setDefaultResourceType(GetParam());
|
||||
}
|
||||
|
||||
ResourceProviderContext* context() { return static_cast<ResourceProviderContext*>(m_context->context3D()); }
|
||||
ResourceProviderContext* context() { return static_cast<ResourceProviderContext*>(m_outputSurface->context3D()); }
|
||||
|
||||
void getResourcePixels(ResourceProvider::ResourceId id, const gfx::Size& size, WGC3Denum format, uint8_t* pixels)
|
||||
{
|
||||
@ -302,7 +302,7 @@ public:
|
||||
|
||||
protected:
|
||||
scoped_ptr<ContextSharedData> m_sharedData;
|
||||
scoped_ptr<GraphicsContext> m_context;
|
||||
scoped_ptr<OutputSurface> m_outputSurface;
|
||||
scoped_ptr<ResourceProvider> m_resourceProvider;
|
||||
};
|
||||
|
||||
@ -417,8 +417,8 @@ TEST_P(ResourceProviderTest, TransferResources)
|
||||
if (GetParam() != ResourceProvider::GLTexture)
|
||||
return;
|
||||
|
||||
scoped_ptr<GraphicsContext> childContext(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>()));
|
||||
scoped_ptr<ResourceProvider> childResourceProvider(ResourceProvider::create(childContext.get()));
|
||||
scoped_ptr<OutputSurface> childOutputSurface(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>()));
|
||||
scoped_ptr<ResourceProvider> childResourceProvider(ResourceProvider::create(childOutputSurface.get()));
|
||||
|
||||
gfx::Size size(1, 1);
|
||||
WGC3Denum format = GL_RGBA;
|
||||
@ -493,7 +493,7 @@ TEST_P(ResourceProviderTest, TransferResources)
|
||||
EXPECT_FALSE(childResourceProvider->inUseByConsumer(id1));
|
||||
EXPECT_FALSE(childResourceProvider->inUseByConsumer(id2));
|
||||
|
||||
ResourceProviderContext* childContext3D = static_cast<ResourceProviderContext*>(childContext->context3D());
|
||||
ResourceProviderContext* childContext3D = static_cast<ResourceProviderContext*>(childOutputSurface->context3D());
|
||||
{
|
||||
ResourceProvider::ScopedReadLockGL lock(childResourceProvider.get(), id1);
|
||||
ASSERT_NE(0U, lock.textureId());
|
||||
@ -534,8 +534,8 @@ TEST_P(ResourceProviderTest, DeleteTransferredResources)
|
||||
if (GetParam() != ResourceProvider::GLTexture)
|
||||
return;
|
||||
|
||||
scoped_ptr<GraphicsContext> childContext(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>()));
|
||||
scoped_ptr<ResourceProvider> childResourceProvider(ResourceProvider::create(childContext.get()));
|
||||
scoped_ptr<OutputSurface> childOutputSurface(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>()));
|
||||
scoped_ptr<ResourceProvider> childResourceProvider(ResourceProvider::create(childOutputSurface.get()));
|
||||
|
||||
gfx::Size size(1, 1);
|
||||
WGC3Denum format = GL_RGBA;
|
||||
@ -595,7 +595,7 @@ TEST_P(ResourceProviderTest, ScopedSampler)
|
||||
if (GetParam() != ResourceProvider::GLTexture)
|
||||
return;
|
||||
|
||||
scoped_ptr<GraphicsContext> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new TextureStateTrackingContext)));
|
||||
scoped_ptr<OutputSurface> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new TextureStateTrackingContext)));
|
||||
TextureStateTrackingContext* context = static_cast<TextureStateTrackingContext*>(outputSurface->context3D());
|
||||
scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(outputSurface.get()));
|
||||
|
||||
|
@ -121,7 +121,7 @@ public:
|
||||
protected:
|
||||
virtual void SetUp()
|
||||
{
|
||||
m_context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new WebGraphicsContext3DForUploadTest(this)));
|
||||
m_outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new WebGraphicsContext3DForUploadTest(this)));
|
||||
m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 300, 150);
|
||||
m_bitmap.allocPixels();
|
||||
|
||||
@ -133,7 +133,7 @@ protected:
|
||||
}
|
||||
m_resourceManager->prioritizeTextures();
|
||||
|
||||
m_resourceProvider = ResourceProvider::create(m_context.get());
|
||||
m_resourceProvider = ResourceProvider::create(m_outputSurface.get());
|
||||
}
|
||||
|
||||
|
||||
@ -198,7 +198,7 @@ protected:
|
||||
protected:
|
||||
// Classes required to interact and test the ResourceUpdateController
|
||||
FakeProxy m_proxy;
|
||||
scoped_ptr<GraphicsContext> m_context;
|
||||
scoped_ptr<OutputSurface> m_outputSurface;
|
||||
scoped_ptr<ResourceProvider> m_resourceProvider;
|
||||
scoped_ptr<ResourceUpdateQueue> m_queue;
|
||||
scoped_ptr<PrioritizedResource> m_textures[4];
|
||||
|
@ -104,18 +104,18 @@ void Scheduler::didSwapBuffersComplete()
|
||||
m_frameRateController->didFinishFrame();
|
||||
}
|
||||
|
||||
void Scheduler::didLoseContext()
|
||||
void Scheduler::didLoseOutputSurface()
|
||||
{
|
||||
TRACE_EVENT0("cc", "Scheduler::didLoseContext");
|
||||
TRACE_EVENT0("cc", "Scheduler::didLoseOutputSurface");
|
||||
m_frameRateController->didAbortAllPendingFrames();
|
||||
m_stateMachine.didLoseContext();
|
||||
m_stateMachine.didLoseOutputSurface();
|
||||
processScheduledActions();
|
||||
}
|
||||
|
||||
void Scheduler::didRecreateContext()
|
||||
void Scheduler::didRecreateOutputSurface()
|
||||
{
|
||||
TRACE_EVENT0("cc", "Scheduler::didRecreateContext");
|
||||
m_stateMachine.didRecreateContext();
|
||||
TRACE_EVENT0("cc", "Scheduler::didRecreateOutputSurface");
|
||||
m_stateMachine.didRecreateOutputSurface();
|
||||
processScheduledActions();
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ void Scheduler::processScheduledActions()
|
||||
if (result.didSwap)
|
||||
m_frameRateController->didBeginFrame();
|
||||
break;
|
||||
} case SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION:
|
||||
} case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_RECREATION:
|
||||
m_client->scheduledActionBeginContextRecreation();
|
||||
break;
|
||||
case SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD:
|
||||
|
@ -79,8 +79,8 @@ public:
|
||||
void setSwapBuffersCompleteSupported(bool);
|
||||
void didSwapBuffersComplete();
|
||||
|
||||
void didLoseContext();
|
||||
void didRecreateContext();
|
||||
void didLoseOutputSurface();
|
||||
void didRecreateOutputSurface();
|
||||
|
||||
bool commitPending() const { return m_stateMachine.commitPending(); }
|
||||
bool redrawPending() const { return m_stateMachine.redrawPending(); }
|
||||
|
@ -28,7 +28,7 @@ SchedulerStateMachine::SchedulerStateMachine()
|
||||
, m_canDraw(false)
|
||||
, m_drawIfPossibleFailed(false)
|
||||
, m_textureState(LAYER_TEXTURE_STATE_UNLOCKED)
|
||||
, m_contextState(CONTEXT_ACTIVE)
|
||||
, m_outputSurfaceState(OUTPUT_SURFACE_ACTIVE)
|
||||
{
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ std::string SchedulerStateMachine::toString()
|
||||
base::StringAppendF(&str, "m_canDraw = %d; ", m_canDraw);
|
||||
base::StringAppendF(&str, "m_drawIfPossibleFailed = %d; ", m_drawIfPossibleFailed);
|
||||
base::StringAppendF(&str, "m_textureState = %d; ", m_textureState);
|
||||
base::StringAppendF(&str, "m_contextState = %d; ", m_contextState);
|
||||
base::StringAppendF(&str, "m_outputSurfaceState = %d; ", m_outputSurfaceState);
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ bool SchedulerStateMachine::shouldDraw() const
|
||||
return false;
|
||||
if (hasDrawnThisFrame())
|
||||
return false;
|
||||
if (m_contextState != CONTEXT_ACTIVE)
|
||||
if (m_outputSurfaceState != OUTPUT_SURFACE_ACTIVE)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@ -120,13 +120,13 @@ SchedulerStateMachine::Action SchedulerStateMachine::nextAction() const
|
||||
return ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD;
|
||||
switch (m_commitState) {
|
||||
case COMMIT_STATE_IDLE:
|
||||
if (m_contextState != CONTEXT_ACTIVE && m_needsForcedRedraw)
|
||||
if (m_outputSurfaceState != OUTPUT_SURFACE_ACTIVE && m_needsForcedRedraw)
|
||||
return ACTION_DRAW_FORCED;
|
||||
if (m_contextState != CONTEXT_ACTIVE && m_needsForcedCommit)
|
||||
if (m_outputSurfaceState != OUTPUT_SURFACE_ACTIVE && m_needsForcedCommit)
|
||||
return ACTION_BEGIN_FRAME;
|
||||
if (m_contextState == CONTEXT_LOST)
|
||||
return ACTION_BEGIN_CONTEXT_RECREATION;
|
||||
if (m_contextState == CONTEXT_RECREATING)
|
||||
if (m_outputSurfaceState == OUTPUT_SURFACE_LOST)
|
||||
return ACTION_BEGIN_OUTPUT_SURFACE_RECREATION;
|
||||
if (m_outputSurfaceState == OUTPUT_SURFACE_RECREATING)
|
||||
return ACTION_NONE;
|
||||
if (shouldDraw())
|
||||
return m_needsForcedRedraw ? ACTION_DRAW_FORCED : ACTION_DRAW_IF_POSSIBLE;
|
||||
@ -143,7 +143,7 @@ SchedulerStateMachine::Action SchedulerStateMachine::nextAction() const
|
||||
return ACTION_COMMIT;
|
||||
|
||||
case COMMIT_STATE_WAITING_FOR_FIRST_DRAW:
|
||||
if (shouldDraw() || m_contextState == CONTEXT_LOST)
|
||||
if (shouldDraw() || m_outputSurfaceState == OUTPUT_SURFACE_LOST)
|
||||
return m_needsForcedRedraw ? ACTION_DRAW_FORCED : ACTION_DRAW_IF_POSSIBLE;
|
||||
// COMMIT_STATE_WAITING_FOR_FIRST_DRAW wants to enforce a draw. If m_canDraw is false
|
||||
// or textures are not available, proceed to the next step (similar as in COMMIT_STATE_IDLE).
|
||||
@ -201,10 +201,10 @@ void SchedulerStateMachine::updateState(Action action)
|
||||
m_textureState = LAYER_TEXTURE_STATE_UNLOCKED;
|
||||
return;
|
||||
|
||||
case ACTION_BEGIN_CONTEXT_RECREATION:
|
||||
case ACTION_BEGIN_OUTPUT_SURFACE_RECREATION:
|
||||
DCHECK(m_commitState == COMMIT_STATE_IDLE);
|
||||
DCHECK(m_contextState == CONTEXT_LOST);
|
||||
m_contextState = CONTEXT_RECREATING;
|
||||
DCHECK(m_outputSurfaceState == OUTPUT_SURFACE_LOST);
|
||||
m_outputSurfaceState = OUTPUT_SURFACE_RECREATING;
|
||||
return;
|
||||
|
||||
case ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD:
|
||||
@ -232,7 +232,7 @@ bool SchedulerStateMachine::vsyncCallbackNeeded() const
|
||||
if (m_needsForcedRedraw)
|
||||
return true;
|
||||
|
||||
return m_needsRedraw && m_visible && m_contextState == CONTEXT_ACTIVE;
|
||||
return m_needsRedraw && m_visible && m_outputSurfaceState == OUTPUT_SURFACE_ACTIVE;
|
||||
}
|
||||
|
||||
void SchedulerStateMachine::didEnterVSync()
|
||||
@ -307,17 +307,17 @@ void SchedulerStateMachine::beginFrameAborted()
|
||||
}
|
||||
}
|
||||
|
||||
void SchedulerStateMachine::didLoseContext()
|
||||
void SchedulerStateMachine::didLoseOutputSurface()
|
||||
{
|
||||
if (m_contextState == CONTEXT_LOST || m_contextState == CONTEXT_RECREATING)
|
||||
if (m_outputSurfaceState == OUTPUT_SURFACE_LOST || m_outputSurfaceState == OUTPUT_SURFACE_RECREATING)
|
||||
return;
|
||||
m_contextState = CONTEXT_LOST;
|
||||
m_outputSurfaceState = OUTPUT_SURFACE_LOST;
|
||||
}
|
||||
|
||||
void SchedulerStateMachine::didRecreateContext()
|
||||
void SchedulerStateMachine::didRecreateOutputSurface()
|
||||
{
|
||||
DCHECK(m_contextState == CONTEXT_RECREATING);
|
||||
m_contextState = CONTEXT_ACTIVE;
|
||||
DCHECK(m_outputSurfaceState == OUTPUT_SURFACE_RECREATING);
|
||||
m_outputSurfaceState = OUTPUT_SURFACE_ACTIVE;
|
||||
setNeedsCommit();
|
||||
}
|
||||
|
||||
|
@ -39,10 +39,10 @@ public:
|
||||
LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD,
|
||||
};
|
||||
|
||||
enum ContextState {
|
||||
CONTEXT_ACTIVE,
|
||||
CONTEXT_LOST,
|
||||
CONTEXT_RECREATING,
|
||||
enum OutputSurfaceState {
|
||||
OUTPUT_SURFACE_ACTIVE,
|
||||
OUTPUT_SURFACE_LOST,
|
||||
OUTPUT_SURFACE_RECREATING,
|
||||
};
|
||||
|
||||
bool commitPending() const
|
||||
@ -58,7 +58,7 @@ public:
|
||||
ACTION_COMMIT,
|
||||
ACTION_DRAW_IF_POSSIBLE,
|
||||
ACTION_DRAW_FORCED,
|
||||
ACTION_BEGIN_CONTEXT_RECREATION,
|
||||
ACTION_BEGIN_OUTPUT_SURFACE_RECREATION,
|
||||
ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD,
|
||||
};
|
||||
Action nextAction() const;
|
||||
@ -120,8 +120,8 @@ public:
|
||||
// when such behavior would be undesirable.
|
||||
void setCanDraw(bool can) { m_canDraw = can; }
|
||||
|
||||
void didLoseContext();
|
||||
void didRecreateContext();
|
||||
void didLoseOutputSurface();
|
||||
void didRecreateOutputSurface();
|
||||
|
||||
// Exposed for testing purposes.
|
||||
void setMaximumNumberOfFailedDrawsBeforeDrawIsForced(int);
|
||||
@ -155,7 +155,7 @@ protected:
|
||||
bool m_canDraw;
|
||||
bool m_drawIfPossibleFailed;
|
||||
TextureState m_textureState;
|
||||
ContextState m_contextState;
|
||||
OutputSurfaceState m_outputSurfaceState;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine);
|
||||
};
|
||||
|
@ -637,16 +637,16 @@ TEST(SchedulerStateMachineTest, TestContextLostWhenCompletelyIdle)
|
||||
state.setVisible(true);
|
||||
state.setCanDraw(true);
|
||||
|
||||
state.didLoseContext();
|
||||
state.didLoseOutputSurface();
|
||||
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction());
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_RECREATION, state.nextAction());
|
||||
state.updateState(state.nextAction());
|
||||
|
||||
// Once context recreation begins, nothing should happen.
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction());
|
||||
|
||||
// Recreate the context
|
||||
state.didRecreateContext();
|
||||
state.didRecreateOutputSurface();
|
||||
|
||||
// When the context is recreated, we should begin a commit
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction());
|
||||
@ -660,9 +660,9 @@ TEST(SchedulerStateMachineTest, TestContextLostWhenIdleAndCommitRequestedWhileRe
|
||||
state.setVisible(true);
|
||||
state.setCanDraw(true);
|
||||
|
||||
state.didLoseContext();
|
||||
state.didLoseOutputSurface();
|
||||
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction());
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_RECREATION, state.nextAction());
|
||||
state.updateState(state.nextAction());
|
||||
|
||||
// Once context recreation begins, nothing should happen.
|
||||
@ -673,7 +673,7 @@ TEST(SchedulerStateMachineTest, TestContextLostWhenIdleAndCommitRequestedWhileRe
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction());
|
||||
|
||||
// Recreate the context
|
||||
state.didRecreateContext();
|
||||
state.didRecreateOutputSurface();
|
||||
|
||||
// When the context is recreated, we should begin a commit
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction());
|
||||
@ -710,7 +710,7 @@ TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgress)
|
||||
state.didLeaveVSync();
|
||||
|
||||
// Cause a lost context while the begin frame is in flight.
|
||||
state.didLoseContext();
|
||||
state.didLoseOutputSurface();
|
||||
|
||||
// Ask for another draw. Expect nothing happens.
|
||||
state.setNeedsRedraw(true);
|
||||
@ -728,9 +728,9 @@ TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgress)
|
||||
|
||||
// Expect to be told to begin context recreation, independent of vsync state
|
||||
state.didEnterVSync();
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction());
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_RECREATION, state.nextAction());
|
||||
state.didLeaveVSync();
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction());
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_RECREATION, state.nextAction());
|
||||
}
|
||||
|
||||
TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgressAndAnotherCommitRequested)
|
||||
@ -753,7 +753,7 @@ TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgressAndAnotherCo
|
||||
state.didLeaveVSync();
|
||||
|
||||
// Cause a lost context while the begin frame is in flight.
|
||||
state.didLoseContext();
|
||||
state.didLoseOutputSurface();
|
||||
|
||||
// Ask for another draw and also set needs commit. Expect nothing happens.
|
||||
state.setNeedsRedraw(true);
|
||||
@ -772,9 +772,9 @@ TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgressAndAnotherCo
|
||||
|
||||
// Expect to be told to begin context recreation, independent of vsync state
|
||||
state.didEnterVSync();
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction());
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_RECREATION, state.nextAction());
|
||||
state.didLeaveVSync();
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction());
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_RECREATION, state.nextAction());
|
||||
}
|
||||
|
||||
|
||||
@ -785,7 +785,7 @@ TEST(SchedulerStateMachineTest, TestFinishAllRenderingWhileContextLost)
|
||||
state.setCanDraw(true);
|
||||
|
||||
// Cause a lost context lost.
|
||||
state.didLoseContext();
|
||||
state.didLoseOutputSurface();
|
||||
|
||||
// Ask a forced redraw and verify it ocurrs.
|
||||
state.setNeedsForcedRedraw(true);
|
||||
@ -797,7 +797,7 @@ TEST(SchedulerStateMachineTest, TestFinishAllRenderingWhileContextLost)
|
||||
state.setNeedsForcedRedraw(false);
|
||||
|
||||
// Expect to be told to begin context recreation, independent of vsync state
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction());
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_RECREATION, state.nextAction());
|
||||
state.updateState(state.nextAction());
|
||||
|
||||
// Ask a forced redraw and verify it ocurrs.
|
||||
@ -853,7 +853,7 @@ TEST(SchedulerStateMachineTest, TestBeginFrameWhenContextLost)
|
||||
state.setCanDraw(true);
|
||||
state.setNeedsCommit();
|
||||
state.setNeedsForcedCommit();
|
||||
state.didLoseContext();
|
||||
state.didLoseOutputSurface();
|
||||
EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction());
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "cc/scoped_resource.h"
|
||||
|
||||
#include "cc/renderer.h"
|
||||
#include "cc/test/fake_graphics_context.h"
|
||||
#include "cc/test/fake_output_surface.h"
|
||||
#include "cc/test/tiled_layer_test_common.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/khronos/GLES2/gl2.h"
|
||||
@ -17,7 +17,7 @@ namespace {
|
||||
|
||||
TEST(ScopedResourceTest, NewScopedResource)
|
||||
{
|
||||
scoped_ptr<GraphicsContext> context(createFakeGraphicsContext());
|
||||
scoped_ptr<OutputSurface> context(createFakeOutputSurface());
|
||||
scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get()));
|
||||
scoped_ptr<ScopedResource> texture = ScopedResource::create(resourceProvider.get());
|
||||
|
||||
@ -31,7 +31,7 @@ TEST(ScopedResourceTest, NewScopedResource)
|
||||
|
||||
TEST(ScopedResourceTest, CreateScopedResource)
|
||||
{
|
||||
scoped_ptr<GraphicsContext> context(createFakeGraphicsContext());
|
||||
scoped_ptr<OutputSurface> context(createFakeOutputSurface());
|
||||
scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get()));
|
||||
scoped_ptr<ScopedResource> texture = ScopedResource::create(resourceProvider.get());
|
||||
texture->Allocate(Renderer::ImplPool, gfx::Size(30, 30), GL_RGBA, ResourceProvider::TextureUsageAny);
|
||||
@ -47,7 +47,7 @@ TEST(ScopedResourceTest, CreateScopedResource)
|
||||
|
||||
TEST(ScopedResourceTest, ScopedResourceIsDeleted)
|
||||
{
|
||||
scoped_ptr<GraphicsContext> context(createFakeGraphicsContext());
|
||||
scoped_ptr<OutputSurface> context(createFakeOutputSurface());
|
||||
scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get()));
|
||||
|
||||
{
|
||||
@ -74,7 +74,7 @@ TEST(ScopedResourceTest, ScopedResourceIsDeleted)
|
||||
|
||||
TEST(ScopedResourceTest, LeakScopedResource)
|
||||
{
|
||||
scoped_ptr<GraphicsContext> context(createFakeGraphicsContext());
|
||||
scoped_ptr<OutputSurface> context(createFakeOutputSurface());
|
||||
scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get()));
|
||||
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ void ScrollbarLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollbarLayerImpl::didLoseContext()
|
||||
void ScrollbarLayerImpl::didLoseOutputSurface()
|
||||
{
|
||||
m_backTrackResourceId = 0;
|
||||
m_foreTrackResourceId = 0;
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
|
||||
virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE;
|
||||
|
||||
virtual void didLoseContext() OVERRIDE;
|
||||
virtual void didLoseOutputSurface() OVERRIDE;
|
||||
|
||||
protected:
|
||||
explicit ScrollbarLayerImpl(int id);
|
||||
|
@ -6,8 +6,8 @@
|
||||
|
||||
#include "base/debug/trace_event.h"
|
||||
#include "cc/draw_quad.h"
|
||||
#include "cc/graphics_context.h"
|
||||
#include "cc/layer_tree_host.h"
|
||||
#include "cc/output_surface.h"
|
||||
#include "cc/resource_update_controller.h"
|
||||
#include "cc/thread.h"
|
||||
|
||||
@ -21,7 +21,7 @@ scoped_ptr<Proxy> SingleThreadProxy::create(LayerTreeHost* layerTreeHost)
|
||||
SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layerTreeHost)
|
||||
: Proxy(scoped_ptr<Thread>(NULL))
|
||||
, m_layerTreeHost(layerTreeHost)
|
||||
, m_contextLost(false)
|
||||
, m_outputSurfaceLost(false)
|
||||
, m_rendererInitialized(false)
|
||||
, m_nextFrameIsNewlyCommittedFrame(false)
|
||||
, m_totalCommitCount(0)
|
||||
@ -82,13 +82,13 @@ bool SingleThreadProxy::isStarted() const
|
||||
return m_layerTreeHostImpl.get();
|
||||
}
|
||||
|
||||
bool SingleThreadProxy::initializeContext()
|
||||
bool SingleThreadProxy::initializeOutputSurface()
|
||||
{
|
||||
DCHECK(Proxy::isMainThread());
|
||||
scoped_ptr<GraphicsContext> context = m_layerTreeHost->createContext();
|
||||
if (!context.get())
|
||||
scoped_ptr<OutputSurface> outputSurface = m_layerTreeHost->createOutputSurface();
|
||||
if (!outputSurface.get())
|
||||
return false;
|
||||
m_contextBeforeInitialization = context.Pass();
|
||||
m_outputSurfaceBeforeInitialization = outputSurface.Pass();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -106,10 +106,10 @@ void SingleThreadProxy::setVisible(bool visible)
|
||||
bool SingleThreadProxy::initializeRenderer()
|
||||
{
|
||||
DCHECK(Proxy::isMainThread());
|
||||
DCHECK(m_contextBeforeInitialization.get());
|
||||
DCHECK(m_outputSurfaceBeforeInitialization.get());
|
||||
{
|
||||
DebugScopedSetImplThread impl(this);
|
||||
bool ok = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitialization.Pass());
|
||||
bool ok = m_layerTreeHostImpl->initializeRenderer(m_outputSurfaceBeforeInitialization.Pass());
|
||||
if (ok) {
|
||||
m_rendererInitialized = true;
|
||||
m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererCapabilities();
|
||||
@ -119,14 +119,14 @@ bool SingleThreadProxy::initializeRenderer()
|
||||
}
|
||||
}
|
||||
|
||||
bool SingleThreadProxy::recreateContext()
|
||||
bool SingleThreadProxy::recreateOutputSurface()
|
||||
{
|
||||
TRACE_EVENT0("cc", "SingleThreadProxy::recreateContext");
|
||||
DCHECK(Proxy::isMainThread());
|
||||
DCHECK(m_contextLost);
|
||||
DCHECK(m_outputSurfaceLost);
|
||||
|
||||
scoped_ptr<GraphicsContext> context = m_layerTreeHost->createContext();
|
||||
if (!context.get())
|
||||
scoped_ptr<OutputSurface> outputSurface = m_layerTreeHost->createOutputSurface();
|
||||
if (!outputSurface.get())
|
||||
return false;
|
||||
|
||||
bool initialized;
|
||||
@ -135,14 +135,14 @@ bool SingleThreadProxy::recreateContext()
|
||||
DebugScopedSetImplThread impl(this);
|
||||
if (!m_layerTreeHostImpl->contentsTexturesPurged())
|
||||
m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider());
|
||||
initialized = m_layerTreeHostImpl->initializeRenderer(context.Pass());
|
||||
initialized = m_layerTreeHostImpl->initializeRenderer(outputSurface.Pass());
|
||||
if (initialized) {
|
||||
m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererCapabilities();
|
||||
}
|
||||
}
|
||||
|
||||
if (initialized)
|
||||
m_contextLost = false;
|
||||
m_outputSurfaceLost = false;
|
||||
|
||||
return initialized;
|
||||
}
|
||||
@ -161,11 +161,11 @@ const RendererCapabilities& SingleThreadProxy::rendererCapabilities() const
|
||||
return m_RendererCapabilitiesForMainThread;
|
||||
}
|
||||
|
||||
void SingleThreadProxy::loseContext()
|
||||
void SingleThreadProxy::loseOutputSurface()
|
||||
{
|
||||
DCHECK(Proxy::isMainThread());
|
||||
m_layerTreeHost->didLoseContext();
|
||||
m_contextLost = true;
|
||||
m_layerTreeHost->didLoseOutputSurface();
|
||||
m_outputSurfaceLost = true;
|
||||
}
|
||||
|
||||
void SingleThreadProxy::setNeedsAnimate()
|
||||
@ -359,7 +359,7 @@ bool SingleThreadProxy::commitAndComposite()
|
||||
|
||||
bool SingleThreadProxy::doComposite()
|
||||
{
|
||||
DCHECK(!m_contextLost);
|
||||
DCHECK(!m_outputSurfaceLost);
|
||||
{
|
||||
DebugScopedSetImplThread impl(this);
|
||||
|
||||
@ -384,8 +384,8 @@ bool SingleThreadProxy::doComposite()
|
||||
}
|
||||
|
||||
if (m_layerTreeHostImpl->isContextLost()) {
|
||||
m_contextLost = true;
|
||||
m_layerTreeHost->didLoseContext();
|
||||
m_outputSurfaceLost = true;
|
||||
m_layerTreeHost->didLoseOutputSurface();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -26,14 +26,14 @@ public:
|
||||
virtual void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, float scale, base::TimeDelta duration) OVERRIDE;
|
||||
virtual void finishAllRendering() OVERRIDE;
|
||||
virtual bool isStarted() const OVERRIDE;
|
||||
virtual bool initializeContext() OVERRIDE;
|
||||
virtual bool initializeOutputSurface() OVERRIDE;
|
||||
virtual void setSurfaceReady() OVERRIDE;
|
||||
virtual void setVisible(bool) OVERRIDE;
|
||||
virtual bool initializeRenderer() OVERRIDE;
|
||||
virtual bool recreateContext() OVERRIDE;
|
||||
virtual bool recreateOutputSurface() OVERRIDE;
|
||||
virtual void renderingStats(RenderingStats*) OVERRIDE;
|
||||
virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE;
|
||||
virtual void loseContext() OVERRIDE;
|
||||
virtual void loseOutputSurface() OVERRIDE;
|
||||
virtual void setNeedsAnimate() OVERRIDE;
|
||||
virtual void setNeedsCommit() OVERRIDE;
|
||||
virtual void setNeedsRedraw() OVERRIDE;
|
||||
@ -47,7 +47,7 @@ public:
|
||||
virtual void forceSerializeOnSwapBuffers() OVERRIDE;
|
||||
|
||||
// LayerTreeHostImplClient implementation
|
||||
virtual void didLoseContextOnImplThread() OVERRIDE { }
|
||||
virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE { }
|
||||
virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE;
|
||||
virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval) OVERRIDE { }
|
||||
virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { }
|
||||
@ -71,11 +71,11 @@ private:
|
||||
|
||||
// Accessed on main thread only.
|
||||
LayerTreeHost* m_layerTreeHost;
|
||||
bool m_contextLost;
|
||||
bool m_outputSurfaceLost;
|
||||
|
||||
// Holds on to the context between initializeContext() and initializeRenderer() calls. Shouldn't
|
||||
// be used for anything else.
|
||||
scoped_ptr<GraphicsContext> m_contextBeforeInitialization;
|
||||
scoped_ptr<OutputSurface> m_outputSurfaceBeforeInitialization;
|
||||
|
||||
// Used on the Thread, but checked on main thread during initialization/shutdown.
|
||||
scoped_ptr<LayerTreeHostImpl> m_layerTreeHostImpl;
|
||||
|
@ -71,7 +71,6 @@ SoftwareRenderer::SoftwareRenderer(RendererClient* client, ResourceProvider* res
|
||||
|
||||
m_capabilities.maxTextureSize = INT_MAX;
|
||||
m_capabilities.bestTextureFormat = GL_RGBA;
|
||||
m_capabilities.contextHasCachedFrontBuffer = true;
|
||||
m_capabilities.usingSetVisibility = true;
|
||||
// The updater can access bitmaps while the SoftwareRenderer is using them.
|
||||
m_capabilities.allowPartialTextureUpdates = true;
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
// RendererClient implementation.
|
||||
virtual const gfx::Size& deviceViewportSize() const OVERRIDE { return m_viewportSize; }
|
||||
virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settings; }
|
||||
virtual void didLoseContext() OVERRIDE { }
|
||||
virtual void didLoseOutputSurface() OVERRIDE { }
|
||||
virtual void onSwapBuffersComplete() OVERRIDE { }
|
||||
virtual void setFullRootLayerDamage() OVERRIDE { }
|
||||
virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE { };
|
||||
|
@ -1,22 +0,0 @@
|
||||
// Copyright 2012 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 CC_TEST_FAKE_GRAPHICS_CONTEXT_H_
|
||||
#define CC_TEST_FAKE_GRAPHICS_CONTEXT_H_
|
||||
|
||||
#include "cc/graphics_context.h"
|
||||
#include "cc/test/compositor_fake_web_graphics_context_3d.h"
|
||||
#include "cc/test/fake_web_compositor_output_surface.h"
|
||||
#include <public/WebCompositorOutputSurface.h>
|
||||
|
||||
namespace WebKit {
|
||||
|
||||
static inline scoped_ptr<cc::GraphicsContext> createFakeGraphicsContext()
|
||||
{
|
||||
return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::GraphicsContext>();
|
||||
}
|
||||
|
||||
} // namespace WebKit
|
||||
|
||||
#endif // CC_TEST_FAKE_GRAPHICS_CONTEXT_H_
|
22
cc/test/fake_output_surface.h
Normal file
22
cc/test/fake_output_surface.h
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright 2012 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 CC_TEST_FAKE_OUTPUT_SURFACE_H_
|
||||
#define CC_TEST_FAKE_OUTPUT_SURFACE_H_
|
||||
|
||||
#include "cc/output_surface.h"
|
||||
#include "cc/test/compositor_fake_web_graphics_context_3d.h"
|
||||
#include "cc/test/fake_web_compositor_output_surface.h"
|
||||
#include <public/WebCompositorOutputSurface.h>
|
||||
|
||||
namespace cc {
|
||||
|
||||
static inline scoped_ptr<cc::OutputSurface> createFakeOutputSurface()
|
||||
{
|
||||
return WebKit::FakeWebCompositorOutputSurface::create(WebKit::CompositorFakeWebGraphicsContext3D::create(WebKit::WebGraphicsContext3D::Attributes()).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>();
|
||||
}
|
||||
|
||||
} // namespace WebKit
|
||||
|
||||
#endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_
|
@ -16,7 +16,7 @@ bool FakeProxy::isStarted() const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FakeProxy::initializeContext()
|
||||
bool FakeProxy::initializeOutputSurface()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -26,7 +26,7 @@ bool FakeProxy::initializeRenderer()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FakeProxy::recreateContext()
|
||||
bool FakeProxy::recreateOutputSurface()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -19,11 +19,11 @@ public:
|
||||
virtual void startPageScaleAnimation(gfx::Vector2d targetPosition, bool useAnchor, float scale, base::TimeDelta duration) OVERRIDE { }
|
||||
virtual void finishAllRendering() OVERRIDE { }
|
||||
virtual bool isStarted() const OVERRIDE;
|
||||
virtual bool initializeContext() OVERRIDE;
|
||||
virtual bool initializeOutputSurface() OVERRIDE;
|
||||
virtual void setSurfaceReady() OVERRIDE { }
|
||||
virtual void setVisible(bool) OVERRIDE { }
|
||||
virtual bool initializeRenderer() OVERRIDE;
|
||||
virtual bool recreateContext() OVERRIDE;
|
||||
virtual bool recreateOutputSurface() OVERRIDE;
|
||||
virtual void renderingStats(RenderingStats*) OVERRIDE { }
|
||||
virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE;
|
||||
virtual void setNeedsAnimate() OVERRIDE { }
|
||||
@ -37,7 +37,7 @@ public:
|
||||
virtual void forceSerializeOnSwapBuffers() OVERRIDE { }
|
||||
virtual size_t maxPartialTextureUpdates() const OVERRIDE;
|
||||
virtual void acquireLayerTextures() OVERRIDE { }
|
||||
virtual void loseContext() OVERRIDE { }
|
||||
virtual void loseOutputSurface() OVERRIDE { }
|
||||
|
||||
virtual RendererCapabilities& rendererCapabilities();
|
||||
void setMaxPartialTextureUpdates(size_t);
|
||||
|
31
cc/test/fake_web_graphics_context_3d_unittest.cc
Normal file
31
cc/test/fake_web_graphics_context_3d_unittest.cc
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright 2011 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 "base/compiler_specific.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "cc/test/fake_web_graphics_context_3d.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
class ContextThatCountsMakeCurrents : public WebKit::FakeWebGraphicsContext3D {
|
||||
public:
|
||||
ContextThatCountsMakeCurrents() : m_makeCurrentCount(0) { }
|
||||
virtual bool makeContextCurrent() OVERRIDE
|
||||
{
|
||||
m_makeCurrentCount++;
|
||||
return true;
|
||||
}
|
||||
int makeCurrentCount() const { return m_makeCurrentCount; }
|
||||
|
||||
private:
|
||||
int m_makeCurrentCount;
|
||||
};
|
||||
|
||||
|
||||
TEST(FakeWebGraphicsContext3DTest, CreationShouldNotMakeCurrent)
|
||||
{
|
||||
scoped_ptr<ContextThatCountsMakeCurrents> context(new ContextThatCountsMakeCurrents);
|
||||
EXPECT_TRUE(context.get());
|
||||
EXPECT_EQ(0, context->makeCurrentCount());
|
||||
}
|
@ -4,10 +4,11 @@
|
||||
|
||||
#include "cc/texture_layer.h"
|
||||
|
||||
#include "third_party/khronos/GLES2/gl2.h"
|
||||
#include "cc/layer_tree_host.h"
|
||||
#include "cc/texture_layer_client.h"
|
||||
#include "cc/texture_layer_impl.h"
|
||||
#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
|
||||
#include "third_party/khronos/GLES2/gl2.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
|
@ -67,7 +67,7 @@ void TextureLayerImpl::dumpLayerProperties(std::string* str, int indent) const
|
||||
LayerImpl::dumpLayerProperties(str, indent);
|
||||
}
|
||||
|
||||
void TextureLayerImpl::didLoseContext()
|
||||
void TextureLayerImpl::didLoseOutputSurface()
|
||||
{
|
||||
m_textureId = 0;
|
||||
m_externalTextureResource = 0;
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE;
|
||||
virtual void didDraw(ResourceProvider*) OVERRIDE;
|
||||
|
||||
virtual void didLoseContext() OVERRIDE;
|
||||
virtual void didLoseOutputSurface() OVERRIDE;
|
||||
|
||||
virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;
|
||||
|
||||
|
@ -9,9 +9,9 @@
|
||||
#include "cc/delay_based_time_source.h"
|
||||
#include "cc/draw_quad.h"
|
||||
#include "cc/frame_rate_controller.h"
|
||||
#include "cc/graphics_context.h"
|
||||
#include "cc/input_handler.h"
|
||||
#include "cc/layer_tree_host.h"
|
||||
#include "cc/output_surface.h"
|
||||
#include "cc/scheduler.h"
|
||||
#include "cc/scoped_thread_proxy.h"
|
||||
#include "cc/thread.h"
|
||||
@ -147,14 +147,14 @@ bool ThreadProxy::isStarted() const
|
||||
return m_started;
|
||||
}
|
||||
|
||||
bool ThreadProxy::initializeContext()
|
||||
bool ThreadProxy::initializeOutputSurface()
|
||||
{
|
||||
TRACE_EVENT0("cc", "ThreadProxy::initializeContext");
|
||||
scoped_ptr<GraphicsContext> context = m_layerTreeHost->createContext();
|
||||
TRACE_EVENT0("cc", "ThreadProxy::initializeOutputSurface");
|
||||
scoped_ptr<OutputSurface> context = m_layerTreeHost->createOutputSurface();
|
||||
if (!context.get())
|
||||
return false;
|
||||
|
||||
Proxy::implThread()->postTask(base::Bind(&ThreadProxy::initializeContextOnImplThread, base::Unretained(this), base::Passed(context.Pass())));
|
||||
Proxy::implThread()->postTask(base::Bind(&ThreadProxy::initializeOutputSurfaceOnImplThread, base::Unretained(this), base::Passed(context.Pass())));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -210,30 +210,30 @@ bool ThreadProxy::initializeRenderer()
|
||||
return initializeSucceeded;
|
||||
}
|
||||
|
||||
bool ThreadProxy::recreateContext()
|
||||
bool ThreadProxy::recreateOutputSurface()
|
||||
{
|
||||
TRACE_EVENT0("cc", "ThreadProxy::recreateContext");
|
||||
TRACE_EVENT0("cc", "ThreadProxy::recreateOutputSurface");
|
||||
DCHECK(isMainThread());
|
||||
|
||||
// Try to create the context.
|
||||
scoped_ptr<GraphicsContext> context = m_layerTreeHost->createContext();
|
||||
if (!context.get())
|
||||
// Try to create the surface.
|
||||
scoped_ptr<OutputSurface> outputSurface = m_layerTreeHost->createOutputSurface();
|
||||
if (!outputSurface.get())
|
||||
return false;
|
||||
if (m_layerTreeHost->needsSharedContext())
|
||||
if (!WebSharedGraphicsContext3D::createCompositorThreadContext())
|
||||
return false;
|
||||
|
||||
// Make a blocking call to recreateContextOnImplThread. The results of that
|
||||
// Make a blocking call to recreateOutputSurfaceOnImplThread. The results of that
|
||||
// call are pushed into the recreateSucceeded and capabilities local
|
||||
// variables.
|
||||
CompletionEvent completion;
|
||||
bool recreateSucceeded = false;
|
||||
RendererCapabilities capabilities;
|
||||
DebugScopedSetMainThreadBlocked mainThreadBlocked(this);
|
||||
Proxy::implThread()->postTask(base::Bind(&ThreadProxy::recreateContextOnImplThread,
|
||||
Proxy::implThread()->postTask(base::Bind(&ThreadProxy::recreateOutputSurfaceOnImplThread,
|
||||
base::Unretained(this),
|
||||
&completion,
|
||||
base::Passed(context.Pass()),
|
||||
base::Passed(outputSurface.Pass()),
|
||||
&recreateSucceeded,
|
||||
&capabilities));
|
||||
completion.wait();
|
||||
@ -263,9 +263,9 @@ const RendererCapabilities& ThreadProxy::rendererCapabilities() const
|
||||
return m_RendererCapabilitiesMainThreadCopy;
|
||||
}
|
||||
|
||||
void ThreadProxy::loseContext()
|
||||
void ThreadProxy::loseOutputSurface()
|
||||
{
|
||||
Proxy::implThread()->postTask(base::Bind(&ThreadProxy::didLoseContextOnImplThread, base::Unretained(this)));
|
||||
Proxy::implThread()->postTask(base::Bind(&ThreadProxy::didLoseOutputSurfaceOnImplThread, base::Unretained(this)));
|
||||
}
|
||||
|
||||
void ThreadProxy::setNeedsAnimate()
|
||||
@ -297,11 +297,11 @@ void ThreadProxy::setNeedsCommit()
|
||||
Proxy::implThread()->postTask(base::Bind(&ThreadProxy::setNeedsCommitOnImplThread, base::Unretained(this)));
|
||||
}
|
||||
|
||||
void ThreadProxy::didLoseContextOnImplThread()
|
||||
void ThreadProxy::didLoseOutputSurfaceOnImplThread()
|
||||
{
|
||||
DCHECK(isImplThread());
|
||||
TRACE_EVENT0("cc", "ThreadProxy::didLoseContextOnImplThread");
|
||||
m_schedulerOnImplThread->didLoseContext();
|
||||
TRACE_EVENT0("cc", "ThreadProxy::didLoseOutputSurfaceOnImplThread");
|
||||
m_schedulerOnImplThread->didLoseOutputSurface();
|
||||
}
|
||||
|
||||
void ThreadProxy::onSwapBuffersCompleteOnImplThread()
|
||||
@ -869,20 +869,20 @@ void ThreadProxy::beginContextRecreation()
|
||||
{
|
||||
TRACE_EVENT0("cc", "ThreadProxy::beginContextRecreation");
|
||||
DCHECK(isMainThread());
|
||||
m_layerTreeHost->didLoseContext();
|
||||
m_contextRecreationCallback.Reset(base::Bind(&ThreadProxy::tryToRecreateContext, base::Unretained(this)));
|
||||
Proxy::mainThread()->postTask(m_contextRecreationCallback.callback());
|
||||
m_layerTreeHost->didLoseOutputSurface();
|
||||
m_outputSurfaceRecreationCallback.Reset(base::Bind(&ThreadProxy::tryToRecreateOutputSurface, base::Unretained(this)));
|
||||
Proxy::mainThread()->postTask(m_outputSurfaceRecreationCallback.callback());
|
||||
}
|
||||
|
||||
void ThreadProxy::tryToRecreateContext()
|
||||
void ThreadProxy::tryToRecreateOutputSurface()
|
||||
{
|
||||
DCHECK(isMainThread());
|
||||
DCHECK(m_layerTreeHost);
|
||||
LayerTreeHost::RecreateResult result = m_layerTreeHost->recreateContext();
|
||||
LayerTreeHost::RecreateResult result = m_layerTreeHost->recreateOutputSurface();
|
||||
if (result == LayerTreeHost::RecreateFailedButTryAgain)
|
||||
Proxy::mainThread()->postTask(m_contextRecreationCallback.callback());
|
||||
Proxy::mainThread()->postTask(m_outputSurfaceRecreationCallback.callback());
|
||||
else if (result == LayerTreeHost::RecreateSucceeded)
|
||||
m_contextRecreationCallback.Cancel();
|
||||
m_outputSurfaceRecreationCallback.Cancel();
|
||||
}
|
||||
|
||||
void ThreadProxy::initializeImplOnImplThread(CompletionEvent* completion, InputHandler* handler)
|
||||
@ -906,19 +906,19 @@ void ThreadProxy::initializeImplOnImplThread(CompletionEvent* completion, InputH
|
||||
completion->signal();
|
||||
}
|
||||
|
||||
void ThreadProxy::initializeContextOnImplThread(scoped_ptr<GraphicsContext> context)
|
||||
void ThreadProxy::initializeOutputSurfaceOnImplThread(scoped_ptr<OutputSurface> outputSurface)
|
||||
{
|
||||
TRACE_EVENT0("cc", "ThreadProxy::initializeContextOnImplThread");
|
||||
DCHECK(isImplThread());
|
||||
m_contextBeforeInitializationOnImplThread = context.Pass();
|
||||
m_outputSurfaceBeforeInitializationOnImplThread = outputSurface.Pass();
|
||||
}
|
||||
|
||||
void ThreadProxy::initializeRendererOnImplThread(CompletionEvent* completion, bool* initializeSucceeded, RendererCapabilities* capabilities)
|
||||
{
|
||||
TRACE_EVENT0("cc", "ThreadProxy::initializeRendererOnImplThread");
|
||||
DCHECK(isImplThread());
|
||||
DCHECK(m_contextBeforeInitializationOnImplThread.get());
|
||||
*initializeSucceeded = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitializationOnImplThread.Pass());
|
||||
DCHECK(m_outputSurfaceBeforeInitializationOnImplThread.get());
|
||||
*initializeSucceeded = m_layerTreeHostImpl->initializeRenderer(m_outputSurfaceBeforeInitializationOnImplThread.Pass());
|
||||
if (*initializeSucceeded) {
|
||||
*capabilities = m_layerTreeHostImpl->rendererCapabilities();
|
||||
m_schedulerOnImplThread->setSwapBuffersCompleteSupported(
|
||||
@ -950,15 +950,15 @@ size_t ThreadProxy::maxPartialTextureUpdates() const
|
||||
return ResourceUpdateController::maxPartialTextureUpdates();
|
||||
}
|
||||
|
||||
void ThreadProxy::recreateContextOnImplThread(CompletionEvent* completion, scoped_ptr<GraphicsContext> context, bool* recreateSucceeded, RendererCapabilities* capabilities)
|
||||
void ThreadProxy::recreateOutputSurfaceOnImplThread(CompletionEvent* completion, scoped_ptr<OutputSurface> outputSurface, bool* recreateSucceeded, RendererCapabilities* capabilities)
|
||||
{
|
||||
TRACE_EVENT0("cc", "ThreadProxy::recreateContextOnImplThread");
|
||||
TRACE_EVENT0("cc", "ThreadProxy::recreateOutputSurfaceOnImplThread");
|
||||
DCHECK(isImplThread());
|
||||
m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider());
|
||||
*recreateSucceeded = m_layerTreeHostImpl->initializeRenderer(context.Pass());
|
||||
*recreateSucceeded = m_layerTreeHostImpl->initializeRenderer(outputSurface.Pass());
|
||||
if (*recreateSucceeded) {
|
||||
*capabilities = m_layerTreeHostImpl->rendererCapabilities();
|
||||
m_schedulerOnImplThread->didRecreateContext();
|
||||
m_schedulerOnImplThread->didRecreateOutputSurface();
|
||||
}
|
||||
completion->signal();
|
||||
}
|
||||
|
@ -34,14 +34,14 @@ public:
|
||||
virtual void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, float scale, base::TimeDelta duration) OVERRIDE;
|
||||
virtual void finishAllRendering() OVERRIDE;
|
||||
virtual bool isStarted() const OVERRIDE;
|
||||
virtual bool initializeContext() OVERRIDE;
|
||||
virtual bool initializeOutputSurface() OVERRIDE;
|
||||
virtual void setSurfaceReady() OVERRIDE;
|
||||
virtual void setVisible(bool) OVERRIDE;
|
||||
virtual bool initializeRenderer() OVERRIDE;
|
||||
virtual bool recreateContext() OVERRIDE;
|
||||
virtual bool recreateOutputSurface() OVERRIDE;
|
||||
virtual void renderingStats(RenderingStats*) OVERRIDE;
|
||||
virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE;
|
||||
virtual void loseContext() OVERRIDE;
|
||||
virtual void loseOutputSurface() OVERRIDE;
|
||||
virtual void setNeedsAnimate() OVERRIDE;
|
||||
virtual void setNeedsCommit() OVERRIDE;
|
||||
virtual void setNeedsRedraw() OVERRIDE;
|
||||
@ -55,7 +55,7 @@ public:
|
||||
virtual void forceSerializeOnSwapBuffers() OVERRIDE;
|
||||
|
||||
// LayerTreeHostImplClient implementation
|
||||
virtual void didLoseContextOnImplThread() OVERRIDE;
|
||||
virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE;
|
||||
virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE;
|
||||
virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval) OVERRIDE;
|
||||
virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE;
|
||||
@ -97,7 +97,7 @@ private:
|
||||
void didCompleteSwapBuffers();
|
||||
void setAnimationEvents(scoped_ptr<AnimationEventsVector>, base::Time wallClockTime);
|
||||
void beginContextRecreation();
|
||||
void tryToRecreateContext();
|
||||
void tryToRecreateOutputSurface();
|
||||
|
||||
// Called on impl thread
|
||||
struct ReadbackRequest {
|
||||
@ -115,13 +115,13 @@ private:
|
||||
void initializeImplOnImplThread(CompletionEvent*, InputHandler*);
|
||||
void setSurfaceReadyOnImplThread();
|
||||
void setVisibleOnImplThread(CompletionEvent*, bool);
|
||||
void initializeContextOnImplThread(scoped_ptr<GraphicsContext>);
|
||||
void initializeOutputSurfaceOnImplThread(scoped_ptr<OutputSurface>);
|
||||
void initializeRendererOnImplThread(CompletionEvent*, bool* initializeSucceeded, RendererCapabilities*);
|
||||
void layerTreeHostClosedOnImplThread(CompletionEvent*);
|
||||
void manageTilesOnImplThread();
|
||||
void setFullRootLayerDamageOnImplThread();
|
||||
void acquireLayerTexturesForMainThreadOnImplThread(CompletionEvent*);
|
||||
void recreateContextOnImplThread(CompletionEvent*, scoped_ptr<GraphicsContext>, bool* recreateSucceeded, RendererCapabilities*);
|
||||
void recreateOutputSurfaceOnImplThread(CompletionEvent*, scoped_ptr<OutputSurface>, bool* recreateSucceeded, RendererCapabilities*);
|
||||
void renderingStatsOnImplThread(CompletionEvent*, RenderingStats*);
|
||||
ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapInternal(bool forcedDraw);
|
||||
void forceSerializeOnSwapBuffersOnImplThread(CompletionEvent*);
|
||||
@ -131,7 +131,7 @@ private:
|
||||
bool m_animateRequested; // Set only when setNeedsAnimate is called.
|
||||
bool m_commitRequested; // Set only when setNeedsCommit is called.
|
||||
bool m_commitRequestSentToImplThread; // Set by setNeedsCommit and setNeedsAnimate.
|
||||
base::CancelableClosure m_contextRecreationCallback;
|
||||
base::CancelableClosure m_outputSurfaceRecreationCallback;
|
||||
LayerTreeHost* m_layerTreeHost;
|
||||
bool m_rendererInitialized;
|
||||
RendererCapabilities m_RendererCapabilitiesMainThreadCopy;
|
||||
@ -150,7 +150,7 @@ private:
|
||||
|
||||
// Holds on to the context we might use for compositing in between initializeContext()
|
||||
// and initializeRenderer() calls.
|
||||
scoped_ptr<GraphicsContext> m_contextBeforeInitializationOnImplThread;
|
||||
scoped_ptr<OutputSurface> m_outputSurfaceBeforeInitializationOnImplThread;
|
||||
|
||||
// Set when the main thread is waiting on a scheduledActionBeginFrame to be issued.
|
||||
CompletionEvent* m_beginFrameCompletionEventOnImplThread;
|
||||
|
@ -236,7 +236,7 @@ Region TiledLayerImpl::visibleContentOpaqueRegion() const
|
||||
return m_tiler->opaqueRegionInContentRect(visibleContentRect());
|
||||
}
|
||||
|
||||
void TiledLayerImpl::didLoseContext()
|
||||
void TiledLayerImpl::didLoseOutputSurface()
|
||||
{
|
||||
m_tiler->reset();
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
void pushInvalidTile(int, int);
|
||||
|
||||
virtual Region visibleContentOpaqueRegion() const OVERRIDE;
|
||||
virtual void didLoseContext() OVERRIDE;
|
||||
virtual void didLoseOutputSurface() OVERRIDE;
|
||||
|
||||
protected:
|
||||
explicit TiledLayerImpl(int id);
|
||||
|
@ -11,8 +11,8 @@
|
||||
#include "cc/resource_update_controller.h"
|
||||
#include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread
|
||||
#include "cc/test/animation_test_common.h"
|
||||
#include "cc/test/fake_graphics_context.h"
|
||||
#include "cc/test/fake_layer_tree_host_client.h"
|
||||
#include "cc/test/fake_output_surface.h"
|
||||
#include "cc/test/fake_proxy.h"
|
||||
#include "cc/test/geometry_test_utils.h"
|
||||
#include "cc/test/tiled_layer_test_common.h"
|
||||
@ -48,7 +48,7 @@ class TiledLayerTest : public testing::Test {
|
||||
public:
|
||||
TiledLayerTest()
|
||||
: m_proxy(NULL)
|
||||
, m_context(WebKit::createFakeGraphicsContext())
|
||||
, m_outputSurface(createFakeOutputSurface())
|
||||
, m_queue(make_scoped_ptr(new ResourceUpdateQueue))
|
||||
, m_occlusion(0)
|
||||
{
|
||||
@ -61,7 +61,7 @@ public:
|
||||
m_resourceManager = PrioritizedResourceManager::create(Renderer::ContentPool, m_proxy);
|
||||
m_layerTreeHost->initializeRendererIfNeeded();
|
||||
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(m_proxy);
|
||||
m_resourceProvider = ResourceProvider::create(m_context.get());
|
||||
m_resourceProvider = ResourceProvider::create(m_outputSurface.get());
|
||||
}
|
||||
|
||||
virtual ~TiledLayerTest()
|
||||
@ -164,7 +164,7 @@ public:
|
||||
public:
|
||||
Proxy* m_proxy;
|
||||
LayerTreeSettings m_settings;
|
||||
scoped_ptr<GraphicsContext> m_context;
|
||||
scoped_ptr<OutputSurface> m_outputSurface;
|
||||
scoped_ptr<ResourceProvider> m_resourceProvider;
|
||||
scoped_ptr<ResourceUpdateQueue> m_queue;
|
||||
RenderingStats m_stats;
|
||||
|
@ -410,7 +410,7 @@ void VideoLayerImpl::didUpdateMatrix(const float matrix[16])
|
||||
setNeedsRedraw();
|
||||
}
|
||||
|
||||
void VideoLayerImpl::didLoseContext()
|
||||
void VideoLayerImpl::didLoseOutputSurface()
|
||||
{
|
||||
freePlaneData(layerTreeHostImpl()->resourceProvider());
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
virtual void didReceiveFrame(); // Callable on impl thread.
|
||||
virtual void didUpdateMatrix(const float*); // Callable on impl thread.
|
||||
|
||||
virtual void didLoseContext() OVERRIDE;
|
||||
virtual void didLoseOutputSurface() OVERRIDE;
|
||||
|
||||
void setNeedsRedraw();
|
||||
|
||||
|
@ -208,7 +208,7 @@ scoped_ptr<FontAtlas> WebLayerTreeViewImpl::createFontAtlas()
|
||||
|
||||
void WebLayerTreeViewImpl::loseCompositorContext(int numTimes)
|
||||
{
|
||||
m_layerTreeHost->loseContext(numTimes);
|
||||
m_layerTreeHost->loseOutputSurface(numTimes);
|
||||
}
|
||||
|
||||
void WebLayerTreeViewImpl::willBeginFrame()
|
||||
|
Reference in New Issue
Block a user