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

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

Issue 1697613002: cc :: Move tracking of layer_property_changed to main thread (2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_impl_unittest.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/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 3241 matching lines...) Expand 10 before | Expand all | Expand 10 after
3252 host_impl_->DrawLayers(&frame); 3252 host_impl_->DrawLayers(&frame);
3253 host_impl_->DidDrawAllLayers(frame); 3253 host_impl_->DidDrawAllLayers(frame);
3254 3254
3255 EXPECT_FALSE(layer->will_draw_called()); 3255 EXPECT_FALSE(layer->will_draw_called());
3256 EXPECT_FALSE(layer->did_draw_called()); 3256 EXPECT_FALSE(layer->did_draw_called());
3257 3257
3258 EXPECT_TRUE(layer->visible_layer_rect().IsEmpty()); 3258 EXPECT_TRUE(layer->visible_layer_rect().IsEmpty());
3259 3259
3260 // Ensure visible_layer_rect for layer is not empty 3260 // Ensure visible_layer_rect for layer is not empty
3261 layer->SetPosition(gfx::PointF()); 3261 layer->SetPosition(gfx::PointF());
3262 layer->NoteLayerPropertyChanged();
3262 3263
3263 EXPECT_FALSE(layer->will_draw_called()); 3264 EXPECT_FALSE(layer->will_draw_called());
3264 EXPECT_FALSE(layer->did_draw_called()); 3265 EXPECT_FALSE(layer->did_draw_called());
3265 3266
3266 SetNeedsRebuildPropertyTrees(); 3267 SetNeedsRebuildPropertyTrees();
3267 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 3268 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
3268 host_impl_->DrawLayers(&frame); 3269 host_impl_->DrawLayers(&frame);
3269 host_impl_->DidDrawAllLayers(frame); 3270 host_impl_->DidDrawAllLayers(frame);
3270 3271
3271 EXPECT_TRUE(layer->will_draw_called()); 3272 EXPECT_TRUE(layer->will_draw_called());
(...skipping 3306 matching lines...) Expand 10 before | Expand all | Expand 10 after
6578 gfx::Rect expected_swap_rect(0, 0, 500, 500); 6579 gfx::Rect expected_swap_rect(0, 0, 500, 500);
6579 EXPECT_EQ(expected_swap_rect.ToString(), 6580 EXPECT_EQ(expected_swap_rect.ToString(),
6580 fake_output_surface->last_swap_rect().ToString()); 6581 fake_output_surface->last_swap_rect().ToString());
6581 6582
6582 // Second frame, only the damaged area should get swapped. Damage should be 6583 // Second frame, only the damaged area should get swapped. Damage should be
6583 // the union of old and new child rects. 6584 // the union of old and new child rects.
6584 // expected damage rect: gfx::Rect(26, 28); 6585 // expected damage rect: gfx::Rect(26, 28);
6585 // expected swap rect: vertically flipped, with origin at bottom left corner. 6586 // expected swap rect: vertically flipped, with origin at bottom left corner.
6586 layer_tree_host_impl->active_tree()->root_layer()->children()[0]->SetPosition( 6587 layer_tree_host_impl->active_tree()->root_layer()->children()[0]->SetPosition(
6587 gfx::PointF()); 6588 gfx::PointF());
6589 layer_tree_host_impl->active_tree()
6590 ->root_layer()
6591 ->children()[0]
6592 ->NoteLayerPropertyChanged();
6588 layer_tree_host_impl->active_tree()->property_trees()->needs_rebuild = true; 6593 layer_tree_host_impl->active_tree()->property_trees()->needs_rebuild = true;
6589 layer_tree_host_impl->active_tree()->BuildPropertyTreesForTesting(); 6594 layer_tree_host_impl->active_tree()->BuildPropertyTreesForTesting();
6590 EXPECT_EQ(DRAW_SUCCESS, layer_tree_host_impl->PrepareToDraw(&frame)); 6595 EXPECT_EQ(DRAW_SUCCESS, layer_tree_host_impl->PrepareToDraw(&frame));
6591 layer_tree_host_impl->DrawLayers(&frame); 6596 layer_tree_host_impl->DrawLayers(&frame);
6592 host_impl_->DidDrawAllLayers(frame); 6597 host_impl_->DidDrawAllLayers(frame);
6593 layer_tree_host_impl->SwapBuffers(frame); 6598 layer_tree_host_impl->SwapBuffers(frame);
6594 6599
6595 // Make sure that partial swap is constrained to the viewport dimensions 6600 // Make sure that partial swap is constrained to the viewport dimensions
6596 // expected damage rect: gfx::Rect(500, 500); 6601 // expected damage rect: gfx::Rect(500, 500);
6597 // expected swap rect: flipped damage rect, but also clamped to viewport 6602 // expected swap rect: flipped damage rect, but also clamped to viewport
(...skipping 3518 matching lines...) Expand 10 before | Expand all | Expand 10 after
10116 // There should not be any jitter measured till we hit the fixed point hits 10121 // There should not be any jitter measured till we hit the fixed point hits
10117 // threshold. 10122 // threshold.
10118 float expected_jitter = 10123 float expected_jitter =
10119 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; 10124 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0;
10120 EXPECT_EQ(jitter, expected_jitter); 10125 EXPECT_EQ(jitter, expected_jitter);
10121 } 10126 }
10122 } 10127 }
10123 10128
10124 } // namespace 10129 } // namespace
10125 } // namespace cc 10130 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698