| 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.h" | 5 #include "cc/layers/picture_layer.h" |
| 6 | 6 |
| 7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
| 8 #include "cc/layers/content_layer_client.h" | 8 #include "cc/layers/content_layer_client.h" |
| 9 #include "cc/layers/picture_layer_impl.h" | 9 #include "cc/layers/picture_layer_impl.h" |
| 10 #include "cc/playback/display_item_list_settings.h" | 10 #include "cc/playback/display_item_list_settings.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 EXPECT_EQ(0, host->source_frame_number()); | 50 EXPECT_EQ(0, host->source_frame_number()); |
| 51 host->CommitComplete(); | 51 host->CommitComplete(); |
| 52 EXPECT_EQ(1, host->source_frame_number()); | 52 EXPECT_EQ(1, host->source_frame_number()); |
| 53 | 53 |
| 54 layer->SetBounds(gfx::Size(0, 0)); | 54 layer->SetBounds(gfx::Size(0, 0)); |
| 55 layer->SavePaintProperties(); | 55 layer->SavePaintProperties(); |
| 56 // Intentionally skipping Update since it would normally be skipped on | 56 // Intentionally skipping Update since it would normally be skipped on |
| 57 // a layer with empty bounds. | 57 // a layer with empty bounds. |
| 58 | 58 |
| 59 FakeProxy proxy; | 59 FakeImplTaskRunnerProvider impl_task_runner_provider; |
| 60 { | |
| 61 DebugScopedSetImplThread impl_thread(&proxy); | |
| 62 | 60 |
| 63 TestSharedBitmapManager shared_bitmap_manager; | 61 TestSharedBitmapManager shared_bitmap_manager; |
| 64 FakeLayerTreeHostImpl host_impl(LayerTreeSettings(), &proxy, | 62 FakeLayerTreeHostImpl host_impl(LayerTreeSettings(), |
| 65 &shared_bitmap_manager, &task_graph_runner); | 63 &impl_task_runner_provider, |
| 66 host_impl.CreatePendingTree(); | 64 &shared_bitmap_manager, &task_graph_runner); |
| 67 scoped_ptr<FakePictureLayerImpl> layer_impl = | 65 host_impl.CreatePendingTree(); |
| 68 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1); | 66 scoped_ptr<FakePictureLayerImpl> layer_impl = |
| 67 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1); |
| 69 | 68 |
| 70 layer->PushPropertiesTo(layer_impl.get()); | 69 layer->PushPropertiesTo(layer_impl.get()); |
| 71 EXPECT_FALSE(layer_impl->CanHaveTilings()); | 70 EXPECT_FALSE(layer_impl->CanHaveTilings()); |
| 72 EXPECT_TRUE(layer_impl->bounds() == gfx::Size(0, 0)); | 71 EXPECT_TRUE(layer_impl->bounds() == gfx::Size(0, 0)); |
| 73 EXPECT_EQ(gfx::Size(), layer_impl->raster_source()->GetSize()); | 72 EXPECT_EQ(gfx::Size(), layer_impl->raster_source()->GetSize()); |
| 74 EXPECT_FALSE(layer_impl->raster_source()->HasRecordings()); | 73 EXPECT_FALSE(layer_impl->raster_source()->HasRecordings()); |
| 75 } | |
| 76 } | 74 } |
| 77 | 75 |
| 78 TEST(PictureLayerTest, SuitableForGpuRasterization) { | 76 TEST(PictureLayerTest, SuitableForGpuRasterization) { |
| 79 scoped_ptr<FakeDisplayListRecordingSource> recording_source_owned( | 77 scoped_ptr<FakeDisplayListRecordingSource> recording_source_owned( |
| 80 new FakeDisplayListRecordingSource); | 78 new FakeDisplayListRecordingSource); |
| 81 FakeDisplayListRecordingSource* recording_source = | 79 FakeDisplayListRecordingSource* recording_source = |
| 82 recording_source_owned.get(); | 80 recording_source_owned.get(); |
| 83 | 81 |
| 84 MockContentLayerClient client; | 82 MockContentLayerClient client; |
| 85 scoped_refptr<FakePictureLayer> layer = | 83 scoped_refptr<FakePictureLayer> layer = |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 // Do a main frame, record the picture layers. The frame number has changed | 165 // Do a main frame, record the picture layers. The frame number has changed |
| 168 // non-monotonically. | 166 // non-monotonically. |
| 169 layer->SetNeedsDisplay(); | 167 layer->SetNeedsDisplay(); |
| 170 host2->Composite(base::TimeTicks::Now()); | 168 host2->Composite(base::TimeTicks::Now()); |
| 171 EXPECT_EQ(3, layer->update_count()); | 169 EXPECT_EQ(3, layer->update_count()); |
| 172 EXPECT_EQ(1, host2->source_frame_number()); | 170 EXPECT_EQ(1, host2->source_frame_number()); |
| 173 } | 171 } |
| 174 | 172 |
| 175 } // namespace | 173 } // namespace |
| 176 } // namespace cc | 174 } // namespace cc |
| OLD | NEW |