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_didRequestRedrawOnVisibleTextureUpload(false) |
70 , m_reduceMemoryResult(true) | 71 , m_reduceMemoryResult(true) |
71 { | 72 { |
72 media::InitializeMediaLibraryForTesting(); | 73 media::InitializeMediaLibraryForTesting(); |
73 } | 74 } |
74 | 75 |
75 virtual void SetUp() | 76 virtual void SetUp() |
76 { | 77 { |
77 LayerTreeSettings settings; | 78 LayerTreeSettings settings; |
78 settings.minimumOcclusionTrackingSize = gfx::Size(); | 79 settings.minimumOcclusionTrackingSize = gfx::Size(); |
79 settings.pageScalePinchZoomEnabled = GetParam(); | 80 settings.pageScalePinchZoomEnabled = GetParam(); |
80 | 81 |
81 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); | 82 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
82 m_hostImpl->initializeRenderer(createOutputSurface()); | 83 m_hostImpl->initializeRenderer(createOutputSurface()); |
83 m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); | 84 m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); |
84 } | 85 } |
85 | 86 |
86 virtual void TearDown() | 87 virtual void TearDown() |
87 { | 88 { |
88 } | 89 } |
89 | 90 |
90 virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE { } | 91 virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE { } |
91 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } | 92 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } |
92 virtual void onVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVER
RIDE { } | 93 virtual void onVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVER
RIDE { } |
93 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState
ChangedCalled = true; } | 94 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState
ChangedCalled = true; } |
94 virtual void onHasPendingTreeStateChanged(bool hasPendingTree) OVERRIDE { m_
hasPendingTree = hasPendingTree; } | 95 virtual void onHasPendingTreeStateChanged(bool hasPendingTree) OVERRIDE { m_
hasPendingTree = hasPendingTree; } |
95 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr
ue; } | 96 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr
ue; } |
| 97 virtual void setNeedsRedrawOnVisibleTextureUploadOnImplThread() OVERRIDE { m
_didRequestRedrawOnVisibleTextureUpload = true; } |
96 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr
ue; } | 98 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr
ue; } |
97 virtual void setNeedsManageTilesOnImplThread() OVERRIDE { } | 99 virtual void setNeedsManageTilesOnImplThread() OVERRIDE { } |
98 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio
nEventsVector>, base::Time wallClockTime) OVERRIDE { } | 100 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio
nEventsVector>, base::Time wallClockTime) OVERRIDE { } |
99 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int
priorityCutoff) OVERRIDE { return m_reduceMemoryResult; } | 101 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int
priorityCutoff) OVERRIDE { return m_reduceMemoryResult; } |
100 virtual void sendManagedMemoryStats() OVERRIDE { } | 102 virtual void sendManagedMemoryStats() OVERRIDE { } |
101 | 103 |
102 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult =
reduceMemoryResult; } | 104 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult =
reduceMemoryResult; } |
103 | 105 |
104 void createLayerTreeHost(bool partialSwap, scoped_ptr<OutputSurface> outputS
urface) | 106 void createLayerTreeHost(bool partialSwap, scoped_ptr<OutputSurface> outputS
urface) |
105 { | 107 { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 218 |
217 FakeProxy m_proxy; | 219 FakeProxy m_proxy; |
218 DebugScopedSetImplThread m_alwaysImplThread; | 220 DebugScopedSetImplThread m_alwaysImplThread; |
219 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; | 221 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; |
220 | 222 |
221 scoped_ptr<LayerTreeHostImpl> m_hostImpl; | 223 scoped_ptr<LayerTreeHostImpl> m_hostImpl; |
222 bool m_onCanDrawStateChangedCalled; | 224 bool m_onCanDrawStateChangedCalled; |
223 bool m_hasPendingTree; | 225 bool m_hasPendingTree; |
224 bool m_didRequestCommit; | 226 bool m_didRequestCommit; |
225 bool m_didRequestRedraw; | 227 bool m_didRequestRedraw; |
| 228 bool m_didRequestRedrawOnVisibleTextureUpload; |
226 bool m_reduceMemoryResult; | 229 bool m_reduceMemoryResult; |
227 }; | 230 }; |
228 | 231 |
229 class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D
{ | 232 class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D
{ |
230 public: | 233 public: |
231 virtual bool makeContextCurrent() { return false; } | 234 virtual bool makeContextCurrent() { return false; } |
232 }; | 235 }; |
233 | 236 |
234 TEST_P(LayerTreeHostImplTest, notifyIfCanDrawChanged) | 237 TEST_P(LayerTreeHostImplTest, notifyIfCanDrawChanged) |
235 { | 238 { |
(...skipping 4323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4559 m_hostImpl->didDrawAllLayers(frame); | 4562 m_hostImpl->didDrawAllLayers(frame); |
4560 } | 4563 } |
4561 } | 4564 } |
4562 | 4565 |
4563 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4566 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
4564 LayerTreeHostImplTest, | 4567 LayerTreeHostImplTest, |
4565 ::testing::Values(false, true)); | 4568 ::testing::Values(false, true)); |
4566 | 4569 |
4567 } // namespace | 4570 } // namespace |
4568 } // namespace cc | 4571 } // namespace cc |
OLD | NEW |