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

Unified Diff: cc/test/layer_tree_test.cc

Issue 845393002: cc: Create ProxyBeginFrameSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 11 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 a40a8c72bf6b8140c638207e3b3d00d80b77e4dd..4e3adda5e702173df157ac5ff6a09c4d81d6f2fc 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -60,6 +60,20 @@ void TestHooks::CreateResourceAndTileTaskWorkerPool(
tile_task_worker_pool, resource_pool, staging_resource_pool);
}
+class TestProxyBeginFrameSource : public ProxyBeginFrameSource {
+ public:
+ explicit TestProxyBeginFrameSource(TestHooks* test_hooks)
+ : test_hooks_(test_hooks) {}
+ ~TestProxyBeginFrameSource() override {}
+
+ void BeginFrames(const BeginFrameArgs& args) override {
+ test_hooks_->SendBeginFramesToChildren(args);
+ }
+
+ private:
+ TestHooks* test_hooks_;
+};
+
// Adapts ThreadProxy for test. Injects test hooks for testing.
class ThreadProxyForTest : public ThreadProxy {
public:
@@ -349,10 +363,6 @@ class LayerTreeHostClientForTesting : public LayerTreeHostClient,
test_hooks_->DidInitializeOutputSurface();
}
- void SendBeginFramesToChildren(const BeginFrameArgs& args) override {
- test_hooks_->SendBeginFramesToChildren(args);
- }
-
void DidFailToInitializeOutputSurface() override {
test_hooks_->DidFailToInitializeOutputSurface();
RequestNewOutputSurface();
@@ -391,7 +401,8 @@ class LayerTreeHostForTesting : public LayerTreeHost {
const LayerTreeSettings& settings,
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
- scoped_ptr<BeginFrameSource> external_begin_frame_source) {
+ scoped_ptr<BeginFrameSource> external_begin_frame_source,
+ ProxyBeginFrameSource* proxy_begin_frame_source) {
scoped_ptr<LayerTreeHostForTesting> layer_tree_host(
new LayerTreeHostForTesting(test_hooks, client, settings));
if (impl_task_runner.get()) {
@@ -406,7 +417,8 @@ class LayerTreeHostForTesting : public LayerTreeHost {
layer_tree_host.get(),
client,
main_task_runner,
- external_begin_frame_source.Pass()));
+ external_begin_frame_source.Pass(),
+ proxy_begin_frame_source));
}
return layer_tree_host.Pass();
}
@@ -587,6 +599,10 @@ void LayerTreeTest::DoBeginTest() {
external_begin_frame_source_ = external_begin_frame_source.get();
}
+ if (settings_.forward_begin_frames_to_children) {
+ proxy_begin_frame_source_.reset(new TestProxyBeginFrameSource(this));
+ }
+
DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get());
layer_tree_host_ = LayerTreeHostForTesting::Create(
this,
@@ -594,7 +610,8 @@ void LayerTreeTest::DoBeginTest() {
settings_,
base::MessageLoopProxy::current(),
impl_thread_ ? impl_thread_->message_loop_proxy() : NULL,
- external_begin_frame_source.Pass());
+ external_begin_frame_source.Pass(),
+ proxy_begin_frame_source_.get());
ASSERT_TRUE(layer_tree_host_);
started_ = true;

Powered by Google App Engine
This is Rietveld 408576698