| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/layer_tree_host_impl.h" | 5 #include "cc/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 public LayerTreeHostImplClient { | 60 public LayerTreeHostImplClient { |
| 61 public: | 61 public: |
| 62 LayerTreeHostImplTest() | 62 LayerTreeHostImplTest() |
| 63 : m_proxy(scoped_ptr<Thread>(NULL)) | 63 : m_proxy(scoped_ptr<Thread>(NULL)) |
| 64 , m_alwaysImplThread(&m_proxy) | 64 , m_alwaysImplThread(&m_proxy) |
| 65 , m_alwaysMainThreadBlocked(&m_proxy) | 65 , m_alwaysMainThreadBlocked(&m_proxy) |
| 66 , m_onCanDrawStateChangedCalled(false) | 66 , m_onCanDrawStateChangedCalled(false) |
| 67 , m_hasPendingTree(false) | 67 , m_hasPendingTree(false) |
| 68 , m_didRequestCommit(false) | 68 , m_didRequestCommit(false) |
| 69 , m_didRequestRedraw(false) | 69 , m_didRequestRedraw(false) |
| 70 , m_didSwapUseIncompleteTexture(false) |
| 71 , m_didUploadVisibleHighResolutionTile(false) |
| 70 , m_reduceMemoryResult(true) | 72 , m_reduceMemoryResult(true) |
| 71 { | 73 { |
| 72 media::InitializeMediaLibraryForTesting(); | 74 media::InitializeMediaLibraryForTesting(); |
| 73 } | 75 } |
| 74 | 76 |
| 75 virtual void SetUp() | 77 virtual void SetUp() |
| 76 { | 78 { |
| 77 LayerTreeSettings settings; | 79 LayerTreeSettings settings; |
| 78 settings.minimumOcclusionTrackingSize = gfx::Size(); | 80 settings.minimumOcclusionTrackingSize = gfx::Size(); |
| 79 settings.pageScalePinchZoomEnabled = GetParam(); | 81 settings.pageScalePinchZoomEnabled = GetParam(); |
| 80 | 82 |
| 81 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); | 83 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
| 82 m_hostImpl->initializeRenderer(createOutputSurface()); | 84 m_hostImpl->initializeRenderer(createOutputSurface()); |
| 83 m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); | 85 m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); |
| 84 } | 86 } |
| 85 | 87 |
| 86 virtual void TearDown() | 88 virtual void TearDown() |
| 87 { | 89 { |
| 88 } | 90 } |
| 89 | 91 |
| 90 virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE { } | 92 virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE { } |
| 91 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } | 93 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } |
| 92 virtual void onVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVER
RIDE { } | 94 virtual void onVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVER
RIDE { } |
| 93 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState
ChangedCalled = true; } | 95 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState
ChangedCalled = true; } |
| 94 virtual void onHasPendingTreeStateChanged(bool hasPendingTree) OVERRIDE { m_
hasPendingTree = hasPendingTree; } | 96 virtual void onHasPendingTreeStateChanged(bool hasPendingTree) OVERRIDE { m_
hasPendingTree = hasPendingTree; } |
| 95 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr
ue; } | 97 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr
ue; } |
| 98 virtual void didSwapUseIncompleteTextureOnImplThread() OVERRIDE { m_didSwapU
seIncompleteTexture = true; } |
| 99 virtual void didUploadVisibleHighResolutionTileOnImplTread() OVERRIDE { m_di
dUploadVisibleHighResolutionTile = true; } |
| 96 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr
ue; } | 100 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr
ue; } |
| 97 virtual void setNeedsManageTilesOnImplThread() OVERRIDE { } | 101 virtual void setNeedsManageTilesOnImplThread() OVERRIDE { } |
| 98 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio
nEventsVector>, base::Time wallClockTime) OVERRIDE { } | 102 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio
nEventsVector>, base::Time wallClockTime) OVERRIDE { } |
| 99 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int
priorityCutoff) OVERRIDE { return m_reduceMemoryResult; } | 103 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int
priorityCutoff) OVERRIDE { return m_reduceMemoryResult; } |
| 100 virtual void sendManagedMemoryStats() OVERRIDE { } | 104 virtual void sendManagedMemoryStats() OVERRIDE { } |
| 105 virtual bool isInsideDraw() OVERRIDE { return false; } |
| 101 | 106 |
| 102 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult =
reduceMemoryResult; } | 107 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult =
reduceMemoryResult; } |
| 103 | 108 |
| 104 void createLayerTreeHost(bool partialSwap, scoped_ptr<OutputSurface> outputS
urface) | 109 void createLayerTreeHost(bool partialSwap, scoped_ptr<OutputSurface> outputS
urface) |
| 105 { | 110 { |
| 106 LayerTreeSettings settings; | 111 LayerTreeSettings settings; |
| 107 settings.minimumOcclusionTrackingSize = gfx::Size(); | 112 settings.minimumOcclusionTrackingSize = gfx::Size(); |
| 108 settings.partialSwapEnabled = partialSwap; | 113 settings.partialSwapEnabled = partialSwap; |
| 109 | 114 |
| 110 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); | 115 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 221 |
| 217 FakeProxy m_proxy; | 222 FakeProxy m_proxy; |
| 218 DebugScopedSetImplThread m_alwaysImplThread; | 223 DebugScopedSetImplThread m_alwaysImplThread; |
| 219 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; | 224 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; |
| 220 | 225 |
| 221 scoped_ptr<LayerTreeHostImpl> m_hostImpl; | 226 scoped_ptr<LayerTreeHostImpl> m_hostImpl; |
| 222 bool m_onCanDrawStateChangedCalled; | 227 bool m_onCanDrawStateChangedCalled; |
| 223 bool m_hasPendingTree; | 228 bool m_hasPendingTree; |
| 224 bool m_didRequestCommit; | 229 bool m_didRequestCommit; |
| 225 bool m_didRequestRedraw; | 230 bool m_didRequestRedraw; |
| 231 bool m_didSwapUseIncompleteTexture; |
| 232 bool m_didUploadVisibleHighResolutionTile; |
| 226 bool m_reduceMemoryResult; | 233 bool m_reduceMemoryResult; |
| 227 }; | 234 }; |
| 228 | 235 |
| 229 class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D
{ | 236 class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D
{ |
| 230 public: | 237 public: |
| 231 virtual bool makeContextCurrent() { return false; } | 238 virtual bool makeContextCurrent() { return false; } |
| 232 }; | 239 }; |
| 233 | 240 |
| 234 TEST_P(LayerTreeHostImplTest, notifyIfCanDrawChanged) | 241 TEST_P(LayerTreeHostImplTest, notifyIfCanDrawChanged) |
| 235 { | 242 { |
| (...skipping 4448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4684 m_hostImpl->didDrawAllLayers(frame); | 4691 m_hostImpl->didDrawAllLayers(frame); |
| 4685 } | 4692 } |
| 4686 } | 4693 } |
| 4687 | 4694 |
| 4688 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4695 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
| 4689 LayerTreeHostImplTest, | 4696 LayerTreeHostImplTest, |
| 4690 ::testing::Values(false, true)); | 4697 ::testing::Values(false, true)); |
| 4691 | 4698 |
| 4692 } // namespace | 4699 } // namespace |
| 4693 } // namespace cc | 4700 } // namespace cc |
| OLD | NEW |