OLD | NEW |
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 <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 const PictureLayerTilingSet* tilings = pending_layer_->tilings(); | 323 const PictureLayerTilingSet* tilings = pending_layer_->tilings(); |
324 EXPECT_GT(tilings->num_tilings(), 0u); | 324 EXPECT_GT(tilings->num_tilings(), 0u); |
325 for (size_t i = 0; i < tilings->num_tilings(); ++i) | 325 for (size_t i = 0; i < tilings->num_tilings(); ++i) |
326 VerifyAllTilesExistAndHavePile(tilings->tiling_at(i), active_pile.get()); | 326 VerifyAllTilesExistAndHavePile(tilings->tiling_at(i), active_pile.get()); |
327 } | 327 } |
328 | 328 |
329 TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) { | 329 TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) { |
330 base::TimeTicks time_ticks; | 330 base::TimeTicks time_ticks; |
331 time_ticks += base::TimeDelta::FromMilliseconds(1); | 331 time_ticks += base::TimeDelta::FromMilliseconds(1); |
332 host_impl_.SetCurrentBeginFrameArgs( | 332 host_impl_.SetCurrentBeginFrameArgs( |
333 CreateBeginFrameArgsForTesting(time_ticks)); | 333 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
334 gfx::Size tile_size(100, 100); | 334 gfx::Size tile_size(100, 100); |
335 gfx::Size layer_bounds(400, 400); | 335 gfx::Size layer_bounds(400, 400); |
336 | 336 |
337 scoped_refptr<FakePicturePileImpl> pending_pile = | 337 scoped_refptr<FakePicturePileImpl> pending_pile = |
338 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 338 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
339 scoped_refptr<FakePicturePileImpl> active_pile = | 339 scoped_refptr<FakePicturePileImpl> active_pile = |
340 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 340 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
341 | 341 |
342 SetupTrees(pending_pile, active_pile); | 342 SetupTrees(pending_pile, active_pile); |
343 | 343 |
344 Region invalidation; | 344 Region invalidation; |
345 AddDefaultTilingsWithInvalidation(invalidation); | 345 AddDefaultTilingsWithInvalidation(invalidation); |
346 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, false); | 346 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, false); |
347 | 347 |
348 time_ticks += base::TimeDelta::FromMilliseconds(200); | 348 time_ticks += base::TimeDelta::FromMilliseconds(200); |
349 host_impl_.SetCurrentBeginFrameArgs( | 349 host_impl_.SetCurrentBeginFrameArgs( |
350 CreateBeginFrameArgsForTesting(time_ticks)); | 350 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
351 | 351 |
352 // Update tiles with viewport for tile priority as (0, 0, 100, 100) and the | 352 // Update tiles with viewport for tile priority as (0, 0, 100, 100) and the |
353 // identify transform for tile priority. | 353 // identify transform for tile priority. |
354 bool resourceless_software_draw = false; | 354 bool resourceless_software_draw = false; |
355 gfx::Rect viewport = gfx::Rect(layer_bounds), | 355 gfx::Rect viewport = gfx::Rect(layer_bounds), |
356 viewport_rect_for_tile_priority = gfx::Rect(0, 0, 100, 100); | 356 viewport_rect_for_tile_priority = gfx::Rect(0, 0, 100, 100); |
357 gfx::Transform transform, transform_for_tile_priority; | 357 gfx::Transform transform, transform_for_tile_priority; |
358 | 358 |
359 host_impl_.SetExternalDrawConstraints(transform, | 359 host_impl_.SetExternalDrawConstraints(transform, |
360 viewport, | 360 viewport, |
(...skipping 17 matching lines...) Expand all Loading... |
378 gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority_in_view_space, | 378 gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority_in_view_space, |
379 tiling->contents_scale())); | 379 tiling->contents_scale())); |
380 } | 380 } |
381 | 381 |
382 // Update tiles with viewport for tile priority as (200, 200, 100, 100) in | 382 // Update tiles with viewport for tile priority as (200, 200, 100, 100) in |
383 // screen space and the transform for tile priority is translated and | 383 // screen space and the transform for tile priority is translated and |
384 // rotated. The actual viewport for tile priority used by PictureLayerImpl | 384 // rotated. The actual viewport for tile priority used by PictureLayerImpl |
385 // should be (200, 200, 100, 100) applied with the said transform. | 385 // should be (200, 200, 100, 100) applied with the said transform. |
386 time_ticks += base::TimeDelta::FromMilliseconds(200); | 386 time_ticks += base::TimeDelta::FromMilliseconds(200); |
387 host_impl_.SetCurrentBeginFrameArgs( | 387 host_impl_.SetCurrentBeginFrameArgs( |
388 CreateBeginFrameArgsForTesting(time_ticks)); | 388 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
389 | 389 |
390 viewport_rect_for_tile_priority = gfx::Rect(200, 200, 100, 100); | 390 viewport_rect_for_tile_priority = gfx::Rect(200, 200, 100, 100); |
391 transform_for_tile_priority.Translate(100, 100); | 391 transform_for_tile_priority.Translate(100, 100); |
392 transform_for_tile_priority.Rotate(45); | 392 transform_for_tile_priority.Rotate(45); |
393 host_impl_.SetExternalDrawConstraints(transform, | 393 host_impl_.SetExternalDrawConstraints(transform, |
394 viewport, | 394 viewport, |
395 viewport, | 395 viewport, |
396 viewport_rect_for_tile_priority, | 396 viewport_rect_for_tile_priority, |
397 transform_for_tile_priority, | 397 transform_for_tile_priority, |
398 resourceless_software_draw); | 398 resourceless_software_draw); |
(...skipping 20 matching lines...) Expand all Loading... |
419 tiling->GetCurrentVisibleRectForTesting(), | 419 tiling->GetCurrentVisibleRectForTesting(), |
420 gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority_in_view_space, | 420 gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority_in_view_space, |
421 tiling->contents_scale())); | 421 tiling->contents_scale())); |
422 } | 422 } |
423 } | 423 } |
424 | 424 |
425 TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) { | 425 TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) { |
426 base::TimeTicks time_ticks; | 426 base::TimeTicks time_ticks; |
427 time_ticks += base::TimeDelta::FromMilliseconds(1); | 427 time_ticks += base::TimeDelta::FromMilliseconds(1); |
428 host_impl_.SetCurrentBeginFrameArgs( | 428 host_impl_.SetCurrentBeginFrameArgs( |
429 CreateBeginFrameArgsForTesting(time_ticks)); | 429 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
430 | 430 |
431 gfx::Size tile_size(100, 100); | 431 gfx::Size tile_size(100, 100); |
432 gfx::Size layer_bounds(400, 400); | 432 gfx::Size layer_bounds(400, 400); |
433 | 433 |
434 scoped_refptr<FakePicturePileImpl> pending_pile = | 434 scoped_refptr<FakePicturePileImpl> pending_pile = |
435 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 435 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
436 scoped_refptr<FakePicturePileImpl> active_pile = | 436 scoped_refptr<FakePicturePileImpl> active_pile = |
437 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 437 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
438 | 438 |
439 SetupTrees(pending_pile, active_pile); | 439 SetupTrees(pending_pile, active_pile); |
(...skipping 21 matching lines...) Expand all Loading... |
461 gfx::Rect visible_rect_for_tile_priority = | 461 gfx::Rect visible_rect_for_tile_priority = |
462 active_layer_->visible_rect_for_tile_priority(); | 462 active_layer_->visible_rect_for_tile_priority(); |
463 EXPECT_FALSE(visible_rect_for_tile_priority.IsEmpty()); | 463 EXPECT_FALSE(visible_rect_for_tile_priority.IsEmpty()); |
464 gfx::Transform screen_space_transform_for_tile_priority = | 464 gfx::Transform screen_space_transform_for_tile_priority = |
465 active_layer_->screen_space_transform(); | 465 active_layer_->screen_space_transform(); |
466 | 466 |
467 // Expand viewport and set it as invalid for prioritizing tiles. | 467 // Expand viewport and set it as invalid for prioritizing tiles. |
468 // Should update viewport and transform, but not update visible rect. | 468 // Should update viewport and transform, but not update visible rect. |
469 time_ticks += base::TimeDelta::FromMilliseconds(200); | 469 time_ticks += base::TimeDelta::FromMilliseconds(200); |
470 host_impl_.SetCurrentBeginFrameArgs( | 470 host_impl_.SetCurrentBeginFrameArgs( |
471 CreateBeginFrameArgsForTesting(time_ticks)); | 471 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
472 resourceless_software_draw = true; | 472 resourceless_software_draw = true; |
473 viewport = gfx::ScaleToEnclosingRect(viewport, 2); | 473 viewport = gfx::ScaleToEnclosingRect(viewport, 2); |
474 transform.Translate(1.f, 1.f); | 474 transform.Translate(1.f, 1.f); |
475 active_layer_->draw_properties().visible_content_rect = viewport; | 475 active_layer_->draw_properties().visible_content_rect = viewport; |
476 active_layer_->draw_properties().screen_space_transform = transform; | 476 active_layer_->draw_properties().screen_space_transform = transform; |
477 host_impl_.SetExternalDrawConstraints(transform, | 477 host_impl_.SetExternalDrawConstraints(transform, |
478 viewport, | 478 viewport, |
479 viewport, | 479 viewport, |
480 viewport, | 480 viewport, |
481 transform, | 481 transform, |
482 resourceless_software_draw); | 482 resourceless_software_draw); |
483 active_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); | 483 active_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); |
484 | 484 |
485 // Transform for tile priority is updated. | 485 // Transform for tile priority is updated. |
486 EXPECT_TRANSFORMATION_MATRIX_EQ(transform, | 486 EXPECT_TRANSFORMATION_MATRIX_EQ(transform, |
487 active_layer_->screen_space_transform()); | 487 active_layer_->screen_space_transform()); |
488 // Visible rect for tile priority retains old value. | 488 // Visible rect for tile priority retains old value. |
489 EXPECT_EQ(visible_rect_for_tile_priority, | 489 EXPECT_EQ(visible_rect_for_tile_priority, |
490 active_layer_->visible_rect_for_tile_priority()); | 490 active_layer_->visible_rect_for_tile_priority()); |
491 | 491 |
492 // Keep expanded viewport but mark it valid. Should update tile viewport. | 492 // Keep expanded viewport but mark it valid. Should update tile viewport. |
493 time_ticks += base::TimeDelta::FromMilliseconds(200); | 493 time_ticks += base::TimeDelta::FromMilliseconds(200); |
494 host_impl_.SetCurrentBeginFrameArgs( | 494 host_impl_.SetCurrentBeginFrameArgs( |
495 CreateBeginFrameArgsForTesting(time_ticks)); | 495 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
496 resourceless_software_draw = false; | 496 resourceless_software_draw = false; |
497 host_impl_.SetExternalDrawConstraints(transform, | 497 host_impl_.SetExternalDrawConstraints(transform, |
498 viewport, | 498 viewport, |
499 viewport, | 499 viewport, |
500 viewport, | 500 viewport, |
501 transform, | 501 transform, |
502 resourceless_software_draw); | 502 resourceless_software_draw); |
503 active_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); | 503 active_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); |
504 | 504 |
505 EXPECT_TRANSFORMATION_MATRIX_EQ(transform, | 505 EXPECT_TRANSFORMATION_MATRIX_EQ(transform, |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1554 | 1554 |
1555 pending_layer_->set_fixed_tile_size(tile_size); | 1555 pending_layer_->set_fixed_tile_size(tile_size); |
1556 ASSERT_TRUE(pending_layer_->CanHaveTilings()); | 1556 ASSERT_TRUE(pending_layer_->CanHaveTilings()); |
1557 PictureLayerTiling* tiling = pending_layer_->AddTiling(1.f); | 1557 PictureLayerTiling* tiling = pending_layer_->AddTiling(1.f); |
1558 host_impl_.pending_tree()->UpdateDrawProperties(); | 1558 host_impl_.pending_tree()->UpdateDrawProperties(); |
1559 EXPECT_EQ(viewport, pending_layer_->visible_rect_for_tile_priority()); | 1559 EXPECT_EQ(viewport, pending_layer_->visible_rect_for_tile_priority()); |
1560 | 1560 |
1561 base::TimeTicks time_ticks; | 1561 base::TimeTicks time_ticks; |
1562 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1562 time_ticks += base::TimeDelta::FromMilliseconds(1); |
1563 host_impl_.SetCurrentBeginFrameArgs( | 1563 host_impl_.SetCurrentBeginFrameArgs( |
1564 CreateBeginFrameArgsForTesting(time_ticks)); | 1564 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
1565 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); | 1565 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); |
1566 EXPECT_EQ(HIGH_RESOLUTION, tiling->resolution()); | 1566 EXPECT_EQ(HIGH_RESOLUTION, tiling->resolution()); |
1567 | 1567 |
1568 int num_visible = 0; | 1568 int num_visible = 0; |
1569 int num_offscreen = 0; | 1569 int num_offscreen = 0; |
1570 | 1570 |
1571 for (PictureLayerTiling::TilingRasterTileIterator iter(tiling); iter; | 1571 for (PictureLayerTiling::TilingRasterTileIterator iter(tiling); iter; |
1572 ++iter) { | 1572 ++iter) { |
1573 const Tile* tile = *iter; | 1573 const Tile* tile = *iter; |
1574 DCHECK(tile); | 1574 DCHECK(tile); |
1575 if (tile->priority(PENDING_TREE).distance_to_visible == 0.f) { | 1575 if (tile->priority(PENDING_TREE).distance_to_visible == 0.f) { |
1576 EXPECT_TRUE(tile->required_for_activation()); | 1576 EXPECT_TRUE(tile->required_for_activation()); |
1577 num_visible++; | 1577 num_visible++; |
1578 } else { | 1578 } else { |
1579 EXPECT_FALSE(tile->required_for_activation()); | 1579 EXPECT_FALSE(tile->required_for_activation()); |
1580 num_offscreen++; | 1580 num_offscreen++; |
1581 } | 1581 } |
1582 } | 1582 } |
1583 | 1583 |
1584 EXPECT_GT(num_visible, 0); | 1584 EXPECT_GT(num_visible, 0); |
1585 EXPECT_GT(num_offscreen, 0); | 1585 EXPECT_GT(num_offscreen, 0); |
1586 } | 1586 } |
1587 | 1587 |
1588 TEST_F(PictureLayerImplTest, TileOutsideOfViewportForTilePriorityNotRequired) { | 1588 TEST_F(PictureLayerImplTest, TileOutsideOfViewportForTilePriorityNotRequired) { |
1589 base::TimeTicks time_ticks; | 1589 base::TimeTicks time_ticks; |
1590 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1590 time_ticks += base::TimeDelta::FromMilliseconds(1); |
1591 host_impl_.SetCurrentBeginFrameArgs( | 1591 host_impl_.SetCurrentBeginFrameArgs( |
1592 CreateBeginFrameArgsForTesting(time_ticks)); | 1592 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
1593 | 1593 |
1594 gfx::Size tile_size(100, 100); | 1594 gfx::Size tile_size(100, 100); |
1595 gfx::Size layer_bounds(400, 400); | 1595 gfx::Size layer_bounds(400, 400); |
1596 gfx::Rect external_viewport_for_tile_priority(400, 200); | 1596 gfx::Rect external_viewport_for_tile_priority(400, 200); |
1597 gfx::Rect visible_content_rect(200, 400); | 1597 gfx::Rect visible_content_rect(200, 400); |
1598 | 1598 |
1599 scoped_refptr<FakePicturePileImpl> active_pile = | 1599 scoped_refptr<FakePicturePileImpl> active_pile = |
1600 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1600 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1601 scoped_refptr<FakePicturePileImpl> pending_pile = | 1601 scoped_refptr<FakePicturePileImpl> pending_pile = |
1602 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1602 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
(...skipping 15 matching lines...) Expand all Loading... |
1618 external_viewport_for_tile_priority, | 1618 external_viewport_for_tile_priority, |
1619 transform_for_tile_priority, | 1619 transform_for_tile_priority, |
1620 resourceless_software_draw); | 1620 resourceless_software_draw); |
1621 host_impl_.pending_tree()->UpdateDrawProperties(); | 1621 host_impl_.pending_tree()->UpdateDrawProperties(); |
1622 | 1622 |
1623 // Set visible content rect that is different from | 1623 // Set visible content rect that is different from |
1624 // external_viewport_for_tile_priority. | 1624 // external_viewport_for_tile_priority. |
1625 pending_layer_->draw_properties().visible_content_rect = visible_content_rect; | 1625 pending_layer_->draw_properties().visible_content_rect = visible_content_rect; |
1626 time_ticks += base::TimeDelta::FromMilliseconds(200); | 1626 time_ticks += base::TimeDelta::FromMilliseconds(200); |
1627 host_impl_.SetCurrentBeginFrameArgs( | 1627 host_impl_.SetCurrentBeginFrameArgs( |
1628 CreateBeginFrameArgsForTesting(time_ticks)); | 1628 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
1629 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); | 1629 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); |
1630 | 1630 |
1631 // Intersect the two rects. Any tile outside should not be required for | 1631 // Intersect the two rects. Any tile outside should not be required for |
1632 // activation. | 1632 // activation. |
1633 gfx::Rect viewport_for_tile_priority = | 1633 gfx::Rect viewport_for_tile_priority = |
1634 pending_layer_->GetViewportForTilePriorityInContentSpace(); | 1634 pending_layer_->GetViewportForTilePriorityInContentSpace(); |
1635 viewport_for_tile_priority.Intersect(pending_layer_->visible_content_rect()); | 1635 viewport_for_tile_priority.Intersect(pending_layer_->visible_content_rect()); |
1636 | 1636 |
1637 int num_inside = 0; | 1637 int num_inside = 0; |
1638 int num_outside = 0; | 1638 int num_outside = 0; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 // All tiles in activation rect is ready to draw. | 1671 // All tiles in activation rect is ready to draw. |
1672 EXPECT_EQ(0u, data.num_missing_tiles); | 1672 EXPECT_EQ(0u, data.num_missing_tiles); |
1673 EXPECT_EQ(0u, data.num_incomplete_tiles); | 1673 EXPECT_EQ(0u, data.num_incomplete_tiles); |
1674 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); | 1674 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); |
1675 } | 1675 } |
1676 | 1676 |
1677 TEST_F(PictureLayerImplTest, HighResTileIsComplete) { | 1677 TEST_F(PictureLayerImplTest, HighResTileIsComplete) { |
1678 base::TimeTicks time_ticks; | 1678 base::TimeTicks time_ticks; |
1679 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1679 time_ticks += base::TimeDelta::FromMilliseconds(1); |
1680 host_impl_.SetCurrentBeginFrameArgs( | 1680 host_impl_.SetCurrentBeginFrameArgs( |
1681 CreateBeginFrameArgsForTesting(time_ticks)); | 1681 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
1682 | 1682 |
1683 gfx::Size tile_size(100, 100); | 1683 gfx::Size tile_size(100, 100); |
1684 gfx::Size layer_bounds(200, 200); | 1684 gfx::Size layer_bounds(200, 200); |
1685 | 1685 |
1686 host_impl_.SetViewportSize(layer_bounds); | 1686 host_impl_.SetViewportSize(layer_bounds); |
1687 | 1687 |
1688 scoped_refptr<FakePicturePileImpl> pending_pile = | 1688 scoped_refptr<FakePicturePileImpl> pending_pile = |
1689 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1689 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1690 SetupPendingTree(pending_pile); | 1690 SetupPendingTree(pending_pile); |
1691 ActivateTree(); | 1691 ActivateTree(); |
(...skipping 15 matching lines...) Expand all Loading... |
1707 EXPECT_EQ(9u, render_pass->quad_list.size()); | 1707 EXPECT_EQ(9u, render_pass->quad_list.size()); |
1708 EXPECT_EQ(0u, data.num_missing_tiles); | 1708 EXPECT_EQ(0u, data.num_missing_tiles); |
1709 EXPECT_EQ(0u, data.num_incomplete_tiles); | 1709 EXPECT_EQ(0u, data.num_incomplete_tiles); |
1710 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); | 1710 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); |
1711 } | 1711 } |
1712 | 1712 |
1713 TEST_F(PictureLayerImplTest, HighResTileIsIncomplete) { | 1713 TEST_F(PictureLayerImplTest, HighResTileIsIncomplete) { |
1714 base::TimeTicks time_ticks; | 1714 base::TimeTicks time_ticks; |
1715 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1715 time_ticks += base::TimeDelta::FromMilliseconds(1); |
1716 host_impl_.SetCurrentBeginFrameArgs( | 1716 host_impl_.SetCurrentBeginFrameArgs( |
1717 CreateBeginFrameArgsForTesting(time_ticks)); | 1717 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
1718 | 1718 |
1719 gfx::Size tile_size(100, 100); | 1719 gfx::Size tile_size(100, 100); |
1720 gfx::Size layer_bounds(200, 200); | 1720 gfx::Size layer_bounds(200, 200); |
1721 | 1721 |
1722 host_impl_.SetViewportSize(layer_bounds); | 1722 host_impl_.SetViewportSize(layer_bounds); |
1723 | 1723 |
1724 scoped_refptr<FakePicturePileImpl> pending_pile = | 1724 scoped_refptr<FakePicturePileImpl> pending_pile = |
1725 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1725 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1726 SetupPendingTree(pending_pile); | 1726 SetupPendingTree(pending_pile); |
1727 ActivateTree(); | 1727 ActivateTree(); |
(...skipping 10 matching lines...) Expand all Loading... |
1738 EXPECT_EQ(1u, render_pass->quad_list.size()); | 1738 EXPECT_EQ(1u, render_pass->quad_list.size()); |
1739 EXPECT_EQ(1u, data.num_missing_tiles); | 1739 EXPECT_EQ(1u, data.num_missing_tiles); |
1740 EXPECT_EQ(0u, data.num_incomplete_tiles); | 1740 EXPECT_EQ(0u, data.num_incomplete_tiles); |
1741 EXPECT_TRUE(active_layer_->only_used_low_res_last_append_quads()); | 1741 EXPECT_TRUE(active_layer_->only_used_low_res_last_append_quads()); |
1742 } | 1742 } |
1743 | 1743 |
1744 TEST_F(PictureLayerImplTest, HighResTileIsIncompleteLowResComplete) { | 1744 TEST_F(PictureLayerImplTest, HighResTileIsIncompleteLowResComplete) { |
1745 base::TimeTicks time_ticks; | 1745 base::TimeTicks time_ticks; |
1746 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1746 time_ticks += base::TimeDelta::FromMilliseconds(1); |
1747 host_impl_.SetCurrentBeginFrameArgs( | 1747 host_impl_.SetCurrentBeginFrameArgs( |
1748 CreateBeginFrameArgsForTesting(time_ticks)); | 1748 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
1749 | 1749 |
1750 gfx::Size tile_size(100, 100); | 1750 gfx::Size tile_size(100, 100); |
1751 gfx::Size layer_bounds(200, 200); | 1751 gfx::Size layer_bounds(200, 200); |
1752 | 1752 |
1753 host_impl_.SetViewportSize(layer_bounds); | 1753 host_impl_.SetViewportSize(layer_bounds); |
1754 | 1754 |
1755 scoped_refptr<FakePicturePileImpl> pending_pile = | 1755 scoped_refptr<FakePicturePileImpl> pending_pile = |
1756 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1756 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1757 SetupPendingTree(pending_pile); | 1757 SetupPendingTree(pending_pile); |
1758 ActivateTree(); | 1758 ActivateTree(); |
(...skipping 13 matching lines...) Expand all Loading... |
1772 EXPECT_EQ(1u, render_pass->quad_list.size()); | 1772 EXPECT_EQ(1u, render_pass->quad_list.size()); |
1773 EXPECT_EQ(0u, data.num_missing_tiles); | 1773 EXPECT_EQ(0u, data.num_missing_tiles); |
1774 EXPECT_EQ(1u, data.num_incomplete_tiles); | 1774 EXPECT_EQ(1u, data.num_incomplete_tiles); |
1775 EXPECT_TRUE(active_layer_->only_used_low_res_last_append_quads()); | 1775 EXPECT_TRUE(active_layer_->only_used_low_res_last_append_quads()); |
1776 } | 1776 } |
1777 | 1777 |
1778 TEST_F(PictureLayerImplTest, LowResTileIsIncomplete) { | 1778 TEST_F(PictureLayerImplTest, LowResTileIsIncomplete) { |
1779 base::TimeTicks time_ticks; | 1779 base::TimeTicks time_ticks; |
1780 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1780 time_ticks += base::TimeDelta::FromMilliseconds(1); |
1781 host_impl_.SetCurrentBeginFrameArgs( | 1781 host_impl_.SetCurrentBeginFrameArgs( |
1782 CreateBeginFrameArgsForTesting(time_ticks)); | 1782 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
1783 | 1783 |
1784 gfx::Size tile_size(100, 100); | 1784 gfx::Size tile_size(100, 100); |
1785 gfx::Size layer_bounds(200, 200); | 1785 gfx::Size layer_bounds(200, 200); |
1786 | 1786 |
1787 host_impl_.SetViewportSize(layer_bounds); | 1787 host_impl_.SetViewportSize(layer_bounds); |
1788 | 1788 |
1789 scoped_refptr<FakePicturePileImpl> pending_pile = | 1789 scoped_refptr<FakePicturePileImpl> pending_pile = |
1790 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1790 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1791 SetupPendingTree(pending_pile); | 1791 SetupPendingTree(pending_pile); |
1792 ActivateTree(); | 1792 ActivateTree(); |
(...skipping 22 matching lines...) Expand all Loading... |
1815 EXPECT_EQ(0u, data.num_missing_tiles); | 1815 EXPECT_EQ(0u, data.num_missing_tiles); |
1816 EXPECT_EQ(1u, data.num_incomplete_tiles); | 1816 EXPECT_EQ(1u, data.num_incomplete_tiles); |
1817 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); | 1817 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); |
1818 } | 1818 } |
1819 | 1819 |
1820 TEST_F(PictureLayerImplTest, | 1820 TEST_F(PictureLayerImplTest, |
1821 HighResAndIdealResTileIsCompleteWhenRasterScaleIsNotIdeal) { | 1821 HighResAndIdealResTileIsCompleteWhenRasterScaleIsNotIdeal) { |
1822 base::TimeTicks time_ticks; | 1822 base::TimeTicks time_ticks; |
1823 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1823 time_ticks += base::TimeDelta::FromMilliseconds(1); |
1824 host_impl_.SetCurrentBeginFrameArgs( | 1824 host_impl_.SetCurrentBeginFrameArgs( |
1825 CreateBeginFrameArgsForTesting(time_ticks)); | 1825 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
1826 | 1826 |
1827 gfx::Size tile_size(100, 100); | 1827 gfx::Size tile_size(100, 100); |
1828 gfx::Size layer_bounds(200, 200); | 1828 gfx::Size layer_bounds(200, 200); |
1829 | 1829 |
1830 host_impl_.SetViewportSize(layer_bounds); | 1830 host_impl_.SetViewportSize(layer_bounds); |
1831 | 1831 |
1832 scoped_refptr<FakePicturePileImpl> pending_pile = | 1832 scoped_refptr<FakePicturePileImpl> pending_pile = |
1833 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1833 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1834 scoped_refptr<FakePicturePileImpl> active_pile = | 1834 scoped_refptr<FakePicturePileImpl> active_pile = |
1835 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1835 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1883 | 1883 |
1884 // Neither the high res nor the ideal tiles were considered as incomplete. | 1884 // Neither the high res nor the ideal tiles were considered as incomplete. |
1885 EXPECT_EQ(0u, data.num_missing_tiles); | 1885 EXPECT_EQ(0u, data.num_missing_tiles); |
1886 EXPECT_EQ(0u, data.num_incomplete_tiles); | 1886 EXPECT_EQ(0u, data.num_incomplete_tiles); |
1887 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); | 1887 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); |
1888 } | 1888 } |
1889 | 1889 |
1890 TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) { | 1890 TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) { |
1891 gfx::Size layer_bounds(400, 400); | 1891 gfx::Size layer_bounds(400, 400); |
1892 gfx::Size tile_size(100, 100); | 1892 gfx::Size tile_size(100, 100); |
| 1893 |
| 1894 host_impl_.SetViewportSize(layer_bounds); |
| 1895 |
1893 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); | 1896 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); |
1894 | 1897 |
1895 // No tiles shared. | 1898 // No tiles shared. |
1896 pending_layer_->set_invalidation(gfx::Rect(layer_bounds)); | 1899 pending_layer_->set_invalidation(gfx::Rect(layer_bounds)); |
1897 | 1900 |
1898 CreateHighLowResAndSetAllTilesVisible(); | 1901 CreateHighLowResAndSetAllTilesVisible(); |
1899 | 1902 |
1900 active_layer_->SetAllTilesReady(); | 1903 active_layer_->SetAllTilesReady(); |
1901 | 1904 |
1902 // No shared tiles and all active tiles ready, so pending can only | 1905 // No shared tiles and all active tiles ready, so pending can only |
1903 // activate with all high res tiles. | 1906 // activate with all high res tiles. |
1904 pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); | 1907 pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); |
1905 pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting(); | 1908 pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting(); |
1906 | 1909 |
1907 AssertAllTilesRequired(pending_layer_->HighResTiling()); | 1910 AssertAllTilesRequired(pending_layer_->HighResTiling()); |
1908 AssertNoTilesRequired(pending_layer_->LowResTiling()); | 1911 AssertNoTilesRequired(pending_layer_->LowResTiling()); |
1909 } | 1912 } |
1910 | 1913 |
1911 TEST_F(PictureLayerImplTest, HighResRequiredWhenMissingHighResFlagOn) { | 1914 TEST_F(PictureLayerImplTest, HighResRequiredWhenMissingHighResFlagOn) { |
1912 gfx::Size layer_bounds(400, 400); | 1915 gfx::Size layer_bounds(400, 400); |
1913 gfx::Size tile_size(100, 100); | 1916 gfx::Size tile_size(100, 100); |
| 1917 |
| 1918 host_impl_.SetViewportSize(layer_bounds); |
| 1919 |
1914 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); | 1920 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); |
1915 | 1921 |
1916 // All tiles shared (no invalidation). | 1922 // All tiles shared (no invalidation). |
1917 CreateHighLowResAndSetAllTilesVisible(); | 1923 CreateHighLowResAndSetAllTilesVisible(); |
1918 | 1924 |
1919 // Verify active tree not ready. | 1925 // Verify active tree not ready. |
1920 Tile* some_active_tile = | 1926 Tile* some_active_tile = |
1921 active_layer_->HighResTiling()->AllTilesForTesting()[0]; | 1927 active_layer_->HighResTiling()->AllTilesForTesting()[0]; |
1922 EXPECT_FALSE(some_active_tile->IsReadyToDraw()); | 1928 EXPECT_FALSE(some_active_tile->IsReadyToDraw()); |
1923 | 1929 |
1924 // When high res are required, even if the active tree is not ready, | 1930 // When high res are required, even if the active tree is not ready, |
1925 // the high res tiles must be ready. | 1931 // the high res tiles must be ready. |
1926 host_impl_.SetRequiresHighResToDraw(); | 1932 host_impl_.SetRequiresHighResToDraw(); |
1927 | 1933 |
1928 pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); | 1934 pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); |
1929 pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting(); | 1935 pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting(); |
1930 | 1936 |
1931 AssertAllTilesRequired(pending_layer_->HighResTiling()); | 1937 AssertAllTilesRequired(pending_layer_->HighResTiling()); |
1932 AssertNoTilesRequired(pending_layer_->LowResTiling()); | 1938 AssertNoTilesRequired(pending_layer_->LowResTiling()); |
1933 } | 1939 } |
1934 | 1940 |
1935 TEST_F(PictureLayerImplTest, AllHighResRequiredEvenIfShared) { | 1941 TEST_F(PictureLayerImplTest, AllHighResRequiredEvenIfShared) { |
1936 gfx::Size layer_bounds(400, 400); | 1942 gfx::Size layer_bounds(400, 400); |
1937 gfx::Size tile_size(100, 100); | 1943 gfx::Size tile_size(100, 100); |
| 1944 |
| 1945 host_impl_.SetViewportSize(layer_bounds); |
| 1946 |
1938 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); | 1947 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); |
1939 | 1948 |
1940 CreateHighLowResAndSetAllTilesVisible(); | 1949 CreateHighLowResAndSetAllTilesVisible(); |
1941 | 1950 |
1942 Tile* some_active_tile = | 1951 Tile* some_active_tile = |
1943 active_layer_->HighResTiling()->AllTilesForTesting()[0]; | 1952 active_layer_->HighResTiling()->AllTilesForTesting()[0]; |
1944 EXPECT_FALSE(some_active_tile->IsReadyToDraw()); | 1953 EXPECT_FALSE(some_active_tile->IsReadyToDraw()); |
1945 | 1954 |
1946 // All tiles shared (no invalidation), so even though the active tree's | 1955 // All tiles shared (no invalidation), so even though the active tree's |
1947 // tiles aren't ready, the high res tiles are required for activation. | 1956 // tiles aren't ready, the high res tiles are required for activation. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); | 2011 pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); |
2003 pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting(); | 2012 pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting(); |
2004 | 2013 |
2005 AssertNoTilesRequired(pending_layer_->HighResTiling()); | 2014 AssertNoTilesRequired(pending_layer_->HighResTiling()); |
2006 AssertNoTilesRequired(pending_layer_->LowResTiling()); | 2015 AssertNoTilesRequired(pending_layer_->LowResTiling()); |
2007 } | 2016 } |
2008 | 2017 |
2009 TEST_F(PictureLayerImplTest, HighResRequiredIfActiveCantHaveTiles) { | 2018 TEST_F(PictureLayerImplTest, HighResRequiredIfActiveCantHaveTiles) { |
2010 gfx::Size layer_bounds(400, 400); | 2019 gfx::Size layer_bounds(400, 400); |
2011 gfx::Size tile_size(100, 100); | 2020 gfx::Size tile_size(100, 100); |
| 2021 |
| 2022 host_impl_.SetViewportSize(layer_bounds); |
| 2023 |
2012 scoped_refptr<FakePicturePileImpl> pending_pile = | 2024 scoped_refptr<FakePicturePileImpl> pending_pile = |
2013 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2025 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
2014 scoped_refptr<FakePicturePileImpl> active_pile = | 2026 scoped_refptr<FakePicturePileImpl> active_pile = |
2015 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); | 2027 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); |
2016 SetupTrees(pending_pile, active_pile); | 2028 SetupTrees(pending_pile, active_pile); |
2017 pending_layer_->set_fixed_tile_size(tile_size); | 2029 pending_layer_->set_fixed_tile_size(tile_size); |
2018 active_layer_->set_fixed_tile_size(tile_size); | 2030 active_layer_->set_fixed_tile_size(tile_size); |
2019 | 2031 |
2020 CreateHighLowResAndSetAllTilesVisible(); | 2032 CreateHighLowResAndSetAllTilesVisible(); |
2021 | 2033 |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2760 page_scale, | 2772 page_scale, |
2761 maximum_animation_scale, | 2773 maximum_animation_scale, |
2762 animating_transform); | 2774 animating_transform); |
2763 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); | 2775 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); |
2764 } | 2776 } |
2765 | 2777 |
2766 TEST_F(PictureLayerImplTest, LayerRasterTileIterator) { | 2778 TEST_F(PictureLayerImplTest, LayerRasterTileIterator) { |
2767 base::TimeTicks time_ticks; | 2779 base::TimeTicks time_ticks; |
2768 time_ticks += base::TimeDelta::FromMilliseconds(1); | 2780 time_ticks += base::TimeDelta::FromMilliseconds(1); |
2769 host_impl_.SetCurrentBeginFrameArgs( | 2781 host_impl_.SetCurrentBeginFrameArgs( |
2770 CreateBeginFrameArgsForTesting(time_ticks)); | 2782 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
2771 | 2783 |
2772 gfx::Size tile_size(100, 100); | 2784 gfx::Size tile_size(100, 100); |
2773 gfx::Size layer_bounds(1000, 1000); | 2785 gfx::Size layer_bounds(1000, 1000); |
2774 | 2786 |
2775 scoped_refptr<FakePicturePileImpl> pending_pile = | 2787 scoped_refptr<FakePicturePileImpl> pending_pile = |
2776 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2788 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
2777 | 2789 |
2778 SetupPendingTree(pending_pile); | 2790 SetupPendingTree(pending_pile); |
2779 | 2791 |
2780 ASSERT_TRUE(pending_layer_->CanHaveTilings()); | 2792 ASSERT_TRUE(pending_layer_->CanHaveTilings()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2830 EXPECT_TRUE(reached_prepaint); | 2842 EXPECT_TRUE(reached_prepaint); |
2831 EXPECT_EQ(0u, non_ideal_tile_count); | 2843 EXPECT_EQ(0u, non_ideal_tile_count); |
2832 EXPECT_EQ(0u, low_res_tile_count); | 2844 EXPECT_EQ(0u, low_res_tile_count); |
2833 EXPECT_EQ(16u, high_res_tile_count); | 2845 EXPECT_EQ(16u, high_res_tile_count); |
2834 EXPECT_EQ(low_res_tile_count + high_res_tile_count + non_ideal_tile_count, | 2846 EXPECT_EQ(low_res_tile_count + high_res_tile_count + non_ideal_tile_count, |
2835 unique_tiles.size()); | 2847 unique_tiles.size()); |
2836 | 2848 |
2837 // No NOW tiles. | 2849 // No NOW tiles. |
2838 time_ticks += base::TimeDelta::FromMilliseconds(200); | 2850 time_ticks += base::TimeDelta::FromMilliseconds(200); |
2839 host_impl_.SetCurrentBeginFrameArgs( | 2851 host_impl_.SetCurrentBeginFrameArgs( |
2840 CreateBeginFrameArgsForTesting(time_ticks)); | 2852 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
2841 | 2853 |
2842 pending_layer_->draw_properties().visible_content_rect = | 2854 pending_layer_->draw_properties().visible_content_rect = |
2843 gfx::Rect(1100, 1100, 500, 500); | 2855 gfx::Rect(1100, 1100, 500, 500); |
2844 bool resourceless_software_draw = false; | 2856 bool resourceless_software_draw = false; |
2845 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); | 2857 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); |
2846 | 2858 |
2847 unique_tiles.clear(); | 2859 unique_tiles.clear(); |
2848 high_res_tile_count = 0u; | 2860 high_res_tile_count = 0u; |
2849 for (it = PictureLayerImpl::LayerRasterTileIterator(pending_layer_, false); | 2861 for (it = PictureLayerImpl::LayerRasterTileIterator(pending_layer_, false); |
2850 it; | 2862 it; |
(...skipping 10 matching lines...) Expand all Loading... |
2861 high_res_tile_count += priority.resolution == HIGH_RESOLUTION; | 2873 high_res_tile_count += priority.resolution == HIGH_RESOLUTION; |
2862 | 2874 |
2863 unique_tiles.insert(tile); | 2875 unique_tiles.insert(tile); |
2864 } | 2876 } |
2865 | 2877 |
2866 EXPECT_EQ(16u, high_res_tile_count); | 2878 EXPECT_EQ(16u, high_res_tile_count); |
2867 EXPECT_EQ(high_res_tile_count, unique_tiles.size()); | 2879 EXPECT_EQ(high_res_tile_count, unique_tiles.size()); |
2868 | 2880 |
2869 time_ticks += base::TimeDelta::FromMilliseconds(200); | 2881 time_ticks += base::TimeDelta::FromMilliseconds(200); |
2870 host_impl_.SetCurrentBeginFrameArgs( | 2882 host_impl_.SetCurrentBeginFrameArgs( |
2871 CreateBeginFrameArgsForTesting(time_ticks)); | 2883 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
2872 | 2884 |
2873 pending_layer_->draw_properties().visible_content_rect = | 2885 pending_layer_->draw_properties().visible_content_rect = |
2874 gfx::Rect(0, 0, 500, 500); | 2886 gfx::Rect(0, 0, 500, 500); |
2875 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); | 2887 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); |
2876 | 2888 |
2877 std::vector<Tile*> high_res_tiles = high_res_tiling->AllTilesForTesting(); | 2889 std::vector<Tile*> high_res_tiles = high_res_tiling->AllTilesForTesting(); |
2878 for (std::vector<Tile*>::iterator tile_it = high_res_tiles.begin(); | 2890 for (std::vector<Tile*>::iterator tile_it = high_res_tiles.begin(); |
2879 tile_it != high_res_tiles.end(); | 2891 tile_it != high_res_tiles.end(); |
2880 ++tile_it) { | 2892 ++tile_it) { |
2881 Tile* tile = *tile_it; | 2893 Tile* tile = *tile_it; |
(...skipping 14 matching lines...) Expand all Loading... |
2896 non_ideal_tile_count += priority.resolution == NON_IDEAL_RESOLUTION; | 2908 non_ideal_tile_count += priority.resolution == NON_IDEAL_RESOLUTION; |
2897 low_res_tile_count += priority.resolution == LOW_RESOLUTION; | 2909 low_res_tile_count += priority.resolution == LOW_RESOLUTION; |
2898 high_res_tile_count += priority.resolution == HIGH_RESOLUTION; | 2910 high_res_tile_count += priority.resolution == HIGH_RESOLUTION; |
2899 } | 2911 } |
2900 | 2912 |
2901 EXPECT_EQ(0u, non_ideal_tile_count); | 2913 EXPECT_EQ(0u, non_ideal_tile_count); |
2902 EXPECT_EQ(1u, low_res_tile_count); | 2914 EXPECT_EQ(1u, low_res_tile_count); |
2903 EXPECT_EQ(0u, high_res_tile_count); | 2915 EXPECT_EQ(0u, high_res_tile_count); |
2904 } | 2916 } |
2905 | 2917 |
2906 TEST_F(PictureLayerImplTest, LayerEvictionTileIterator) { | 2918 TEST_F(PictureLayerImplTest, TilingSetEvictionQueue) { |
2907 gfx::Size tile_size(100, 100); | 2919 gfx::Size tile_size(100, 100); |
2908 gfx::Size layer_bounds(1000, 1000); | 2920 gfx::Size layer_bounds(1000, 1000); |
2909 | 2921 |
2910 scoped_refptr<FakePicturePileImpl> pending_pile = | 2922 scoped_refptr<FakePicturePileImpl> pending_pile = |
2911 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2923 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
2912 | 2924 |
2913 SetupPendingTree(pending_pile); | 2925 SetupPendingTree(pending_pile); |
2914 | 2926 |
2915 ASSERT_TRUE(pending_layer_->CanHaveTilings()); | 2927 ASSERT_TRUE(pending_layer_->CanHaveTilings()); |
2916 | 2928 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2957 mark_required = !mark_required; | 2969 mark_required = !mark_required; |
2958 } | 2970 } |
2959 } | 2971 } |
2960 | 2972 |
2961 // Sanity checks. | 2973 // Sanity checks. |
2962 EXPECT_EQ(91u, all_tiles.size()); | 2974 EXPECT_EQ(91u, all_tiles.size()); |
2963 EXPECT_EQ(91u, all_tiles_set.size()); | 2975 EXPECT_EQ(91u, all_tiles_set.size()); |
2964 EXPECT_GT(number_of_marked_tiles, 1u); | 2976 EXPECT_GT(number_of_marked_tiles, 1u); |
2965 EXPECT_GT(number_of_unmarked_tiles, 1u); | 2977 EXPECT_GT(number_of_unmarked_tiles, 1u); |
2966 | 2978 |
2967 // Empty iterator. | |
2968 PictureLayerImpl::LayerEvictionTileIterator it; | |
2969 EXPECT_FALSE(it); | |
2970 | |
2971 // Tiles don't have resources yet. | 2979 // Tiles don't have resources yet. |
2972 it = PictureLayerImpl::LayerEvictionTileIterator( | 2980 scoped_ptr<TilingSetEvictionQueue> queue = |
2973 pending_layer_, SAME_PRIORITY_FOR_BOTH_TREES); | 2981 pending_layer_->CreateEvictionQueue(SAME_PRIORITY_FOR_BOTH_TREES); |
2974 EXPECT_FALSE(it); | 2982 EXPECT_TRUE(queue->IsEmpty()); |
2975 | 2983 |
2976 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); | 2984 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); |
2977 | 2985 |
2978 std::set<Tile*> unique_tiles; | 2986 std::set<Tile*> unique_tiles; |
2979 float expected_scales[] = {2.0f, 0.3f, 0.7f, low_res_factor, 1.0f}; | 2987 float expected_scales[] = {2.0f, 0.3f, 0.7f, low_res_factor, 1.0f}; |
2980 size_t scale_index = 0; | 2988 size_t scale_index = 0; |
2981 bool reached_visible = false; | 2989 bool reached_visible = false; |
2982 Tile* last_tile = nullptr; | 2990 Tile* last_tile = nullptr; |
2983 for (it = PictureLayerImpl::LayerEvictionTileIterator( | 2991 queue = pending_layer_->CreateEvictionQueue(SAME_PRIORITY_FOR_BOTH_TREES); |
2984 pending_layer_, SAME_PRIORITY_FOR_BOTH_TREES); | 2992 while (!queue->IsEmpty()) { |
2985 it; | 2993 Tile* tile = queue->Top(); |
2986 ++it) { | |
2987 Tile* tile = *it; | |
2988 if (!last_tile) | 2994 if (!last_tile) |
2989 last_tile = tile; | 2995 last_tile = tile; |
2990 | 2996 |
2991 EXPECT_TRUE(tile); | 2997 EXPECT_TRUE(tile); |
2992 | 2998 |
2993 TilePriority priority = tile->priority(PENDING_TREE); | 2999 TilePriority priority = tile->priority(PENDING_TREE); |
2994 | 3000 |
2995 if (priority.priority_bin == TilePriority::NOW) { | 3001 if (priority.priority_bin == TilePriority::NOW) { |
2996 reached_visible = true; | 3002 reached_visible = true; |
2997 last_tile = tile; | 3003 last_tile = tile; |
(...skipping 17 matching lines...) Expand all Loading... |
3015 last_tile->required_for_activation() && | 3021 last_tile->required_for_activation() && |
3016 priority.priority_bin == | 3022 priority.priority_bin == |
3017 last_tile->priority(PENDING_TREE).priority_bin && | 3023 last_tile->priority(PENDING_TREE).priority_bin && |
3018 std::abs(tile->contents_scale() - last_tile->contents_scale()) < | 3024 std::abs(tile->contents_scale() - last_tile->contents_scale()) < |
3019 std::numeric_limits<float>::epsilon()) { | 3025 std::numeric_limits<float>::epsilon()) { |
3020 EXPECT_LE(priority.distance_to_visible, | 3026 EXPECT_LE(priority.distance_to_visible, |
3021 last_tile->priority(PENDING_TREE).distance_to_visible); | 3027 last_tile->priority(PENDING_TREE).distance_to_visible); |
3022 } | 3028 } |
3023 | 3029 |
3024 last_tile = tile; | 3030 last_tile = tile; |
| 3031 queue->Pop(); |
3025 } | 3032 } |
3026 | 3033 |
3027 EXPECT_TRUE(reached_visible); | 3034 EXPECT_TRUE(reached_visible); |
3028 EXPECT_EQ(65u, unique_tiles.size()); | 3035 EXPECT_EQ(65u, unique_tiles.size()); |
3029 | 3036 |
3030 scale_index = 0; | 3037 scale_index = 0; |
3031 bool reached_required = false; | 3038 bool reached_required = false; |
3032 for (; it; ++it) { | 3039 while (!queue->IsEmpty()) { |
3033 Tile* tile = *it; | 3040 Tile* tile = queue->Top(); |
3034 EXPECT_TRUE(tile); | 3041 EXPECT_TRUE(tile); |
3035 | 3042 |
3036 TilePriority priority = tile->priority(PENDING_TREE); | 3043 TilePriority priority = tile->priority(PENDING_TREE); |
3037 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); | 3044 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); |
3038 | 3045 |
3039 if (reached_required) { | 3046 if (reached_required) { |
3040 EXPECT_TRUE(tile->required_for_activation()); | 3047 EXPECT_TRUE(tile->required_for_activation()); |
3041 } else if (tile->required_for_activation()) { | 3048 } else if (tile->required_for_activation()) { |
3042 reached_required = true; | 3049 reached_required = true; |
3043 scale_index = 0; | 3050 scale_index = 0; |
3044 } | 3051 } |
3045 | 3052 |
3046 while (std::abs(tile->contents_scale() - expected_scales[scale_index]) > | 3053 while (std::abs(tile->contents_scale() - expected_scales[scale_index]) > |
3047 std::numeric_limits<float>::epsilon()) { | 3054 std::numeric_limits<float>::epsilon()) { |
3048 ++scale_index; | 3055 ++scale_index; |
3049 ASSERT_LT(scale_index, arraysize(expected_scales)); | 3056 ASSERT_LT(scale_index, arraysize(expected_scales)); |
3050 } | 3057 } |
3051 | 3058 |
3052 EXPECT_FLOAT_EQ(tile->contents_scale(), expected_scales[scale_index]); | 3059 EXPECT_FLOAT_EQ(tile->contents_scale(), expected_scales[scale_index]); |
3053 unique_tiles.insert(tile); | 3060 unique_tiles.insert(tile); |
| 3061 queue->Pop(); |
3054 } | 3062 } |
3055 | 3063 |
3056 EXPECT_TRUE(reached_required); | 3064 EXPECT_TRUE(reached_required); |
3057 EXPECT_EQ(all_tiles_set.size(), unique_tiles.size()); | 3065 EXPECT_EQ(all_tiles_set.size(), unique_tiles.size()); |
3058 } | 3066 } |
3059 | 3067 |
3060 TEST_F(PictureLayerImplTest, Occlusion) { | 3068 TEST_F(PictureLayerImplTest, Occlusion) { |
3061 gfx::Size tile_size(102, 102); | 3069 gfx::Size tile_size(102, 102); |
3062 gfx::Size layer_bounds(1000, 1000); | 3070 gfx::Size layer_bounds(1000, 1000); |
3063 gfx::Size viewport_size(1000, 1000); | 3071 gfx::Size viewport_size(1000, 1000); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3148 page_scale, | 3156 page_scale, |
3149 maximum_animation_scale, | 3157 maximum_animation_scale, |
3150 animating_transform); | 3158 animating_transform); |
3151 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); | 3159 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); |
3152 } | 3160 } |
3153 | 3161 |
3154 TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) { | 3162 TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) { |
3155 gfx::Size tile_size(100, 100); | 3163 gfx::Size tile_size(100, 100); |
3156 gfx::Size layer_bounds(1000, 1000); | 3164 gfx::Size layer_bounds(1000, 1000); |
3157 | 3165 |
| 3166 host_impl_.SetViewportSize(layer_bounds); |
| 3167 |
3158 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); | 3168 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); |
3159 | 3169 |
3160 // Make sure some tiles are not shared. | 3170 // Make sure some tiles are not shared. |
3161 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size)); | 3171 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size)); |
3162 | 3172 |
3163 CreateHighLowResAndSetAllTilesVisible(); | 3173 CreateHighLowResAndSetAllTilesVisible(); |
3164 active_layer_->SetAllTilesReady(); | 3174 active_layer_->SetAllTilesReady(); |
3165 | 3175 |
3166 // All pending layer tiles required are not ready. | 3176 // All pending layer tiles required are not ready. |
3167 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); | 3177 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
3168 | 3178 |
3169 // Initialize all low-res tiles. | 3179 // Initialize all low-res tiles. |
3170 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->LowResTiling()); | 3180 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->LowResTiling()); |
3171 | 3181 |
3172 // Low-res tiles should not be enough. | 3182 // Low-res tiles should not be enough. |
3173 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); | 3183 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
3174 | 3184 |
3175 // Initialize remaining tiles. | 3185 // Initialize remaining tiles. |
3176 pending_layer_->SetAllTilesReady(); | 3186 pending_layer_->SetAllTilesReady(); |
3177 | 3187 |
3178 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); | 3188 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
3179 } | 3189 } |
3180 | 3190 |
3181 TEST_F(PictureLayerImplTest, HighResReadyToDrawEnoughToActivate) { | 3191 TEST_F(PictureLayerImplTest, HighResReadyToDrawEnoughToActivate) { |
3182 gfx::Size tile_size(100, 100); | 3192 gfx::Size tile_size(100, 100); |
3183 gfx::Size layer_bounds(1000, 1000); | 3193 gfx::Size layer_bounds(1000, 1000); |
3184 | 3194 |
| 3195 host_impl_.SetViewportSize(layer_bounds); |
| 3196 |
3185 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); | 3197 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); |
3186 | 3198 |
3187 // Make sure some tiles are not shared. | 3199 // Make sure some tiles are not shared. |
3188 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size)); | 3200 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size)); |
3189 | 3201 |
3190 CreateHighLowResAndSetAllTilesVisible(); | 3202 CreateHighLowResAndSetAllTilesVisible(); |
3191 active_layer_->SetAllTilesReady(); | 3203 active_layer_->SetAllTilesReady(); |
3192 | 3204 |
3193 // All pending layer tiles required are not ready. | 3205 // All pending layer tiles required are not ready. |
3194 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); | 3206 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
3195 | 3207 |
3196 // Initialize all high-res tiles. | 3208 // Initialize all high-res tiles. |
3197 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling()); | 3209 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling()); |
3198 | 3210 |
3199 // High-res tiles should be enough, since they cover everything visible. | 3211 // High-res tiles should be enough, since they cover everything visible. |
3200 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); | 3212 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
3201 } | 3213 } |
3202 | 3214 |
3203 TEST_F(PictureLayerImplTest, | 3215 TEST_F(PictureLayerImplTest, |
3204 SharedActiveHighResReadyAndPendingLowResReadyNotEnoughToActivate) { | 3216 SharedActiveHighResReadyAndPendingLowResReadyNotEnoughToActivate) { |
3205 gfx::Size tile_size(100, 100); | 3217 gfx::Size tile_size(100, 100); |
3206 gfx::Size layer_bounds(1000, 1000); | 3218 gfx::Size layer_bounds(1000, 1000); |
3207 | 3219 |
| 3220 host_impl_.SetViewportSize(layer_bounds); |
| 3221 |
3208 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); | 3222 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); |
3209 | 3223 |
3210 // Make sure some tiles are not shared. | 3224 // Make sure some tiles are not shared. |
3211 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size)); | 3225 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size)); |
3212 | 3226 |
3213 CreateHighLowResAndSetAllTilesVisible(); | 3227 CreateHighLowResAndSetAllTilesVisible(); |
3214 | 3228 |
3215 // Initialize all high-res tiles in the active layer. | 3229 // Initialize all high-res tiles in the active layer. |
3216 active_layer_->SetAllTilesReadyInTiling(active_layer_->HighResTiling()); | 3230 active_layer_->SetAllTilesReadyInTiling(active_layer_->HighResTiling()); |
3217 // And all the low-res tiles in the pending layer. | 3231 // And all the low-res tiles in the pending layer. |
3218 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->LowResTiling()); | 3232 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->LowResTiling()); |
3219 | 3233 |
3220 // The unshared high-res tiles are not ready, so we cannot activate. | 3234 // The unshared high-res tiles are not ready, so we cannot activate. |
3221 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); | 3235 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
3222 | 3236 |
3223 // When the unshared pending high-res tiles are ready, we can activate. | 3237 // When the unshared pending high-res tiles are ready, we can activate. |
3224 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling()); | 3238 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling()); |
3225 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); | 3239 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
3226 } | 3240 } |
3227 | 3241 |
3228 TEST_F(PictureLayerImplTest, SharedActiveHighResReadyNotEnoughToActivate) { | 3242 TEST_F(PictureLayerImplTest, SharedActiveHighResReadyNotEnoughToActivate) { |
3229 gfx::Size tile_size(100, 100); | 3243 gfx::Size tile_size(100, 100); |
3230 gfx::Size layer_bounds(1000, 1000); | 3244 gfx::Size layer_bounds(1000, 1000); |
3231 | 3245 |
| 3246 host_impl_.SetViewportSize(layer_bounds); |
| 3247 |
3232 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); | 3248 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); |
3233 | 3249 |
3234 // Make sure some tiles are not shared. | 3250 // Make sure some tiles are not shared. |
3235 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size)); | 3251 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size)); |
3236 | 3252 |
3237 CreateHighLowResAndSetAllTilesVisible(); | 3253 CreateHighLowResAndSetAllTilesVisible(); |
3238 | 3254 |
3239 // Initialize all high-res tiles in the active layer. | 3255 // Initialize all high-res tiles in the active layer. |
3240 active_layer_->SetAllTilesReadyInTiling(active_layer_->HighResTiling()); | 3256 active_layer_->SetAllTilesReadyInTiling(active_layer_->HighResTiling()); |
3241 | 3257 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3309 1.f, // maximum animation scale | 3325 1.f, // maximum animation scale |
3310 false); | 3326 false); |
3311 ASSERT_EQ(3u, pending_layer_->tilings()->num_tilings()); | 3327 ASSERT_EQ(3u, pending_layer_->tilings()->num_tilings()); |
3312 EXPECT_FLOAT_EQ(7.26f, | 3328 EXPECT_FLOAT_EQ(7.26f, |
3313 pending_layer_->tilings()->tiling_at(0)->contents_scale()); | 3329 pending_layer_->tilings()->tiling_at(0)->contents_scale()); |
3314 } | 3330 } |
3315 | 3331 |
3316 TEST_F(NoLowResPictureLayerImplTest, AllHighResRequiredEvenIfShared) { | 3332 TEST_F(NoLowResPictureLayerImplTest, AllHighResRequiredEvenIfShared) { |
3317 gfx::Size layer_bounds(400, 400); | 3333 gfx::Size layer_bounds(400, 400); |
3318 gfx::Size tile_size(100, 100); | 3334 gfx::Size tile_size(100, 100); |
| 3335 |
| 3336 host_impl_.SetViewportSize(layer_bounds); |
| 3337 |
3319 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); | 3338 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); |
3320 | 3339 |
3321 CreateHighLowResAndSetAllTilesVisible(); | 3340 CreateHighLowResAndSetAllTilesVisible(); |
3322 | 3341 |
3323 Tile* some_active_tile = | 3342 Tile* some_active_tile = |
3324 active_layer_->HighResTiling()->AllTilesForTesting()[0]; | 3343 active_layer_->HighResTiling()->AllTilesForTesting()[0]; |
3325 EXPECT_FALSE(some_active_tile->IsReadyToDraw()); | 3344 EXPECT_FALSE(some_active_tile->IsReadyToDraw()); |
3326 | 3345 |
3327 // All tiles shared (no invalidation), so even though the active tree's | 3346 // All tiles shared (no invalidation), so even though the active tree's |
3328 // tiles aren't ready, there is nothing required. | 3347 // tiles aren't ready, there is nothing required. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3367 | 3386 |
3368 AssertNoTilesRequired(pending_layer_->HighResTiling()); | 3387 AssertNoTilesRequired(pending_layer_->HighResTiling()); |
3369 if (host_impl_.settings().create_low_res_tiling) | 3388 if (host_impl_.settings().create_low_res_tiling) |
3370 AssertNoTilesRequired(pending_layer_->LowResTiling()); | 3389 AssertNoTilesRequired(pending_layer_->LowResTiling()); |
3371 } | 3390 } |
3372 | 3391 |
3373 TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) { | 3392 TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) { |
3374 base::TimeTicks time_ticks; | 3393 base::TimeTicks time_ticks; |
3375 time_ticks += base::TimeDelta::FromMilliseconds(1); | 3394 time_ticks += base::TimeDelta::FromMilliseconds(1); |
3376 host_impl_.SetCurrentBeginFrameArgs( | 3395 host_impl_.SetCurrentBeginFrameArgs( |
3377 CreateBeginFrameArgsForTesting(time_ticks)); | 3396 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
3378 | 3397 |
3379 gfx::Size tile_size(100, 100); | 3398 gfx::Size tile_size(100, 100); |
3380 gfx::Size layer_bounds(400, 400); | 3399 gfx::Size layer_bounds(400, 400); |
3381 | 3400 |
3382 scoped_refptr<FakePicturePileImpl> pending_pile = | 3401 scoped_refptr<FakePicturePileImpl> pending_pile = |
3383 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 3402 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
3384 scoped_refptr<FakePicturePileImpl> active_pile = | 3403 scoped_refptr<FakePicturePileImpl> active_pile = |
3385 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 3404 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
3386 | 3405 |
3387 SetupTrees(pending_pile, active_pile); | 3406 SetupTrees(pending_pile, active_pile); |
(...skipping 21 matching lines...) Expand all Loading... |
3409 gfx::Rect visible_rect_for_tile_priority = | 3428 gfx::Rect visible_rect_for_tile_priority = |
3410 active_layer_->visible_rect_for_tile_priority(); | 3429 active_layer_->visible_rect_for_tile_priority(); |
3411 EXPECT_FALSE(visible_rect_for_tile_priority.IsEmpty()); | 3430 EXPECT_FALSE(visible_rect_for_tile_priority.IsEmpty()); |
3412 gfx::Transform screen_space_transform_for_tile_priority = | 3431 gfx::Transform screen_space_transform_for_tile_priority = |
3413 active_layer_->screen_space_transform(); | 3432 active_layer_->screen_space_transform(); |
3414 | 3433 |
3415 // Expand viewport and set it as invalid for prioritizing tiles. | 3434 // Expand viewport and set it as invalid for prioritizing tiles. |
3416 // Should update viewport and transform, but not update visible rect. | 3435 // Should update viewport and transform, but not update visible rect. |
3417 time_ticks += base::TimeDelta::FromMilliseconds(200); | 3436 time_ticks += base::TimeDelta::FromMilliseconds(200); |
3418 host_impl_.SetCurrentBeginFrameArgs( | 3437 host_impl_.SetCurrentBeginFrameArgs( |
3419 CreateBeginFrameArgsForTesting(time_ticks)); | 3438 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
3420 resourceless_software_draw = true; | 3439 resourceless_software_draw = true; |
3421 viewport = gfx::ScaleToEnclosingRect(viewport, 2); | 3440 viewport = gfx::ScaleToEnclosingRect(viewport, 2); |
3422 transform.Translate(1.f, 1.f); | 3441 transform.Translate(1.f, 1.f); |
3423 active_layer_->draw_properties().visible_content_rect = viewport; | 3442 active_layer_->draw_properties().visible_content_rect = viewport; |
3424 active_layer_->draw_properties().screen_space_transform = transform; | 3443 active_layer_->draw_properties().screen_space_transform = transform; |
3425 host_impl_.SetExternalDrawConstraints(transform, | 3444 host_impl_.SetExternalDrawConstraints(transform, |
3426 viewport, | 3445 viewport, |
3427 viewport, | 3446 viewport, |
3428 viewport, | 3447 viewport, |
3429 transform, | 3448 transform, |
3430 resourceless_software_draw); | 3449 resourceless_software_draw); |
3431 active_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); | 3450 active_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); |
3432 | 3451 |
3433 // Transform for tile priority is updated. | 3452 // Transform for tile priority is updated. |
3434 EXPECT_TRANSFORMATION_MATRIX_EQ(transform, | 3453 EXPECT_TRANSFORMATION_MATRIX_EQ(transform, |
3435 active_layer_->screen_space_transform()); | 3454 active_layer_->screen_space_transform()); |
3436 // Visible rect for tile priority retains old value. | 3455 // Visible rect for tile priority retains old value. |
3437 EXPECT_EQ(visible_rect_for_tile_priority, | 3456 EXPECT_EQ(visible_rect_for_tile_priority, |
3438 active_layer_->visible_rect_for_tile_priority()); | 3457 active_layer_->visible_rect_for_tile_priority()); |
3439 | 3458 |
3440 // Keep expanded viewport but mark it valid. Should update tile viewport. | 3459 // Keep expanded viewport but mark it valid. Should update tile viewport. |
3441 time_ticks += base::TimeDelta::FromMilliseconds(200); | 3460 time_ticks += base::TimeDelta::FromMilliseconds(200); |
3442 host_impl_.SetCurrentBeginFrameArgs( | 3461 host_impl_.SetCurrentBeginFrameArgs( |
3443 CreateBeginFrameArgsForTesting(time_ticks)); | 3462 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
3444 resourceless_software_draw = false; | 3463 resourceless_software_draw = false; |
3445 host_impl_.SetExternalDrawConstraints(transform, | 3464 host_impl_.SetExternalDrawConstraints(transform, |
3446 viewport, | 3465 viewport, |
3447 viewport, | 3466 viewport, |
3448 viewport, | 3467 viewport, |
3449 transform, | 3468 transform, |
3450 resourceless_software_draw); | 3469 resourceless_software_draw); |
3451 active_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); | 3470 active_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); |
3452 | 3471 |
3453 EXPECT_TRANSFORMATION_MATRIX_EQ(transform, | 3472 EXPECT_TRANSFORMATION_MATRIX_EQ(transform, |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3670 false); | 3689 false); |
3671 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings()); | 3690 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings()); |
3672 } | 3691 } |
3673 | 3692 |
3674 TEST_F(PictureLayerImplTest, SharedQuadStateContainsMaxTilingScale) { | 3693 TEST_F(PictureLayerImplTest, SharedQuadStateContainsMaxTilingScale) { |
3675 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 3694 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
3676 | 3695 |
3677 gfx::Size tile_size(400, 400); | 3696 gfx::Size tile_size(400, 400); |
3678 gfx::Size layer_bounds(1000, 2000); | 3697 gfx::Size layer_bounds(1000, 2000); |
3679 | 3698 |
| 3699 host_impl_.SetViewportSize(layer_bounds); |
| 3700 |
3680 scoped_refptr<FakePicturePileImpl> pending_pile = | 3701 scoped_refptr<FakePicturePileImpl> pending_pile = |
3681 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 3702 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
3682 scoped_refptr<FakePicturePileImpl> active_pile = | 3703 scoped_refptr<FakePicturePileImpl> active_pile = |
3683 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 3704 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
3684 | 3705 |
3685 SetupTrees(pending_pile, active_pile); | 3706 SetupTrees(pending_pile, active_pile); |
3686 | 3707 |
3687 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 2.5f, 1.f, 1.f, 1.f, false); | 3708 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 2.5f, 1.f, 1.f, 1.f, false); |
3688 host_impl_.pending_tree()->UpdateDrawProperties(); | 3709 host_impl_.pending_tree()->UpdateDrawProperties(); |
3689 | 3710 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3834 | 3855 |
3835 void VerifyEvictionConsidersOcclusion( | 3856 void VerifyEvictionConsidersOcclusion( |
3836 PictureLayerImpl* layer, | 3857 PictureLayerImpl* layer, |
3837 size_t expected_occluded_tile_count[NUM_TREE_PRIORITIES]) { | 3858 size_t expected_occluded_tile_count[NUM_TREE_PRIORITIES]) { |
3838 for (int priority_count = 0; priority_count < NUM_TREE_PRIORITIES; | 3859 for (int priority_count = 0; priority_count < NUM_TREE_PRIORITIES; |
3839 ++priority_count) { | 3860 ++priority_count) { |
3840 TreePriority tree_priority = static_cast<TreePriority>(priority_count); | 3861 TreePriority tree_priority = static_cast<TreePriority>(priority_count); |
3841 size_t occluded_tile_count = 0u; | 3862 size_t occluded_tile_count = 0u; |
3842 Tile* last_tile = nullptr; | 3863 Tile* last_tile = nullptr; |
3843 | 3864 |
3844 for (PictureLayerImpl::LayerEvictionTileIterator it = | 3865 scoped_ptr<TilingSetEvictionQueue> queue = |
3845 PictureLayerImpl::LayerEvictionTileIterator(layer, | 3866 layer->CreateEvictionQueue(tree_priority); |
3846 tree_priority); | 3867 while (!queue->IsEmpty()) { |
3847 it; | 3868 Tile* tile = queue->Top(); |
3848 ++it) { | |
3849 Tile* tile = *it; | |
3850 if (!last_tile) | 3869 if (!last_tile) |
3851 last_tile = tile; | 3870 last_tile = tile; |
3852 | 3871 |
3853 // The only way we will encounter an occluded tile after an unoccluded | 3872 // The only way we will encounter an occluded tile after an unoccluded |
3854 // tile is if the priorty bin decreased, the tile is required for | 3873 // tile is if the priorty bin decreased, the tile is required for |
3855 // activation, or the scale changed. | 3874 // activation, or the scale changed. |
3856 bool tile_is_occluded = | 3875 bool tile_is_occluded = |
3857 tile->is_occluded_for_tree_priority(tree_priority); | 3876 tile->is_occluded_for_tree_priority(tree_priority); |
3858 if (tile_is_occluded) { | 3877 if (tile_is_occluded) { |
3859 occluded_tile_count++; | 3878 occluded_tile_count++; |
3860 | 3879 |
3861 bool last_tile_is_occluded = | 3880 bool last_tile_is_occluded = |
3862 last_tile->is_occluded_for_tree_priority(tree_priority); | 3881 last_tile->is_occluded_for_tree_priority(tree_priority); |
3863 if (!last_tile_is_occluded) { | 3882 if (!last_tile_is_occluded) { |
3864 TilePriority::PriorityBin tile_priority_bin = | 3883 TilePriority::PriorityBin tile_priority_bin = |
3865 tile->priority_for_tree_priority(tree_priority).priority_bin; | 3884 tile->priority_for_tree_priority(tree_priority).priority_bin; |
3866 TilePriority::PriorityBin last_tile_priority_bin = | 3885 TilePriority::PriorityBin last_tile_priority_bin = |
3867 last_tile->priority_for_tree_priority(tree_priority) | 3886 last_tile->priority_for_tree_priority(tree_priority) |
3868 .priority_bin; | 3887 .priority_bin; |
3869 | 3888 |
3870 EXPECT_TRUE( | 3889 EXPECT_TRUE( |
3871 (tile_priority_bin < last_tile_priority_bin) || | 3890 (tile_priority_bin < last_tile_priority_bin) || |
3872 tile->required_for_activation() || | 3891 tile->required_for_activation() || |
3873 (tile->contents_scale() != last_tile->contents_scale())); | 3892 (tile->contents_scale() != last_tile->contents_scale())); |
3874 } | 3893 } |
3875 } | 3894 } |
3876 last_tile = tile; | 3895 last_tile = tile; |
| 3896 queue->Pop(); |
3877 } | 3897 } |
3878 EXPECT_EQ(expected_occluded_tile_count[priority_count], | 3898 EXPECT_EQ(expected_occluded_tile_count[priority_count], |
3879 occluded_tile_count); | 3899 occluded_tile_count); |
3880 } | 3900 } |
3881 } | 3901 } |
3882 }; | 3902 }; |
3883 | 3903 |
3884 TEST_F(OcclusionTrackingPictureLayerImplTest, | 3904 TEST_F(OcclusionTrackingPictureLayerImplTest, |
3885 OccludedTilesSkippedDuringRasterization) { | 3905 OccludedTilesSkippedDuringRasterization) { |
3886 base::TimeTicks time_ticks; | 3906 base::TimeTicks time_ticks; |
3887 time_ticks += base::TimeDelta::FromMilliseconds(1); | 3907 time_ticks += base::TimeDelta::FromMilliseconds(1); |
3888 host_impl_.SetCurrentBeginFrameArgs( | 3908 host_impl_.SetCurrentBeginFrameArgs( |
3889 CreateBeginFrameArgsForTesting(time_ticks)); | 3909 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
3890 | 3910 |
3891 gfx::Size tile_size(102, 102); | 3911 gfx::Size tile_size(102, 102); |
3892 gfx::Size layer_bounds(1000, 1000); | 3912 gfx::Size layer_bounds(1000, 1000); |
3893 gfx::Size viewport_size(500, 500); | 3913 gfx::Size viewport_size(500, 500); |
3894 gfx::Point occluding_layer_position(310, 0); | 3914 gfx::Point occluding_layer_position(310, 0); |
3895 | 3915 |
3896 scoped_refptr<FakePicturePileImpl> pending_pile = | 3916 scoped_refptr<FakePicturePileImpl> pending_pile = |
3897 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 3917 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
3898 SetupPendingTree(pending_pile); | 3918 SetupPendingTree(pending_pile); |
3899 pending_layer_->set_fixed_tile_size(tile_size); | 3919 pending_layer_->set_fixed_tile_size(tile_size); |
(...skipping 25 matching lines...) Expand all Loading... |
3925 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 1)); | 3945 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 1)); |
3926 LayerImpl* layer1 = pending_layer_->children()[0]; | 3946 LayerImpl* layer1 = pending_layer_->children()[0]; |
3927 layer1->SetBounds(layer_bounds); | 3947 layer1->SetBounds(layer_bounds); |
3928 layer1->SetContentBounds(layer_bounds); | 3948 layer1->SetContentBounds(layer_bounds); |
3929 layer1->SetDrawsContent(true); | 3949 layer1->SetDrawsContent(true); |
3930 layer1->SetContentsOpaque(true); | 3950 layer1->SetContentsOpaque(true); |
3931 layer1->SetPosition(occluding_layer_position); | 3951 layer1->SetPosition(occluding_layer_position); |
3932 | 3952 |
3933 time_ticks += base::TimeDelta::FromMilliseconds(200); | 3953 time_ticks += base::TimeDelta::FromMilliseconds(200); |
3934 host_impl_.SetCurrentBeginFrameArgs( | 3954 host_impl_.SetCurrentBeginFrameArgs( |
3935 CreateBeginFrameArgsForTesting(time_ticks)); | 3955 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
3936 host_impl_.pending_tree()->UpdateDrawProperties(); | 3956 host_impl_.pending_tree()->UpdateDrawProperties(); |
3937 | 3957 |
3938 unoccluded_tile_count = 0; | 3958 unoccluded_tile_count = 0; |
3939 for (PictureLayerImpl::LayerRasterTileIterator it = | 3959 for (PictureLayerImpl::LayerRasterTileIterator it = |
3940 PictureLayerImpl::LayerRasterTileIterator(pending_layer_, false); | 3960 PictureLayerImpl::LayerRasterTileIterator(pending_layer_, false); |
3941 it; | 3961 it; |
3942 ++it) { | 3962 ++it) { |
3943 Tile* tile = *it; | 3963 Tile* tile = *it; |
3944 | 3964 |
3945 EXPECT_FALSE(tile->is_occluded(PENDING_TREE)); | 3965 EXPECT_FALSE(tile->is_occluded(PENDING_TREE)); |
3946 | 3966 |
3947 bool tile_is_visible = | 3967 bool tile_is_visible = |
3948 tile->content_rect().Intersects(pending_layer_->visible_content_rect()); | 3968 tile->content_rect().Intersects(pending_layer_->visible_content_rect()); |
3949 if (tile_is_visible) | 3969 if (tile_is_visible) |
3950 unoccluded_tile_count++; | 3970 unoccluded_tile_count++; |
3951 } | 3971 } |
3952 EXPECT_EQ(20, unoccluded_tile_count); | 3972 EXPECT_EQ(20, unoccluded_tile_count); |
3953 | 3973 |
3954 // Full occlusion. | 3974 // Full occlusion. |
3955 layer1->SetPosition(gfx::Point(0, 0)); | 3975 layer1->SetPosition(gfx::Point(0, 0)); |
3956 | 3976 |
3957 time_ticks += base::TimeDelta::FromMilliseconds(200); | 3977 time_ticks += base::TimeDelta::FromMilliseconds(200); |
3958 host_impl_.SetCurrentBeginFrameArgs( | 3978 host_impl_.SetCurrentBeginFrameArgs( |
3959 CreateBeginFrameArgsForTesting(time_ticks)); | 3979 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
3960 host_impl_.pending_tree()->UpdateDrawProperties(); | 3980 host_impl_.pending_tree()->UpdateDrawProperties(); |
3961 | 3981 |
3962 unoccluded_tile_count = 0; | 3982 unoccluded_tile_count = 0; |
3963 for (PictureLayerImpl::LayerRasterTileIterator it = | 3983 for (PictureLayerImpl::LayerRasterTileIterator it = |
3964 PictureLayerImpl::LayerRasterTileIterator(pending_layer_, false); | 3984 PictureLayerImpl::LayerRasterTileIterator(pending_layer_, false); |
3965 it; | 3985 it; |
3966 ++it) { | 3986 ++it) { |
3967 Tile* tile = *it; | 3987 Tile* tile = *it; |
3968 | 3988 |
3969 EXPECT_FALSE(tile->is_occluded(PENDING_TREE)); | 3989 EXPECT_FALSE(tile->is_occluded(PENDING_TREE)); |
3970 | 3990 |
3971 bool tile_is_visible = | 3991 bool tile_is_visible = |
3972 tile->content_rect().Intersects(pending_layer_->visible_content_rect()); | 3992 tile->content_rect().Intersects(pending_layer_->visible_content_rect()); |
3973 if (tile_is_visible) | 3993 if (tile_is_visible) |
3974 unoccluded_tile_count++; | 3994 unoccluded_tile_count++; |
3975 } | 3995 } |
3976 EXPECT_EQ(unoccluded_tile_count, 0); | 3996 EXPECT_EQ(unoccluded_tile_count, 0); |
3977 } | 3997 } |
3978 | 3998 |
3979 TEST_F(OcclusionTrackingPictureLayerImplTest, | 3999 TEST_F(OcclusionTrackingPictureLayerImplTest, |
3980 OccludedTilesNotMarkedAsRequired) { | 4000 OccludedTilesNotMarkedAsRequired) { |
3981 base::TimeTicks time_ticks; | 4001 base::TimeTicks time_ticks; |
3982 time_ticks += base::TimeDelta::FromMilliseconds(1); | 4002 time_ticks += base::TimeDelta::FromMilliseconds(1); |
3983 host_impl_.SetCurrentBeginFrameArgs( | 4003 host_impl_.SetCurrentBeginFrameArgs( |
3984 CreateBeginFrameArgsForTesting(time_ticks)); | 4004 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
3985 | 4005 |
3986 gfx::Size tile_size(102, 102); | 4006 gfx::Size tile_size(102, 102); |
3987 gfx::Size layer_bounds(1000, 1000); | 4007 gfx::Size layer_bounds(1000, 1000); |
3988 gfx::Size viewport_size(500, 500); | 4008 gfx::Size viewport_size(500, 500); |
3989 gfx::Point occluding_layer_position(310, 0); | 4009 gfx::Point occluding_layer_position(310, 0); |
3990 | 4010 |
3991 scoped_refptr<FakePicturePileImpl> pending_pile = | 4011 scoped_refptr<FakePicturePileImpl> pending_pile = |
3992 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 4012 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
3993 SetupPendingTree(pending_pile); | 4013 SetupPendingTree(pending_pile); |
3994 pending_layer_->set_fixed_tile_size(tile_size); | 4014 pending_layer_->set_fixed_tile_size(tile_size); |
(...skipping 30 matching lines...) Expand all Loading... |
4025 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 1)); | 4045 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 1)); |
4026 LayerImpl* layer1 = pending_layer_->children()[0]; | 4046 LayerImpl* layer1 = pending_layer_->children()[0]; |
4027 layer1->SetBounds(layer_bounds); | 4047 layer1->SetBounds(layer_bounds); |
4028 layer1->SetContentBounds(layer_bounds); | 4048 layer1->SetContentBounds(layer_bounds); |
4029 layer1->SetDrawsContent(true); | 4049 layer1->SetDrawsContent(true); |
4030 layer1->SetContentsOpaque(true); | 4050 layer1->SetContentsOpaque(true); |
4031 layer1->SetPosition(occluding_layer_position); | 4051 layer1->SetPosition(occluding_layer_position); |
4032 | 4052 |
4033 time_ticks += base::TimeDelta::FromMilliseconds(200); | 4053 time_ticks += base::TimeDelta::FromMilliseconds(200); |
4034 host_impl_.SetCurrentBeginFrameArgs( | 4054 host_impl_.SetCurrentBeginFrameArgs( |
4035 CreateBeginFrameArgsForTesting(time_ticks)); | 4055 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
4036 host_impl_.pending_tree()->UpdateDrawProperties(); | 4056 host_impl_.pending_tree()->UpdateDrawProperties(); |
4037 | 4057 |
4038 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { | 4058 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { |
4039 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); | 4059 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); |
4040 tiling->UpdateAllTilePrioritiesForTesting(); | 4060 tiling->UpdateAllTilePrioritiesForTesting(); |
4041 | 4061 |
4042 occluded_tile_count = 0; | 4062 occluded_tile_count = 0; |
4043 for (PictureLayerTiling::CoverageIterator iter( | 4063 for (PictureLayerTiling::CoverageIterator iter( |
4044 tiling, | 4064 tiling, |
4045 pending_layer_->contents_scale_x(), | 4065 pending_layer_->contents_scale_x(), |
(...skipping 19 matching lines...) Expand all Loading... |
4065 default: | 4085 default: |
4066 NOTREACHED(); | 4086 NOTREACHED(); |
4067 } | 4087 } |
4068 } | 4088 } |
4069 | 4089 |
4070 // Full occlusion. | 4090 // Full occlusion. |
4071 layer1->SetPosition(gfx::PointF(0, 0)); | 4091 layer1->SetPosition(gfx::PointF(0, 0)); |
4072 | 4092 |
4073 time_ticks += base::TimeDelta::FromMilliseconds(200); | 4093 time_ticks += base::TimeDelta::FromMilliseconds(200); |
4074 host_impl_.SetCurrentBeginFrameArgs( | 4094 host_impl_.SetCurrentBeginFrameArgs( |
4075 CreateBeginFrameArgsForTesting(time_ticks)); | 4095 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
4076 host_impl_.pending_tree()->UpdateDrawProperties(); | 4096 host_impl_.pending_tree()->UpdateDrawProperties(); |
4077 | 4097 |
4078 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { | 4098 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { |
4079 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); | 4099 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); |
4080 tiling->UpdateAllTilePrioritiesForTesting(); | 4100 tiling->UpdateAllTilePrioritiesForTesting(); |
4081 | 4101 |
4082 occluded_tile_count = 0; | 4102 occluded_tile_count = 0; |
4083 for (PictureLayerTiling::CoverageIterator iter( | 4103 for (PictureLayerTiling::CoverageIterator iter( |
4084 tiling, | 4104 tiling, |
4085 pending_layer_->contents_scale_x(), | 4105 pending_layer_->contents_scale_x(), |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4494 // Make an empty pending tree. | 4514 // Make an empty pending tree. |
4495 host_impl_.CreatePendingTree(); | 4515 host_impl_.CreatePendingTree(); |
4496 host_impl_.pending_tree()->DetachLayerTree(); | 4516 host_impl_.pending_tree()->DetachLayerTree(); |
4497 EXPECT_FALSE(active_layer_->GetRecycledTwinLayer()); | 4517 EXPECT_FALSE(active_layer_->GetRecycledTwinLayer()); |
4498 } | 4518 } |
4499 | 4519 |
4500 void PictureLayerImplTest::TestQuadsForSolidColor(bool test_for_solid) { | 4520 void PictureLayerImplTest::TestQuadsForSolidColor(bool test_for_solid) { |
4501 base::TimeTicks time_ticks; | 4521 base::TimeTicks time_ticks; |
4502 time_ticks += base::TimeDelta::FromMilliseconds(1); | 4522 time_ticks += base::TimeDelta::FromMilliseconds(1); |
4503 host_impl_.SetCurrentBeginFrameArgs( | 4523 host_impl_.SetCurrentBeginFrameArgs( |
4504 CreateBeginFrameArgsForTesting(time_ticks)); | 4524 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
4505 | 4525 |
4506 gfx::Size tile_size(100, 100); | 4526 gfx::Size tile_size(100, 100); |
4507 gfx::Size layer_bounds(200, 200); | 4527 gfx::Size layer_bounds(200, 200); |
4508 gfx::Rect layer_rect(layer_bounds); | 4528 gfx::Rect layer_rect(layer_bounds); |
4509 | 4529 |
4510 FakeContentLayerClient client; | 4530 FakeContentLayerClient client; |
4511 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 4531 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
4512 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 4532 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
4513 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); | 4533 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); |
4514 host->SetRootLayer(layer); | 4534 host->SetRootLayer(layer); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4561 } | 4581 } |
4562 | 4582 |
4563 TEST_F(PictureLayerImplTest, DrawNonSolidQuads) { | 4583 TEST_F(PictureLayerImplTest, DrawNonSolidQuads) { |
4564 TestQuadsForSolidColor(false); | 4584 TestQuadsForSolidColor(false); |
4565 } | 4585 } |
4566 | 4586 |
4567 TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) { | 4587 TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) { |
4568 base::TimeTicks time_ticks; | 4588 base::TimeTicks time_ticks; |
4569 time_ticks += base::TimeDelta::FromMilliseconds(1); | 4589 time_ticks += base::TimeDelta::FromMilliseconds(1); |
4570 host_impl_.SetCurrentBeginFrameArgs( | 4590 host_impl_.SetCurrentBeginFrameArgs( |
4571 CreateBeginFrameArgsForTesting(time_ticks)); | 4591 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
4572 | 4592 |
4573 gfx::Size tile_size(100, 100); | 4593 gfx::Size tile_size(100, 100); |
4574 gfx::Size layer_bounds(200, 200); | 4594 gfx::Size layer_bounds(200, 200); |
4575 gfx::Rect layer_rect(layer_bounds); | 4595 gfx::Rect layer_rect(layer_bounds); |
4576 | 4596 |
4577 FakeContentLayerClient client; | 4597 FakeContentLayerClient client; |
4578 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 4598 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
4579 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 4599 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
4580 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); | 4600 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); |
4581 host->SetRootLayer(layer); | 4601 host->SetRootLayer(layer); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4618 | 4638 |
4619 // We've switched to a solid color, so we should end up with no tilings. | 4639 // We've switched to a solid color, so we should end up with no tilings. |
4620 ASSERT_TRUE(active_layer_->tilings()); | 4640 ASSERT_TRUE(active_layer_->tilings()); |
4621 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); | 4641 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); |
4622 } | 4642 } |
4623 | 4643 |
4624 TEST_F(PictureLayerImplTest, ChangeInViewportAllowsTilingUpdates) { | 4644 TEST_F(PictureLayerImplTest, ChangeInViewportAllowsTilingUpdates) { |
4625 base::TimeTicks time_ticks; | 4645 base::TimeTicks time_ticks; |
4626 time_ticks += base::TimeDelta::FromMilliseconds(1); | 4646 time_ticks += base::TimeDelta::FromMilliseconds(1); |
4627 host_impl_.SetCurrentBeginFrameArgs( | 4647 host_impl_.SetCurrentBeginFrameArgs( |
4628 CreateBeginFrameArgsForTesting(time_ticks)); | 4648 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
4629 | 4649 |
4630 gfx::Size tile_size(100, 100); | 4650 gfx::Size tile_size(100, 100); |
4631 gfx::Size layer_bounds(400, 4000); | 4651 gfx::Size layer_bounds(400, 4000); |
4632 | 4652 |
4633 scoped_refptr<FakePicturePileImpl> pending_pile = | 4653 scoped_refptr<FakePicturePileImpl> pending_pile = |
4634 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 4654 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
4635 scoped_refptr<FakePicturePileImpl> active_pile = | 4655 scoped_refptr<FakePicturePileImpl> active_pile = |
4636 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 4656 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
4637 | 4657 |
4638 SetupTrees(pending_pile, active_pile); | 4658 SetupTrees(pending_pile, active_pile); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4740 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4760 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4741 EXPECT_EQ(result.width(), 448); | 4761 EXPECT_EQ(result.width(), 448); |
4742 EXPECT_EQ(result.height(), 448); | 4762 EXPECT_EQ(result.height(), 448); |
4743 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4763 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4744 EXPECT_EQ(result.width(), 512); | 4764 EXPECT_EQ(result.width(), 512); |
4745 EXPECT_EQ(result.height(), 500 + 2); | 4765 EXPECT_EQ(result.height(), 500 + 2); |
4746 } | 4766 } |
4747 | 4767 |
4748 } // namespace | 4768 } // namespace |
4749 } // namespace cc | 4769 } // namespace cc |
OLD | NEW |