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/resources/resource_update_queue.h" | 10 #include "cc/resources/resource_update_queue.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 settings.single_thread_proxy_scheduler = false; | 122 settings.single_thread_proxy_scheduler = false; |
123 | 123 |
124 FakeLayerTreeHostClient host_client1(FakeLayerTreeHostClient::DIRECT_3D); | 124 FakeLayerTreeHostClient host_client1(FakeLayerTreeHostClient::DIRECT_3D); |
125 FakeLayerTreeHostClient host_client2(FakeLayerTreeHostClient::DIRECT_3D); | 125 FakeLayerTreeHostClient host_client2(FakeLayerTreeHostClient::DIRECT_3D); |
126 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 126 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
127 new TestSharedBitmapManager()); | 127 new TestSharedBitmapManager()); |
128 | 128 |
129 MockContentLayerClient client; | 129 MockContentLayerClient client; |
130 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(&client); | 130 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(&client); |
131 | 131 |
132 scoped_ptr<LayerTreeHost> host1 = LayerTreeHost::CreateSingleThreaded( | 132 LayerTreeHost::InitParams params; |
133 &host_client1, &host_client1, shared_bitmap_manager.get(), nullptr, | 133 params.client = &host_client1; |
134 nullptr, settings, base::ThreadTaskRunnerHandle::Get(), nullptr); | 134 params.shared_bitmap_manager = shared_bitmap_manager.get(); |
| 135 params.settings = &settings; |
| 136 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 137 scoped_ptr<LayerTreeHost> host1 = |
| 138 LayerTreeHost::CreateSingleThreaded(&host_client1, ¶ms); |
135 host_client1.SetLayerTreeHost(host1.get()); | 139 host_client1.SetLayerTreeHost(host1.get()); |
136 | 140 |
137 scoped_ptr<LayerTreeHost> host2 = LayerTreeHost::CreateSingleThreaded( | 141 params.client = &host_client2; |
138 &host_client2, &host_client2, shared_bitmap_manager.get(), nullptr, | 142 scoped_ptr<LayerTreeHost> host2 = |
139 nullptr, settings, base::ThreadTaskRunnerHandle::Get(), nullptr); | 143 LayerTreeHost::CreateSingleThreaded(&host_client2, ¶ms); |
140 host_client2.SetLayerTreeHost(host2.get()); | 144 host_client2.SetLayerTreeHost(host2.get()); |
141 | 145 |
142 // The PictureLayer is put in one LayerTreeHost. | 146 // The PictureLayer is put in one LayerTreeHost. |
143 host1->SetRootLayer(layer); | 147 host1->SetRootLayer(layer); |
144 // Do a main frame, record the picture layers. | 148 // Do a main frame, record the picture layers. |
145 EXPECT_EQ(0u, layer->update_count()); | 149 EXPECT_EQ(0u, layer->update_count()); |
146 layer->SetNeedsDisplay(); | 150 layer->SetNeedsDisplay(); |
147 host1->Composite(base::TimeTicks::Now()); | 151 host1->Composite(base::TimeTicks::Now()); |
148 EXPECT_EQ(1u, layer->update_count()); | 152 EXPECT_EQ(1u, layer->update_count()); |
149 EXPECT_EQ(1, host1->source_frame_number()); | 153 EXPECT_EQ(1, host1->source_frame_number()); |
(...skipping 11 matching lines...) Expand all Loading... |
161 // 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 |
162 // non-monotonically. | 166 // non-monotonically. |
163 layer->SetNeedsDisplay(); | 167 layer->SetNeedsDisplay(); |
164 host2->Composite(base::TimeTicks::Now()); | 168 host2->Composite(base::TimeTicks::Now()); |
165 EXPECT_EQ(3u, layer->update_count()); | 169 EXPECT_EQ(3u, layer->update_count()); |
166 EXPECT_EQ(1, host2->source_frame_number()); | 170 EXPECT_EQ(1, host2->source_frame_number()); |
167 } | 171 } |
168 | 172 |
169 } // namespace | 173 } // namespace |
170 } // namespace cc | 174 } // namespace cc |
OLD | NEW |