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

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

Issue 1051993002: cc: Remove tile sharing from tilings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 5 years, 8 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
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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "cc/test/fake_content_layer_client.h" 7 #include "cc/test/fake_content_layer_client.h"
8 #include "cc/test/fake_picture_layer.h" 8 #include "cc/test/fake_picture_layer.h"
9 #include "cc/test/fake_picture_layer_impl.h" 9 #include "cc/test/fake_picture_layer_impl.h"
10 #include "cc/test/layer_tree_test.h" 10 #include "cc/test/layer_tree_test.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 case 1: { 235 case 1: {
236 PictureLayerTiling* tiling = picture_impl->HighResTiling(); 236 PictureLayerTiling* tiling = picture_impl->HighResTiling();
237 PictureLayerTiling* recycled_tiling = recycled_impl->HighResTiling(); 237 PictureLayerTiling* recycled_tiling = recycled_impl->HighResTiling();
238 int num_tiles_y = tiling->TilingDataForTesting().num_tiles_y(); 238 int num_tiles_y = tiling->TilingDataForTesting().num_tiles_y();
239 239
240 // There should be tiles at the top of the picture layer but not at the 240 // There should be tiles at the top of the picture layer but not at the
241 // bottom. 241 // bottom.
242 EXPECT_TRUE(tiling->TileAt(0, 0)); 242 EXPECT_TRUE(tiling->TileAt(0, 0));
243 EXPECT_FALSE(tiling->TileAt(0, num_tiles_y)); 243 EXPECT_FALSE(tiling->TileAt(0, num_tiles_y));
244 244
245 // The recycled tiling matches it. 245 // The recycled tiling has no tiles.
246 EXPECT_TRUE(recycled_tiling->TileAt(0, 0)); 246 EXPECT_FALSE(recycled_tiling->TileAt(0, 0));
247 EXPECT_FALSE(recycled_tiling->TileAt(0, num_tiles_y)); 247 EXPECT_FALSE(recycled_tiling->TileAt(0, num_tiles_y));
248 248
249 // The live tiles rect matches on the recycled tree. 249 // The live tiles rect matches on the recycled tree.
250 EXPECT_EQ(tiling->live_tiles_rect(), 250 EXPECT_EQ(tiling->live_tiles_rect(),
251 recycled_tiling->live_tiles_rect()); 251 recycled_tiling->live_tiles_rect());
252 252
253 // Make the bottom of the layer visible. 253 // Make the bottom of the layer visible.
254 picture_impl->SetPosition(gfx::PointF(0.f, -100000.f + 100.f)); 254 picture_impl->SetPosition(gfx::PointF(0.f, -100000.f + 100.f));
255 impl->SetNeedsRedraw(); 255 impl->SetNeedsRedraw();
256 break; 256 break;
257 } 257 }
258 case 2: { 258 case 2: {
259 PictureLayerTiling* tiling = picture_impl->HighResTiling(); 259 PictureLayerTiling* tiling = picture_impl->HighResTiling();
260 PictureLayerTiling* recycled_tiling = recycled_impl->HighResTiling(); 260 PictureLayerTiling* recycled_tiling = recycled_impl->HighResTiling();
261 261
262 // There not be tiles at the top of the layer now. 262 // There not be tiles at the top of the layer now.
263 EXPECT_FALSE(tiling->TileAt(0, 0)); 263 EXPECT_FALSE(tiling->TileAt(0, 0));
264 264
265 // The recycled twin tiling should not have unshared tiles at the top 265 // The recycled twin tiling should not have unshared tiles at the top
266 // either. 266 // either.
267 EXPECT_FALSE(recycled_tiling->TileAt(0, 0)); 267 EXPECT_FALSE(recycled_tiling->TileAt(0, 0));
268 268
269 // The live tiles rect matches on the recycled tree.
270 EXPECT_EQ(tiling->live_tiles_rect(),
271 recycled_tiling->live_tiles_rect());
272
273 // Make the top of the layer visible again. 269 // Make the top of the layer visible again.
274 picture_impl->SetPosition(gfx::PointF()); 270 picture_impl->SetPosition(gfx::PointF());
275 impl->SetNeedsRedraw(); 271 impl->SetNeedsRedraw();
276 break; 272 break;
277 } 273 }
278 case 3: { 274 case 3: {
279 PictureLayerTiling* tiling = picture_impl->HighResTiling(); 275 PictureLayerTiling* tiling = picture_impl->HighResTiling();
280 PictureLayerTiling* recycled_tiling = recycled_impl->HighResTiling(); 276 PictureLayerTiling* recycled_tiling = recycled_impl->HighResTiling();
281 int num_tiles_y = tiling->TilingDataForTesting().num_tiles_y(); 277 int num_tiles_y = tiling->TilingDataForTesting().num_tiles_y();
282 278
283 // There should be tiles at the top of the picture layer again. 279 // There should be tiles at the top of the picture layer again.
284 EXPECT_TRUE(tiling->TileAt(0, 0)); 280 EXPECT_TRUE(tiling->TileAt(0, 0));
285 EXPECT_FALSE(tiling->TileAt(0, num_tiles_y)); 281 EXPECT_FALSE(tiling->TileAt(0, num_tiles_y));
286 282
287 // The recycled tiling should also have tiles at the top. 283 // The recycled tiling should have no tiles.
288 EXPECT_TRUE(recycled_tiling->TileAt(0, 0)); 284 EXPECT_FALSE(recycled_tiling->TileAt(0, 0));
289 EXPECT_FALSE(recycled_tiling->TileAt(0, num_tiles_y)); 285 EXPECT_FALSE(recycled_tiling->TileAt(0, num_tiles_y));
290 286
291 // The live tiles rect matches on the recycled tree. 287 // The live tiles rect matches on the recycled tree.
292 EXPECT_EQ(tiling->live_tiles_rect(), 288 EXPECT_EQ(tiling->live_tiles_rect(),
293 recycled_tiling->live_tiles_rect()); 289 recycled_tiling->live_tiles_rect());
294 290
295 // Make a new main frame without changing the picture layer at all, so 291 // Make a new main frame without changing the picture layer at all, so
296 // it won't need to update or push properties. 292 // it won't need to update or push properties.
297 did_post_commit_ = true; 293 did_post_commit_ = true;
298 PostSetNeedsCommitToMainThread(); 294 PostSetNeedsCommitToMainThread();
299 break; 295 break;
300 } 296 }
301 } 297 }
302 } 298 }
303 299
304 void WillActivateTreeOnThread(LayerTreeHostImpl* impl) override { 300 void WillActivateTreeOnThread(LayerTreeHostImpl* impl) override {
305 LayerImpl* child = impl->sync_tree()->root_layer()->children()[0]; 301 LayerImpl* child = impl->sync_tree()->root_layer()->children()[0];
306 FakePictureLayerImpl* picture_impl = 302 FakePictureLayerImpl* picture_impl =
307 static_cast<FakePictureLayerImpl*>(child); 303 static_cast<FakePictureLayerImpl*>(child);
308 PictureLayerTiling* tiling = picture_impl->HighResTiling(); 304 PictureLayerTiling* tiling = picture_impl->HighResTiling();
309 int num_tiles_y = tiling->TilingDataForTesting().num_tiles_y(); 305 int num_tiles_y = tiling->TilingDataForTesting().num_tiles_y();
310 306
311 // The pending layer should always have tiles at the top of it each commit. 307 if (!impl->active_tree()->root_layer()) {
312 // The tile is part of the required for activation set so it should exist. 308 // If active tree doesn't have the layer, then pending tree should have
enne (OOO) 2015/04/13 22:36:03 This is the first frame?
vmpstr 2015/04/13 23:52:13 Yes. Did you want me to change the comment to that
313 EXPECT_TRUE(tiling->TileAt(0, 0)); 309 // all needed tiles.
310 EXPECT_TRUE(tiling->TileAt(0, 0));
311 } else {
312 // Since there was no invalidation, the pending tree shouldn't have any
313 // tiles.
314 EXPECT_FALSE(tiling->TileAt(0, 0));
315 }
314 EXPECT_FALSE(tiling->TileAt(0, num_tiles_y)); 316 EXPECT_FALSE(tiling->TileAt(0, num_tiles_y));
315 317
316 if (did_post_commit_) 318 if (did_post_commit_)
317 EndTest(); 319 EndTest();
318 } 320 }
319 321
320 void AfterTest() override {} 322 void AfterTest() override {}
321 323
322 int frame_; 324 int frame_;
323 bool did_post_commit_; 325 bool did_post_commit_;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 int last_frame_drawn_; 565 int last_frame_drawn_;
564 }; 566 };
565 567
566 // Multi-thread only because in single thread you can't pinch zoom on the 568 // Multi-thread only because in single thread you can't pinch zoom on the
567 // compositor thread. 569 // compositor thread.
568 // Disabled due to flakiness. See http://crbug.com/460581 570 // Disabled due to flakiness. See http://crbug.com/460581
569 // MULTI_THREAD_IMPL_TEST_F(LayerTreeHostPictureTestRSLLMembershipWithScale); 571 // MULTI_THREAD_IMPL_TEST_F(LayerTreeHostPictureTestRSLLMembershipWithScale);
570 572
571 } // namespace 573 } // namespace
572 } // namespace cc 574 } // namespace cc
OLDNEW
« cc/resources/tiling_set_eviction_queue.cc ('K') | « cc/test/fake_picture_layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698