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

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 23171014: Fix UpdateTilePriorities viewport in Android WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to 221292 Created 7 years, 3 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/layers/picture_layer_impl.cc ('k') | cc/output/delegating_renderer_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "cc/debug/test_web_graphics_context_3d.h" 9 #include "cc/debug/test_web_graphics_context_3d.h"
10 #include "cc/layers/append_quads_data.h" 10 #include "cc/layers/append_quads_data.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 EXPECT_EQ(pending_layer_->tilings()->num_tilings(), 235 EXPECT_EQ(pending_layer_->tilings()->num_tilings(),
236 active_layer_->tilings()->num_tilings()); 236 active_layer_->tilings()->num_tilings());
237 237
238 const PictureLayerTilingSet* tilings = pending_layer_->tilings(); 238 const PictureLayerTilingSet* tilings = pending_layer_->tilings();
239 EXPECT_GT(tilings->num_tilings(), 0u); 239 EXPECT_GT(tilings->num_tilings(), 0u);
240 for (size_t i = 0; i < tilings->num_tilings(); ++i) 240 for (size_t i = 0; i < tilings->num_tilings(); ++i)
241 VerifyAllTilesExistAndHavePile(tilings->tiling_at(i), active_pile.get()); 241 VerifyAllTilesExistAndHavePile(tilings->tiling_at(i), active_pile.get());
242 } 242 }
243 243
244 TEST_F(PictureLayerImplTest, SuppressUpdateTilePriorities) {
245 base::TimeTicks time_ticks;
246 host_impl_.SetCurrentFrameTimeTicks(time_ticks);
247
248 gfx::Size tile_size(100, 100);
249 gfx::Size layer_bounds(400, 400);
250
251 scoped_refptr<FakePicturePileImpl> pending_pile =
252 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
253 scoped_refptr<FakePicturePileImpl> active_pile =
254 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
255
256 SetupTrees(pending_pile, active_pile);
257
258 Region invalidation;
259 AddDefaultTilingsWithInvalidation(invalidation);
260 EXPECT_TRUE(host_impl_.manage_tiles_needed());
261 active_layer_->UpdateTilePriorities();
262 host_impl_.ManageTiles();
263 EXPECT_FALSE(host_impl_.manage_tiles_needed());
264
265 time_ticks += base::TimeDelta::FromMilliseconds(200);
266 host_impl_.SetCurrentFrameTimeTicks(time_ticks);
267
268 // Setting this boolean should cause an early out in UpdateTilePriorities.
269 bool valid_for_tile_management = false;
270 host_impl_.SetExternalDrawConstraints(gfx::Transform(),
271 gfx::Rect(layer_bounds),
272 gfx::Rect(layer_bounds),
273 valid_for_tile_management);
274 active_layer_->UpdateTilePriorities();
275 EXPECT_FALSE(host_impl_.manage_tiles_needed());
276
277 time_ticks += base::TimeDelta::FromMilliseconds(200);
278 host_impl_.SetCurrentFrameTimeTicks(time_ticks);
279
280 valid_for_tile_management = true;
281 host_impl_.SetExternalDrawConstraints(gfx::Transform(),
282 gfx::Rect(layer_bounds),
283 gfx::Rect(layer_bounds),
284 valid_for_tile_management);
285 active_layer_->UpdateTilePriorities();
286 EXPECT_TRUE(host_impl_.manage_tiles_needed());
287 }
288
244 TEST_F(PictureLayerImplTest, ClonePartialInvalidation) { 289 TEST_F(PictureLayerImplTest, ClonePartialInvalidation) {
245 gfx::Size tile_size(100, 100); 290 gfx::Size tile_size(100, 100);
246 gfx::Size layer_bounds(400, 400); 291 gfx::Size layer_bounds(400, 400);
247 gfx::Rect layer_invalidation(150, 200, 30, 180); 292 gfx::Rect layer_invalidation(150, 200, 30, 180);
248 293
249 scoped_refptr<FakePicturePileImpl> pending_pile = 294 scoped_refptr<FakePicturePileImpl> pending_pile =
250 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 295 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
251 scoped_refptr<FakePicturePileImpl> active_pile = 296 scoped_refptr<FakePicturePileImpl> active_pile =
252 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 297 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
253 298
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 active_layer_ = static_cast<FakePictureLayerImpl*>( 1082 active_layer_ = static_cast<FakePictureLayerImpl*>(
1038 host_impl_.active_tree()->LayerById(id_)); 1083 host_impl_.active_tree()->LayerById(id_));
1039 1084
1040 EXPECT_EQ(0u, active_layer_->num_tilings()); 1085 EXPECT_EQ(0u, active_layer_->num_tilings());
1041 EXPECT_EQ(!default_lcd_text_setting, active_layer_->is_using_lcd_text()); 1086 EXPECT_EQ(!default_lcd_text_setting, active_layer_->is_using_lcd_text());
1042 EXPECT_FALSE(active_layer_->needs_post_commit_initialization()); 1087 EXPECT_FALSE(active_layer_->needs_post_commit_initialization());
1043 } 1088 }
1044 1089
1045 } // namespace 1090 } // namespace
1046 } // namespace cc 1091 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/output/delegating_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698