| 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 "cc/layers/content_layer_client.h" | 7 #include "cc/layers/content_layer_client.h" |
| 8 #include "cc/layers/picture_layer_impl.h" | 8 #include "cc/layers/picture_layer_impl.h" |
| 9 #include "cc/resources/resource_update_queue.h" | 9 #include "cc/resources/resource_update_queue.h" |
| 10 #include "cc/test/fake_layer_tree_host.h" | 10 #include "cc/test/fake_layer_tree_host.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 layer->SetBounds(gfx::Size(0, 0)); | 55 layer->SetBounds(gfx::Size(0, 0)); |
| 56 layer->SavePaintProperties(); | 56 layer->SavePaintProperties(); |
| 57 // Intentionally skipping Update since it would normally be skipped on | 57 // Intentionally skipping Update since it would normally be skipped on |
| 58 // a layer with empty bounds. | 58 // a layer with empty bounds. |
| 59 | 59 |
| 60 FakeProxy proxy; | 60 FakeProxy proxy; |
| 61 { | 61 { |
| 62 DebugScopedSetImplThread impl_thread(&proxy); | 62 DebugScopedSetImplThread impl_thread(&proxy); |
| 63 | 63 |
| 64 TestSharedBitmapManager shared_bitmap_manager; | 64 TestSharedBitmapManager shared_bitmap_manager; |
| 65 FakeLayerTreeHostImpl host_impl( | 65 FakeLayerTreeHostImpl host_impl(ImplSidePaintingSettings(), &proxy, |
| 66 ImplSidePaintingSettings(), &proxy, &shared_bitmap_manager); | 66 &shared_bitmap_manager, nullptr); |
| 67 host_impl.CreatePendingTree(); | 67 host_impl.CreatePendingTree(); |
| 68 scoped_ptr<FakePictureLayerImpl> layer_impl = | 68 scoped_ptr<FakePictureLayerImpl> layer_impl = |
| 69 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1); | 69 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1); |
| 70 | 70 |
| 71 layer->PushPropertiesTo(layer_impl.get()); | 71 layer->PushPropertiesTo(layer_impl.get()); |
| 72 EXPECT_FALSE(layer_impl->CanHaveTilings()); | 72 EXPECT_FALSE(layer_impl->CanHaveTilings()); |
| 73 EXPECT_TRUE(layer_impl->bounds() == gfx::Size(0, 0)); | 73 EXPECT_TRUE(layer_impl->bounds() == gfx::Size(0, 0)); |
| 74 EXPECT_EQ(gfx::Size(), layer_impl->raster_source()->GetSize()); | 74 EXPECT_EQ(gfx::Size(), layer_impl->raster_source()->GetSize()); |
| 75 EXPECT_FALSE(layer_impl->raster_source()->HasRecordings()); | 75 EXPECT_FALSE(layer_impl->raster_source()->HasRecordings()); |
| 76 } | 76 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 FakeLayerTreeHostClient host_client1(FakeLayerTreeHostClient::DIRECT_3D); | 123 FakeLayerTreeHostClient host_client1(FakeLayerTreeHostClient::DIRECT_3D); |
| 124 FakeLayerTreeHostClient host_client2(FakeLayerTreeHostClient::DIRECT_3D); | 124 FakeLayerTreeHostClient host_client2(FakeLayerTreeHostClient::DIRECT_3D); |
| 125 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 125 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 126 new TestSharedBitmapManager()); | 126 new TestSharedBitmapManager()); |
| 127 | 127 |
| 128 MockContentLayerClient client; | 128 MockContentLayerClient client; |
| 129 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(&client); | 129 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(&client); |
| 130 | 130 |
| 131 scoped_ptr<LayerTreeHost> host1 = LayerTreeHost::CreateSingleThreaded( | 131 scoped_ptr<LayerTreeHost> host1 = LayerTreeHost::CreateSingleThreaded( |
| 132 &host_client1, &host_client1, shared_bitmap_manager.get(), nullptr, | 132 &host_client1, &host_client1, shared_bitmap_manager.get(), nullptr, |
| 133 settings, base::MessageLoopProxy::current(), nullptr); | 133 nullptr, settings, base::MessageLoopProxy::current(), nullptr); |
| 134 host_client1.SetLayerTreeHost(host1.get()); | 134 host_client1.SetLayerTreeHost(host1.get()); |
| 135 | 135 |
| 136 scoped_ptr<LayerTreeHost> host2 = LayerTreeHost::CreateSingleThreaded( | 136 scoped_ptr<LayerTreeHost> host2 = LayerTreeHost::CreateSingleThreaded( |
| 137 &host_client2, &host_client2, shared_bitmap_manager.get(), nullptr, | 137 &host_client2, &host_client2, shared_bitmap_manager.get(), nullptr, |
| 138 settings, base::MessageLoopProxy::current(), nullptr); | 138 nullptr, settings, base::MessageLoopProxy::current(), nullptr); |
| 139 host_client2.SetLayerTreeHost(host2.get()); | 139 host_client2.SetLayerTreeHost(host2.get()); |
| 140 | 140 |
| 141 // The PictureLayer is put in one LayerTreeHost. | 141 // The PictureLayer is put in one LayerTreeHost. |
| 142 host1->SetRootLayer(layer); | 142 host1->SetRootLayer(layer); |
| 143 // Do a main frame, record the picture layers. | 143 // Do a main frame, record the picture layers. |
| 144 EXPECT_EQ(0u, layer->update_count()); | 144 EXPECT_EQ(0u, layer->update_count()); |
| 145 layer->SetNeedsDisplay(); | 145 layer->SetNeedsDisplay(); |
| 146 host1->Composite(base::TimeTicks::Now()); | 146 host1->Composite(base::TimeTicks::Now()); |
| 147 EXPECT_EQ(1u, layer->update_count()); | 147 EXPECT_EQ(1u, layer->update_count()); |
| 148 EXPECT_EQ(1, host1->source_frame_number()); | 148 EXPECT_EQ(1, host1->source_frame_number()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 160 // Do a main frame, record the picture layers. The frame number has changed | 160 // Do a main frame, record the picture layers. The frame number has changed |
| 161 // non-monotonically. | 161 // non-monotonically. |
| 162 layer->SetNeedsDisplay(); | 162 layer->SetNeedsDisplay(); |
| 163 host2->Composite(base::TimeTicks::Now()); | 163 host2->Composite(base::TimeTicks::Now()); |
| 164 EXPECT_EQ(3u, layer->update_count()); | 164 EXPECT_EQ(3u, layer->update_count()); |
| 165 EXPECT_EQ(1, host2->source_frame_number()); | 165 EXPECT_EQ(1, host2->source_frame_number()); |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace | 168 } // namespace |
| 169 } // namespace cc | 169 } // namespace cc |
| OLD | NEW |