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

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: git merge origin/master Created 4 years, 6 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 TestHooks* test_hooks, 414 TestHooks* test_hooks,
413 CompositorMode mode, 415 CompositorMode mode,
414 LayerTreeHostClientForTesting* client, 416 LayerTreeHostClientForTesting* client,
415 RemoteProtoChannel* remote_proto_channel, 417 RemoteProtoChannel* remote_proto_channel,
416 SharedBitmapManager* shared_bitmap_manager, 418 SharedBitmapManager* shared_bitmap_manager,
417 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 419 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
418 TaskGraphRunner* task_graph_runner, 420 TaskGraphRunner* task_graph_runner,
419 const LayerTreeSettings& settings, 421 const LayerTreeSettings& settings,
420 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 422 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
421 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, 423 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
422 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { 424 std::unique_ptr<BeginFrameSource> external_begin_frame_source,
425 ImageSerializationProcessor* image_serialization_processor) {
423 LayerTreeHost::InitParams params; 426 LayerTreeHost::InitParams params;
424 params.client = client; 427 params.client = client;
425 params.shared_bitmap_manager = shared_bitmap_manager; 428 params.shared_bitmap_manager = shared_bitmap_manager;
426 params.gpu_memory_buffer_manager = gpu_memory_buffer_manager; 429 params.gpu_memory_buffer_manager = gpu_memory_buffer_manager;
427 params.task_graph_runner = task_graph_runner; 430 params.task_graph_runner = task_graph_runner;
428 params.settings = &settings; 431 params.settings = &settings;
432 params.image_serialization_processor = image_serialization_processor;
433
429 params.animation_host = 434 params.animation_host =
430 AnimationHost::CreateForTesting(ThreadInstance::MAIN); 435 AnimationHost::CreateForTesting(ThreadInstance::MAIN);
431 std::unique_ptr<LayerTreeHostForTesting> layer_tree_host( 436 std::unique_ptr<LayerTreeHostForTesting> layer_tree_host(
432 new LayerTreeHostForTesting(test_hooks, &params, mode)); 437 new LayerTreeHostForTesting(test_hooks, &params, mode));
433 std::unique_ptr<TaskRunnerProvider> task_runner_provider = 438 std::unique_ptr<TaskRunnerProvider> task_runner_provider =
434 TaskRunnerProvider::Create(main_task_runner, impl_task_runner); 439 TaskRunnerProvider::Create(main_task_runner, impl_task_runner);
435 std::unique_ptr<Proxy> proxy; 440 std::unique_ptr<Proxy> proxy;
436 switch (mode) { 441 switch (mode) {
437 case CompositorMode::SINGLE_THREADED: 442 case CompositorMode::SINGLE_THREADED:
438 proxy = SingleThreadProxyForTest::Create(test_hooks, 443 proxy = SingleThreadProxyForTest::Create(test_hooks,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 test_started_(false) {} 504 test_started_(false) {}
500 505
501 TestHooks* test_hooks_; 506 TestHooks* test_hooks_;
502 bool test_started_; 507 bool test_started_;
503 }; 508 };
504 509
505 LayerTreeTest::LayerTreeTest() 510 LayerTreeTest::LayerTreeTest()
506 : output_surface_(nullptr), 511 : output_surface_(nullptr),
507 external_begin_frame_source_(nullptr), 512 external_begin_frame_source_(nullptr),
508 remote_proto_channel_bridge_(this), 513 remote_proto_channel_bridge_(this),
514 image_serialization_processor_(
515 base::WrapUnique(new FakeImageSerializationProcessor)),
509 beginning_(false), 516 beginning_(false),
510 end_when_begin_returns_(false), 517 end_when_begin_returns_(false),
511 timed_out_(false), 518 timed_out_(false),
512 scheduled_(false), 519 scheduled_(false),
513 started_(false), 520 started_(false),
514 ended_(false), 521 ended_(false),
515 delegating_renderer_(false), 522 delegating_renderer_(false),
516 timeout_seconds_(0), 523 timeout_seconds_(0),
517 weak_factory_(this) { 524 weak_factory_(this) {
518 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr(); 525 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr();
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 } 711 }
705 712
706 DCHECK(!impl_thread_ || impl_thread_->task_runner().get()); 713 DCHECK(!impl_thread_ || impl_thread_->task_runner().get());
707 714
708 if (IsRemoteTest()) { 715 if (IsRemoteTest()) {
709 DCHECK(impl_thread_); 716 DCHECK(impl_thread_);
710 layer_tree_host_ = LayerTreeHostForTesting::Create( 717 layer_tree_host_ = LayerTreeHostForTesting::Create(
711 this, mode_, client_.get(), &remote_proto_channel_bridge_.channel_main, 718 this, mode_, client_.get(), &remote_proto_channel_bridge_.channel_main,
712 nullptr, nullptr, task_graph_runner_.get(), settings_, 719 nullptr, nullptr, task_graph_runner_.get(), settings_,
713 base::ThreadTaskRunnerHandle::Get(), nullptr, 720 base::ThreadTaskRunnerHandle::Get(), nullptr,
714 std::move(external_begin_frame_source)); 721 std::move(external_begin_frame_source),
722 image_serialization_processor_.get());
715 DCHECK(remote_proto_channel_bridge_.channel_main.HasReceiver()); 723 DCHECK(remote_proto_channel_bridge_.channel_main.HasReceiver());
716 } else { 724 } else {
717 layer_tree_host_ = LayerTreeHostForTesting::Create( 725 layer_tree_host_ = LayerTreeHostForTesting::Create(
718 this, mode_, client_.get(), nullptr, shared_bitmap_manager_.get(), 726 this, mode_, client_.get(), nullptr, shared_bitmap_manager_.get(),
719 gpu_memory_buffer_manager_.get(), task_graph_runner_.get(), settings_, 727 gpu_memory_buffer_manager_.get(), task_graph_runner_.get(), settings_,
720 base::ThreadTaskRunnerHandle::Get(), 728 base::ThreadTaskRunnerHandle::Get(),
721 impl_thread_ ? impl_thread_->task_runner() : NULL, 729 impl_thread_ ? impl_thread_->task_runner() : NULL,
722 std::move(external_begin_frame_source)); 730 std::move(external_begin_frame_source),
731 image_serialization_processor_.get());
723 } 732 }
724 733
725 ASSERT_TRUE(layer_tree_host_); 734 ASSERT_TRUE(layer_tree_host_);
726 735
727 started_ = true; 736 started_ = true;
728 beginning_ = true; 737 beginning_ = true;
729 SetupTree(); 738 SetupTree();
730 WillBeginTest(); 739 WillBeginTest();
731 BeginTest(); 740 BeginTest();
732 beginning_ = false; 741 beginning_ = false;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 DCHECK(proto.message_type() == 968 DCHECK(proto.message_type() ==
960 proto::CompositorMessageToImpl::INITIALIZE_IMPL); 969 proto::CompositorMessageToImpl::INITIALIZE_IMPL);
961 970
962 proto::InitializeImpl initialize_proto = proto.initialize_impl_message(); 971 proto::InitializeImpl initialize_proto = proto.initialize_impl_message();
963 LayerTreeSettings settings; 972 LayerTreeSettings settings;
964 settings.FromProtobuf(initialize_proto.layer_tree_settings()); 973 settings.FromProtobuf(initialize_proto.layer_tree_settings());
965 settings.abort_commit_before_output_surface_creation = false; 974 settings.abort_commit_before_output_surface_creation = false;
966 remote_client_layer_tree_host_ = LayerTreeHostForTesting::Create( 975 remote_client_layer_tree_host_ = LayerTreeHostForTesting::Create(
967 this, mode_, client_.get(), &remote_proto_channel_bridge_.channel_impl, 976 this, mode_, client_.get(), &remote_proto_channel_bridge_.channel_impl,
968 nullptr, nullptr, task_graph_runner_.get(), settings, 977 nullptr, nullptr, task_graph_runner_.get(), settings,
969 base::ThreadTaskRunnerHandle::Get(), impl_thread_->task_runner(), 978 base::ThreadTaskRunnerHandle::Get(), impl_thread_->task_runner(), nullptr,
970 nullptr); 979 image_serialization_processor_.get());
971 980
972 DCHECK(remote_proto_channel_bridge_.channel_impl.HasReceiver()); 981 DCHECK(remote_proto_channel_bridge_.channel_impl.HasReceiver());
973 DCHECK(task_runner_provider()->HasImplThread()); 982 DCHECK(task_runner_provider()->HasImplThread());
974 } 983 }
975 984
976 TaskGraphRunner* LayerTreeTest::task_graph_runner() const { 985 TaskGraphRunner* LayerTreeTest::task_graph_runner() const {
977 return task_graph_runner_.get(); 986 return task_graph_runner_.get();
978 } 987 }
979 988
980 TaskRunnerProvider* LayerTreeTest::task_runner_provider() const { 989 TaskRunnerProvider* LayerTreeTest::task_runner_provider() const {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 1046
1038 RemoteChannelImplForTest* LayerTreeTest::GetRemoteChannelImplForTest() const { 1047 RemoteChannelImplForTest* LayerTreeTest::GetRemoteChannelImplForTest() const {
1039 DCHECK(IsRemoteTest()); 1048 DCHECK(IsRemoteTest());
1040 DCHECK(remote_client_layer_tree_host_); 1049 DCHECK(remote_client_layer_tree_host_);
1041 1050
1042 return static_cast<RemoteChannelImplForTest*>( 1051 return static_cast<RemoteChannelImplForTest*>(
1043 remote_client_layer_tree_host_->proxy()); 1052 remote_client_layer_tree_host_->proxy());
1044 } 1053 }
1045 1054
1046 } // namespace cc 1055 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698