diff options
61 files changed, 430 insertions, 458 deletions
@@ -1,11 +1,8 @@ include_rules = [ - "+media", "+skia/ext", "+third_party/skia/include", "+third_party/khronos/GLES2/gl2.h", "+third_party/khronos/GLES2/gl2ext.h", "+ui/gfx", - # 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", + "+media", ] @@ -62,6 +62,7 @@ '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', @@ -114,7 +115,6 @@ 'nine_patch_layer_impl.h', 'occlusion_tracker.cc', 'occlusion_tracker.h', - 'output_surface.h', 'overdraw_metrics.cc', 'overdraw_metrics.h', 'page_scale_animation.cc', diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp index 7887aca..c2da8c9 100644 --- a/cc/cc_tests.gyp +++ b/cc/cc_tests.gyp @@ -57,7 +57,6 @@ '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', @@ -65,7 +64,8 @@ 'test/compositor_fake_web_graphics_context_3d.h', 'test/fake_content_layer_client.cc', 'test/fake_content_layer_client.h', - 'test/fake_output_surface.h', + 'test/fake_graphics_context.h', + 'test/fake_graphics_context_3d_unittest.cc', 'test/fake_layer_tree_host_client.cc', 'test/fake_layer_tree_host_client.h', 'test/fake_picture_layer_tiling_client.cc', diff --git a/cc/delegated_renderer_layer_impl.cc b/cc/delegated_renderer_layer_impl.cc index 7b17eaf..7907454 100644 --- a/cc/delegated_renderer_layer_impl.cc +++ b/cc/delegated_renderer_layer_impl.cc @@ -65,7 +65,7 @@ void DelegatedRendererLayerImpl::clearRenderPasses() m_renderPassesInDrawOrder.clear(); } -void DelegatedRendererLayerImpl::didLoseOutputSurface() +void DelegatedRendererLayerImpl::didLoseContext() { clearRenderPasses(); } diff --git a/cc/delegated_renderer_layer_impl.h b/cc/delegated_renderer_layer_impl.h index 88f811e..0e1dfd9 100644 --- a/cc/delegated_renderer_layer_impl.h +++ b/cc/delegated_renderer_layer_impl.h @@ -23,7 +23,7 @@ public: void setRenderPasses(ScopedPtrVector<RenderPass>&); void clearRenderPasses(); - virtual void didLoseOutputSurface() OVERRIDE; + virtual void didLoseContext() OVERRIDE; virtual RenderPass::Id firstContributingRenderPassId() const OVERRIDE; virtual RenderPass::Id nextContributingRenderPassId(RenderPass::Id) const OVERRIDE; diff --git a/cc/delegated_renderer_layer_impl_unittest.cc b/cc/delegated_renderer_layer_impl_unittest.cc index 60edc8e..5b29527 100644 --- a/cc/delegated_renderer_layer_impl_unittest.cc +++ b/cc/delegated_renderer_layer_impl_unittest.cc @@ -12,7 +12,6 @@ #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" @@ -40,12 +39,12 @@ public: settings.minimumOcclusionTrackingSize = gfx::Size(); m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); - m_hostImpl->initializeRenderer(createFakeOutputSurface()); + m_hostImpl->initializeRenderer(createContext()); m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); } // LayerTreeHostImplClient implementation. - virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE { } + virtual void didLoseContextOnImplThread() OVERRIDE { } virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } virtual void onVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVERRIDE { } virtual void onCanDrawStateChanged(bool) OVERRIDE { } @@ -57,6 +56,11 @@ 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; diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc index e625362..e02eb4b 100644 --- a/cc/gl_renderer.cc +++ b/cc/gl_renderer.cc @@ -102,6 +102,9 @@ 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. @@ -1350,7 +1353,7 @@ void GLRenderer::ensureFramebuffer() void GLRenderer::onContextLost() { - m_client->didLoseOutputSurface(); + m_client->didLoseContext(); } diff --git a/cc/gl_renderer.h b/cc/gl_renderer.h index 653b4ac..391790e 100644 --- a/cc/gl_renderer.h +++ b/cc/gl_renderer.h @@ -16,8 +16,6 @@ #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 { diff --git a/cc/gl_renderer_unittest.cc b/cc/gl_renderer_unittest.cc index 9e040bf..3dda6e6 100644 --- a/cc/gl_renderer_unittest.cc +++ b/cc/gl_renderer_unittest.cc @@ -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 didLoseOutputSurface() OVERRIDE { } + virtual void didLoseContext() 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<OutputSurface> m_context; + scoped_ptr<GraphicsContext> 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<OutputSurface> context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ForbidSynchronousCallContext))); + scoped_ptr<GraphicsContext> 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<OutputSurface> context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new LoseContextOnFirstGetContext))); + scoped_ptr<GraphicsContext> 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<OutputSurface> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ContextThatDoesNotSupportMemoryManagmentExtensions))); - scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(outputSurface.get())); + scoped_ptr<GraphicsContext> context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ContextThatDoesNotSupportMemoryManagmentExtensions))); + scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get())); FakeRendererGL renderer(&mockClient, resourceProvider.get()); renderer.initialize(); @@ -392,7 +392,7 @@ private: TEST(GLRendererTest2, opaqueBackground) { FakeRendererClient mockClient; - scoped_ptr<OutputSurface> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ClearCountingContext))); + scoped_ptr<GraphicsContext> 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<OutputSurface> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ClearCountingContext))); + scoped_ptr<GraphicsContext> 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<OutputSurface> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new VisibilityChangeIsLastCallTrackingContext))); + scoped_ptr<GraphicsContext> 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<OutputSurface> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new TextureStateTrackingContext))); + scoped_ptr<GraphicsContext> 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()); diff --git a/cc/graphics_context.h b/cc/graphics_context.h new file mode 100644 index 0000000..7057f37 --- /dev/null +++ b/cc/graphics_context.h @@ -0,0 +1,18 @@ +// 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_ diff --git a/cc/heads_up_display_layer_impl.cc b/cc/heads_up_display_layer_impl.cc index 4fb57c8..358c56c 100644 --- a/cc/heads_up_display_layer_impl.cc +++ b/cc/heads_up_display_layer_impl.cc @@ -134,7 +134,7 @@ void HeadsUpDisplayLayerImpl::didDraw(ResourceProvider* resourceProvider) DCHECK(!resourceProvider->inUseByConsumer(m_hudTexture->id())); } -void HeadsUpDisplayLayerImpl::didLoseOutputSurface() +void HeadsUpDisplayLayerImpl::didLoseContext() { m_hudTexture.reset(); } diff --git a/cc/heads_up_display_layer_impl.h b/cc/heads_up_display_layer_impl.h index 03a90d1..a7b6ce2 100644 --- a/cc/heads_up_display_layer_impl.h +++ b/cc/heads_up_display_layer_impl.h @@ -37,7 +37,7 @@ public: void updateHudTexture(ResourceProvider*); virtual void didDraw(ResourceProvider*) OVERRIDE; - virtual void didLoseOutputSurface() OVERRIDE; + virtual void didLoseContext() OVERRIDE; virtual bool layerIsAlwaysDamaged() const OVERRIDE; diff --git a/cc/io_surface_layer_impl.cc b/cc/io_surface_layer_impl.cc index 10d80f3..bcf0072 100644 --- a/cc/io_surface_layer_impl.cc +++ b/cc/io_surface_layer_impl.cc @@ -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; - OutputSurface* outputSurface = layerTreeHostImpl()->outputSurface(); + GraphicsContext* context = layerTreeHostImpl()->context(); // FIXME: Implement this path for software compositing. - WebKit::WebGraphicsContext3D* context3d = outputSurface->context3D(); + WebKit::WebGraphicsContext3D* context3d = context->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::didLoseOutputSurface() +void IOSurfaceLayerImpl::didLoseContext() { // We don't have a valid texture ID in the new context; however, // the IOSurface is still valid. diff --git a/cc/io_surface_layer_impl.h b/cc/io_surface_layer_impl.h index 451373b..0571bea 100644 --- a/cc/io_surface_layer_impl.h +++ b/cc/io_surface_layer_impl.h @@ -24,7 +24,7 @@ public: virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; virtual void willDraw(ResourceProvider*) OVERRIDE; - virtual void didLoseOutputSurface() OVERRIDE; + virtual void didLoseContext() OVERRIDE; virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc index f87a622..34441b5 100644 --- a/cc/layer_impl.cc +++ b/cc/layer_impl.cc @@ -680,7 +680,7 @@ Region LayerImpl::visibleContentOpaqueRegion() const return Region(); } -void LayerImpl::didLoseOutputSurface() +void LayerImpl::didLoseContext() { } diff --git a/cc/layer_impl.h b/cc/layer_impl.h index 3e64233..c39cd6d 100644 --- a/cc/layer_impl.h +++ b/cc/layer_impl.h @@ -262,10 +262,10 @@ public: virtual void didUpdateTransforms() { } - // Indicates that the surface previously used to render this layer + // Indicates that the context previously used to render this layer // was lost and that a new one has been created. Won't be called - // until the new surface has been created successfully. - virtual void didLoseOutputSurface(); + // until the new context has been created successfully. + virtual void didLoseContext(); ScrollbarAnimationController* scrollbarAnimationController() const { return m_scrollbarAnimationController.get(); } diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc index 70f1625..d372a2e 100644 --- a/cc/layer_tree_host.cc +++ b/cc/layer_tree_host.cc @@ -9,6 +9,7 @@ #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" @@ -146,6 +147,8 @@ LayerTreeSettings::~LayerTreeSettings() RendererCapabilities::RendererCapabilities() : bestTextureFormat(0) + , contextHasCachedFrontBuffer(false) + , usingPartialSwap(false) , usingAcceleratedPainting(false) , usingSetVisibility(false) , usingSwapCompleteCallback(false) @@ -182,7 +185,7 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting , m_commitNumber(0) , m_renderingStats() , m_rendererInitialized(false) - , m_outputSurfaceLost(false) + , m_contextLost(false) , m_numTimesRecreateShouldFail(0) , m_numFailedRecreateAttempts(0) , m_settings(settings) @@ -219,7 +222,7 @@ bool LayerTreeHost::initializeProxy(scoped_ptr<Proxy> proxy) m_proxy = proxy.Pass(); m_proxy->start(); - return m_proxy->initializeOutputSurface(); + return m_proxy->initializeContext(); } LayerTreeHost::~LayerTreeHost() @@ -245,7 +248,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 output surface. + // Uh oh, better tell the client that we can't do anything with this context. m_client->didRecreateOutputSurface(false); return; } @@ -270,28 +273,28 @@ void LayerTreeHost::initializeRenderer() min(m_settings.maxUntiledLayerSize.height(), m_proxy->rendererCapabilities().maxTextureSize)); } -LayerTreeHost::RecreateResult LayerTreeHost::recreateOutputSurface() +LayerTreeHost::RecreateResult LayerTreeHost::recreateContext() { - TRACE_EVENT0("cc", "LayerTreeHost::recreateOutputSurface"); - DCHECK(m_outputSurfaceLost); + TRACE_EVENT0("cc", "LayerTreeHost::recreateContext"); + DCHECK(m_contextLost); bool recreated = false; if (!m_numTimesRecreateShouldFail) - recreated = m_proxy->recreateOutputSurface(); + recreated = m_proxy->recreateContext(); else m_numTimesRecreateShouldFail--; if (recreated) { m_client->didRecreateOutputSurface(true); - m_outputSurfaceLost = false; + m_contextLost = false; return RecreateSucceeded; } // Tolerate a certain number of recreation failures to work around races - // in the output-surface-lost machinery. + // in the context-lost machinery. m_numFailedRecreateAttempts++; if (m_numFailedRecreateAttempts < 5) { - // FIXME: The single thread does not self-schedule output surface + // FIXME: The single thread does not self-schedule context // recreation. So force another recreation attempt to happen by requesting // another commit. if (!m_proxy->hasImplThread()) @@ -299,8 +302,8 @@ LayerTreeHost::RecreateResult LayerTreeHost::recreateOutputSurface() return RecreateFailedButTryAgain; } - // We have tried too many times to recreate the output surface. Tell the - // host to fall back to software rendering. + // We have tried too many times to recreate the context. Tell the host to fall + // back to software rendering. m_client->didRecreateOutputSurface(false); return RecreateFailedAndGaveUp; } @@ -426,7 +429,7 @@ void LayerTreeHost::commitComplete() m_client->didCommit(); } -scoped_ptr<OutputSurface> LayerTreeHost::createOutputSurface() +scoped_ptr<GraphicsContext> LayerTreeHost::createContext() { return m_client->createOutputSurface(); } @@ -441,11 +444,11 @@ scoped_ptr<LayerTreeHostImpl> LayerTreeHost::createLayerTreeHostImpl(LayerTreeHo return LayerTreeHostImpl::create(m_settings, client, m_proxy.get()); } -void LayerTreeHost::didLoseOutputSurface() +void LayerTreeHost::didLoseContext() { - TRACE_EVENT0("cc", "LayerTreeHost::didLoseOutputSurface"); + TRACE_EVENT0("cc", "LayerTreeHost::didLoseContext"); DCHECK(m_proxy->isMainThread()); - m_outputSurfaceLost = true; + m_contextLost = true; m_numFailedRecreateAttempts = 0; setNeedsCommit(); } @@ -593,11 +596,11 @@ void LayerTreeHost::startPageScaleAnimation(gfx::Vector2d targetOffset, bool use m_proxy->startPageScaleAnimation(targetOffset, useAnchor, scale, duration); } -void LayerTreeHost::loseOutputSurface(int numTimes) +void LayerTreeHost::loseContext(int numTimes) { - TRACE_EVENT1("cc", "LayerTreeHost::loseCompositorOutputSurface", "numTimes", numTimes); + TRACE_EVENT1("cc", "LayerTreeHost::loseCompositorContext", "numTimes", numTimes); m_numTimesRecreateShouldFail = numTimes - 1; - m_proxy->loseOutputSurface(); + m_proxy->loseContext(); } PrioritizedResourceManager* LayerTreeHost::contentsTextureManager() const @@ -626,8 +629,8 @@ bool LayerTreeHost::initializeRendererIfNeeded() if (!m_rendererInitialized) return false; } - if (m_outputSurfaceLost) { - if (recreateOutputSurface() != RecreateSucceeded) + if (m_contextLost) { + if (recreateContext() != RecreateSucceeded) return false; } return true; diff --git a/cc/layer_tree_host.h b/cc/layer_tree_host.h index 4423082..0e7bab5 100644 --- a/cc/layer_tree_host.h +++ b/cc/layer_tree_host.h @@ -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,6 +102,7 @@ struct CC_EXPORT RendererCapabilities { ~RendererCapabilities(); GLenum bestTextureFormat; + bool contextHasCachedFrontBuffer; bool usingPartialSwap; bool usingAcceleratedPainting; bool usingSetVisibility; @@ -136,16 +137,16 @@ public: void finishCommitOnImplThread(LayerTreeHostImpl*); void willCommit(); void commitComplete(); - scoped_ptr<OutputSurface> createOutputSurface(); + scoped_ptr<GraphicsContext> createContext(); scoped_ptr<InputHandler> createInputHandler(); virtual scoped_ptr<LayerTreeHostImpl> createLayerTreeHostImpl(LayerTreeHostImplClient*); - void didLoseOutputSurface(); + void didLoseContext(); enum RecreateResult { RecreateSucceeded, RecreateFailedButTryAgain, RecreateFailedAndGaveUp, }; - RecreateResult recreateOutputSurface(); + RecreateResult recreateContext(); void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); } void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); } void deleteContentsTexturesOnImplThread(ResourceProvider*); @@ -180,7 +181,7 @@ public: const RendererCapabilities& rendererCapabilities() const; // Test only hook - void loseOutputSurface(int numTimes); + void loseContext(int numTimes); void setNeedsAnimate(); // virtual for testing @@ -283,7 +284,7 @@ private: RenderingStats m_renderingStats; bool m_rendererInitialized; - bool m_outputSurfaceLost; + bool m_contextLost; int m_numTimesRecreateShouldFail; int m_numFailedRecreateAttempts; diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc index c239479d..a3a0f9a 100644 --- a/cc/layer_tree_host_impl.cc +++ b/cc/layer_tree_host_impl.cc @@ -279,9 +279,9 @@ bool LayerTreeHostImpl::canDraw() return true; } -OutputSurface* LayerTreeHostImpl::outputSurface() const +GraphicsContext* LayerTreeHostImpl::context() const { - return m_outputSurface.get(); + return m_context.get(); } void LayerTreeHostImpl::animate(base::TimeTicks monotonicTime, base::Time wallClockTime) @@ -891,9 +891,9 @@ const LayerTreeSettings& LayerTreeHostImpl::settings() const return m_settings; } -void LayerTreeHostImpl::didLoseOutputSurface() +void LayerTreeHostImpl::didLoseContext() { - m_client->didLoseOutputSurfaceOnImplThread(); + m_client->didLoseContextOnImplThread(); } void LayerTreeHostImpl::onSwapBuffersComplete() @@ -983,40 +983,40 @@ void LayerTreeHostImpl::setVisible(bool visible) setBackgroundTickingEnabled(!m_visible && m_needsAnimateLayers); } -bool LayerTreeHostImpl::initializeRenderer(scoped_ptr<OutputSurface> outputSurface) +bool LayerTreeHostImpl::initializeRenderer(scoped_ptr<GraphicsContext> context) { // 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(); - sendDidLoseOutputSurfaceRecursive(m_rootLayerImpl.get()); + sendDidLoseContextRecursive(m_rootLayerImpl.get()); } // Note: order is important here. m_renderer.reset(); m_tileManager.reset(); m_resourceProvider.reset(); - m_outputSurface.reset(); + m_context.reset(); - if (!outputSurface->bindToClient(this)) + if (!context->bindToClient(this)) return false; - scoped_ptr<ResourceProvider> resourceProvider = ResourceProvider::create(outputSurface.get()); + scoped_ptr<ResourceProvider> resourceProvider = ResourceProvider::create(context.get()); if (!resourceProvider) return false; if (m_settings.implSidePainting) m_tileManager.reset(new TileManager(this, resourceProvider.get(), m_settings.numRasterThreads)); - if (outputSurface->context3D()) + if (context->context3D()) m_renderer = GLRenderer::create(this, resourceProvider.get()); - else if (outputSurface->softwareDevice()) - m_renderer = SoftwareRenderer::create(this, resourceProvider.get(), outputSurface->softwareDevice()); + else if (context->softwareDevice()) + m_renderer = SoftwareRenderer::create(this, resourceProvider.get(), context->softwareDevice()); if (!m_renderer) return false; m_resourceProvider = resourceProvider.Pass(); - m_outputSurface = outputSurface.Pass(); + m_context = context.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::sendDidLoseOutputSurfaceRecursive(LayerImpl* current) +void LayerTreeHostImpl::sendDidLoseContextRecursive(LayerImpl* current) { DCHECK(current); - current->didLoseOutputSurface(); + current->didLoseContext(); if (current->maskLayer()) - sendDidLoseOutputSurfaceRecursive(current->maskLayer()); + sendDidLoseContextRecursive(current->maskLayer()); if (current->replicaLayer()) - sendDidLoseOutputSurfaceRecursive(current->replicaLayer()); + sendDidLoseContextRecursive(current->replicaLayer()); for (size_t i = 0; i < current->children().size(); ++i) - sendDidLoseOutputSurfaceRecursive(current->children()[i]); + sendDidLoseContextRecursive(current->children()[i]); } static void clearRenderSurfacesOnLayerImplRecursive(LayerImpl* current) diff --git a/cc/layer_tree_host_impl.h b/cc/layer_tree_host_impl.h index 675d765..d4aa8f5 100644 --- a/cc/layer_tree_host_impl.h +++ b/cc/layer_tree_host_impl.h @@ -37,7 +37,7 @@ struct RenderingStats; // LayerTreeHost->Proxy callback interface. class LayerTreeHostImplClient { public: - virtual void didLoseOutputSurfaceOnImplThread() = 0; + virtual void didLoseContextOnImplThread() = 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 didLoseOutputSurface() OVERRIDE; + virtual void didLoseContext() OVERRIDE; virtual void onSwapBuffersComplete() OVERRIDE; virtual void setFullRootLayerDamage() OVERRIDE; virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE; @@ -181,14 +181,14 @@ public: // Implementation bool canDraw(); - OutputSurface* outputSurface() const; + GraphicsContext* context() const; std::string layerTreeAsText() const; void finishAllRendering(); int sourceAnimationFrameNumber() const; - bool initializeRenderer(scoped_ptr<OutputSurface>); + bool initializeRenderer(scoped_ptr<GraphicsContext>); 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 sendDidLoseOutputSurfaceRecursive(LayerImpl*); + void sendDidLoseContextRecursive(LayerImpl*); void clearRenderSurfaces(); bool ensureRenderSurfaceLayerList(); void clearCurrentlyScrollingLayer(); @@ -333,7 +333,7 @@ private: void dumpRenderSurfaces(std::string*, int indent, const LayerImpl*) const; - scoped_ptr<OutputSurface> m_outputSurface; + scoped_ptr<GraphicsContext> m_context; scoped_ptr<ResourceProvider> m_resourceProvider; scoped_ptr<Renderer> m_renderer; scoped_ptr<TileManager> m_tileManager; diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc index 6de5665..84939bc 100644 --- a/cc/layer_tree_host_impl_unittest.cc +++ b/cc/layer_tree_host_impl_unittest.cc @@ -82,7 +82,7 @@ public: settings.pageScalePinchZoomEnabled = GetParam(); m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); - m_hostImpl->initializeRenderer(createOutputSurface()); + m_hostImpl->initializeRenderer(createContext()); m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); } @@ -90,7 +90,7 @@ public: { } - virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE { } + virtual void didLoseContextOnImplThread() 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<OutputSurface> outputSurface, scoped_ptr<LayerImpl> root) + scoped_ptr<LayerTreeHostImpl> createLayerTreeHost(bool partialSwap, scoped_ptr<GraphicsContext> graphicsContext, 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(outputSurface.Pass()); + myHostImpl->initializeRenderer(graphicsContext.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(createOutputSurface()); + m_hostImpl->initializeRenderer(createContext()); 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<OutputSurface> createOutputSurface() + scoped_ptr<GraphicsContext> createContext() { - return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<OutputSurface>(); + return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<GraphicsContext>(); } 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<OutputSurface>()); + m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<GraphicsContext>()); 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(createOutputSurface()); + m_hostImpl->initializeRenderer(createContext()); 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<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ReshapeTrackerContext)).PassAs<OutputSurface>(); + scoped_ptr<GraphicsContext> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ReshapeTrackerContext)).PassAs<GraphicsContext>(); 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<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapTrackerContext)).PassAs<OutputSurface>(); + scoped_ptr<GraphicsContext> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapTrackerContext)).PassAs<GraphicsContext>(); 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<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebGraphicsContext3D>(new MockContext)).PassAs<OutputSurface>(); - MockContext* mockContext = static_cast<MockContext*>(outputSurface->context3D()); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebGraphicsContext3D>(new MockContext)).PassAs<GraphicsContext>(); + MockContext* mockContext = static_cast<MockContext*>(context->context3D()); MockContextHarness harness(mockContext); // Run test case - scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, outputSurface.Pass(), FakeLayerWithQuads::create(1)); + scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context.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<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockContext)).PassAs<OutputSurface>(); - MockContext* mockContext = static_cast<MockContext*>(outputSurface->context3D()); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockContext)).PassAs<GraphicsContext>(); + MockContext* mockContext = static_cast<MockContext*>(context->context3D()); MockContextHarness harness(mockContext); - scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, outputSurface.Pass(), FakeLayerWithQuads::create(1)); + scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, context.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<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); LayerTreeSettings settings; settings.partialSwapEnabled = partialSwap; scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, client, proxy); - myHostImpl->initializeRenderer(outputSurface.Pass()); + myHostImpl->initializeRenderer(context.Pass()); myHostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); /* @@ -2450,48 +2450,48 @@ TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorNoPartialSwap) } } -// Make sure that output surface lost notifications are propagated through the tree. -class OutputSurfaceLostNotificationCheckLayer : public LayerImpl { +// Make sure that context lost notifications are propagated through the tree. +class ContextLostNotificationCheckLayer : public LayerImpl { public: - static scoped_ptr<LayerImpl> create(int id) { return scoped_ptr<LayerImpl>(new OutputSurfaceLostNotificationCheckLayer(id)); } + static scoped_ptr<LayerImpl> create(int id) { return scoped_ptr<LayerImpl>(new ContextLostNotificationCheckLayer(id)); } - virtual void didLoseOutputSurface() OVERRIDE + virtual void didLoseContext() OVERRIDE { - m_didLoseOutputSurfaceCalled = true; + m_didLoseContextCalled = true; } - bool didLoseOutputSurfaceCalled() const { return m_didLoseOutputSurfaceCalled; } + bool didLoseContextCalled() const { return m_didLoseContextCalled; } private: - explicit OutputSurfaceLostNotificationCheckLayer(int id) + explicit ContextLostNotificationCheckLayer(int id) : LayerImpl(id) - , m_didLoseOutputSurfaceCalled(false) + , m_didLoseContextCalled(false) { } - bool m_didLoseOutputSurfaceCalled; + bool m_didLoseContextCalled; }; -TEST_P(LayerTreeHostImplTest, outputSurfaceLostAndRestoredNotificationSentToAllLayers) +TEST_P(LayerTreeHostImplTest, contextLostAndRestoredNotificationSentToAllLayers) { - m_hostImpl->setRootLayer(OutputSurfaceLostNotificationCheckLayer::create(1)); - OutputSurfaceLostNotificationCheckLayer* root = static_cast<OutputSurfaceLostNotificationCheckLayer*>(m_hostImpl->rootLayer()); + m_hostImpl->setRootLayer(ContextLostNotificationCheckLayer::create(1)); + ContextLostNotificationCheckLayer* root = static_cast<ContextLostNotificationCheckLayer*>(m_hostImpl->rootLayer()); - root->addChild(OutputSurfaceLostNotificationCheckLayer::create(1)); - OutputSurfaceLostNotificationCheckLayer* layer1 = static_cast<OutputSurfaceLostNotificationCheckLayer*>(root->children()[0]); + root->addChild(ContextLostNotificationCheckLayer::create(1)); + ContextLostNotificationCheckLayer* layer1 = static_cast<ContextLostNotificationCheckLayer*>(root->children()[0]); - layer1->addChild(OutputSurfaceLostNotificationCheckLayer::create(2)); - OutputSurfaceLostNotificationCheckLayer* layer2 = static_cast<OutputSurfaceLostNotificationCheckLayer*>(layer1->children()[0]); + layer1->addChild(ContextLostNotificationCheckLayer::create(2)); + ContextLostNotificationCheckLayer* layer2 = static_cast<ContextLostNotificationCheckLayer*>(layer1->children()[0]); - EXPECT_FALSE(root->didLoseOutputSurfaceCalled()); - EXPECT_FALSE(layer1->didLoseOutputSurfaceCalled()); - EXPECT_FALSE(layer2->didLoseOutputSurfaceCalled()); + EXPECT_FALSE(root->didLoseContextCalled()); + EXPECT_FALSE(layer1->didLoseContextCalled()); + EXPECT_FALSE(layer2->didLoseContextCalled()); - m_hostImpl->initializeRenderer(createOutputSurface()); + m_hostImpl->initializeRenderer(createContext()); - EXPECT_TRUE(root->didLoseOutputSurfaceCalled()); - EXPECT_TRUE(layer1->didLoseOutputSurfaceCalled()); - EXPECT_TRUE(layer2->didLoseOutputSurfaceCalled()); + EXPECT_TRUE(root->didLoseContextCalled()); + EXPECT_TRUE(layer1->didLoseContextCalled()); + EXPECT_TRUE(layer2->didLoseContextCalled()); } 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<OutputSurface>()); + m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<GraphicsContext>()); m_hostImpl->finishAllRendering(); } @@ -2518,14 +2518,14 @@ private: unsigned m_succeedCount; }; -TEST_P(LayerTreeHostImplTest, context3DLostDuringInitialize) +TEST_P(LayerTreeHostImplTest, contextLostDuringInitialize) { LayerTreeSettings settings; m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); // Initialize into a known successful state. - EXPECT_TRUE(m_hostImpl->initializeRenderer(createOutputSurface())); - EXPECT_TRUE(m_hostImpl->outputSurface()); + EXPECT_TRUE(m_hostImpl->initializeRenderer(createContext())); + EXPECT_TRUE(m_hostImpl->context()); EXPECT_TRUE(m_hostImpl->renderer()); EXPECT_TRUE(m_hostImpl->resourceProvider()); @@ -2538,15 +2538,15 @@ TEST_P(LayerTreeHostImplTest, context3DLostDuringInitialize) 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<OutputSurface>())); - EXPECT_EQ(0, m_hostImpl->outputSurface()); + EXPECT_FALSE(m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(i))).PassAs<GraphicsContext>())); + EXPECT_EQ(0, m_hostImpl->context()); EXPECT_EQ(0, m_hostImpl->renderer()); EXPECT_EQ(0, m_hostImpl->resourceProvider()); - EXPECT_TRUE(m_hostImpl->initializeRenderer(createOutputSurface())); + EXPECT_TRUE(m_hostImpl->initializeRenderer(createContext())); } - 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->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(kMakeCurrentSuccessesNeededForSuccessfulInitialization))).PassAs<GraphicsContext>())); + EXPECT_TRUE(m_hostImpl->context()); 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, dontUseOldResourcesAfterLostOutputSurface) +TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) { int layerId = 1; @@ -2899,7 +2899,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostOutputSurface) rootLayer->addChild(delegatedRendererLayer.PassAs<LayerImpl>()); // Use a context that supports IOSurfaces - m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DWithIOSurface)).PassAs<OutputSurface>()); + m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DWithIOSurface)).PassAs<GraphicsContext>()); FakeVideoFrame hwVideoFrame( VideoFrame::WrapNativeTexture( @@ -2927,9 +2927,9 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostOutputSurface) unsigned numResources = m_hostImpl->resourceProvider()->numResources(); - // Lose the WebGraphicsContext3D, replacing it with a StrictWebGraphicsContext3DWithIOSurface, + // Lose the context, 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<OutputSurface>()); + m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new StrictWebGraphicsContext3DWithIOSurface)).PassAs<GraphicsContext>()); // Create dummy resources so that looking up an old resource will get an // invalid texture id mapping. @@ -2937,7 +2937,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostOutputSurface) m_hostImpl->resourceProvider()->createResourceFromExternalTexture(StrictWebGraphicsContext3D::kExternalTextureId); // The WebVideoFrameProvider is expected to recreate its textures after a - // lost output surface (or not serve a frame). + // lost context (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 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()); + // 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()); 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(trackingWebGraphicsContext3D->numTextures(), 0u); + EXPECT_GT(trackingWebGraphicsContext->numTextures(), 0u); // Kill the layer tree. m_hostImpl->setRootLayer(LayerImpl::create(100)); // There should be no textures left in use after. - EXPECT_EQ(0u, trackingWebGraphicsContext3D->numTextures()); + EXPECT_EQ(0u, trackingWebGraphicsContext->numTextures()); } class MockDrawQuadsToFillScreenContext : public FakeWebGraphicsContext3D { @@ -3076,11 +3076,11 @@ public: TEST_P(LayerTreeHostImplTest, hasTransparentBackground) { - scoped_ptr<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockDrawQuadsToFillScreenContext)).PassAs<OutputSurface>(); - MockDrawQuadsToFillScreenContext* mockContext = static_cast<MockDrawQuadsToFillScreenContext*>(outputSurface->context3D()); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockDrawQuadsToFillScreenContext)).PassAs<GraphicsContext>(); + MockDrawQuadsToFillScreenContext* mockContext = static_cast<MockDrawQuadsToFillScreenContext*>(context->context3D()); // Run test case - scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, outputSurface.Pass(), LayerImpl::create(1)); + scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context.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<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); - layerTreeHostImpl->initializeRenderer(outputSurface.Pass()); + layerTreeHostImpl->initializeRenderer(context.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<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); gfx::Size rootSize(100, 100); - myHostImpl->initializeRenderer(outputSurface.Pass()); + myHostImpl->initializeRenderer(context.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<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); gfx::Size rootSize(1000, 1000); - myHostImpl->initializeRenderer(outputSurface.Pass()); + myHostImpl->initializeRenderer(context.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<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); gfx::Size rootSize(1000, 1000); - myHostImpl->initializeRenderer(outputSurface.Pass()); + myHostImpl->initializeRenderer(context.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<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); gfx::Size rootSize(1000, 1000); - myHostImpl->initializeRenderer(outputSurface.Pass()); + myHostImpl->initializeRenderer(context.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<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); gfx::Size rootSize(1000, 1000); - myHostImpl->initializeRenderer(outputSurface.Pass()); + myHostImpl->initializeRenderer(context.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<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>(); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); gfx::Size rootSize(1000, 1000); - myHostImpl->initializeRenderer(outputSurface.Pass()); + myHostImpl->initializeRenderer(context.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<OutputSurface> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>(); - myHostImpl->initializeRenderer(outputSurface.Pass()); + scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>(); + myHostImpl->initializeRenderer(context.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 didLoseOutputSurface() OVERRIDE { } + virtual void didLoseContext() 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<OutputSurface> outputSurface(createOutputSurface()); - ASSERT_TRUE(outputSurface->context3D()); - scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(outputSurface.get())); + scoped_ptr<GraphicsContext> context(createContext()); + ASSERT_TRUE(context->context3D()); + scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get())); scoped_ptr<TestRenderer> renderer(TestRenderer::create(resourceProvider.get(), &m_proxy)); diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc index 8da17c5..3752537 100644 --- a/cc/layer_tree_host_unittest.cc +++ b/cc/layer_tree_host_unittest.cc @@ -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->outputSurface()->context3D()); + CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D()); switch (impl->sourceFrameNumber()) { case 0: @@ -1435,7 +1435,7 @@ public: virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { - CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->outputSurface()->context3D()); + CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->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->outputSurface()->context3D()); + CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D()); switch (impl->sourceFrameNumber()) { case 0: @@ -1557,7 +1557,7 @@ public: virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { - CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->outputSurface()->context3D()); + CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->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 loseOutputSurface(1) should lead to a didRecreateOutputSurface(true) +// A loseContext(1) should lead to a didRecreateOutputSurface(true) class LayerTreeHostTestSetSingleLostContext : public LayerTreeHostTest { public: LayerTreeHostTestSetSingleLostContext() @@ -1972,7 +1972,7 @@ public: virtual void didCommitAndDrawFrame() OVERRIDE { - m_layerTreeHost->loseOutputSurface(1); + m_layerTreeHost->loseContext(1); } virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE @@ -1991,7 +1991,7 @@ TEST_F(LayerTreeHostTestSetSingleLostContext, runMultiThread) runTest(true); } -// A loseOutputSurface(10) should lead to a didRecreateOutputSurface(false), and +// A loseContext(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->loseOutputSurface(10); + m_layerTreeHost->loseContext(10); } virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE @@ -2880,7 +2880,7 @@ public: EXPECT_TRUE(m_layer->haveBackingTexture()); m_layerTreeHost->setVisible(false); postEvictTextures(); - m_layerTreeHost->loseOutputSurface(1); + m_layerTreeHost->loseContext(1); m_layerTreeHost->setVisible(true); break; default: diff --git a/cc/nine_patch_layer_impl.cc b/cc/nine_patch_layer_impl.cc index 46a8af2..223583f 100644 --- a/cc/nine_patch_layer_impl.cc +++ b/cc/nine_patch_layer_impl.cc @@ -146,7 +146,7 @@ void NinePatchLayerImpl::didDraw(ResourceProvider* resourceProvider) { } -void NinePatchLayerImpl::didLoseOutputSurface() +void NinePatchLayerImpl::didLoseContext() { m_resourceId = 0; } diff --git a/cc/nine_patch_layer_impl.h b/cc/nine_patch_layer_impl.h index f574c3a..e42d481 100644 --- a/cc/nine_patch_layer_impl.h +++ b/cc/nine_patch_layer_impl.h @@ -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 didLoseOutputSurface() OVERRIDE; + virtual void didLoseContext() OVERRIDE; protected: explicit NinePatchLayerImpl(int id); diff --git a/cc/nine_patch_layer_unittest.cc b/cc/nine_patch_layer_unittest.cc index 520f8d5..ead0d60 100644 --- a/cc/nine_patch_layer_unittest.cc +++ b/cc/nine_patch_layer_unittest.cc @@ -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<OutputSurface> outputSurface; + scoped_ptr<GraphicsContext> context; scoped_ptr<ResourceProvider> resourceProvider; { DebugScopedSetImplThread implThread(proxy()); DebugScopedSetMainThreadBlocked mainThreadBlocked(proxy()); - outputSurface = createFakeOutputSurface(); - resourceProvider = ResourceProvider::create(outputSurface.get()); + context = WebKit::createFakeGraphicsContext(); + resourceProvider = ResourceProvider::create(context.get()); params.texture->acquireBackingTexture(resourceProvider.get()); ASSERT_TRUE(params.texture->haveBackingTexture()); } diff --git a/cc/output_surface.h b/cc/output_surface.h deleted file mode 100644 index 9f91c32..0000000 --- a/cc/output_surface.h +++ /dev/null @@ -1,21 +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_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_ diff --git a/cc/prioritized_resource_unittest.cc b/cc/prioritized_resource_unittest.cc index 173fd14..95bf7f9 100644 --- a/cc/prioritized_resource_unittest.cc +++ b/cc/prioritized_resource_unittest.cc @@ -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_output_surface.h" +#include "cc/test/fake_graphics_context.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_outputSurface(createFakeOutputSurface()) + , m_context(WebKit::createFakeGraphicsContext()) { DebugScopedSetImplThread implThread(&m_proxy); - m_resourceProvider = ResourceProvider::create(m_outputSurface.get()); + m_resourceProvider = ResourceProvider::create(m_context.get()); } virtual ~PrioritizedResourceTest() @@ -98,7 +98,7 @@ protected: FakeProxy m_proxy; const gfx::Size m_textureSize; const GLenum m_textureFormat; - scoped_ptr<OutputSurface> m_outputSurface; + scoped_ptr<GraphicsContext> m_context; 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 initializeOutputSurface() = 0; + virtual bool initializeContext() = 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 recreateOutputSurface() = 0; + virtual bool recreateContext() = 0; virtual void renderingStats(RenderingStats*) = 0; @@ -98,7 +98,7 @@ public: virtual void acquireLayerTextures() = 0; // Testing hooks - virtual void loseOutputSurface() = 0; + virtual void loseContext() = 0; protected: explicit Proxy(scoped_ptr<Thread> implThread); diff --git a/cc/renderer.h b/cc/renderer.h index b739537..04949dc 100644 --- a/cc/renderer.h +++ b/cc/renderer.h @@ -19,7 +19,7 @@ class CC_EXPORT RendererClient { public: virtual const gfx::Size& deviceViewportSize() const = 0; virtual const LayerTreeSettings& settings() const = 0; - virtual void didLoseOutputSurface() = 0; + virtual void didLoseContext() = 0; virtual void onSwapBuffersComplete() = 0; virtual void setFullRootLayerDamage() = 0; virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) = 0; diff --git a/cc/resource_provider.cc b/cc/resource_provider.cc index 6aaca18..735fc14 100644 --- a/cc/resource_provider.cc +++ b/cc/resource_provider.cc @@ -109,7 +109,7 @@ ResourceProvider::Child::~Child() { } -scoped_ptr<ResourceProvider> ResourceProvider::create(OutputSurface* context) +scoped_ptr<ResourceProvider> ResourceProvider::create(GraphicsContext* context) { scoped_ptr<ResourceProvider> resourceProvider(new ResourceProvider(context)); if (!resourceProvider->initialize()) @@ -119,7 +119,7 @@ scoped_ptr<ResourceProvider> ResourceProvider::create(OutputSurface* context) ResourceProvider::~ResourceProvider() { - WebGraphicsContext3D* context3d = m_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->context3D(); if (!context3d || !context3d->makeContextCurrent()) return; m_textureUploader.reset(); @@ -129,7 +129,7 @@ ResourceProvider::~ResourceProvider() WebGraphicsContext3D* ResourceProvider::graphicsContext3D() { DCHECK(m_threadChecker.CalledOnValidThread()); - return m_outputSurface->context3D(); + return m_context->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_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->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_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->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_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->context3D(); DCHECK(context3d); GLC(context3d, context3d->deleteTexture(resource->glId)); } if (resource->glPixelBufferId) { - WebGraphicsContext3D* context3d = m_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->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_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->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_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->context3D(); if (context3d) context3d->flush(); } @@ -357,7 +357,7 @@ void ResourceProvider::flush() bool ResourceProvider::shallowFlushIfSupported() { DCHECK(m_threadChecker.CalledOnValidThread()); - WebGraphicsContext3D* context3d = m_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->context3D(); if (!context3d || !m_useShallowFlush) return false; @@ -479,8 +479,8 @@ ResourceProvider::ScopedWriteLockSoftware::~ScopedWriteLockSoftware() m_resourceProvider->unlockForWrite(m_resourceId); } -ResourceProvider::ResourceProvider(OutputSurface* context) - : m_outputSurface(context) +ResourceProvider::ResourceProvider(GraphicsContext* context) + : m_context(context) , m_nextId(1) , m_nextChild(1) , m_defaultResourceType(GLTexture) @@ -494,7 +494,7 @@ ResourceProvider::ResourceProvider(OutputSurface* context) bool ResourceProvider::initialize() { DCHECK(m_threadChecker.CalledOnValidThread()); - WebGraphicsContext3D* context3d = m_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->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_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->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_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->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_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->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_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->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_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->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_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->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_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->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_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->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_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->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_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->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_outputSurface->context3D(); + WebGraphicsContext3D* context3d = m_context->context3D(); ResourceMap::iterator it = m_resources.find(resourceId); DCHECK(it != m_resources.end()); Resource* resource = &it->second; diff --git a/cc/resource_provider.h b/cc/resource_provider.h index 0bbcaf8..ba68863 100644 --- a/cc/resource_provider.h +++ b/cc/resource_provider.h @@ -10,7 +10,7 @@ #include "base/memory/scoped_ptr.h" #include "base/threading/thread_checker.h" #include "cc/cc_export.h" -#include "cc/output_surface.h" +#include "cc/graphics_context.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(OutputSurface*); + static scoped_ptr<ResourceProvider> create(GraphicsContext*); virtual ~ResourceProvider(); @@ -257,7 +257,7 @@ private: }; typedef base::hash_map<int, Child> ChildMap; - explicit ResourceProvider(OutputSurface*); + explicit ResourceProvider(GraphicsContext*); bool initialize(); const Resource* lockForRead(ResourceId); @@ -269,7 +269,7 @@ private: bool transferResource(WebKit::WebGraphicsContext3D*, ResourceId, TransferableResource*); void deleteResourceInternal(ResourceMap::iterator it); - OutputSurface* m_outputSurface; + GraphicsContext* m_context; ResourceId m_nextId; ResourceMap m_resources; int m_nextChild; diff --git a/cc/resource_provider_unittest.cc b/cc/resource_provider_unittest.cc index db473d7..71912b3 100644 --- a/cc/resource_provider_unittest.cc +++ b/cc/resource_provider_unittest.cc @@ -5,17 +5,17 @@ #include "cc/resource_provider.h" #include "base/logging.h" -#include "cc/output_surface.h" +#include "cc/graphics_context.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_outputSurface(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>().PassAs<WebKit::WebGraphicsContext3D>())) - , m_resourceProvider(ResourceProvider::create(m_outputSurface.get())) + , m_context(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>().PassAs<WebKit::WebGraphicsContext3D>())) + , m_resourceProvider(ResourceProvider::create(m_context.get())) { m_resourceProvider->setDefaultResourceType(GetParam()); } - ResourceProviderContext* context() { return static_cast<ResourceProviderContext*>(m_outputSurface->context3D()); } + ResourceProviderContext* context() { return static_cast<ResourceProviderContext*>(m_context->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<OutputSurface> m_outputSurface; + scoped_ptr<GraphicsContext> m_context; scoped_ptr<ResourceProvider> m_resourceProvider; }; @@ -417,8 +417,8 @@ TEST_P(ResourceProviderTest, TransferResources) if (GetParam() != ResourceProvider::GLTexture) return; - scoped_ptr<OutputSurface> childOutputSurface(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>())); - scoped_ptr<ResourceProvider> childResourceProvider(ResourceProvider::create(childOutputSurface.get())); + scoped_ptr<GraphicsContext> childContext(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>())); + scoped_ptr<ResourceProvider> childResourceProvider(ResourceProvider::create(childContext.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*>(childOutputSurface->context3D()); + ResourceProviderContext* childContext3D = static_cast<ResourceProviderContext*>(childContext->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<OutputSurface> childOutputSurface(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>())); - scoped_ptr<ResourceProvider> childResourceProvider(ResourceProvider::create(childOutputSurface.get())); + scoped_ptr<GraphicsContext> childContext(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>())); + scoped_ptr<ResourceProvider> childResourceProvider(ResourceProvider::create(childContext.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<OutputSurface> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new TextureStateTrackingContext))); + scoped_ptr<GraphicsContext> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new TextureStateTrackingContext))); TextureStateTrackingContext* context = static_cast<TextureStateTrackingContext*>(outputSurface->context3D()); scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(outputSurface.get())); diff --git a/cc/resource_update_controller_unittest.cc b/cc/resource_update_controller_unittest.cc index 4b324b6..fad3f26 100644 --- a/cc/resource_update_controller_unittest.cc +++ b/cc/resource_update_controller_unittest.cc @@ -121,7 +121,7 @@ public: protected: virtual void SetUp() { - m_outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new WebGraphicsContext3DForUploadTest(this))); + m_context = 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_outputSurface.get()); + m_resourceProvider = ResourceProvider::create(m_context.get()); } @@ -198,7 +198,7 @@ protected: protected: // Classes required to interact and test the ResourceUpdateController FakeProxy m_proxy; - scoped_ptr<OutputSurface> m_outputSurface; + scoped_ptr<GraphicsContext> m_context; scoped_ptr<ResourceProvider> m_resourceProvider; scoped_ptr<ResourceUpdateQueue> m_queue; scoped_ptr<PrioritizedResource> m_textures[4]; diff --git a/cc/scheduler.cc b/cc/scheduler.cc index 099708a..ed2884f 100644 --- a/cc/scheduler.cc +++ b/cc/scheduler.cc @@ -104,18 +104,18 @@ void Scheduler::didSwapBuffersComplete() m_frameRateController->didFinishFrame(); } -void Scheduler::didLoseOutputSurface() +void Scheduler::didLoseContext() { - TRACE_EVENT0("cc", "Scheduler::didLoseOutputSurface"); + TRACE_EVENT0("cc", "Scheduler::didLoseContext"); m_frameRateController->didAbortAllPendingFrames(); - m_stateMachine.didLoseOutputSurface(); + m_stateMachine.didLoseContext(); processScheduledActions(); } -void Scheduler::didRecreateOutputSurface() +void Scheduler::didRecreateContext() { - TRACE_EVENT0("cc", "Scheduler::didRecreateOutputSurface"); - m_stateMachine.didRecreateOutputSurface(); + TRACE_EVENT0("cc", "Scheduler::didRecreateContext"); + m_stateMachine.didRecreateContext(); processScheduledActions(); } @@ -174,7 +174,7 @@ void Scheduler::processScheduledActions() if (result.didSwap) m_frameRateController->didBeginFrame(); break; - } case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_RECREATION: + } case SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION: m_client->scheduledActionBeginContextRecreation(); break; case SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD: diff --git a/cc/scheduler.h b/cc/scheduler.h index 9beffc5..ffe03cf 100644 --- a/cc/scheduler.h +++ b/cc/scheduler.h @@ -79,8 +79,8 @@ public: void setSwapBuffersCompleteSupported(bool); void didSwapBuffersComplete(); - void didLoseOutputSurface(); - void didRecreateOutputSurface(); + void didLoseContext(); + void didRecreateContext(); bool commitPending() const { return m_stateMachine.commitPending(); } bool redrawPending() const { return m_stateMachine.redrawPending(); } diff --git a/cc/scheduler_state_machine.cc b/cc/scheduler_state_machine.cc index e8404476..7b2ce7b 100644 --- a/cc/scheduler_state_machine.cc +++ b/cc/scheduler_state_machine.cc @@ -28,7 +28,7 @@ SchedulerStateMachine::SchedulerStateMachine() , m_canDraw(false) , m_drawIfPossibleFailed(false) , m_textureState(LAYER_TEXTURE_STATE_UNLOCKED) - , m_outputSurfaceState(OUTPUT_SURFACE_ACTIVE) + , m_contextState(CONTEXT_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_outputSurfaceState = %d; ", m_outputSurfaceState); + base::StringAppendF(&str, "m_contextState = %d; ", m_contextState); return str; } @@ -93,7 +93,7 @@ bool SchedulerStateMachine::shouldDraw() const return false; if (hasDrawnThisFrame()) return false; - if (m_outputSurfaceState != OUTPUT_SURFACE_ACTIVE) + if (m_contextState != CONTEXT_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_outputSurfaceState != OUTPUT_SURFACE_ACTIVE && m_needsForcedRedraw) + if (m_contextState != CONTEXT_ACTIVE && m_needsForcedRedraw) return ACTION_DRAW_FORCED; - if (m_outputSurfaceState != OUTPUT_SURFACE_ACTIVE && m_needsForcedCommit) + if (m_contextState != CONTEXT_ACTIVE && m_needsForcedCommit) return ACTION_BEGIN_FRAME; - if (m_outputSurfaceState == OUTPUT_SURFACE_LOST) - return ACTION_BEGIN_OUTPUT_SURFACE_RECREATION; - if (m_outputSurfaceState == OUTPUT_SURFACE_RECREATING) + if (m_contextState == CONTEXT_LOST) + return ACTION_BEGIN_CONTEXT_RECREATION; + if (m_contextState == CONTEXT_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_outputSurfaceState == OUTPUT_SURFACE_LOST) + if (shouldDraw() || m_contextState == CONTEXT_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_OUTPUT_SURFACE_RECREATION: + case ACTION_BEGIN_CONTEXT_RECREATION: DCHECK(m_commitState == COMMIT_STATE_IDLE); - DCHECK(m_outputSurfaceState == OUTPUT_SURFACE_LOST); - m_outputSurfaceState = OUTPUT_SURFACE_RECREATING; + DCHECK(m_contextState == CONTEXT_LOST); + m_contextState = CONTEXT_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_outputSurfaceState == OUTPUT_SURFACE_ACTIVE; + return m_needsRedraw && m_visible && m_contextState == CONTEXT_ACTIVE; } void SchedulerStateMachine::didEnterVSync() @@ -307,17 +307,17 @@ void SchedulerStateMachine::beginFrameAborted() } } -void SchedulerStateMachine::didLoseOutputSurface() +void SchedulerStateMachine::didLoseContext() { - if (m_outputSurfaceState == OUTPUT_SURFACE_LOST || m_outputSurfaceState == OUTPUT_SURFACE_RECREATING) + if (m_contextState == CONTEXT_LOST || m_contextState == CONTEXT_RECREATING) return; - m_outputSurfaceState = OUTPUT_SURFACE_LOST; + m_contextState = CONTEXT_LOST; } -void SchedulerStateMachine::didRecreateOutputSurface() +void SchedulerStateMachine::didRecreateContext() { - DCHECK(m_outputSurfaceState == OUTPUT_SURFACE_RECREATING); - m_outputSurfaceState = OUTPUT_SURFACE_ACTIVE; + DCHECK(m_contextState == CONTEXT_RECREATING); + m_contextState = CONTEXT_ACTIVE; setNeedsCommit(); } diff --git a/cc/scheduler_state_machine.h b/cc/scheduler_state_machine.h index 51b8ddd..1ac14ec9 100644 --- a/cc/scheduler_state_machine.h +++ b/cc/scheduler_state_machine.h @@ -39,10 +39,10 @@ public: LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD, }; - enum OutputSurfaceState { - OUTPUT_SURFACE_ACTIVE, - OUTPUT_SURFACE_LOST, - OUTPUT_SURFACE_RECREATING, + enum ContextState { + CONTEXT_ACTIVE, + CONTEXT_LOST, + CONTEXT_RECREATING, }; bool commitPending() const @@ -58,7 +58,7 @@ public: ACTION_COMMIT, ACTION_DRAW_IF_POSSIBLE, ACTION_DRAW_FORCED, - ACTION_BEGIN_OUTPUT_SURFACE_RECREATION, + ACTION_BEGIN_CONTEXT_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 didLoseOutputSurface(); - void didRecreateOutputSurface(); + void didLoseContext(); + void didRecreateContext(); // Exposed for testing purposes. void setMaximumNumberOfFailedDrawsBeforeDrawIsForced(int); @@ -155,7 +155,7 @@ protected: bool m_canDraw; bool m_drawIfPossibleFailed; TextureState m_textureState; - OutputSurfaceState m_outputSurfaceState; + ContextState m_contextState; DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); }; diff --git a/cc/scheduler_state_machine_unittest.cc b/cc/scheduler_state_machine_unittest.cc index bb3c21e..df6a3df 100644 --- a/cc/scheduler_state_machine_unittest.cc +++ b/cc/scheduler_state_machine_unittest.cc @@ -637,16 +637,16 @@ TEST(SchedulerStateMachineTest, TestContextLostWhenCompletelyIdle) state.setVisible(true); state.setCanDraw(true); - state.didLoseOutputSurface(); + state.didLoseContext(); - EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_RECREATION, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_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.didRecreateOutputSurface(); + state.didRecreateContext(); // 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.didLoseOutputSurface(); + state.didLoseContext(); - EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_RECREATION, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_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.didRecreateOutputSurface(); + state.didRecreateContext(); // 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.didLoseOutputSurface(); + state.didLoseContext(); // 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_OUTPUT_SURFACE_RECREATION, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); state.didLeaveVSync(); - EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_RECREATION, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_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.didLoseOutputSurface(); + state.didLoseContext(); // 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_OUTPUT_SURFACE_RECREATION, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); state.didLeaveVSync(); - EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_RECREATION, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); } @@ -785,7 +785,7 @@ TEST(SchedulerStateMachineTest, TestFinishAllRenderingWhileContextLost) state.setCanDraw(true); // Cause a lost context lost. - state.didLoseOutputSurface(); + state.didLoseContext(); // 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_OUTPUT_SURFACE_RECREATION, state.nextAction()); + EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_CONTEXT_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.didLoseOutputSurface(); + state.didLoseContext(); EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); } diff --git a/cc/scoped_resource_unittest.cc b/cc/scoped_resource_unittest.cc index 6a72564..ddf583a 100644 --- a/cc/scoped_resource_unittest.cc +++ b/cc/scoped_resource_unittest.cc @@ -5,7 +5,7 @@ #include "cc/scoped_resource.h" #include "cc/renderer.h" -#include "cc/test/fake_output_surface.h" +#include "cc/test/fake_graphics_context.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<OutputSurface> context(createFakeOutputSurface()); + scoped_ptr<GraphicsContext> context(createFakeGraphicsContext()); 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<OutputSurface> context(createFakeOutputSurface()); + scoped_ptr<GraphicsContext> context(createFakeGraphicsContext()); 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<OutputSurface> context(createFakeOutputSurface()); + scoped_ptr<GraphicsContext> context(createFakeGraphicsContext()); scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get())); { @@ -74,7 +74,7 @@ TEST(ScopedResourceTest, ScopedResourceIsDeleted) TEST(ScopedResourceTest, LeakScopedResource) { - scoped_ptr<OutputSurface> context(createFakeOutputSurface()); + scoped_ptr<GraphicsContext> context(createFakeGraphicsContext()); scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get())); { diff --git a/cc/scrollbar_layer_impl.cc b/cc/scrollbar_layer_impl.cc index d43e70a..5b6968dc 100644 --- a/cc/scrollbar_layer_impl.cc +++ b/cc/scrollbar_layer_impl.cc @@ -125,7 +125,7 @@ void ScrollbarLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append } } -void ScrollbarLayerImpl::didLoseOutputSurface() +void ScrollbarLayerImpl::didLoseContext() { m_backTrackResourceId = 0; m_foreTrackResourceId = 0; diff --git a/cc/scrollbar_layer_impl.h b/cc/scrollbar_layer_impl.h index 6b55aa8..f742972 100644 --- a/cc/scrollbar_layer_impl.h +++ b/cc/scrollbar_layer_impl.h @@ -42,7 +42,7 @@ public: virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; - virtual void didLoseOutputSurface() OVERRIDE; + virtual void didLoseContext() OVERRIDE; protected: explicit ScrollbarLayerImpl(int id); diff --git a/cc/single_thread_proxy.cc b/cc/single_thread_proxy.cc index d26d666..d0bea46 100644 --- a/cc/single_thread_proxy.cc +++ b/cc/single_thread_proxy.cc @@ -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_outputSurfaceLost(false) + , m_contextLost(false) , m_rendererInitialized(false) , m_nextFrameIsNewlyCommittedFrame(false) , m_totalCommitCount(0) @@ -82,13 +82,13 @@ bool SingleThreadProxy::isStarted() const return m_layerTreeHostImpl.get(); } -bool SingleThreadProxy::initializeOutputSurface() +bool SingleThreadProxy::initializeContext() { DCHECK(Proxy::isMainThread()); - scoped_ptr<OutputSurface> outputSurface = m_layerTreeHost->createOutputSurface(); - if (!outputSurface.get()) + scoped_ptr<GraphicsContext> context = m_layerTreeHost->createContext(); + if (!context.get()) return false; - m_outputSurfaceBeforeInitialization = outputSurface.Pass(); + m_contextBeforeInitialization = context.Pass(); return true; } @@ -106,10 +106,10 @@ void SingleThreadProxy::setVisible(bool visible) bool SingleThreadProxy::initializeRenderer() { DCHECK(Proxy::isMainThread()); - DCHECK(m_outputSurfaceBeforeInitialization.get()); + DCHECK(m_contextBeforeInitialization.get()); { DebugScopedSetImplThread impl(this); - bool ok = m_layerTreeHostImpl->initializeRenderer(m_outputSurfaceBeforeInitialization.Pass()); + bool ok = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitialization.Pass()); if (ok) { m_rendererInitialized = true; m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererCapabilities(); @@ -119,14 +119,14 @@ bool SingleThreadProxy::initializeRenderer() } } -bool SingleThreadProxy::recreateOutputSurface() +bool SingleThreadProxy::recreateContext() { TRACE_EVENT0("cc", "SingleThreadProxy::recreateContext"); DCHECK(Proxy::isMainThread()); - DCHECK(m_outputSurfaceLost); + DCHECK(m_contextLost); - scoped_ptr<OutputSurface> outputSurface = m_layerTreeHost->createOutputSurface(); - if (!outputSurface.get()) + scoped_ptr<GraphicsContext> context = m_layerTreeHost->createContext(); + if (!context.get()) return false; bool initialized; @@ -135,14 +135,14 @@ bool SingleThreadProxy::recreateOutputSurface() DebugScopedSetImplThread impl(this); if (!m_layerTreeHostImpl->contentsTexturesPurged()) m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); - initialized = m_layerTreeHostImpl->initializeRenderer(outputSurface.Pass()); + initialized = m_layerTreeHostImpl->initializeRenderer(context.Pass()); if (initialized) { m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererCapabilities(); } } if (initialized) - m_outputSurfaceLost = false; + m_contextLost = false; return initialized; } @@ -161,11 +161,11 @@ const RendererCapabilities& SingleThreadProxy::rendererCapabilities() const return m_RendererCapabilitiesForMainThread; } -void SingleThreadProxy::loseOutputSurface() +void SingleThreadProxy::loseContext() { DCHECK(Proxy::isMainThread()); - m_layerTreeHost->didLoseOutputSurface(); - m_outputSurfaceLost = true; + m_layerTreeHost->didLoseContext(); + m_contextLost = true; } void SingleThreadProxy::setNeedsAnimate() @@ -359,7 +359,7 @@ bool SingleThreadProxy::commitAndComposite() bool SingleThreadProxy::doComposite() { - DCHECK(!m_outputSurfaceLost); + DCHECK(!m_contextLost); { DebugScopedSetImplThread impl(this); @@ -384,8 +384,8 @@ bool SingleThreadProxy::doComposite() } if (m_layerTreeHostImpl->isContextLost()) { - m_outputSurfaceLost = true; - m_layerTreeHost->didLoseOutputSurface(); + m_contextLost = true; + m_layerTreeHost->didLoseContext(); return false; } diff --git a/cc/single_thread_proxy.h b/cc/single_thread_proxy.h index 51deb25..a51c64f 100644 --- a/cc/single_thread_proxy.h +++ b/cc/single_thread_proxy.h @@ -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 initializeOutputSurface() OVERRIDE; + virtual bool initializeContext() OVERRIDE; virtual void setSurfaceReady() OVERRIDE; virtual void setVisible(bool) OVERRIDE; virtual bool initializeRenderer() OVERRIDE; - virtual bool recreateOutputSurface() OVERRIDE; + virtual bool recreateContext() OVERRIDE; virtual void renderingStats(RenderingStats*) OVERRIDE; virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE; - virtual void loseOutputSurface() OVERRIDE; + virtual void loseContext() 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 didLoseOutputSurfaceOnImplThread() OVERRIDE { } + virtual void didLoseContextOnImplThread() 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_outputSurfaceLost; + bool m_contextLost; // Holds on to the context between initializeContext() and initializeRenderer() calls. Shouldn't // be used for anything else. - scoped_ptr<OutputSurface> m_outputSurfaceBeforeInitialization; + scoped_ptr<GraphicsContext> m_contextBeforeInitialization; // Used on the Thread, but checked on main thread during initialization/shutdown. scoped_ptr<LayerTreeHostImpl> m_layerTreeHostImpl; diff --git a/cc/software_renderer.cc b/cc/software_renderer.cc index 1d7ad11..cbfffe5 100644 --- a/cc/software_renderer.cc +++ b/cc/software_renderer.cc @@ -71,6 +71,7 @@ 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; diff --git a/cc/software_renderer_unittest.cc b/cc/software_renderer_unittest.cc index d720173..4b80d28 100644 --- a/cc/software_renderer_unittest.cc +++ b/cc/software_renderer_unittest.cc @@ -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 didLoseOutputSurface() OVERRIDE { } + virtual void didLoseContext() OVERRIDE { } virtual void onSwapBuffersComplete() OVERRIDE { } virtual void setFullRootLayerDamage() OVERRIDE { } virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE { }; diff --git a/cc/test/fake_graphics_context.h b/cc/test/fake_graphics_context.h new file mode 100644 index 0000000..aecfcc4 --- /dev/null +++ b/cc/test/fake_graphics_context.h @@ -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_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_ diff --git a/cc/test/fake_output_surface.h b/cc/test/fake_output_surface.h deleted file mode 100644 index 69bce19..0000000 --- a/cc/test/fake_output_surface.h +++ /dev/null @@ -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_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_ diff --git a/cc/test/fake_proxy.cc b/cc/test/fake_proxy.cc index df2c072..d485056 100644 --- a/cc/test/fake_proxy.cc +++ b/cc/test/fake_proxy.cc @@ -16,7 +16,7 @@ bool FakeProxy::isStarted() const return true; } -bool FakeProxy::initializeOutputSurface() +bool FakeProxy::initializeContext() { return true; } @@ -26,7 +26,7 @@ bool FakeProxy::initializeRenderer() return true; } -bool FakeProxy::recreateOutputSurface() +bool FakeProxy::recreateContext() { return true; } diff --git a/cc/test/fake_proxy.h b/cc/test/fake_proxy.h index c89f120..3bbacb5 100644 --- a/cc/test/fake_proxy.h +++ b/cc/test/fake_proxy.h @@ -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 initializeOutputSurface() OVERRIDE; + virtual bool initializeContext() OVERRIDE; virtual void setSurfaceReady() OVERRIDE { } virtual void setVisible(bool) OVERRIDE { } virtual bool initializeRenderer() OVERRIDE; - virtual bool recreateOutputSurface() OVERRIDE; + virtual bool recreateContext() 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 loseOutputSurface() OVERRIDE { } + virtual void loseContext() OVERRIDE { } virtual RendererCapabilities& rendererCapabilities(); void setMaxPartialTextureUpdates(size_t); diff --git a/cc/test/fake_web_graphics_context_3d_unittest.cc b/cc/test/fake_web_graphics_context_3d_unittest.cc deleted file mode 100644 index ade749f..0000000 --- a/cc/test/fake_web_graphics_context_3d_unittest.cc +++ /dev/null @@ -1,31 +0,0 @@ -// 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()); -} diff --git a/cc/texture_layer.cc b/cc/texture_layer.cc index b6007f0..2afa51c 100644 --- a/cc/texture_layer.cc +++ b/cc/texture_layer.cc @@ -4,11 +4,10 @@ #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 { diff --git a/cc/texture_layer_impl.cc b/cc/texture_layer_impl.cc index 37b9843..e8a6874 100644 --- a/cc/texture_layer_impl.cc +++ b/cc/texture_layer_impl.cc @@ -67,7 +67,7 @@ void TextureLayerImpl::dumpLayerProperties(std::string* str, int indent) const LayerImpl::dumpLayerProperties(str, indent); } -void TextureLayerImpl::didLoseOutputSurface() +void TextureLayerImpl::didLoseContext() { m_textureId = 0; m_externalTextureResource = 0; diff --git a/cc/texture_layer_impl.h b/cc/texture_layer_impl.h index f800a2c..c2e4fff 100644 --- a/cc/texture_layer_impl.h +++ b/cc/texture_layer_impl.h @@ -22,7 +22,7 @@ public: virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; virtual void didDraw(ResourceProvider*) OVERRIDE; - virtual void didLoseOutputSurface() OVERRIDE; + virtual void didLoseContext() OVERRIDE; virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc index f2a6214..bff066b 100644 --- a/cc/thread_proxy.cc +++ b/cc/thread_proxy.cc @@ -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::initializeOutputSurface() +bool ThreadProxy::initializeContext() { - TRACE_EVENT0("cc", "ThreadProxy::initializeOutputSurface"); - scoped_ptr<OutputSurface> context = m_layerTreeHost->createOutputSurface(); + TRACE_EVENT0("cc", "ThreadProxy::initializeContext"); + scoped_ptr<GraphicsContext> context = m_layerTreeHost->createContext(); if (!context.get()) return false; - Proxy::implThread()->postTask(base::Bind(&ThreadProxy::initializeOutputSurfaceOnImplThread, base::Unretained(this), base::Passed(context.Pass()))); + Proxy::implThread()->postTask(base::Bind(&ThreadProxy::initializeContextOnImplThread, base::Unretained(this), base::Passed(context.Pass()))); return true; } @@ -210,30 +210,30 @@ bool ThreadProxy::initializeRenderer() return initializeSucceeded; } -bool ThreadProxy::recreateOutputSurface() +bool ThreadProxy::recreateContext() { - TRACE_EVENT0("cc", "ThreadProxy::recreateOutputSurface"); + TRACE_EVENT0("cc", "ThreadProxy::recreateContext"); DCHECK(isMainThread()); - // Try to create the surface. - scoped_ptr<OutputSurface> outputSurface = m_layerTreeHost->createOutputSurface(); - if (!outputSurface.get()) + // Try to create the context. + scoped_ptr<GraphicsContext> context = m_layerTreeHost->createContext(); + if (!context.get()) return false; if (m_layerTreeHost->needsSharedContext()) if (!WebSharedGraphicsContext3D::createCompositorThreadContext()) return false; - // Make a blocking call to recreateOutputSurfaceOnImplThread. The results of that + // Make a blocking call to recreateContextOnImplThread. 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::recreateOutputSurfaceOnImplThread, + Proxy::implThread()->postTask(base::Bind(&ThreadProxy::recreateContextOnImplThread, base::Unretained(this), &completion, - base::Passed(outputSurface.Pass()), + base::Passed(context.Pass()), &recreateSucceeded, &capabilities)); completion.wait(); @@ -263,9 +263,9 @@ const RendererCapabilities& ThreadProxy::rendererCapabilities() const return m_RendererCapabilitiesMainThreadCopy; } -void ThreadProxy::loseOutputSurface() +void ThreadProxy::loseContext() { - Proxy::implThread()->postTask(base::Bind(&ThreadProxy::didLoseOutputSurfaceOnImplThread, base::Unretained(this))); + Proxy::implThread()->postTask(base::Bind(&ThreadProxy::didLoseContextOnImplThread, 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::didLoseOutputSurfaceOnImplThread() +void ThreadProxy::didLoseContextOnImplThread() { DCHECK(isImplThread()); - TRACE_EVENT0("cc", "ThreadProxy::didLoseOutputSurfaceOnImplThread"); - m_schedulerOnImplThread->didLoseOutputSurface(); + TRACE_EVENT0("cc", "ThreadProxy::didLoseContextOnImplThread"); + m_schedulerOnImplThread->didLoseContext(); } void ThreadProxy::onSwapBuffersCompleteOnImplThread() @@ -869,20 +869,20 @@ void ThreadProxy::beginContextRecreation() { TRACE_EVENT0("cc", "ThreadProxy::beginContextRecreation"); DCHECK(isMainThread()); - m_layerTreeHost->didLoseOutputSurface(); - m_outputSurfaceRecreationCallback.Reset(base::Bind(&ThreadProxy::tryToRecreateOutputSurface, base::Unretained(this))); - Proxy::mainThread()->postTask(m_outputSurfaceRecreationCallback.callback()); + m_layerTreeHost->didLoseContext(); + m_contextRecreationCallback.Reset(base::Bind(&ThreadProxy::tryToRecreateContext, base::Unretained(this))); + Proxy::mainThread()->postTask(m_contextRecreationCallback.callback()); } -void ThreadProxy::tryToRecreateOutputSurface() +void ThreadProxy::tryToRecreateContext() { DCHECK(isMainThread()); DCHECK(m_layerTreeHost); - LayerTreeHost::RecreateResult result = m_layerTreeHost->recreateOutputSurface(); + LayerTreeHost::RecreateResult result = m_layerTreeHost->recreateContext(); if (result == LayerTreeHost::RecreateFailedButTryAgain) - Proxy::mainThread()->postTask(m_outputSurfaceRecreationCallback.callback()); + Proxy::mainThread()->postTask(m_contextRecreationCallback.callback()); else if (result == LayerTreeHost::RecreateSucceeded) - m_outputSurfaceRecreationCallback.Cancel(); + m_contextRecreationCallback.Cancel(); } void ThreadProxy::initializeImplOnImplThread(CompletionEvent* completion, InputHandler* handler) @@ -906,19 +906,19 @@ void ThreadProxy::initializeImplOnImplThread(CompletionEvent* completion, InputH completion->signal(); } -void ThreadProxy::initializeOutputSurfaceOnImplThread(scoped_ptr<OutputSurface> outputSurface) +void ThreadProxy::initializeContextOnImplThread(scoped_ptr<GraphicsContext> context) { TRACE_EVENT0("cc", "ThreadProxy::initializeContextOnImplThread"); DCHECK(isImplThread()); - m_outputSurfaceBeforeInitializationOnImplThread = outputSurface.Pass(); + m_contextBeforeInitializationOnImplThread = context.Pass(); } void ThreadProxy::initializeRendererOnImplThread(CompletionEvent* completion, bool* initializeSucceeded, RendererCapabilities* capabilities) { TRACE_EVENT0("cc", "ThreadProxy::initializeRendererOnImplThread"); DCHECK(isImplThread()); - DCHECK(m_outputSurfaceBeforeInitializationOnImplThread.get()); - *initializeSucceeded = m_layerTreeHostImpl->initializeRenderer(m_outputSurfaceBeforeInitializationOnImplThread.Pass()); + DCHECK(m_contextBeforeInitializationOnImplThread.get()); + *initializeSucceeded = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitializationOnImplThread.Pass()); if (*initializeSucceeded) { *capabilities = m_layerTreeHostImpl->rendererCapabilities(); m_schedulerOnImplThread->setSwapBuffersCompleteSupported( @@ -950,15 +950,15 @@ size_t ThreadProxy::maxPartialTextureUpdates() const return ResourceUpdateController::maxPartialTextureUpdates(); } -void ThreadProxy::recreateOutputSurfaceOnImplThread(CompletionEvent* completion, scoped_ptr<OutputSurface> outputSurface, bool* recreateSucceeded, RendererCapabilities* capabilities) +void ThreadProxy::recreateContextOnImplThread(CompletionEvent* completion, scoped_ptr<GraphicsContext> context, bool* recreateSucceeded, RendererCapabilities* capabilities) { - TRACE_EVENT0("cc", "ThreadProxy::recreateOutputSurfaceOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::recreateContextOnImplThread"); DCHECK(isImplThread()); m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); - *recreateSucceeded = m_layerTreeHostImpl->initializeRenderer(outputSurface.Pass()); + *recreateSucceeded = m_layerTreeHostImpl->initializeRenderer(context.Pass()); if (*recreateSucceeded) { *capabilities = m_layerTreeHostImpl->rendererCapabilities(); - m_schedulerOnImplThread->didRecreateOutputSurface(); + m_schedulerOnImplThread->didRecreateContext(); } completion->signal(); } diff --git a/cc/thread_proxy.h b/cc/thread_proxy.h index da4f386..f093b28 100644 --- a/cc/thread_proxy.h +++ b/cc/thread_proxy.h @@ -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 initializeOutputSurface() OVERRIDE; + virtual bool initializeContext() OVERRIDE; virtual void setSurfaceReady() OVERRIDE; virtual void setVisible(bool) OVERRIDE; virtual bool initializeRenderer() OVERRIDE; - virtual bool recreateOutputSurface() OVERRIDE; + virtual bool recreateContext() OVERRIDE; virtual void renderingStats(RenderingStats*) OVERRIDE; virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE; - virtual void loseOutputSurface() OVERRIDE; + virtual void loseContext() 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 didLoseOutputSurfaceOnImplThread() OVERRIDE; + virtual void didLoseContextOnImplThread() 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 tryToRecreateOutputSurface(); + void tryToRecreateContext(); // Called on impl thread struct ReadbackRequest { @@ -115,13 +115,13 @@ private: void initializeImplOnImplThread(CompletionEvent*, InputHandler*); void setSurfaceReadyOnImplThread(); void setVisibleOnImplThread(CompletionEvent*, bool); - void initializeOutputSurfaceOnImplThread(scoped_ptr<OutputSurface>); + void initializeContextOnImplThread(scoped_ptr<GraphicsContext>); void initializeRendererOnImplThread(CompletionEvent*, bool* initializeSucceeded, RendererCapabilities*); void layerTreeHostClosedOnImplThread(CompletionEvent*); void manageTilesOnImplThread(); void setFullRootLayerDamageOnImplThread(); void acquireLayerTexturesForMainThreadOnImplThread(CompletionEvent*); - void recreateOutputSurfaceOnImplThread(CompletionEvent*, scoped_ptr<OutputSurface>, bool* recreateSucceeded, RendererCapabilities*); + void recreateContextOnImplThread(CompletionEvent*, scoped_ptr<GraphicsContext>, 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_outputSurfaceRecreationCallback; + base::CancelableClosure m_contextRecreationCallback; 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<OutputSurface> m_outputSurfaceBeforeInitializationOnImplThread; + scoped_ptr<GraphicsContext> m_contextBeforeInitializationOnImplThread; // Set when the main thread is waiting on a scheduledActionBeginFrame to be issued. CompletionEvent* m_beginFrameCompletionEventOnImplThread; diff --git a/cc/tiled_layer_impl.cc b/cc/tiled_layer_impl.cc index cfd2243..1d224c5 100644 --- a/cc/tiled_layer_impl.cc +++ b/cc/tiled_layer_impl.cc @@ -236,7 +236,7 @@ Region TiledLayerImpl::visibleContentOpaqueRegion() const return m_tiler->opaqueRegionInContentRect(visibleContentRect()); } -void TiledLayerImpl::didLoseOutputSurface() +void TiledLayerImpl::didLoseContext() { m_tiler->reset(); } diff --git a/cc/tiled_layer_impl.h b/cc/tiled_layer_impl.h index 73c757b..c8ff334 100644 --- a/cc/tiled_layer_impl.h +++ b/cc/tiled_layer_impl.h @@ -33,7 +33,7 @@ public: void pushInvalidTile(int, int); virtual Region visibleContentOpaqueRegion() const OVERRIDE; - virtual void didLoseOutputSurface() OVERRIDE; + virtual void didLoseContext() OVERRIDE; protected: explicit TiledLayerImpl(int id); diff --git a/cc/tiled_layer_unittest.cc b/cc/tiled_layer_unittest.cc index 44f1bd9..0c65290 100644 --- a/cc/tiled_layer_unittest.cc +++ b/cc/tiled_layer_unittest.cc @@ -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_outputSurface(createFakeOutputSurface()) + , m_context(WebKit::createFakeGraphicsContext()) , 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_outputSurface.get()); + m_resourceProvider = ResourceProvider::create(m_context.get()); } virtual ~TiledLayerTest() @@ -164,7 +164,7 @@ public: public: Proxy* m_proxy; LayerTreeSettings m_settings; - scoped_ptr<OutputSurface> m_outputSurface; + scoped_ptr<GraphicsContext> m_context; scoped_ptr<ResourceProvider> m_resourceProvider; scoped_ptr<ResourceUpdateQueue> m_queue; RenderingStats m_stats; diff --git a/cc/video_layer_impl.cc b/cc/video_layer_impl.cc index 5555528..918fac6 100644 --- a/cc/video_layer_impl.cc +++ b/cc/video_layer_impl.cc @@ -410,7 +410,7 @@ void VideoLayerImpl::didUpdateMatrix(const float matrix[16]) setNeedsRedraw(); } -void VideoLayerImpl::didLoseOutputSurface() +void VideoLayerImpl::didLoseContext() { freePlaneData(layerTreeHostImpl()->resourceProvider()); } diff --git a/cc/video_layer_impl.h b/cc/video_layer_impl.h index 59a0ca1a9..6a4af37 100644 --- a/cc/video_layer_impl.h +++ b/cc/video_layer_impl.h @@ -50,7 +50,7 @@ public: virtual void didReceiveFrame(); // Callable on impl thread. virtual void didUpdateMatrix(const float*); // Callable on impl thread. - virtual void didLoseOutputSurface() OVERRIDE; + virtual void didLoseContext() OVERRIDE; void setNeedsRedraw(); diff --git a/webkit/compositor_bindings/web_layer_tree_view_impl.cc b/webkit/compositor_bindings/web_layer_tree_view_impl.cc index 1504116..bcd6332 100644 --- a/webkit/compositor_bindings/web_layer_tree_view_impl.cc +++ b/webkit/compositor_bindings/web_layer_tree_view_impl.cc @@ -208,7 +208,7 @@ scoped_ptr<FontAtlas> WebLayerTreeViewImpl::createFontAtlas() void WebLayerTreeViewImpl::loseCompositorContext(int numTimes) { - m_layerTreeHost->loseOutputSurface(numTimes); + m_layerTreeHost->loseContext(numTimes); } void WebLayerTreeViewImpl::willBeginFrame() |