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

Side by Side Diff: cc/test/layer_tree_test.cc

Issue 1982893002: [blimp] Add SkPicture caching support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix non-existing SkPicture::uniqueID() when dealing with display items without SkPictures 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
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/test/layer_tree_test.h" 5 #include "cc/test/layer_tree_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
12 #include "cc/animation/animation.h" 12 #include "cc/animation/animation.h"
13 #include "cc/animation/animation_host.h" 13 #include "cc/animation/animation_host.h"
14 #include "cc/animation/element_animations.h" 14 #include "cc/animation/element_animations.h"
15 #include "cc/animation/timing_function.h" 15 #include "cc/animation/timing_function.h"
16 #include "cc/base/switches.h" 16 #include "cc/base/switches.h"
17 #include "cc/input/input_handler.h" 17 #include "cc/input/input_handler.h"
18 #include "cc/layers/layer.h" 18 #include "cc/layers/layer.h"
19 #include "cc/layers/layer_impl.h" 19 #include "cc/layers/layer_impl.h"
20 #include "cc/proto/compositor_message_to_impl.pb.h" 20 #include "cc/proto/compositor_message_to_impl.pb.h"
21 #include "cc/proto/image_serialization_processor.h"
21 #include "cc/test/animation_test_common.h" 22 #include "cc/test/animation_test_common.h"
22 #include "cc/test/begin_frame_args_test.h" 23 #include "cc/test/begin_frame_args_test.h"
23 #include "cc/test/fake_external_begin_frame_source.h" 24 #include "cc/test/fake_external_begin_frame_source.h"
25 #include "cc/test/fake_image_serialization_processor.h"
24 #include "cc/test/fake_layer_tree_host_client.h" 26 #include "cc/test/fake_layer_tree_host_client.h"
25 #include "cc/test/fake_output_surface.h" 27 #include "cc/test/fake_output_surface.h"
26 #include "cc/test/remote_channel_impl_for_test.h" 28 #include "cc/test/remote_channel_impl_for_test.h"
27 #include "cc/test/test_context_provider.h" 29 #include "cc/test/test_context_provider.h"
28 #include "cc/test/test_gpu_memory_buffer_manager.h" 30 #include "cc/test/test_gpu_memory_buffer_manager.h"
29 #include "cc/test/test_shared_bitmap_manager.h" 31 #include "cc/test/test_shared_bitmap_manager.h"
30 #include "cc/test/test_task_graph_runner.h" 32 #include "cc/test/test_task_graph_runner.h"
31 #include "cc/test/threaded_channel_for_test.h" 33 #include "cc/test/threaded_channel_for_test.h"
32 #include "cc/trees/layer_tree_host_client.h" 34 #include "cc/trees/layer_tree_host_client.h"
33 #include "cc/trees/layer_tree_host_impl.h" 35 #include "cc/trees/layer_tree_host_impl.h"
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 TestHooks* test_hooks, 410 TestHooks* test_hooks,
409 CompositorMode mode, 411 CompositorMode mode,
410 LayerTreeHostClientForTesting* client, 412 LayerTreeHostClientForTesting* client,
411 RemoteProtoChannel* remote_proto_channel, 413 RemoteProtoChannel* remote_proto_channel,
412 SharedBitmapManager* shared_bitmap_manager, 414 SharedBitmapManager* shared_bitmap_manager,
413 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 415 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
414 TaskGraphRunner* task_graph_runner, 416 TaskGraphRunner* task_graph_runner,
415 const LayerTreeSettings& settings, 417 const LayerTreeSettings& settings,
416 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 418 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
417 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, 419 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
418 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { 420 std::unique_ptr<BeginFrameSource> external_begin_frame_source,
421 ImageSerializationProcessor* image_serialization_processor) {
419 LayerTreeHost::InitParams params; 422 LayerTreeHost::InitParams params;
420 params.client = client; 423 params.client = client;
421 params.shared_bitmap_manager = shared_bitmap_manager; 424 params.shared_bitmap_manager = shared_bitmap_manager;
422 params.gpu_memory_buffer_manager = gpu_memory_buffer_manager; 425 params.gpu_memory_buffer_manager = gpu_memory_buffer_manager;
423 params.task_graph_runner = task_graph_runner; 426 params.task_graph_runner = task_graph_runner;
424 params.settings = &settings; 427 params.settings = &settings;
428 params.image_serialization_processor = image_serialization_processor;
429
425 std::unique_ptr<LayerTreeHostForTesting> layer_tree_host( 430 std::unique_ptr<LayerTreeHostForTesting> layer_tree_host(
426 new LayerTreeHostForTesting(test_hooks, &params, mode)); 431 new LayerTreeHostForTesting(test_hooks, &params, mode));
427 std::unique_ptr<TaskRunnerProvider> task_runner_provider = 432 std::unique_ptr<TaskRunnerProvider> task_runner_provider =
428 TaskRunnerProvider::Create(main_task_runner, impl_task_runner); 433 TaskRunnerProvider::Create(main_task_runner, impl_task_runner);
429 std::unique_ptr<Proxy> proxy; 434 std::unique_ptr<Proxy> proxy;
430 switch (mode) { 435 switch (mode) {
431 case CompositorMode::SINGLE_THREADED: 436 case CompositorMode::SINGLE_THREADED:
432 proxy = SingleThreadProxyForTest::Create(test_hooks, 437 proxy = SingleThreadProxyForTest::Create(test_hooks,
433 layer_tree_host.get(), client, 438 layer_tree_host.get(), client,
434 task_runner_provider.get()); 439 task_runner_provider.get());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 test_started_(false) {} 498 test_started_(false) {}
494 499
495 TestHooks* test_hooks_; 500 TestHooks* test_hooks_;
496 bool test_started_; 501 bool test_started_;
497 }; 502 };
498 503
499 LayerTreeTest::LayerTreeTest() 504 LayerTreeTest::LayerTreeTest()
500 : output_surface_(nullptr), 505 : output_surface_(nullptr),
501 external_begin_frame_source_(nullptr), 506 external_begin_frame_source_(nullptr),
502 remote_proto_channel_bridge_(this), 507 remote_proto_channel_bridge_(this),
508 image_serialization_processor_(
509 base::WrapUnique(new FakeImageSerializationProcessor)),
503 beginning_(false), 510 beginning_(false),
504 end_when_begin_returns_(false), 511 end_when_begin_returns_(false),
505 timed_out_(false), 512 timed_out_(false),
506 scheduled_(false), 513 scheduled_(false),
507 started_(false), 514 started_(false),
508 ended_(false), 515 ended_(false),
509 delegating_renderer_(false), 516 delegating_renderer_(false),
510 timeout_seconds_(0), 517 timeout_seconds_(0),
511 weak_factory_(this) { 518 weak_factory_(this) {
512 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr(); 519 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr();
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 } 705 }
699 706
700 DCHECK(!impl_thread_ || impl_thread_->task_runner().get()); 707 DCHECK(!impl_thread_ || impl_thread_->task_runner().get());
701 708
702 if (IsRemoteTest()) { 709 if (IsRemoteTest()) {
703 DCHECK(impl_thread_); 710 DCHECK(impl_thread_);
704 layer_tree_host_ = LayerTreeHostForTesting::Create( 711 layer_tree_host_ = LayerTreeHostForTesting::Create(
705 this, mode_, client_.get(), &remote_proto_channel_bridge_.channel_main, 712 this, mode_, client_.get(), &remote_proto_channel_bridge_.channel_main,
706 nullptr, nullptr, task_graph_runner_.get(), settings_, 713 nullptr, nullptr, task_graph_runner_.get(), settings_,
707 base::ThreadTaskRunnerHandle::Get(), nullptr, 714 base::ThreadTaskRunnerHandle::Get(), nullptr,
708 std::move(external_begin_frame_source)); 715 std::move(external_begin_frame_source),
716 image_serialization_processor_.get());
709 DCHECK(remote_proto_channel_bridge_.channel_main.HasReceiver()); 717 DCHECK(remote_proto_channel_bridge_.channel_main.HasReceiver());
710 } else { 718 } else {
711 layer_tree_host_ = LayerTreeHostForTesting::Create( 719 layer_tree_host_ = LayerTreeHostForTesting::Create(
712 this, mode_, client_.get(), nullptr, shared_bitmap_manager_.get(), 720 this, mode_, client_.get(), nullptr, shared_bitmap_manager_.get(),
713 gpu_memory_buffer_manager_.get(), task_graph_runner_.get(), settings_, 721 gpu_memory_buffer_manager_.get(), task_graph_runner_.get(), settings_,
714 base::ThreadTaskRunnerHandle::Get(), 722 base::ThreadTaskRunnerHandle::Get(),
715 impl_thread_ ? impl_thread_->task_runner() : NULL, 723 impl_thread_ ? impl_thread_->task_runner() : NULL,
716 std::move(external_begin_frame_source)); 724 std::move(external_begin_frame_source),
725 image_serialization_processor_.get());
717 } 726 }
718 727
719 ASSERT_TRUE(layer_tree_host_); 728 ASSERT_TRUE(layer_tree_host_);
720 729
721 started_ = true; 730 started_ = true;
722 beginning_ = true; 731 beginning_ = true;
723 SetupTree(); 732 SetupTree();
724 WillBeginTest(); 733 WillBeginTest();
725 BeginTest(); 734 BeginTest();
726 beginning_ = false; 735 beginning_ = false;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 DCHECK(proto.message_type() == 962 DCHECK(proto.message_type() ==
954 proto::CompositorMessageToImpl::INITIALIZE_IMPL); 963 proto::CompositorMessageToImpl::INITIALIZE_IMPL);
955 964
956 proto::InitializeImpl initialize_proto = proto.initialize_impl_message(); 965 proto::InitializeImpl initialize_proto = proto.initialize_impl_message();
957 LayerTreeSettings settings; 966 LayerTreeSettings settings;
958 settings.FromProtobuf(initialize_proto.layer_tree_settings()); 967 settings.FromProtobuf(initialize_proto.layer_tree_settings());
959 settings.abort_commit_before_output_surface_creation = false; 968 settings.abort_commit_before_output_surface_creation = false;
960 remote_client_layer_tree_host_ = LayerTreeHostForTesting::Create( 969 remote_client_layer_tree_host_ = LayerTreeHostForTesting::Create(
961 this, mode_, client_.get(), &remote_proto_channel_bridge_.channel_impl, 970 this, mode_, client_.get(), &remote_proto_channel_bridge_.channel_impl,
962 nullptr, nullptr, task_graph_runner_.get(), settings, 971 nullptr, nullptr, task_graph_runner_.get(), settings,
963 base::ThreadTaskRunnerHandle::Get(), impl_thread_->task_runner(), 972 base::ThreadTaskRunnerHandle::Get(), impl_thread_->task_runner(), nullptr,
964 nullptr); 973 image_serialization_processor_.get());
965 974
966 DCHECK(remote_proto_channel_bridge_.channel_impl.HasReceiver()); 975 DCHECK(remote_proto_channel_bridge_.channel_impl.HasReceiver());
967 DCHECK(task_runner_provider()->HasImplThread()); 976 DCHECK(task_runner_provider()->HasImplThread());
968 } 977 }
969 978
970 TaskGraphRunner* LayerTreeTest::task_graph_runner() const { 979 TaskGraphRunner* LayerTreeTest::task_graph_runner() const {
971 return task_graph_runner_.get(); 980 return task_graph_runner_.get();
972 } 981 }
973 982
974 TaskRunnerProvider* LayerTreeTest::task_runner_provider() const { 983 TaskRunnerProvider* LayerTreeTest::task_runner_provider() const {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 1040
1032 RemoteChannelImplForTest* LayerTreeTest::GetRemoteChannelImplForTest() const { 1041 RemoteChannelImplForTest* LayerTreeTest::GetRemoteChannelImplForTest() const {
1033 DCHECK(IsRemoteTest()); 1042 DCHECK(IsRemoteTest());
1034 DCHECK(remote_client_layer_tree_host_); 1043 DCHECK(remote_client_layer_tree_host_);
1035 1044
1036 return static_cast<RemoteChannelImplForTest*>( 1045 return static_cast<RemoteChannelImplForTest*>(
1037 remote_client_layer_tree_host_->proxy()); 1046 remote_client_layer_tree_host_->proxy());
1038 } 1047 }
1039 1048
1040 } // namespace cc 1049 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698