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

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

Issue 1800923002: cc: Directly use property trees to calculate clip rect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add setting to only calculate and verify in cc_unittest Created 4 years, 9 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
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/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/picture_layer_impl.h" 13 #include "cc/layers/picture_layer_impl.h"
14 #include "cc/playback/display_item_list_settings.h" 14 #include "cc/playback/display_item_list_settings.h"
15 #include "cc/proto/layer.pb.h" 15 #include "cc/proto/layer.pb.h"
16 #include "cc/test/fake_display_list_recording_source.h" 16 #include "cc/test/fake_display_list_recording_source.h"
17 #include "cc/test/fake_image_serialization_processor.h" 17 #include "cc/test/fake_image_serialization_processor.h"
18 #include "cc/test/fake_layer_tree_host.h" 18 #include "cc/test/fake_layer_tree_host.h"
19 #include "cc/test/fake_output_surface.h" 19 #include "cc/test/fake_output_surface.h"
20 #include "cc/test/fake_picture_layer.h" 20 #include "cc/test/fake_picture_layer.h"
21 #include "cc/test/fake_picture_layer_impl.h" 21 #include "cc/test/fake_picture_layer_impl.h"
22 #include "cc/test/fake_proxy.h" 22 #include "cc/test/fake_proxy.h"
23 #include "cc/test/layer_tree_settings_for_testing.h"
23 #include "cc/test/skia_common.h" 24 #include "cc/test/skia_common.h"
24 #include "cc/test/test_shared_bitmap_manager.h" 25 #include "cc/test/test_shared_bitmap_manager.h"
25 #include "cc/test/test_task_graph_runner.h" 26 #include "cc/test/test_task_graph_runner.h"
26 #include "cc/trees/single_thread_proxy.h" 27 #include "cc/trees/single_thread_proxy.h"
27 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
28 29
29 namespace cc { 30 namespace cc {
30 31
31 class TestSerializationPictureLayer : public PictureLayer { 32 class TestSerializationPictureLayer : public PictureLayer {
32 public: 33 public:
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 host->CommitComplete(); 327 host->CommitComplete();
327 EXPECT_EQ(1, host->source_frame_number()); 328 EXPECT_EQ(1, host->source_frame_number());
328 329
329 layer->SavePaintProperties(); 330 layer->SavePaintProperties();
330 layer->Update(); 331 layer->Update();
331 332
332 FakeImplTaskRunnerProvider impl_task_runner_provider; 333 FakeImplTaskRunnerProvider impl_task_runner_provider;
333 334
334 TestSharedBitmapManager shared_bitmap_manager; 335 TestSharedBitmapManager shared_bitmap_manager;
335 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d()); 336 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d());
336 LayerTreeSettings layer_tree_settings = LayerTreeSettings(); 337 LayerTreeSettings layer_tree_settings = LayerTreeSettingsForTesting();
337 layer_tree_settings.image_decode_tasks_enabled = true; 338 layer_tree_settings.image_decode_tasks_enabled = true;
338 FakeLayerTreeHostImpl host_impl(layer_tree_settings, 339 FakeLayerTreeHostImpl host_impl(layer_tree_settings,
339 &impl_task_runner_provider, 340 &impl_task_runner_provider,
340 &shared_bitmap_manager, &task_graph_runner); 341 &shared_bitmap_manager, &task_graph_runner);
341 host_impl.SetVisible(true); 342 host_impl.SetVisible(true);
342 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); 343 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get()));
343 344
344 host_impl.CreatePendingTree(); 345 host_impl.CreatePendingTree();
345 host_impl.pending_tree()->SetRootLayer( 346 host_impl.pending_tree()->SetRootLayer(
346 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); 347 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1));
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } 419 }
419 420
420 // PicturePile uses the source frame number as a unit for measuring invalidation 421 // PicturePile uses the source frame number as a unit for measuring invalidation
421 // frequency. When a pile moves between compositors, the frame number increases 422 // frequency. When a pile moves between compositors, the frame number increases
422 // non-monotonically. This executes that code path under this scenario allowing 423 // non-monotonically. This executes that code path under this scenario allowing
423 // for the code to verify correctness with DCHECKs. 424 // for the code to verify correctness with DCHECKs.
424 TEST(PictureLayerTest, NonMonotonicSourceFrameNumber) { 425 TEST(PictureLayerTest, NonMonotonicSourceFrameNumber) {
425 LayerTreeSettings settings; 426 LayerTreeSettings settings;
426 settings.single_thread_proxy_scheduler = false; 427 settings.single_thread_proxy_scheduler = false;
427 settings.use_zero_copy = true; 428 settings.use_zero_copy = true;
429 settings.verify_clip_tree_calculations = true;
428 430
429 FakeLayerTreeHostClient host_client1(FakeLayerTreeHostClient::DIRECT_3D); 431 FakeLayerTreeHostClient host_client1(FakeLayerTreeHostClient::DIRECT_3D);
430 FakeLayerTreeHostClient host_client2(FakeLayerTreeHostClient::DIRECT_3D); 432 FakeLayerTreeHostClient host_client2(FakeLayerTreeHostClient::DIRECT_3D);
431 TestSharedBitmapManager shared_bitmap_manager; 433 TestSharedBitmapManager shared_bitmap_manager;
432 TestTaskGraphRunner task_graph_runner; 434 TestTaskGraphRunner task_graph_runner;
433 435
434 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); 436 ContentLayerClient* client = EmptyContentLayerClient::GetInstance();
435 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(client); 437 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(client);
436 438
437 LayerTreeHost::InitParams params; 439 LayerTreeHost::InitParams params;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 // Do a main frame, record the picture layers. The frame number has changed 475 // Do a main frame, record the picture layers. The frame number has changed
474 // non-monotonically. 476 // non-monotonically.
475 layer->SetNeedsDisplay(); 477 layer->SetNeedsDisplay();
476 host2->Composite(base::TimeTicks::Now()); 478 host2->Composite(base::TimeTicks::Now());
477 EXPECT_EQ(3, layer->update_count()); 479 EXPECT_EQ(3, layer->update_count());
478 EXPECT_EQ(1, host2->source_frame_number()); 480 EXPECT_EQ(1, host2->source_frame_number());
479 } 481 }
480 482
481 } // namespace 483 } // namespace
482 } // namespace cc 484 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698