Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: cc/layers/picture_layer_unittest.cc

Issue 2337913003: Fork cc::OutputSurface into cc::CompositorFrameSink. (Closed)
Patch Set: cfsfork: android-vulkan Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/layers/render_surface_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
11 #include "cc/animation/animation_host.h" 11 #include "cc/animation/animation_host.h"
12 #include "cc/layers/append_quads_data.h" 12 #include "cc/layers/append_quads_data.h"
13 #include "cc/layers/content_layer_client.h" 13 #include "cc/layers/content_layer_client.h"
14 #include "cc/layers/empty_content_layer_client.h" 14 #include "cc/layers/empty_content_layer_client.h"
15 #include "cc/layers/picture_layer_impl.h" 15 #include "cc/layers/picture_layer_impl.h"
16 #include "cc/playback/display_item_list_settings.h" 16 #include "cc/playback/display_item_list_settings.h"
17 #include "cc/proto/layer.pb.h" 17 #include "cc/proto/layer.pb.h"
18 #include "cc/test/fake_client_picture_cache.h" 18 #include "cc/test/fake_client_picture_cache.h"
19 #include "cc/test/fake_compositor_frame_sink.h"
19 #include "cc/test/fake_engine_picture_cache.h" 20 #include "cc/test/fake_engine_picture_cache.h"
20 #include "cc/test/fake_image_serialization_processor.h" 21 #include "cc/test/fake_image_serialization_processor.h"
21 #include "cc/test/fake_layer_tree_host.h" 22 #include "cc/test/fake_layer_tree_host.h"
22 #include "cc/test/fake_output_surface.h"
23 #include "cc/test/fake_picture_layer.h" 23 #include "cc/test/fake_picture_layer.h"
24 #include "cc/test/fake_picture_layer_impl.h" 24 #include "cc/test/fake_picture_layer_impl.h"
25 #include "cc/test/fake_proxy.h" 25 #include "cc/test/fake_proxy.h"
26 #include "cc/test/fake_recording_source.h" 26 #include "cc/test/fake_recording_source.h"
27 #include "cc/test/layer_tree_settings_for_testing.h" 27 #include "cc/test/layer_tree_settings_for_testing.h"
28 #include "cc/test/skia_common.h" 28 #include "cc/test/skia_common.h"
29 #include "cc/test/stub_layer_tree_host_single_thread_client.h" 29 #include "cc/test/stub_layer_tree_host_single_thread_client.h"
30 #include "cc/test/test_shared_bitmap_manager.h" 30 #include "cc/test/test_shared_bitmap_manager.h"
31 #include "cc/test/test_task_graph_runner.h" 31 #include "cc/test/test_task_graph_runner.h"
32 #include "cc/trees/single_thread_proxy.h" 32 #include "cc/trees/single_thread_proxy.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 EXPECT_EQ(1, host->SourceFrameNumber()); 246 EXPECT_EQ(1, host->SourceFrameNumber());
247 247
248 layer->SetBounds(gfx::Size(0, 0)); 248 layer->SetBounds(gfx::Size(0, 0));
249 layer->SavePaintProperties(); 249 layer->SavePaintProperties();
250 // Intentionally skipping Update since it would normally be skipped on 250 // Intentionally skipping Update since it would normally be skipped on
251 // a layer with empty bounds. 251 // a layer with empty bounds.
252 252
253 FakeImplTaskRunnerProvider impl_task_runner_provider; 253 FakeImplTaskRunnerProvider impl_task_runner_provider;
254 254
255 TestSharedBitmapManager shared_bitmap_manager; 255 TestSharedBitmapManager shared_bitmap_manager;
256 std::unique_ptr<FakeOutputSurface> output_surface = 256 std::unique_ptr<FakeCompositorFrameSink> compositor_frame_sink =
257 FakeOutputSurface::CreateDelegatingSoftware(); 257 FakeCompositorFrameSink::CreateSoftware();
258 FakeLayerTreeHostImpl host_impl(LayerTreeSettings(), 258 FakeLayerTreeHostImpl host_impl(LayerTreeSettings(),
259 &impl_task_runner_provider, 259 &impl_task_runner_provider,
260 &shared_bitmap_manager, &task_graph_runner); 260 &shared_bitmap_manager, &task_graph_runner);
261 host_impl.InitializeRenderer(output_surface.get()); 261 host_impl.InitializeRenderer(compositor_frame_sink.get());
262 host_impl.CreatePendingTree(); 262 host_impl.CreatePendingTree();
263 std::unique_ptr<FakePictureLayerImpl> layer_impl = 263 std::unique_ptr<FakePictureLayerImpl> layer_impl =
264 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1); 264 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1);
265 265
266 layer->PushPropertiesTo(layer_impl.get()); 266 layer->PushPropertiesTo(layer_impl.get());
267 EXPECT_FALSE(layer_impl->CanHaveTilings()); 267 EXPECT_FALSE(layer_impl->CanHaveTilings());
268 EXPECT_TRUE(layer_impl->bounds() == gfx::Size(0, 0)); 268 EXPECT_TRUE(layer_impl->bounds() == gfx::Size(0, 0));
269 EXPECT_EQ(gfx::Size(), layer_impl->raster_source()->GetSize()); 269 EXPECT_EQ(gfx::Size(), layer_impl->raster_source()->GetSize());
270 EXPECT_FALSE(layer_impl->raster_source()->HasRecordings()); 270 EXPECT_FALSE(layer_impl->raster_source()->HasRecordings());
271 } 271 }
(...skipping 15 matching lines...) Expand all
287 287
288 gfx::Rect invalidation_bounds(layer_size); 288 gfx::Rect invalidation_bounds(layer_size);
289 289
290 // The important two lines are the following: 290 // The important two lines are the following:
291 layer->SetNeedsDisplayRect(invalidation_bounds); 291 layer->SetNeedsDisplayRect(invalidation_bounds);
292 layer->Update(); 292 layer->Update();
293 293
294 host->CommitComplete(); 294 host->CommitComplete();
295 FakeImplTaskRunnerProvider impl_task_runner_provider; 295 FakeImplTaskRunnerProvider impl_task_runner_provider;
296 TestSharedBitmapManager shared_bitmap_manager; 296 TestSharedBitmapManager shared_bitmap_manager;
297 std::unique_ptr<OutputSurface> output_surface( 297 std::unique_ptr<CompositorFrameSink> compositor_frame_sink(
298 FakeOutputSurface::CreateDelegating3d()); 298 FakeCompositorFrameSink::Create3d());
299 LayerTreeSettings layer_tree_settings = LayerTreeSettingsForTesting(); 299 LayerTreeSettings layer_tree_settings = LayerTreeSettingsForTesting();
300 layer_tree_settings.image_decode_tasks_enabled = true; 300 layer_tree_settings.image_decode_tasks_enabled = true;
301 FakeLayerTreeHostImpl host_impl(layer_tree_settings, 301 FakeLayerTreeHostImpl host_impl(layer_tree_settings,
302 &impl_task_runner_provider, 302 &impl_task_runner_provider,
303 &shared_bitmap_manager, &task_graph_runner); 303 &shared_bitmap_manager, &task_graph_runner);
304 host_impl.SetVisible(true); 304 host_impl.SetVisible(true);
305 host_impl.InitializeRenderer(output_surface.get()); 305 host_impl.InitializeRenderer(compositor_frame_sink.get());
306 host_impl.CreatePendingTree(); 306 host_impl.CreatePendingTree();
307 host_impl.pending_tree()->SetRootLayerForTesting( 307 host_impl.pending_tree()->SetRootLayerForTesting(
308 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); 308 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1));
309 host_impl.pending_tree()->BuildLayerListForTesting(); 309 host_impl.pending_tree()->BuildLayerListForTesting();
310 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>( 310 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>(
311 host_impl.pending_tree()->root_layer_for_testing()); 311 host_impl.pending_tree()->root_layer_for_testing());
312 layer->PushPropertiesTo(layer_impl); 312 layer->PushPropertiesTo(layer_impl);
313 313
314 EXPECT_EQ(invalidation_bounds, 314 EXPECT_EQ(invalidation_bounds,
315 layer_impl->GetPendingInvalidation()->bounds()); 315 layer_impl->GetPendingInvalidation()->bounds());
(...skipping 15 matching lines...) Expand all
331 layer->SavePaintProperties(); 331 layer->SavePaintProperties();
332 332
333 gfx::Rect invalidation_bounds(layer_size); 333 gfx::Rect invalidation_bounds(layer_size);
334 334
335 // The important line is the following (note that we do not call Update): 335 // The important line is the following (note that we do not call Update):
336 layer->SetNeedsDisplayRect(invalidation_bounds); 336 layer->SetNeedsDisplayRect(invalidation_bounds);
337 337
338 host->CommitComplete(); 338 host->CommitComplete();
339 FakeImplTaskRunnerProvider impl_task_runner_provider; 339 FakeImplTaskRunnerProvider impl_task_runner_provider;
340 TestSharedBitmapManager shared_bitmap_manager; 340 TestSharedBitmapManager shared_bitmap_manager;
341 std::unique_ptr<OutputSurface> output_surface( 341 std::unique_ptr<CompositorFrameSink> compositor_frame_sink(
342 FakeOutputSurface::CreateDelegating3d()); 342 FakeCompositorFrameSink::Create3d());
343 LayerTreeSettings layer_tree_settings = LayerTreeSettingsForTesting(); 343 LayerTreeSettings layer_tree_settings = LayerTreeSettingsForTesting();
344 layer_tree_settings.image_decode_tasks_enabled = true; 344 layer_tree_settings.image_decode_tasks_enabled = true;
345 FakeLayerTreeHostImpl host_impl(layer_tree_settings, 345 FakeLayerTreeHostImpl host_impl(layer_tree_settings,
346 &impl_task_runner_provider, 346 &impl_task_runner_provider,
347 &shared_bitmap_manager, &task_graph_runner); 347 &shared_bitmap_manager, &task_graph_runner);
348 host_impl.SetVisible(true); 348 host_impl.SetVisible(true);
349 host_impl.InitializeRenderer(output_surface.get()); 349 host_impl.InitializeRenderer(compositor_frame_sink.get());
350 host_impl.CreatePendingTree(); 350 host_impl.CreatePendingTree();
351 host_impl.pending_tree()->SetRootLayerForTesting( 351 host_impl.pending_tree()->SetRootLayerForTesting(
352 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); 352 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1));
353 host_impl.pending_tree()->BuildLayerListForTesting(); 353 host_impl.pending_tree()->BuildLayerListForTesting();
354 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>( 354 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>(
355 host_impl.pending_tree()->root_layer_for_testing()); 355 host_impl.pending_tree()->root_layer_for_testing());
356 layer->PushPropertiesTo(layer_impl); 356 layer->PushPropertiesTo(layer_impl);
357 357
358 EXPECT_EQ(gfx::Rect(), layer_impl->GetPendingInvalidation()->bounds()); 358 EXPECT_EQ(gfx::Rect(), layer_impl->GetPendingInvalidation()->bounds());
359 } 359 }
(...skipping 19 matching lines...) Expand all
379 EXPECT_EQ(0, host->SourceFrameNumber()); 379 EXPECT_EQ(0, host->SourceFrameNumber());
380 host->CommitComplete(); 380 host->CommitComplete();
381 EXPECT_EQ(1, host->SourceFrameNumber()); 381 EXPECT_EQ(1, host->SourceFrameNumber());
382 382
383 layer->SavePaintProperties(); 383 layer->SavePaintProperties();
384 layer->Update(); 384 layer->Update();
385 385
386 FakeImplTaskRunnerProvider impl_task_runner_provider; 386 FakeImplTaskRunnerProvider impl_task_runner_provider;
387 387
388 TestSharedBitmapManager shared_bitmap_manager; 388 TestSharedBitmapManager shared_bitmap_manager;
389 std::unique_ptr<OutputSurface> output_surface( 389 std::unique_ptr<CompositorFrameSink> compositor_frame_sink(
390 FakeOutputSurface::CreateDelegating3d()); 390 FakeCompositorFrameSink::Create3d());
391 LayerTreeSettings layer_tree_settings = LayerTreeSettingsForTesting(); 391 LayerTreeSettings layer_tree_settings = LayerTreeSettingsForTesting();
392 layer_tree_settings.image_decode_tasks_enabled = true; 392 layer_tree_settings.image_decode_tasks_enabled = true;
393 FakeLayerTreeHostImpl host_impl(layer_tree_settings, 393 FakeLayerTreeHostImpl host_impl(layer_tree_settings,
394 &impl_task_runner_provider, 394 &impl_task_runner_provider,
395 &shared_bitmap_manager, &task_graph_runner); 395 &shared_bitmap_manager, &task_graph_runner);
396 host_impl.SetVisible(true); 396 host_impl.SetVisible(true);
397 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); 397 EXPECT_TRUE(host_impl.InitializeRenderer(compositor_frame_sink.get()));
398 398
399 host_impl.CreatePendingTree(); 399 host_impl.CreatePendingTree();
400 host_impl.pending_tree()->SetRootLayerForTesting( 400 host_impl.pending_tree()->SetRootLayerForTesting(
401 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); 401 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1));
402 host_impl.pending_tree()->BuildLayerListForTesting(); 402 host_impl.pending_tree()->BuildLayerListForTesting();
403 403
404 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>( 404 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>(
405 host_impl.pending_tree()->root_layer_for_testing()); 405 host_impl.pending_tree()->root_layer_for_testing());
406 406
407 layer->PushPropertiesTo(layer_impl); 407 layer->PushPropertiesTo(layer_impl);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 // Do a main frame, record the picture layers. The frame number has changed 546 // Do a main frame, record the picture layers. The frame number has changed
547 // non-monotonically. 547 // non-monotonically.
548 layer->SetNeedsDisplay(); 548 layer->SetNeedsDisplay();
549 host2->Composite(base::TimeTicks::Now()); 549 host2->Composite(base::TimeTicks::Now());
550 EXPECT_EQ(3, layer->update_count()); 550 EXPECT_EQ(3, layer->update_count());
551 EXPECT_EQ(1, host2->SourceFrameNumber()); 551 EXPECT_EQ(1, host2->SourceFrameNumber());
552 } 552 }
553 553
554 } // namespace 554 } // namespace
555 } // namespace cc 555 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/layers/render_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698