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

Unified Diff: cc/test/layer_tree_test.cc

Issue 2717553005: cc: Glue LTHI and Scheduler changes for checker-imaging. (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: cc/test/layer_tree_test.cc
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index e3dc1e1045c4e68fe2a4e0bee6283990f1a8569f..184086fe9e42cc1841776f1902109f237e2ea4cf 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -93,10 +93,12 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
LayerTreeHostImplClient* host_impl_client,
TaskRunnerProvider* task_runner_provider,
TaskGraphRunner* task_graph_runner,
- RenderingStatsInstrumentation* stats_instrumentation) {
+ RenderingStatsInstrumentation* stats_instrumentation,
+ scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner) {
return base::WrapUnique(new LayerTreeHostImplForTesting(
test_hooks, settings, host_impl_client, task_runner_provider,
- task_graph_runner, stats_instrumentation));
+ task_graph_runner, stats_instrumentation,
+ std::move(image_worker_task_runner)));
}
protected:
@@ -106,7 +108,8 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
LayerTreeHostImplClient* host_impl_client,
TaskRunnerProvider* task_runner_provider,
TaskGraphRunner* task_graph_runner,
- RenderingStatsInstrumentation* stats_instrumentation)
+ RenderingStatsInstrumentation* stats_instrumentation,
+ scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner)
: LayerTreeHostImpl(settings,
host_impl_client,
task_runner_provider,
@@ -114,7 +117,7 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
task_graph_runner,
AnimationHost::CreateForTesting(ThreadInstance::IMPL),
0,
- nullptr),
+ std::move(image_worker_task_runner)),
test_hooks_(test_hooks),
block_notify_ready_to_activate_for_testing_(false),
notify_ready_to_activate_was_blocked_(false) {}
@@ -136,6 +139,11 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
test_hooks_->DidFinishImplFrameOnThread(this);
}
+ void DidSendBeginMainFrame() override {
+ LayerTreeHostImpl::DidSendBeginMainFrame();
+ test_hooks_->DidSendBeginMainFrameOnThread(this);
+ }
+
void BeginMainFrameAborted(
CommitEarlyOutReason reason,
std::vector<std::unique_ptr<SwapPromise>> swap_promises) override {
@@ -208,6 +216,13 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
}
}
+ void BlockImplSideInvalidationRequestsForTesting(bool block) override {
+ block_impl_side_invalidation_ = block;
+ if (!block_impl_side_invalidation_ && impl_side_invalidation_was_blocked_) {
+ RequestImplSideInvalidation();
+ }
+ }
+
void ActivateSyncTree() override {
test_hooks_->WillActivateTreeOnThread(this);
LayerTreeHostImpl::ActivateSyncTree();
@@ -250,6 +265,22 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
test_hooks_->NotifyTileStateChangedOnThread(this, tile);
}
+ void InvalidateContentOnImplSide() override {
+ LayerTreeHostImpl::InvalidateContentOnImplSide();
+ test_hooks_->DidInvalidateContentOnImplSide(this);
+ }
+
+ void RequestImplSideInvalidation() override {
+ if (block_impl_side_invalidation_) {
+ impl_side_invalidation_was_blocked_ = true;
+ return;
+ }
+
+ impl_side_invalidation_was_blocked_ = false;
+ LayerTreeHostImpl::RequestImplSideInvalidation();
+ test_hooks_->DidRequestImplSideInvalidation(this);
+ }
+
AnimationHost* animation_host() const {
return static_cast<AnimationHost*>(mutator_host());
}
@@ -258,6 +289,9 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
TestHooks* test_hooks_;
bool block_notify_ready_to_activate_for_testing_;
bool notify_ready_to_activate_was_blocked_;
+
+ bool block_impl_side_invalidation_ = false;
+ bool impl_side_invalidation_was_blocked_ = false;
};
// Implementation of LayerTreeHost callback interface.
@@ -342,12 +376,14 @@ class LayerTreeHostForTesting : public LayerTreeHost {
const LayerTreeSettings& settings,
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
+ scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner,
MutatorHost* mutator_host) {
LayerTreeHost::InitParams params;
params.client = client;
params.task_graph_runner = task_graph_runner;
params.settings = &settings;
params.mutator_host = mutator_host;
+ params.image_worker_task_runner = std::move(image_worker_task_runner);
std::unique_ptr<LayerTreeHostForTesting> layer_tree_host(
new LayerTreeHostForTesting(test_hooks, &params, mode));
@@ -377,7 +413,7 @@ class LayerTreeHostForTesting : public LayerTreeHost {
LayerTreeHostImplForTesting::Create(
test_hooks_, GetSettings(), host_impl_client,
GetTaskRunnerProvider(), task_graph_runner(),
- rendering_stats_instrumentation());
+ rendering_stats_instrumentation(), image_worker_task_runner_);
input_handler_weak_ptr_ = host_impl->AsWeakPtr();
return host_impl;
}
@@ -595,7 +631,8 @@ void LayerTreeTest::DoBeginTest() {
layer_tree_host_ = LayerTreeHostForTesting::Create(
this, mode_, client_.get(), client_.get(), task_graph_runner_.get(),
- settings_, main_task_runner, impl_task_runner, animation_host_.get());
+ settings_, main_task_runner, impl_task_runner,
+ image_worker_->task_runner(), animation_host_.get());
ASSERT_TRUE(layer_tree_host_);
main_task_runner_ =
@@ -741,6 +778,9 @@ void LayerTreeTest::RunTest(CompositorMode mode) {
ASSERT_TRUE(impl_thread_->Start());
}
+ image_worker_ = base::MakeUnique<base::Thread>("ImageWorker");
+ ASSERT_TRUE(image_worker_->Start());
+
shared_bitmap_manager_.reset(new TestSharedBitmapManager);
gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager);
task_graph_runner_.reset(new TestTaskGraphRunner);
« no previous file with comments | « cc/test/layer_tree_test.h ('k') | cc/test/test_hooks.h » ('j') | cc/trees/layer_tree_host.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698