Chromium Code Reviews| 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 "base/run_loop.h" | 5 #include "base/run_loop.h" |
| 6 #include "base/thread_task_runner_handle.h" | 6 #include "base/thread_task_runner_handle.h" |
| 7 #include "cc/playback/display_list_raster_source.h" | 7 #include "cc/playback/display_list_raster_source.h" |
| 8 #include "cc/playback/display_list_recording_source.h" | 8 #include "cc/playback/display_list_recording_source.h" |
| 9 #include "cc/raster/raster_buffer.h" | 9 #include "cc/raster/raster_buffer.h" |
| 10 #include "cc/resources/resource_pool.h" | 10 #include "cc/resources/resource_pool.h" |
| (...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1442 non_intersecting_rect, // Visible rect. | 1442 non_intersecting_rect, // Visible rect. |
| 1443 non_intersecting_rect, // Skewport rect. | 1443 non_intersecting_rect, // Skewport rect. |
| 1444 non_intersecting_rect, // Soon rect. | 1444 non_intersecting_rect, // Soon rect. |
| 1445 intersecting_rect); // Eventually rect. | 1445 intersecting_rect); // Eventually rect. |
| 1446 scoped_ptr<TilingSetRasterQueueAll> queue( | 1446 scoped_ptr<TilingSetRasterQueueAll> queue( |
| 1447 new TilingSetRasterQueueAll(tiling_set.get(), false)); | 1447 new TilingSetRasterQueueAll(tiling_set.get(), false)); |
| 1448 EXPECT_FALSE(queue->IsEmpty()); | 1448 EXPECT_FALSE(queue->IsEmpty()); |
| 1449 } | 1449 } |
| 1450 } | 1450 } |
| 1451 | 1451 |
| 1452 TEST_F(TileManagerTilePriorityQueueTest, NoRasterTasksforSolidColorTiles) { | |
| 1453 gfx::Size size(10, 10); | |
| 1454 const gfx::Size layer_bounds(10, 10); | |
| 1455 | |
| 1456 scoped_ptr<FakeDisplayListRecordingSource> recording_source = | |
| 1457 FakeDisplayListRecordingSource::CreateFilledRecordingSource(layer_bounds); | |
| 1458 | |
| 1459 SkPaint solid_paint; | |
| 1460 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34); | |
| 1461 solid_paint.setColor(solid_color); | |
| 1462 recording_source->add_draw_rect_with_paint(gfx::Rect(layer_bounds), | |
| 1463 solid_paint); | |
| 1464 recording_source->Rerecord(); | |
| 1465 | |
| 1466 scoped_refptr<DisplayListRasterSource> raster = | |
|
vmpstr
2016/01/06 19:35:03
nit: raster_source
sohanjg
2016/01/07 10:13:00
Done.
| |
| 1467 DisplayListRasterSource::CreateFromDisplayListRecordingSource( | |
| 1468 recording_source.get(), false); | |
| 1469 | |
| 1470 FakePictureLayerTilingClient tiling_client; | |
| 1471 tiling_client.SetTileSize(size); | |
| 1472 | |
| 1473 scoped_ptr<PictureLayerImpl> layer = | |
|
vmpstr
2016/01/06 19:35:03
nit: layer_impl
sohanjg
2016/01/07 10:13:00
Done.
| |
| 1474 PictureLayerImpl::Create(host_impl_.active_tree(), 1, false, nullptr); | |
| 1475 PictureLayerTilingSet* tiling_set = layer->picture_layer_tiling_set(); | |
| 1476 | |
| 1477 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster); | |
| 1478 tiling->set_resolution(HIGH_RESOLUTION); | |
| 1479 tiling->CreateAllTilesForTesting(); | |
| 1480 tiling->SetTilePriorityRectsForTesting(gfx::Rect(size), // Visible rect. | |
| 1481 gfx::Rect(size), // Skewport rect. | |
| 1482 gfx::Rect(size), // Soon rect. | |
| 1483 gfx::Rect(size)); // Eventually rect. | |
| 1484 | |
| 1485 host_impl_.tile_manager()->PrepareTiles(host_impl_.global_tile_state()); | |
| 1486 | |
| 1487 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); | |
| 1488 for (size_t tile_idx = 0; tile_idx < tiles.size(); ++tile_idx) { | |
| 1489 Tile* tile = tiles[tile_idx]; | |
| 1490 EXPECT_FALSE(tile->HasRasterTask()); | |
|
vmpstr
2016/01/06 19:35:03
can you also
EXPECT_EQ(TileDrawInfo::SOLID_COLOR_
sohanjg
2016/01/07 10:13:00
Done.
| |
| 1491 } | |
| 1492 } | |
| 1493 | |
| 1452 // TODO(vmpstr): Merge TileManagerTest and TileManagerTilePriorityQueueTest. | 1494 // TODO(vmpstr): Merge TileManagerTest and TileManagerTilePriorityQueueTest. |
| 1453 class TileManagerTest : public testing::Test { | 1495 class TileManagerTest : public testing::Test { |
| 1454 public: | 1496 public: |
| 1455 TileManagerTest() | 1497 TileManagerTest() |
| 1456 : output_surface_(FakeOutputSurface::CreateSoftware( | 1498 : output_surface_(FakeOutputSurface::CreateSoftware( |
| 1457 make_scoped_ptr(new SoftwareOutputDevice))) {} | 1499 make_scoped_ptr(new SoftwareOutputDevice))) {} |
| 1458 | 1500 |
| 1459 void SetUp() override { | 1501 void SetUp() override { |
| 1460 LayerTreeSettingsForTesting settings; | 1502 LayerTreeSettingsForTesting settings; |
| 1461 CustomizeSettings(&settings); | 1503 CustomizeSettings(&settings); |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1893 | 1935 |
| 1894 // Ensures that the tile manager does not attempt to reuse tiles when partial | 1936 // Ensures that the tile manager does not attempt to reuse tiles when partial |
| 1895 // raster is disabled. | 1937 // raster is disabled. |
| 1896 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { | 1938 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { |
| 1897 RunPartialRasterCheck(std::move(host_impl_), | 1939 RunPartialRasterCheck(std::move(host_impl_), |
| 1898 false /* partial_raster_enabled */); | 1940 false /* partial_raster_enabled */); |
| 1899 } | 1941 } |
| 1900 | 1942 |
| 1901 } // namespace | 1943 } // namespace |
| 1902 } // namespace cc | 1944 } // namespace cc |
| OLD | NEW |