| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "cc/gl_renderer.h" | 6 #include "cc/gl_renderer.h" |
| 7 | 7 |
| 8 #include "cc/draw_quad.h" | 8 #include "cc/draw_quad.h" |
| 9 #include "cc/prioritized_texture_manager.h" | 9 #include "cc/prioritized_texture_manager.h" |
| 10 #include "cc/resource_provider.h" | 10 #include "cc/resource_provider.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 class FakeRendererClient : public RendererClient { | 56 class FakeRendererClient : public RendererClient { |
| 57 public: | 57 public: |
| 58 FakeRendererClient() | 58 FakeRendererClient() |
| 59 : m_setFullRootLayerDamageCount(0) | 59 : m_setFullRootLayerDamageCount(0) |
| 60 , m_lastCallWasSetVisibility(0) | 60 , m_lastCallWasSetVisibility(0) |
| 61 , m_rootLayer(LayerImpl::create(1)) | 61 , m_rootLayer(LayerImpl::create(1)) |
| 62 , m_memoryAllocationLimitBytes(PrioritizedTextureManager::defaultMemoryA
llocationLimit()) | 62 , m_memoryAllocationLimitBytes(PrioritizedTextureManager::defaultMemoryA
llocationLimit()) |
| 63 { | 63 { |
| 64 m_rootLayer->createRenderSurface(); | 64 m_rootLayer->createRenderSurface(); |
| 65 RenderPass::Id renderPassId = m_rootLayer->renderSurface()->renderPassId
(); | 65 RenderPass::Id renderPassId = m_rootLayer->renderSurface()->renderPassId
(); |
| 66 scoped_ptr<RenderPass> rootRenderPass = RenderPass::create(renderPassId,
IntRect(), WebTransformationMatrix()); | 66 scoped_ptr<RenderPass> rootRenderPass = RenderPass::create(renderPassId,
gfx::Rect(), WebTransformationMatrix()); |
| 67 m_renderPassesInDrawOrder.push_back(rootRenderPass.get()); | 67 m_renderPassesInDrawOrder.push_back(rootRenderPass.get()); |
| 68 m_renderPasses.set(renderPassId, rootRenderPass.Pass()); | 68 m_renderPasses.set(renderPassId, rootRenderPass.Pass()); |
| 69 } | 69 } |
| 70 | 70 |
| 71 // RendererClient methods. | 71 // RendererClient methods. |
| 72 virtual const IntSize& deviceViewportSize() const OVERRIDE { static IntSize
fakeSize(1, 1); return fakeSize; } | 72 virtual const gfx::Size& deviceViewportSize() const OVERRIDE { static gfx::S
ize fakeSize(1, 1); return fakeSize; } |
| 73 virtual const LayerTreeSettings& settings() const OVERRIDE { static LayerTre
eSettings fakeSettings; return fakeSettings; } | 73 virtual const LayerTreeSettings& settings() const OVERRIDE { static LayerTre
eSettings fakeSettings; return fakeSettings; } |
| 74 virtual void didLoseContext() OVERRIDE { } | 74 virtual void didLoseContext() OVERRIDE { } |
| 75 virtual void onSwapBuffersComplete() OVERRIDE { } | 75 virtual void onSwapBuffersComplete() OVERRIDE { } |
| 76 virtual void setFullRootLayerDamage() OVERRIDE { m_setFullRootLayerDamageCou
nt++; } | 76 virtual void setFullRootLayerDamage() OVERRIDE { m_setFullRootLayerDamageCou
nt++; } |
| 77 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERR
IDE { m_memoryAllocationLimitBytes = policy.bytesLimitWhenVisible; } | 77 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERR
IDE { m_memoryAllocationLimitBytes = policy.bytesLimitWhenVisible; } |
| 78 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) O
VERRIDE { if (m_lastCallWasSetVisibility) *m_lastCallWasSetVisibility = false; } | 78 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) O
VERRIDE { if (m_lastCallWasSetVisibility) *m_lastCallWasSetVisibility = false; } |
| 79 | 79 |
| 80 // Methods added for test. | 80 // Methods added for test. |
| 81 int setFullRootLayerDamageCount() const { return m_setFullRootLayerDamageCou
nt; } | 81 int setFullRootLayerDamageCount() const { return m_setFullRootLayerDamageCou
nt; } |
| 82 void setLastCallWasSetVisibilityPointer(bool* lastCallWasSetVisibility) { m_
lastCallWasSetVisibility = lastCallWasSetVisibility; } | 82 void setLastCallWasSetVisibilityPointer(bool* lastCallWasSetVisibility) { m_
lastCallWasSetVisibility = lastCallWasSetVisibility; } |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 // process, after glFlush is called, and after the RendererClient's enforceM
anagedMemoryPolicy | 476 // process, after glFlush is called, and after the RendererClient's enforceM
anagedMemoryPolicy |
| 477 // is called. Plumb this tracking between both the RenderClient and the Cont
ext by giving | 477 // is called. Plumb this tracking between both the RenderClient and the Cont
ext by giving |
| 478 // them both a pointer to a variable on the stack. | 478 // them both a pointer to a variable on the stack. |
| 479 context->setLastCallWasSetVisibilityPointer(&lastCallWasSetVisiblity); | 479 context->setLastCallWasSetVisibilityPointer(&lastCallWasSetVisiblity); |
| 480 mockClient.setLastCallWasSetVisibilityPointer(&lastCallWasSetVisiblity); | 480 mockClient.setLastCallWasSetVisibilityPointer(&lastCallWasSetVisiblity); |
| 481 renderer.setVisible(true); | 481 renderer.setVisible(true); |
| 482 renderer.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPa
sses()); | 482 renderer.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPa
sses()); |
| 483 renderer.setVisible(false); | 483 renderer.setVisible(false); |
| 484 EXPECT_TRUE(lastCallWasSetVisiblity); | 484 EXPECT_TRUE(lastCallWasSetVisiblity); |
| 485 } | 485 } |
| OLD | NEW |