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

Side by Side Diff: cc/layer_tree_host_impl_unittest.cc

Issue 12217105: cc: Check for completed raster tasks at interval. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Post task to impl thread when worker pool becomes idle. Created 7 years, 10 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 | Annotate | Revision Log
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_didUploadVisibleHighResolutionTile(false) 70 , m_didUploadVisibleHighResolutionTile(false)
71 , m_didDetectIdleRaster(false)
71 , m_reduceMemoryResult(true) 72 , m_reduceMemoryResult(true)
72 { 73 {
73 media::InitializeMediaLibraryForTesting(); 74 media::InitializeMediaLibraryForTesting();
74 } 75 }
75 76
76 virtual void SetUp() 77 virtual void SetUp()
77 { 78 {
78 LayerTreeSettings settings; 79 LayerTreeSettings settings;
79 settings.minimumOcclusionTrackingSize = gfx::Size(); 80 settings.minimumOcclusionTrackingSize = gfx::Size();
80 settings.pageScalePinchZoomEnabled = GetParam(); 81 settings.pageScalePinchZoomEnabled = GetParam();
81 82
82 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); 83 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
83 m_hostImpl->initializeRenderer(createOutputSurface()); 84 m_hostImpl->initializeRenderer(createOutputSurface());
84 m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); 85 m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
85 } 86 }
86 87
87 virtual void TearDown() 88 virtual void TearDown()
88 { 89 {
89 } 90 }
90 91
91 virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE { } 92 virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE { }
92 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } 93 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { }
93 virtual void onVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVER RIDE { } 94 virtual void onVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVER RIDE { }
94 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState ChangedCalled = true; } 95 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState ChangedCalled = true; }
95 virtual void onHasPendingTreeStateChanged(bool hasPendingTree) OVERRIDE { m_ hasPendingTree = hasPendingTree; } 96 virtual void onHasPendingTreeStateChanged(bool hasPendingTree) OVERRIDE { m_ hasPendingTree = hasPendingTree; }
96 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr ue; } 97 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr ue; }
97 virtual void didUploadVisibleHighResolutionTileOnImplThread() OVERRIDE { m_d idUploadVisibleHighResolutionTile = true; } 98 virtual void didUploadVisibleHighResolutionTileOnImplThread() OVERRIDE { m_d idUploadVisibleHighResolutionTile = true; }
99 virtual void didDetectIdleRasterOnImplThread() OVERRIDE { m_didDetectIdleRas ter = true; }
98 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr ue; } 100 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr ue; }
99 virtual void setNeedsManageTilesOnImplThread() OVERRIDE { } 101 virtual void setNeedsManageTilesOnImplThread() OVERRIDE { }
102 virtual void setNeedsCheckForCompletedRasterTasksOnImplThread() OVERRIDE { }
100 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio nEventsVector>, base::Time wallClockTime) OVERRIDE { } 103 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio nEventsVector>, base::Time wallClockTime) OVERRIDE { }
101 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) OVERRIDE { return m_reduceMemoryResult; } 104 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) OVERRIDE { return m_reduceMemoryResult; }
102 virtual void reduceWastedContentsTextureMemoryOnImplThread() OVERRIDE { } 105 virtual void reduceWastedContentsTextureMemoryOnImplThread() OVERRIDE { }
103 virtual void sendManagedMemoryStats() OVERRIDE { } 106 virtual void sendManagedMemoryStats() OVERRIDE { }
104 virtual bool isInsideDraw() OVERRIDE { return false; } 107 virtual bool isInsideDraw() OVERRIDE { return false; }
105 virtual void renewTreePriority() OVERRIDE { } 108 virtual void renewTreePriority() OVERRIDE { }
106 109
107 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult = reduceMemoryResult; } 110 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult = reduceMemoryResult; }
108 111
109 void createLayerTreeHost(bool partialSwap, scoped_ptr<OutputSurface> outputS urface) 112 void createLayerTreeHost(bool partialSwap, scoped_ptr<OutputSurface> outputS urface)
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 FakeProxy m_proxy; 225 FakeProxy m_proxy;
223 DebugScopedSetImplThread m_alwaysImplThread; 226 DebugScopedSetImplThread m_alwaysImplThread;
224 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; 227 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked;
225 228
226 scoped_ptr<LayerTreeHostImpl> m_hostImpl; 229 scoped_ptr<LayerTreeHostImpl> m_hostImpl;
227 bool m_onCanDrawStateChangedCalled; 230 bool m_onCanDrawStateChangedCalled;
228 bool m_hasPendingTree; 231 bool m_hasPendingTree;
229 bool m_didRequestCommit; 232 bool m_didRequestCommit;
230 bool m_didRequestRedraw; 233 bool m_didRequestRedraw;
231 bool m_didUploadVisibleHighResolutionTile; 234 bool m_didUploadVisibleHighResolutionTile;
235 bool m_didDetectIdleRaster;
232 bool m_reduceMemoryResult; 236 bool m_reduceMemoryResult;
233 }; 237 };
234 238
235 class TestWebGraphicsContext3DMakeCurrentFails : public TestWebGraphicsContext3D { 239 class TestWebGraphicsContext3DMakeCurrentFails : public TestWebGraphicsContext3D {
236 public: 240 public:
237 virtual bool makeContextCurrent() { return false; } 241 virtual bool makeContextCurrent() { return false; }
238 }; 242 };
239 243
240 TEST_P(LayerTreeHostImplTest, notifyIfCanDrawChanged) 244 TEST_P(LayerTreeHostImplTest, notifyIfCanDrawChanged)
241 { 245 {
(...skipping 4092 matching lines...) Expand 10 before | Expand all | Expand 10 after
4334 m_hostImpl->didDrawAllLayers(frame); 4338 m_hostImpl->didDrawAllLayers(frame);
4335 } 4339 }
4336 } 4340 }
4337 4341
4338 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, 4342 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests,
4339 LayerTreeHostImplTest, 4343 LayerTreeHostImplTest,
4340 ::testing::Values(false, true)); 4344 ::testing::Values(false, true));
4341 4345
4342 } // namespace 4346 } // namespace
4343 } // namespace cc 4347 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/raster_worker_pool.h » ('j') | cc/worker_pool.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698