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

Side by Side Diff: cc/trees/damage_tracker_unittest.cc

Issue 1823833002: cc : Update render surfaces using LayerListIterator instead of treewalk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ASAN unittest crashes Created 4 years, 9 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
« no previous file with comments | « cc/test/layer_tree_host_common_test.cc ('k') | cc/trees/draw_property_utils.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/trees/damage_tracker.h" 5 #include "cc/trees/damage_tracker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
10 #include "cc/layers/layer_impl.h" 10 #include "cc/layers/layer_impl.h"
(...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 root->render_surface()->damage_tracker()->current_damage_rect(); 1458 root->render_surface()->damage_tracker()->current_damage_rect();
1459 EXPECT_EQ(gfx::Rect(30, 31, 14, 15).ToString(), root_damage_rect.ToString()); 1459 EXPECT_EQ(gfx::Rect(30, 31, 14, 15).ToString(), root_damage_rect.ToString());
1460 } 1460 }
1461 1461
1462 TEST_F(DamageTrackerTest, VerifyDamageForEmptyLayerList) { 1462 TEST_F(DamageTrackerTest, VerifyDamageForEmptyLayerList) {
1463 // Though it should never happen, its a good idea to verify that the damage 1463 // Though it should never happen, its a good idea to verify that the damage
1464 // tracker does not crash when it receives an empty layer_list. 1464 // tracker does not crash when it receives an empty layer_list.
1465 1465
1466 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_.active_tree(), 1); 1466 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_.active_tree(), 1);
1467 root->SetForceRenderSurface(true); 1467 root->SetForceRenderSurface(true);
1468 root->layer_tree_impl()->property_trees()->needs_rebuild = true; 1468 host_impl_.active_tree()->SetRootLayer(std::move(root));
1469 EmulateDrawingOneFrame(root.get()); 1469 LayerImpl* root_ptr = host_impl_.active_tree()->root_layer();
1470 root->draw_properties().render_target = root.get(); 1470 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true;
1471 EmulateDrawingOneFrame(root_ptr);
1472 root_ptr->draw_properties().render_target = root_ptr;
1471 1473
1472 ASSERT_EQ(root.get(), root->render_target()); 1474 ASSERT_EQ(root_ptr, root_ptr->render_target());
1473 RenderSurfaceImpl* target_surface = root->render_surface(); 1475 RenderSurfaceImpl* target_surface = root_ptr->render_surface();
1474 1476
1475 LayerImplList empty_list; 1477 LayerImplList empty_list;
1476 target_surface->damage_tracker()->UpdateDamageTrackingState( 1478 target_surface->damage_tracker()->UpdateDamageTrackingState(
1477 empty_list, 1479 empty_list,
1478 target_surface->OwningLayerId(), 1480 target_surface->OwningLayerId(),
1479 false, 1481 false,
1480 gfx::Rect(), 1482 gfx::Rect(),
1481 NULL, 1483 NULL,
1482 FilterOperations()); 1484 FilterOperations());
1483 1485
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 gfx::Rect root_damage_rect = 1557 gfx::Rect root_damage_rect =
1556 root->render_surface()->damage_tracker()->current_damage_rect(); 1558 root->render_surface()->damage_tracker()->current_damage_rect();
1557 gfx::Rect damage_we_care_about = gfx::Rect(i, i); 1559 gfx::Rect damage_we_care_about = gfx::Rect(i, i);
1558 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); 1560 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right());
1559 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); 1561 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom());
1560 } 1562 }
1561 } 1563 }
1562 1564
1563 } // namespace 1565 } // namespace
1564 } // namespace cc 1566 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_host_common_test.cc ('k') | cc/trees/draw_property_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698