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

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

Issue 1108773003: Revert of cc: Remove tile sharing from tilings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/fake_picture_layer_impl.cc ('k') | no next file » | 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/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 has no tiles. 245 // The recycled tiling matches it.
246 EXPECT_FALSE(recycled_tiling->TileAt(0, 0)); 246 EXPECT_TRUE(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
269 // Make the top of the layer visible again. 273 // Make the top of the layer visible again.
270 picture_impl->SetPosition(gfx::PointF()); 274 picture_impl->SetPosition(gfx::PointF());
271 impl->SetNeedsRedraw(); 275 impl->SetNeedsRedraw();
272 break; 276 break;
273 } 277 }
274 case 3: { 278 case 3: {
275 PictureLayerTiling* tiling = picture_impl->HighResTiling(); 279 PictureLayerTiling* tiling = picture_impl->HighResTiling();
276 PictureLayerTiling* recycled_tiling = recycled_impl->HighResTiling(); 280 PictureLayerTiling* recycled_tiling = recycled_impl->HighResTiling();
277 int num_tiles_y = tiling->TilingDataForTesting().num_tiles_y(); 281 int num_tiles_y = tiling->TilingDataForTesting().num_tiles_y();
278 282
279 // There should be tiles at the top of the picture layer again. 283 // There should be tiles at the top of the picture layer again.
280 EXPECT_TRUE(tiling->TileAt(0, 0)); 284 EXPECT_TRUE(tiling->TileAt(0, 0));
281 EXPECT_FALSE(tiling->TileAt(0, num_tiles_y)); 285 EXPECT_FALSE(tiling->TileAt(0, num_tiles_y));
282 286
283 // The recycled tiling should have no tiles. 287 // The recycled tiling should also have tiles at the top.
284 EXPECT_FALSE(recycled_tiling->TileAt(0, 0)); 288 EXPECT_TRUE(recycled_tiling->TileAt(0, 0));
285 EXPECT_FALSE(recycled_tiling->TileAt(0, num_tiles_y)); 289 EXPECT_FALSE(recycled_tiling->TileAt(0, num_tiles_y));
286 290
287 // The live tiles rect matches on the recycled tree. 291 // The live tiles rect matches on the recycled tree.
288 EXPECT_EQ(tiling->live_tiles_rect(), 292 EXPECT_EQ(tiling->live_tiles_rect(),
289 recycled_tiling->live_tiles_rect()); 293 recycled_tiling->live_tiles_rect());
290 294
291 // Make a new main frame without changing the picture layer at all, so 295 // Make a new main frame without changing the picture layer at all, so
292 // it won't need to update or push properties. 296 // it won't need to update or push properties.
293 did_post_commit_ = true; 297 did_post_commit_ = true;
294 PostSetNeedsCommitToMainThread(); 298 PostSetNeedsCommitToMainThread();
295 break; 299 break;
296 } 300 }
297 } 301 }
298 } 302 }
299 303
300 void WillActivateTreeOnThread(LayerTreeHostImpl* impl) override { 304 void WillActivateTreeOnThread(LayerTreeHostImpl* impl) override {
301 LayerImpl* child = impl->sync_tree()->root_layer()->children()[0]; 305 LayerImpl* child = impl->sync_tree()->root_layer()->children()[0];
302 FakePictureLayerImpl* picture_impl = 306 FakePictureLayerImpl* picture_impl =
303 static_cast<FakePictureLayerImpl*>(child); 307 static_cast<FakePictureLayerImpl*>(child);
304 PictureLayerTiling* tiling = picture_impl->HighResTiling(); 308 PictureLayerTiling* tiling = picture_impl->HighResTiling();
305 int num_tiles_y = tiling->TilingDataForTesting().num_tiles_y(); 309 int num_tiles_y = tiling->TilingDataForTesting().num_tiles_y();
306 310
307 if (!impl->active_tree()->root_layer()) { 311 // The pending layer should always have tiles at the top of it each commit.
308 // If active tree doesn't have the layer, then pending tree should have 312 // The tile is part of the required for activation set so it should exist.
309 // all needed tiles. 313 EXPECT_TRUE(tiling->TileAt(0, 0));
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 }
316 EXPECT_FALSE(tiling->TileAt(0, num_tiles_y)); 314 EXPECT_FALSE(tiling->TileAt(0, num_tiles_y));
317 315
318 if (did_post_commit_) 316 if (did_post_commit_)
319 EndTest(); 317 EndTest();
320 } 318 }
321 319
322 void AfterTest() override {} 320 void AfterTest() override {}
323 321
324 int frame_; 322 int frame_;
325 bool did_post_commit_; 323 bool did_post_commit_;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 int last_frame_drawn_; 563 int last_frame_drawn_;
566 }; 564 };
567 565
568 // Multi-thread only because in single thread you can't pinch zoom on the 566 // Multi-thread only because in single thread you can't pinch zoom on the
569 // compositor thread. 567 // compositor thread.
570 // Disabled due to flakiness. See http://crbug.com/460581 568 // Disabled due to flakiness. See http://crbug.com/460581
571 // MULTI_THREAD_IMPL_TEST_F(LayerTreeHostPictureTestRSLLMembershipWithScale); 569 // MULTI_THREAD_IMPL_TEST_F(LayerTreeHostPictureTestRSLLMembershipWithScale);
572 570
573 } // namespace 571 } // namespace
574 } // namespace cc 572 } // namespace cc
OLDNEW
« no previous file with comments | « 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