| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 10 #include "cc/layers/append_quads_data.h" | 10 #include "cc/layers/append_quads_data.h" |
| 11 #include "cc/layers/content_layer_client.h" | 11 #include "cc/layers/content_layer_client.h" |
| 12 #include "cc/layers/empty_content_layer_client.h" | 12 #include "cc/layers/empty_content_layer_client.h" |
| 13 #include "cc/layers/layer_settings.h" | |
| 14 #include "cc/layers/picture_layer_impl.h" | 13 #include "cc/layers/picture_layer_impl.h" |
| 15 #include "cc/playback/display_item_list_settings.h" | 14 #include "cc/playback/display_item_list_settings.h" |
| 16 #include "cc/proto/layer.pb.h" | 15 #include "cc/proto/layer.pb.h" |
| 17 #include "cc/test/fake_display_list_recording_source.h" | 16 #include "cc/test/fake_display_list_recording_source.h" |
| 18 #include "cc/test/fake_image_serialization_processor.h" | 17 #include "cc/test/fake_image_serialization_processor.h" |
| 19 #include "cc/test/fake_layer_tree_host.h" | 18 #include "cc/test/fake_layer_tree_host.h" |
| 20 #include "cc/test/fake_output_surface.h" | 19 #include "cc/test/fake_output_surface.h" |
| 21 #include "cc/test/fake_picture_layer.h" | 20 #include "cc/test/fake_picture_layer.h" |
| 22 #include "cc/test/fake_picture_layer_impl.h" | 21 #include "cc/test/fake_picture_layer_impl.h" |
| 23 #include "cc/test/fake_proxy.h" | 22 #include "cc/test/fake_proxy.h" |
| 24 #include "cc/test/layer_tree_settings_for_testing.h" | |
| 25 #include "cc/test/skia_common.h" | 23 #include "cc/test/skia_common.h" |
| 26 #include "cc/test/test_shared_bitmap_manager.h" | 24 #include "cc/test/test_shared_bitmap_manager.h" |
| 27 #include "cc/test/test_task_graph_runner.h" | 25 #include "cc/test/test_task_graph_runner.h" |
| 28 #include "cc/trees/single_thread_proxy.h" | 26 #include "cc/trees/single_thread_proxy.h" |
| 29 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| 30 | 28 |
| 31 namespace cc { | 29 namespace cc { |
| 32 | 30 |
| 33 class TestSerializationPictureLayer : public PictureLayer { | 31 class TestSerializationPictureLayer : public PictureLayer { |
| 34 public: | 32 public: |
| 35 static scoped_refptr<TestSerializationPictureLayer> Create( | 33 static scoped_refptr<TestSerializationPictureLayer> Create( |
| 36 const gfx::Size& recording_source_viewport) { | 34 const gfx::Size& recording_source_viewport) { |
| 37 return make_scoped_refptr(new TestSerializationPictureLayer( | 35 return make_scoped_refptr(new TestSerializationPictureLayer( |
| 38 LayerSettings(), EmptyContentLayerClient::GetInstance(), | 36 EmptyContentLayerClient::GetInstance(), |
| 39 FakeDisplayListRecordingSource::CreateFilledRecordingSource( | 37 FakeDisplayListRecordingSource::CreateFilledRecordingSource( |
| 40 recording_source_viewport), | 38 recording_source_viewport), |
| 41 recording_source_viewport)); | 39 recording_source_viewport)); |
| 42 } | 40 } |
| 43 | 41 |
| 44 FakeDisplayListRecordingSource* recording_source() { | 42 FakeDisplayListRecordingSource* recording_source() { |
| 45 return static_cast<FakeDisplayListRecordingSource*>( | 43 return static_cast<FakeDisplayListRecordingSource*>( |
| 46 recording_source_.get()); | 44 recording_source_.get()); |
| 47 } | 45 } |
| 48 | 46 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // Validate that the PictureLayer specific fields are properly set. | 84 // Validate that the PictureLayer specific fields are properly set. |
| 87 EXPECT_TRUE(recording_source()->EqualsTo(*layer->recording_source())); | 85 EXPECT_TRUE(recording_source()->EqualsTo(*layer->recording_source())); |
| 88 EXPECT_EQ(last_updated_visible_layer_rect_, | 86 EXPECT_EQ(last_updated_visible_layer_rect_, |
| 89 layer->last_updated_visible_layer_rect_); | 87 layer->last_updated_visible_layer_rect_); |
| 90 EXPECT_EQ(update_source_frame_number_, layer->update_source_frame_number_); | 88 EXPECT_EQ(update_source_frame_number_, layer->update_source_frame_number_); |
| 91 EXPECT_EQ(is_mask_, layer->is_mask_); | 89 EXPECT_EQ(is_mask_, layer->is_mask_); |
| 92 EXPECT_EQ(nearest_neighbor_, layer->nearest_neighbor_); | 90 EXPECT_EQ(nearest_neighbor_, layer->nearest_neighbor_); |
| 93 } | 91 } |
| 94 | 92 |
| 95 private: | 93 private: |
| 96 TestSerializationPictureLayer(const LayerSettings& settings, | 94 TestSerializationPictureLayer(ContentLayerClient* client, |
| 97 ContentLayerClient* client, | |
| 98 scoped_ptr<DisplayListRecordingSource> source, | 95 scoped_ptr<DisplayListRecordingSource> source, |
| 99 const gfx::Size& recording_source_viewport) | 96 const gfx::Size& recording_source_viewport) |
| 100 : PictureLayer(settings, client, std::move(source)), | 97 : PictureLayer(client, std::move(source)), |
| 101 recording_source_viewport_(recording_source_viewport) {} | 98 recording_source_viewport_(recording_source_viewport) {} |
| 102 ~TestSerializationPictureLayer() override {} | 99 ~TestSerializationPictureLayer() override {} |
| 103 | 100 |
| 104 gfx::Size recording_source_viewport_; | 101 gfx::Size recording_source_viewport_; |
| 105 | 102 |
| 106 DISALLOW_COPY_AND_ASSIGN(TestSerializationPictureLayer); | 103 DISALLOW_COPY_AND_ASSIGN(TestSerializationPictureLayer); |
| 107 }; | 104 }; |
| 108 | 105 |
| 109 namespace { | 106 namespace { |
| 110 | 107 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 137 layer->recording_source()->add_draw_rect( | 134 layer->recording_source()->add_draw_rect( |
| 138 gfx::Rect(recording_source_viewport)); | 135 gfx::Rect(recording_source_viewport)); |
| 139 layer->recording_source()->SetGenerateDiscardableImagesMetadata(true); | 136 layer->recording_source()->SetGenerateDiscardableImagesMetadata(true); |
| 140 layer->recording_source()->Rerecord(); | 137 layer->recording_source()->Rerecord(); |
| 141 layer->ValidateSerialization(); | 138 layer->ValidateSerialization(); |
| 142 } | 139 } |
| 143 | 140 |
| 144 TEST(PictureLayerTest, TestSerializationDeserialization) { | 141 TEST(PictureLayerTest, TestSerializationDeserialization) { |
| 145 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 142 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
| 146 TestTaskGraphRunner task_graph_runner; | 143 TestTaskGraphRunner task_graph_runner; |
| 147 LayerTreeSettings settings; | |
| 148 settings.use_compositor_animation_timelines = true; | |
| 149 scoped_ptr<FakeImageSerializationProcessor> | 144 scoped_ptr<FakeImageSerializationProcessor> |
| 150 fake_image_serialization_processor = | 145 fake_image_serialization_processor = |
| 151 make_scoped_ptr(new FakeImageSerializationProcessor); | 146 make_scoped_ptr(new FakeImageSerializationProcessor); |
| 152 scoped_ptr<FakeLayerTreeHost> host = | 147 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create( |
| 153 FakeLayerTreeHost::Create(&host_client, &task_graph_runner, settings, | 148 &host_client, &task_graph_runner, LayerTreeSettings(), |
| 154 CompositorMode::SINGLE_THREADED, | 149 CompositorMode::SINGLE_THREADED, |
| 155 fake_image_serialization_processor.get()); | 150 fake_image_serialization_processor.get()); |
| 156 gfx::Size recording_source_viewport(256, 256); | 151 gfx::Size recording_source_viewport(256, 256); |
| 157 scoped_refptr<TestSerializationPictureLayer> layer = | 152 scoped_refptr<TestSerializationPictureLayer> layer = |
| 158 TestSerializationPictureLayer::Create(recording_source_viewport); | 153 TestSerializationPictureLayer::Create(recording_source_viewport); |
| 159 host->SetRootLayer(layer); | 154 host->SetRootLayer(layer); |
| 160 | 155 |
| 161 layer->SetBounds(recording_source_viewport); | 156 layer->SetBounds(recording_source_viewport); |
| 162 layer->set_update_source_frame_number(0); | 157 layer->set_update_source_frame_number(0); |
| 163 layer->recording_source()->SetDisplayListUsesCachedPicture(false); | 158 layer->recording_source()->SetDisplayListUsesCachedPicture(false); |
| 164 layer->recording_source()->add_draw_rect( | 159 layer->recording_source()->add_draw_rect( |
| 165 gfx::Rect(recording_source_viewport)); | 160 gfx::Rect(recording_source_viewport)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 176 | 171 |
| 177 gfx::Size recording_source_viewport(256, 256); | 172 gfx::Size recording_source_viewport(256, 256); |
| 178 scoped_refptr<TestSerializationPictureLayer> layer = | 173 scoped_refptr<TestSerializationPictureLayer> layer = |
| 179 TestSerializationPictureLayer::Create(recording_source_viewport); | 174 TestSerializationPictureLayer::Create(recording_source_viewport); |
| 180 host->SetRootLayer(layer); | 175 host->SetRootLayer(layer); |
| 181 layer->ValidateSerialization(); | 176 layer->ValidateSerialization(); |
| 182 } | 177 } |
| 183 | 178 |
| 184 TEST(PictureLayerTest, NoTilesIfEmptyBounds) { | 179 TEST(PictureLayerTest, NoTilesIfEmptyBounds) { |
| 185 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); | 180 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); |
| 186 scoped_refptr<PictureLayer> layer = | 181 scoped_refptr<PictureLayer> layer = PictureLayer::Create(client); |
| 187 PictureLayer::Create(LayerSettings(), client); | |
| 188 layer->SetBounds(gfx::Size(10, 10)); | 182 layer->SetBounds(gfx::Size(10, 10)); |
| 189 | 183 |
| 190 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 184 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
| 191 TestTaskGraphRunner task_graph_runner; | 185 TestTaskGraphRunner task_graph_runner; |
| 192 scoped_ptr<FakeLayerTreeHost> host = | 186 scoped_ptr<FakeLayerTreeHost> host = |
| 193 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); | 187 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); |
| 194 host->SetRootLayer(layer); | 188 host->SetRootLayer(layer); |
| 195 layer->SetIsDrawable(true); | 189 layer->SetIsDrawable(true); |
| 196 layer->SavePaintProperties(); | 190 layer->SavePaintProperties(); |
| 197 layer->Update(); | 191 layer->Update(); |
| 198 | 192 |
| 199 EXPECT_EQ(0, host->source_frame_number()); | 193 EXPECT_EQ(0, host->source_frame_number()); |
| 200 host->CommitComplete(); | 194 host->CommitComplete(); |
| 201 EXPECT_EQ(1, host->source_frame_number()); | 195 EXPECT_EQ(1, host->source_frame_number()); |
| 202 | 196 |
| 203 layer->SetBounds(gfx::Size(0, 0)); | 197 layer->SetBounds(gfx::Size(0, 0)); |
| 204 layer->SavePaintProperties(); | 198 layer->SavePaintProperties(); |
| 205 // Intentionally skipping Update since it would normally be skipped on | 199 // Intentionally skipping Update since it would normally be skipped on |
| 206 // a layer with empty bounds. | 200 // a layer with empty bounds. |
| 207 | 201 |
| 208 FakeImplTaskRunnerProvider impl_task_runner_provider; | 202 FakeImplTaskRunnerProvider impl_task_runner_provider; |
| 209 | 203 |
| 210 TestSharedBitmapManager shared_bitmap_manager; | 204 TestSharedBitmapManager shared_bitmap_manager; |
| 211 scoped_ptr<FakeOutputSurface> output_surface = | 205 scoped_ptr<FakeOutputSurface> output_surface = |
| 212 FakeOutputSurface::CreateSoftware( | 206 FakeOutputSurface::CreateSoftware( |
| 213 make_scoped_ptr(new SoftwareOutputDevice)); | 207 make_scoped_ptr(new SoftwareOutputDevice)); |
| 214 FakeLayerTreeHostImpl host_impl(LayerTreeSettingsForTesting(), | 208 FakeLayerTreeHostImpl host_impl(LayerTreeSettings(), |
| 215 &impl_task_runner_provider, | 209 &impl_task_runner_provider, |
| 216 &shared_bitmap_manager, &task_graph_runner); | 210 &shared_bitmap_manager, &task_graph_runner); |
| 217 host_impl.InitializeRenderer(output_surface.get()); | 211 host_impl.InitializeRenderer(output_surface.get()); |
| 218 host_impl.CreatePendingTree(); | 212 host_impl.CreatePendingTree(); |
| 219 scoped_ptr<FakePictureLayerImpl> layer_impl = | 213 scoped_ptr<FakePictureLayerImpl> layer_impl = |
| 220 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1); | 214 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1); |
| 221 | 215 |
| 222 layer->PushPropertiesTo(layer_impl.get()); | 216 layer->PushPropertiesTo(layer_impl.get()); |
| 223 EXPECT_FALSE(layer_impl->CanHaveTilings()); | 217 EXPECT_FALSE(layer_impl->CanHaveTilings()); |
| 224 EXPECT_TRUE(layer_impl->bounds() == gfx::Size(0, 0)); | 218 EXPECT_TRUE(layer_impl->bounds() == gfx::Size(0, 0)); |
| 225 EXPECT_EQ(gfx::Size(), layer_impl->raster_source()->GetSize()); | 219 EXPECT_EQ(gfx::Size(), layer_impl->raster_source()->GetSize()); |
| 226 EXPECT_FALSE(layer_impl->raster_source()->HasRecordings()); | 220 EXPECT_FALSE(layer_impl->raster_source()->HasRecordings()); |
| 227 } | 221 } |
| 228 | 222 |
| 229 TEST(PictureLayerTest, ClearVisibleRectWhenNoTiling) { | 223 TEST(PictureLayerTest, ClearVisibleRectWhenNoTiling) { |
| 230 gfx::Size layer_size(50, 50); | 224 gfx::Size layer_size(50, 50); |
| 231 FakeContentLayerClient client; | 225 FakeContentLayerClient client; |
| 232 client.set_bounds(layer_size); | 226 client.set_bounds(layer_size); |
| 233 skia::RefPtr<SkImage> image = CreateDiscardableImage(layer_size); | 227 skia::RefPtr<SkImage> image = CreateDiscardableImage(layer_size); |
| 234 client.add_draw_image(image.get(), gfx::Point(), SkPaint()); | 228 client.add_draw_image(image.get(), gfx::Point(), SkPaint()); |
| 235 scoped_refptr<PictureLayer> layer = | 229 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
| 236 PictureLayer::Create(LayerSettings(), &client); | |
| 237 layer->SetBounds(gfx::Size(10, 10)); | 230 layer->SetBounds(gfx::Size(10, 10)); |
| 238 | 231 |
| 239 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 232 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
| 240 TestTaskGraphRunner task_graph_runner; | 233 TestTaskGraphRunner task_graph_runner; |
| 241 scoped_ptr<FakeLayerTreeHost> host = | 234 scoped_ptr<FakeLayerTreeHost> host = |
| 242 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); | 235 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); |
| 243 host->SetRootLayer(layer); | 236 host->SetRootLayer(layer); |
| 244 layer->SetIsDrawable(true); | 237 layer->SetIsDrawable(true); |
| 245 layer->SavePaintProperties(); | 238 layer->SavePaintProperties(); |
| 246 layer->Update(); | 239 layer->Update(); |
| 247 | 240 |
| 248 EXPECT_EQ(0, host->source_frame_number()); | 241 EXPECT_EQ(0, host->source_frame_number()); |
| 249 host->CommitComplete(); | 242 host->CommitComplete(); |
| 250 EXPECT_EQ(1, host->source_frame_number()); | 243 EXPECT_EQ(1, host->source_frame_number()); |
| 251 | 244 |
| 252 layer->SavePaintProperties(); | 245 layer->SavePaintProperties(); |
| 253 layer->Update(); | 246 layer->Update(); |
| 254 | 247 |
| 255 FakeImplTaskRunnerProvider impl_task_runner_provider; | 248 FakeImplTaskRunnerProvider impl_task_runner_provider; |
| 256 | 249 |
| 257 TestSharedBitmapManager shared_bitmap_manager; | 250 TestSharedBitmapManager shared_bitmap_manager; |
| 258 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d()); | 251 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d()); |
| 259 LayerTreeSettings layer_tree_settings = LayerTreeSettingsForTesting(); | 252 LayerTreeSettings layer_tree_settings = LayerTreeSettings(); |
| 260 layer_tree_settings.image_decode_tasks_enabled = true; | 253 layer_tree_settings.image_decode_tasks_enabled = true; |
| 261 FakeLayerTreeHostImpl host_impl(layer_tree_settings, | 254 FakeLayerTreeHostImpl host_impl(layer_tree_settings, |
| 262 &impl_task_runner_provider, | 255 &impl_task_runner_provider, |
| 263 &shared_bitmap_manager, &task_graph_runner); | 256 &shared_bitmap_manager, &task_graph_runner); |
| 264 host_impl.SetVisible(true); | 257 host_impl.SetVisible(true); |
| 265 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); | 258 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); |
| 266 | 259 |
| 267 host_impl.CreatePendingTree(); | 260 host_impl.CreatePendingTree(); |
| 268 host_impl.pending_tree()->SetRootLayer( | 261 host_impl.pending_tree()->SetRootLayer( |
| 269 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); | 262 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 300 |
| 308 TEST(PictureLayerTest, SuitableForGpuRasterization) { | 301 TEST(PictureLayerTest, SuitableForGpuRasterization) { |
| 309 scoped_ptr<FakeDisplayListRecordingSource> recording_source_owned( | 302 scoped_ptr<FakeDisplayListRecordingSource> recording_source_owned( |
| 310 new FakeDisplayListRecordingSource); | 303 new FakeDisplayListRecordingSource); |
| 311 FakeDisplayListRecordingSource* recording_source = | 304 FakeDisplayListRecordingSource* recording_source = |
| 312 recording_source_owned.get(); | 305 recording_source_owned.get(); |
| 313 | 306 |
| 314 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); | 307 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); |
| 315 scoped_refptr<FakePictureLayer> layer = | 308 scoped_refptr<FakePictureLayer> layer = |
| 316 FakePictureLayer::CreateWithRecordingSource( | 309 FakePictureLayer::CreateWithRecordingSource( |
| 317 LayerSettings(), client, std::move(recording_source_owned)); | 310 client, std::move(recording_source_owned)); |
| 318 | 311 |
| 319 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 312 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
| 320 TestTaskGraphRunner task_graph_runner; | 313 TestTaskGraphRunner task_graph_runner; |
| 321 scoped_ptr<FakeLayerTreeHost> host = | 314 scoped_ptr<FakeLayerTreeHost> host = |
| 322 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); | 315 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); |
| 323 host->SetRootLayer(layer); | 316 host->SetRootLayer(layer); |
| 324 | 317 |
| 325 // Update layers to initialize the recording source. | 318 // Update layers to initialize the recording source. |
| 326 gfx::Size layer_bounds(200, 200); | 319 gfx::Size layer_bounds(200, 200); |
| 327 gfx::Rect layer_rect(layer_bounds); | 320 gfx::Rect layer_rect(layer_bounds); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 338 recording_source->SetUnsuitableForGpuRasterization(); | 331 recording_source->SetUnsuitableForGpuRasterization(); |
| 339 EXPECT_FALSE(recording_source->IsSuitableForGpuRasterization()); | 332 EXPECT_FALSE(recording_source->IsSuitableForGpuRasterization()); |
| 340 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); | 333 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); |
| 341 } | 334 } |
| 342 | 335 |
| 343 // PicturePile uses the source frame number as a unit for measuring invalidation | 336 // PicturePile uses the source frame number as a unit for measuring invalidation |
| 344 // frequency. When a pile moves between compositors, the frame number increases | 337 // frequency. When a pile moves between compositors, the frame number increases |
| 345 // non-monotonically. This executes that code path under this scenario allowing | 338 // non-monotonically. This executes that code path under this scenario allowing |
| 346 // for the code to verify correctness with DCHECKs. | 339 // for the code to verify correctness with DCHECKs. |
| 347 TEST(PictureLayerTest, NonMonotonicSourceFrameNumber) { | 340 TEST(PictureLayerTest, NonMonotonicSourceFrameNumber) { |
| 348 LayerTreeSettingsForTesting settings; | 341 LayerTreeSettings settings; |
| 349 settings.single_thread_proxy_scheduler = false; | 342 settings.single_thread_proxy_scheduler = false; |
| 350 settings.use_zero_copy = true; | 343 settings.use_zero_copy = true; |
| 351 | 344 |
| 352 FakeLayerTreeHostClient host_client1(FakeLayerTreeHostClient::DIRECT_3D); | 345 FakeLayerTreeHostClient host_client1(FakeLayerTreeHostClient::DIRECT_3D); |
| 353 FakeLayerTreeHostClient host_client2(FakeLayerTreeHostClient::DIRECT_3D); | 346 FakeLayerTreeHostClient host_client2(FakeLayerTreeHostClient::DIRECT_3D); |
| 354 TestSharedBitmapManager shared_bitmap_manager; | 347 TestSharedBitmapManager shared_bitmap_manager; |
| 355 TestTaskGraphRunner task_graph_runner; | 348 TestTaskGraphRunner task_graph_runner; |
| 356 | 349 |
| 357 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); | 350 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); |
| 358 scoped_refptr<FakePictureLayer> layer = | 351 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(client); |
| 359 FakePictureLayer::Create(LayerSettings(), client); | |
| 360 | 352 |
| 361 LayerTreeHost::InitParams params; | 353 LayerTreeHost::InitParams params; |
| 362 params.client = &host_client1; | 354 params.client = &host_client1; |
| 363 params.shared_bitmap_manager = &shared_bitmap_manager; | 355 params.shared_bitmap_manager = &shared_bitmap_manager; |
| 364 params.settings = &settings; | 356 params.settings = &settings; |
| 365 params.task_graph_runner = &task_graph_runner; | 357 params.task_graph_runner = &task_graph_runner; |
| 366 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); | 358 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 367 scoped_ptr<LayerTreeHost> host1 = | 359 scoped_ptr<LayerTreeHost> host1 = |
| 368 LayerTreeHost::CreateSingleThreaded(&host_client1, ¶ms); | 360 LayerTreeHost::CreateSingleThreaded(&host_client1, ¶ms); |
| 369 host1->SetVisible(true); | 361 host1->SetVisible(true); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 397 // Do a main frame, record the picture layers. The frame number has changed | 389 // Do a main frame, record the picture layers. The frame number has changed |
| 398 // non-monotonically. | 390 // non-monotonically. |
| 399 layer->SetNeedsDisplay(); | 391 layer->SetNeedsDisplay(); |
| 400 host2->Composite(base::TimeTicks::Now()); | 392 host2->Composite(base::TimeTicks::Now()); |
| 401 EXPECT_EQ(3, layer->update_count()); | 393 EXPECT_EQ(3, layer->update_count()); |
| 402 EXPECT_EQ(1, host2->source_frame_number()); | 394 EXPECT_EQ(1, host2->source_frame_number()); |
| 403 } | 395 } |
| 404 | 396 |
| 405 } // namespace | 397 } // namespace |
| 406 } // namespace cc | 398 } // namespace cc |
| OLD | NEW |