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

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

Powered by Google App Engine
This is Rietveld 408576698