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

Side by Side Diff: cc/layer_tree_host_unittest.cc

Issue 11644036: cc: Don't let invalidations that we're going to handle immediately cause an extra commit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ignoreSetNeedsCommit Created 8 years 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
« no previous file with comments | « cc/layer.cc ('k') | cc/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.h" 5 #include "cc/layer_tree_host.h"
6 6
7 #include "base/synchronization/lock.h" 7 #include "base/synchronization/lock.h"
8 #include "cc/content_layer.h" 8 #include "cc/content_layer.h"
9 #include "cc/content_layer_client.h" 9 #include "cc/content_layer_client.h"
10 #include "cc/layer_impl.h" 10 #include "cc/layer_impl.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 private: 271 private:
272 int m_numCommits; 272 int m_numCommits;
273 int m_numDraws; 273 int m_numDraws;
274 }; 274 };
275 275
276 TEST_F(LayerTreeHostTestSetNeedsRedraw, runMultiThread) 276 TEST_F(LayerTreeHostTestSetNeedsRedraw, runMultiThread)
277 { 277 {
278 runTest(true); 278 runTest(true);
279 } 279 }
280 280
281 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest {
282 public:
283 LayerTreeHostTestNoExtraCommitFromInvalidate()
284 : m_rootLayer(ContentLayer::create(&m_client))
285 {
286 }
287
288 virtual void beginTest() OVERRIDE
289 {
290 m_rootLayer->setAutomaticallyComputeRasterScale(false);
291 m_rootLayer->setIsDrawable(true);
292 m_rootLayer->setBounds(gfx::Size(1, 1));
293 m_layerTreeHost->setRootLayer(m_rootLayer);
294 postSetNeedsCommitToMainThread();
295 }
296
297 virtual void didCommit() OVERRIDE
298 {
299 switch (m_layerTreeHost->commitNumber()) {
300 case 1:
301 // Changing the content bounds will cause a single commit!
302 m_rootLayer->setRasterScale(4.0f);
303 break;
304 default:
305 // No extra commits.
306 EXPECT_EQ(2, m_layerTreeHost->commitNumber());
307 endTest();
308 }
309 }
310
311 virtual void afterTest() OVERRIDE
312 {
313 }
314
315 private:
316 FakeContentLayerClient m_client;
317 scoped_refptr<ContentLayer> m_rootLayer;
318 };
319
320 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate)
321
281 class LayerTreeHostTestCompositeAndReadback : public LayerTreeHostTest { 322 class LayerTreeHostTestCompositeAndReadback : public LayerTreeHostTest {
282 public: 323 public:
283 LayerTreeHostTestCompositeAndReadback() 324 LayerTreeHostTestCompositeAndReadback()
284 : m_numCommits(0) 325 : m_numCommits(0)
285 { 326 {
286 } 327 }
287 328
288 virtual void beginTest() OVERRIDE 329 virtual void beginTest() OVERRIDE
289 { 330 {
290 postSetNeedsCommitToMainThread(); 331 postSetNeedsCommitToMainThread();
(...skipping 2668 matching lines...) Expand 10 before | Expand all | Expand 10 after
2959 LayerTreeSettings settings; 3000 LayerTreeSettings settings;
2960 settings.maxPartialTextureUpdates = 4; 3001 settings.maxPartialTextureUpdates = 4;
2961 3002
2962 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>()); 3003 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>());
2963 EXPECT_TRUE(host->initializeRendererIfNeeded()); 3004 EXPECT_TRUE(host->initializeRendererIfNeeded());
2964 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates); 3005 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates);
2965 } 3006 }
2966 3007
2967 } // namespace 3008 } // namespace
2968 } // namespace cc 3009 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer.cc ('k') | cc/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698