| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 FakePictureLayer::Create(LayerSettings(), &client); | 132 FakePictureLayer::Create(LayerSettings(), &client); |
| 133 | 133 |
| 134 LayerTreeHost::InitParams params; | 134 LayerTreeHost::InitParams params; |
| 135 params.client = &host_client1; | 135 params.client = &host_client1; |
| 136 params.shared_bitmap_manager = &shared_bitmap_manager; | 136 params.shared_bitmap_manager = &shared_bitmap_manager; |
| 137 params.settings = &settings; | 137 params.settings = &settings; |
| 138 params.task_graph_runner = &task_graph_runner; | 138 params.task_graph_runner = &task_graph_runner; |
| 139 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); | 139 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 140 scoped_ptr<LayerTreeHost> host1 = | 140 scoped_ptr<LayerTreeHost> host1 = |
| 141 LayerTreeHost::CreateSingleThreaded(&host_client1, ¶ms); | 141 LayerTreeHost::CreateSingleThreaded(&host_client1, ¶ms); |
| 142 host1->SetVisible(true); |
| 142 host_client1.SetLayerTreeHost(host1.get()); | 143 host_client1.SetLayerTreeHost(host1.get()); |
| 143 | 144 |
| 144 params.client = &host_client2; | 145 params.client = &host_client2; |
| 145 scoped_ptr<LayerTreeHost> host2 = | 146 scoped_ptr<LayerTreeHost> host2 = |
| 146 LayerTreeHost::CreateSingleThreaded(&host_client2, ¶ms); | 147 LayerTreeHost::CreateSingleThreaded(&host_client2, ¶ms); |
| 148 host2->SetVisible(true); |
| 147 host_client2.SetLayerTreeHost(host2.get()); | 149 host_client2.SetLayerTreeHost(host2.get()); |
| 148 | 150 |
| 149 // The PictureLayer is put in one LayerTreeHost. | 151 // The PictureLayer is put in one LayerTreeHost. |
| 150 host1->SetRootLayer(layer); | 152 host1->SetRootLayer(layer); |
| 151 // Do a main frame, record the picture layers. | 153 // Do a main frame, record the picture layers. |
| 152 EXPECT_EQ(0, layer->update_count()); | 154 EXPECT_EQ(0, layer->update_count()); |
| 153 layer->SetNeedsDisplay(); | 155 layer->SetNeedsDisplay(); |
| 154 host1->Composite(base::TimeTicks::Now()); | 156 host1->Composite(base::TimeTicks::Now()); |
| 155 EXPECT_EQ(1, layer->update_count()); | 157 EXPECT_EQ(1, layer->update_count()); |
| 156 EXPECT_EQ(1, host1->source_frame_number()); | 158 EXPECT_EQ(1, host1->source_frame_number()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 168 // Do a main frame, record the picture layers. The frame number has changed | 170 // Do a main frame, record the picture layers. The frame number has changed |
| 169 // non-monotonically. | 171 // non-monotonically. |
| 170 layer->SetNeedsDisplay(); | 172 layer->SetNeedsDisplay(); |
| 171 host2->Composite(base::TimeTicks::Now()); | 173 host2->Composite(base::TimeTicks::Now()); |
| 172 EXPECT_EQ(3, layer->update_count()); | 174 EXPECT_EQ(3, layer->update_count()); |
| 173 EXPECT_EQ(1, host2->source_frame_number()); | 175 EXPECT_EQ(1, host2->source_frame_number()); |
| 174 } | 176 } |
| 175 | 177 |
| 176 } // namespace | 178 } // namespace |
| 177 } // namespace cc | 179 } // namespace cc |
| OLD | NEW |