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

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: fix perftests compile by not verify clip tree calc there Created 4 years, 7 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/test/fake_layer_tree_host_impl.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/layers/append_quads_data.h" 11 #include "cc/layers/append_quads_data.h"
12 #include "cc/layers/content_layer_client.h" 12 #include "cc/layers/content_layer_client.h"
13 #include "cc/layers/empty_content_layer_client.h" 13 #include "cc/layers/empty_content_layer_client.h"
14 #include "cc/layers/picture_layer_impl.h" 14 #include "cc/layers/picture_layer_impl.h"
15 #include "cc/playback/display_item_list_settings.h" 15 #include "cc/playback/display_item_list_settings.h"
16 #include "cc/proto/layer.pb.h" 16 #include "cc/proto/layer.pb.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/fake_recording_source.h" 23 #include "cc/test/fake_recording_source.h"
24 #include "cc/test/layer_tree_settings_for_testing.h"
24 #include "cc/test/skia_common.h" 25 #include "cc/test/skia_common.h"
25 #include "cc/test/test_shared_bitmap_manager.h" 26 #include "cc/test/test_shared_bitmap_manager.h"
26 #include "cc/test/test_task_graph_runner.h" 27 #include "cc/test/test_task_graph_runner.h"
27 #include "cc/trees/single_thread_proxy.h" 28 #include "cc/trees/single_thread_proxy.h"
28 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
29 #include "third_party/skia/include/core/SkRefCnt.h" 30 #include "third_party/skia/include/core/SkRefCnt.h"
30 31
31 namespace cc { 32 namespace cc {
32 33
33 class TestSerializationPictureLayer : public PictureLayer { 34 class TestSerializationPictureLayer : public PictureLayer {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 host->CommitComplete(); 321 host->CommitComplete();
321 EXPECT_EQ(1, host->source_frame_number()); 322 EXPECT_EQ(1, host->source_frame_number());
322 323
323 layer->SavePaintProperties(); 324 layer->SavePaintProperties();
324 layer->Update(); 325 layer->Update();
325 326
326 FakeImplTaskRunnerProvider impl_task_runner_provider; 327 FakeImplTaskRunnerProvider impl_task_runner_provider;
327 328
328 TestSharedBitmapManager shared_bitmap_manager; 329 TestSharedBitmapManager shared_bitmap_manager;
329 std::unique_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d()); 330 std::unique_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d());
330 LayerTreeSettings layer_tree_settings = LayerTreeSettings(); 331 LayerTreeSettings layer_tree_settings = LayerTreeSettingsForTesting();
331 layer_tree_settings.image_decode_tasks_enabled = true; 332 layer_tree_settings.image_decode_tasks_enabled = true;
332 FakeLayerTreeHostImpl host_impl(layer_tree_settings, 333 FakeLayerTreeHostImpl host_impl(layer_tree_settings,
333 &impl_task_runner_provider, 334 &impl_task_runner_provider,
334 &shared_bitmap_manager, &task_graph_runner); 335 &shared_bitmap_manager, &task_graph_runner);
335 host_impl.SetVisible(true); 336 host_impl.SetVisible(true);
336 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); 337 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get()));
337 338
338 host_impl.CreatePendingTree(); 339 host_impl.CreatePendingTree();
339 host_impl.pending_tree()->SetRootLayer( 340 host_impl.pending_tree()->SetRootLayer(
340 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); 341 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1));
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 } 411 }
411 412
412 // PicturePile uses the source frame number as a unit for measuring invalidation 413 // PicturePile uses the source frame number as a unit for measuring invalidation
413 // frequency. When a pile moves between compositors, the frame number increases 414 // frequency. When a pile moves between compositors, the frame number increases
414 // non-monotonically. This executes that code path under this scenario allowing 415 // non-monotonically. This executes that code path under this scenario allowing
415 // for the code to verify correctness with DCHECKs. 416 // for the code to verify correctness with DCHECKs.
416 TEST(PictureLayerTest, NonMonotonicSourceFrameNumber) { 417 TEST(PictureLayerTest, NonMonotonicSourceFrameNumber) {
417 LayerTreeSettings settings; 418 LayerTreeSettings settings;
418 settings.single_thread_proxy_scheduler = false; 419 settings.single_thread_proxy_scheduler = false;
419 settings.use_zero_copy = true; 420 settings.use_zero_copy = true;
421 settings.verify_clip_tree_calculations = true;
420 422
421 FakeLayerTreeHostClient host_client1(FakeLayerTreeHostClient::DIRECT_3D); 423 FakeLayerTreeHostClient host_client1(FakeLayerTreeHostClient::DIRECT_3D);
422 FakeLayerTreeHostClient host_client2(FakeLayerTreeHostClient::DIRECT_3D); 424 FakeLayerTreeHostClient host_client2(FakeLayerTreeHostClient::DIRECT_3D);
423 TestSharedBitmapManager shared_bitmap_manager; 425 TestSharedBitmapManager shared_bitmap_manager;
424 TestTaskGraphRunner task_graph_runner; 426 TestTaskGraphRunner task_graph_runner;
425 427
426 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); 428 ContentLayerClient* client = EmptyContentLayerClient::GetInstance();
427 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(client); 429 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(client);
428 430
429 LayerTreeHost::InitParams params; 431 LayerTreeHost::InitParams params;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 // Do a main frame, record the picture layers. The frame number has changed 467 // Do a main frame, record the picture layers. The frame number has changed
466 // non-monotonically. 468 // non-monotonically.
467 layer->SetNeedsDisplay(); 469 layer->SetNeedsDisplay();
468 host2->Composite(base::TimeTicks::Now()); 470 host2->Composite(base::TimeTicks::Now());
469 EXPECT_EQ(3, layer->update_count()); 471 EXPECT_EQ(3, layer->update_count());
470 EXPECT_EQ(1, host2->source_frame_number()); 472 EXPECT_EQ(1, host2->source_frame_number());
471 } 473 }
472 474
473 } // namespace 475 } // namespace
474 } // namespace cc 476 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/test/fake_layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698