Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11879012: cc: Redraw incomplete frames when new texture uploads finish (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@decouple_draw3b
Patch Set: rename some method, only check for incomplete frames when impl-side painting Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 { }
101 105
102 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult = reduceMemoryResult; } 106 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult = reduceMemoryResult; }
103 107
104 void createLayerTreeHost(bool partialSwap, scoped_ptr<OutputSurface> outputS urface) 108 void createLayerTreeHost(bool partialSwap, scoped_ptr<OutputSurface> outputS urface)
105 { 109 {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 220
217 FakeProxy m_proxy; 221 FakeProxy m_proxy;
218 DebugScopedSetImplThread m_alwaysImplThread; 222 DebugScopedSetImplThread m_alwaysImplThread;
219 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; 223 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked;
220 224
221 scoped_ptr<LayerTreeHostImpl> m_hostImpl; 225 scoped_ptr<LayerTreeHostImpl> m_hostImpl;
222 bool m_onCanDrawStateChangedCalled; 226 bool m_onCanDrawStateChangedCalled;
223 bool m_hasPendingTree; 227 bool m_hasPendingTree;
224 bool m_didRequestCommit; 228 bool m_didRequestCommit;
225 bool m_didRequestRedraw; 229 bool m_didRequestRedraw;
230 bool m_didSwapUseIncompleteTexture;
231 bool m_didUploadVisibleHighResolutionTile;
226 bool m_reduceMemoryResult; 232 bool m_reduceMemoryResult;
227 }; 233 };
228 234
229 class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D { 235 class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D {
230 public: 236 public:
231 virtual bool makeContextCurrent() { return false; } 237 virtual bool makeContextCurrent() { return false; }
232 }; 238 };
233 239
234 TEST_P(LayerTreeHostImplTest, notifyIfCanDrawChanged) 240 TEST_P(LayerTreeHostImplTest, notifyIfCanDrawChanged)
235 { 241 {
(...skipping 4323 matching lines...) Expand 10 before | Expand all | Expand 10 after
4559 m_hostImpl->didDrawAllLayers(frame); 4565 m_hostImpl->didDrawAllLayers(frame);
4560 } 4566 }
4561 } 4567 }
4562 4568
4563 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, 4569 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests,
4564 LayerTreeHostImplTest, 4570 LayerTreeHostImplTest,
4565 ::testing::Values(false, true)); 4571 ::testing::Values(false, true));
4566 4572
4567 } // namespace 4573 } // namespace
4568 } // namespace cc 4574 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698