summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkhushalsagar <khushalsagar@chromium.org>2015-10-21 12:25:16 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-21 19:26:08 +0000
commitb64b360d1ccab108abfaa1b08b17ab8a7b48dcce (patch)
treeb6421c6e109d4e4ac91a64f0e2d2fe3fcc7ad17f
parentd502b83c802a28f76e8b6471ae3218b2b4a33fb1 (diff)
downloadchromium_src-b64b360d1ccab108abfaa1b08b17ab8a7b48dcce.zip
chromium_src-b64b360d1ccab108abfaa1b08b17ab8a7b48dcce.tar.gz
chromium_src-b64b360d1ccab108abfaa1b08b17ab8a7b48dcce.tar.bz2
cc: Split Proxy to eliminate unnecessary dependencies on the impl side
The impl side of the compositor uses Proxy to only access the task runners and make debug assertions. Move those parts to TaskRunnerProvider to seperate these dependencies. BUG=527200 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1411663002 Cr-Commit-Position: refs/heads/master@{#355370}
-rw-r--r--cc/BUILD.gn4
-rw-r--r--cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc8
-rw-r--r--cc/animation/scrollbar_animation_controller_thinning_unittest.cc8
-rw-r--r--cc/cc.gyp6
-rw-r--r--cc/cc_tests.gyp2
-rw-r--r--cc/debug/frame_timing_tracker.cc7
-rw-r--r--cc/debug/frame_timing_tracker_unittest.cc38
-rw-r--r--cc/debug/micro_benchmark_controller_unittest.cc11
-rw-r--r--cc/input/scroll_state_unittest.cc6
-rw-r--r--cc/input/top_controls_manager_unittest.cc8
-rw-r--r--cc/layers/delegated_renderer_layer_impl_unittest.cc13
-rw-r--r--cc/layers/heads_up_display_layer_impl_unittest.cc6
-rw-r--r--cc/layers/layer_impl_unittest.cc22
-rw-r--r--cc/layers/layer_iterator_unittest.cc6
-rw-r--r--cc/layers/layer_perftest.cc8
-rw-r--r--cc/layers/layer_position_constraint_unittest.cc1
-rw-r--r--cc/layers/layer_unittest.cc8
-rw-r--r--cc/layers/layer_utils_unittest.cc8
-rw-r--r--cc/layers/nine_patch_layer_impl_unittest.cc8
-rw-r--r--cc/layers/picture_image_layer_impl_unittest.cc8
-rw-r--r--cc/layers/picture_layer_impl_perftest.cc8
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc12
-rw-r--r--cc/layers/render_surface_unittest.cc14
-rw-r--r--cc/layers/scrollbar_layer_unittest.cc10
-rw-r--r--cc/layers/solid_color_layer_impl_unittest.cc22
-rw-r--r--cc/layers/surface_layer_unittest.cc2
-rw-r--r--cc/layers/texture_layer_impl.cc7
-rw-r--r--cc/layers/texture_layer_unittest.cc8
-rw-r--r--cc/layers/ui_resource_layer_impl_unittest.cc20
-rw-r--r--cc/layers/video_frame_provider_client_impl_unittest.cc9
-rw-r--r--cc/layers/video_layer_impl.cc16
-rw-r--r--cc/layers/video_layer_impl_unittest.cc25
-rw-r--r--cc/output/gl_renderer_unittest.cc2
-rw-r--r--cc/test/fake_impl_proxy.h35
-rw-r--r--cc/test/fake_impl_task_runner_provider.h35
-rw-r--r--cc/test/fake_layer_tree_host.cc2
-rw-r--r--cc/test/fake_layer_tree_host.h4
-rw-r--r--cc/test/fake_layer_tree_host_impl.cc24
-rw-r--r--cc/test/fake_layer_tree_host_impl.h6
-rw-r--r--cc/test/fake_ui_resource_layer_tree_host_impl.cc5
-rw-r--r--cc/test/fake_ui_resource_layer_tree_host_impl.h7
-rw-r--r--cc/test/layer_test_common.h4
-rw-r--r--cc/test/layer_tree_json_parser_unittest.cc10
-rw-r--r--cc/test/layer_tree_test.cc2
-rw-r--r--cc/tiles/tile_manager_perftest.cc8
-rw-r--r--cc/tiles/tile_manager_unittest.cc22
-rw-r--r--cc/trees/damage_tracker_unittest.cc8
-rw-r--r--cc/trees/layer_tree_host_common_unittest.cc78
-rw-r--r--cc/trees/layer_tree_host_impl.cc56
-rw-r--r--cc/trees/layer_tree_host_impl.h30
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc44
-rw-r--r--cc/trees/layer_tree_host_unittest_context.cc2
-rw-r--r--cc/trees/layer_tree_impl.cc15
-rw-r--r--cc/trees/layer_tree_impl.h7
-rw-r--r--cc/trees/layer_tree_impl_unittest.cc16
-rw-r--r--cc/trees/occlusion_tracker_unittest.cc2
-rw-r--r--cc/trees/proxy.cc73
-rw-r--r--cc/trees/proxy.h68
-rw-r--r--cc/trees/single_thread_proxy.h28
-rw-r--r--cc/trees/task_runner_provider.cc93
-rw-r--r--cc/trees/task_runner_provider.h107
-rw-r--r--cc/trees/tree_synchronizer_unittest.cc25
62 files changed, 641 insertions, 516 deletions
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index 6bd6aa2..c24430b 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -491,6 +491,8 @@ component("cc") {
"trees/single_thread_proxy.h",
"trees/swap_promise_monitor.cc",
"trees/swap_promise_monitor.h",
+ "trees/task_runner_provider.cc",
+ "trees/task_runner_provider.h",
"trees/thread_proxy.cc",
"trees/thread_proxy.h",
"trees/threaded_channel.cc",
@@ -557,7 +559,7 @@ source_set("test_support") {
"test/fake_display_list_recording_source.h",
"test/fake_external_begin_frame_source.cc",
"test/fake_external_begin_frame_source.h",
- "test/fake_impl_proxy.h",
+ "test/fake_impl_task_runner_provider.h",
"test/fake_layer_tree_host.cc",
"test/fake_layer_tree_host.h",
"test/fake_layer_tree_host_client.cc",
diff --git a/cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc b/cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc
index 2c8f993..aa9b74f 100644
--- a/cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc
+++ b/cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc
@@ -5,7 +5,7 @@
#include "cc/animation/scrollbar_animation_controller_linear_fade.h"
#include "cc/layers/solid_color_scrollbar_layer_impl.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/test_shared_bitmap_manager.h"
@@ -21,7 +21,9 @@ class ScrollbarAnimationControllerLinearFadeTest
public ScrollbarAnimationControllerClient {
public:
ScrollbarAnimationControllerLinearFadeTest()
- : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_),
+ : host_impl_(&task_runner_provider_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_),
did_request_redraw_(false),
did_request_animate_(false) {}
@@ -73,7 +75,7 @@ class ScrollbarAnimationControllerLinearFadeTest
virtual ScrollbarOrientation orientation() const { return HORIZONTAL; }
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
TestSharedBitmapManager shared_bitmap_manager_;
TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
diff --git a/cc/animation/scrollbar_animation_controller_thinning_unittest.cc b/cc/animation/scrollbar_animation_controller_thinning_unittest.cc
index 3c5ff36..e8f8f90 100644
--- a/cc/animation/scrollbar_animation_controller_thinning_unittest.cc
+++ b/cc/animation/scrollbar_animation_controller_thinning_unittest.cc
@@ -5,7 +5,7 @@
#include "cc/animation/scrollbar_animation_controller_thinning.h"
#include "cc/layers/solid_color_scrollbar_layer_impl.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/test_shared_bitmap_manager.h"
@@ -21,7 +21,9 @@ class ScrollbarAnimationControllerThinningTest
public ScrollbarAnimationControllerClient {
public:
ScrollbarAnimationControllerThinningTest()
- : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_) {}
+ : host_impl_(&task_runner_provider_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_) {}
void PostDelayedScrollbarAnimationTask(const base::Closure& start_fade,
base::TimeDelta delay) override {
@@ -70,7 +72,7 @@ class ScrollbarAnimationControllerThinningTest
base::TimeDelta::FromSeconds(5), base::TimeDelta::FromSeconds(3));
}
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
TestSharedBitmapManager shared_bitmap_manager_;
TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
diff --git a/cc/cc.gyp b/cc/cc.gyp
index 00c8aad..38b50ac 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -553,10 +553,12 @@
'trees/single_thread_proxy.h',
'trees/swap_promise_monitor.cc',
'trees/swap_promise_monitor.h',
- 'trees/threaded_channel.cc',
- 'trees/threaded_channel.h',
'trees/thread_proxy.cc',
'trees/thread_proxy.h',
+ 'trees/task_runner_provider.cc',
+ 'trees/task_runner_provider.h',
+ 'trees/threaded_channel.cc',
+ 'trees/threaded_channel.h',
'trees/tree_synchronizer.cc',
'trees/tree_synchronizer.h',
],
diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp
index 4941130..f349604 100644
--- a/cc/cc_tests.gyp
+++ b/cc/cc_tests.gyp
@@ -171,7 +171,7 @@
'test/fake_display_list_recording_source.h',
'test/fake_external_begin_frame_source.cc',
'test/fake_external_begin_frame_source.h',
- 'test/fake_impl_proxy.h',
+ 'test/fake_impl_task_runner_provider.h',
'test/fake_layer_tree_host.cc',
'test/fake_layer_tree_host.h',
'test/fake_layer_tree_host_client.cc',
diff --git a/cc/debug/frame_timing_tracker.cc b/cc/debug/frame_timing_tracker.cc
index 38977ee..effd67a 100644
--- a/cc/debug/frame_timing_tracker.cc
+++ b/cc/debug/frame_timing_tracker.cc
@@ -44,12 +44,9 @@ scoped_ptr<FrameTimingTracker> FrameTimingTracker::Create(
FrameTimingTracker::FrameTimingTracker(LayerTreeHostImpl* layer_tree_host_impl)
: layer_tree_host_impl_(layer_tree_host_impl),
post_events_notifier_(
- layer_tree_host_impl_->proxy()->HasImplThread()
- ? layer_tree_host_impl_->proxy()->ImplThreadTaskRunner()
- : layer_tree_host_impl_->proxy()->MainThreadTaskRunner(),
+ layer_tree_host_impl_->GetTaskRunner(),
base::Bind(&FrameTimingTracker::PostEvents, base::Unretained(this)),
- base::TimeDelta::FromMilliseconds(kSendTimingIntervalMS)) {
-}
+ base::TimeDelta::FromMilliseconds(kSendTimingIntervalMS)) {}
FrameTimingTracker::~FrameTimingTracker() {
}
diff --git a/cc/debug/frame_timing_tracker_unittest.cc b/cc/debug/frame_timing_tracker_unittest.cc
index 218927c..7383497 100644
--- a/cc/debug/frame_timing_tracker_unittest.cc
+++ b/cc/debug/frame_timing_tracker_unittest.cc
@@ -9,7 +9,7 @@
#include "base/trace_event/trace_event_argument.h"
#include "base/values.h"
#include "cc/debug/frame_timing_tracker.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/test_task_graph_runner.h"
@@ -74,10 +74,10 @@ std::string MainFrameToString(
}
TEST(FrameTimingTrackerTest, DefaultTrackerIsEmpty) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
scoped_ptr<FrameTimingTracker> tracker(
@@ -89,10 +89,10 @@ TEST(FrameTimingTrackerTest, DefaultTrackerIsEmpty) {
}
TEST(FrameTimingTrackerTest, NoFrameIdsIsEmpty) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
scoped_ptr<FrameTimingTracker> tracker(
@@ -104,10 +104,10 @@ TEST(FrameTimingTrackerTest, NoFrameIdsIsEmpty) {
}
TEST(FrameTimingTrackerTest, NoRectIdsYieldsNoMainFrameEvents) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
scoped_ptr<FrameTimingTracker> tracker(
@@ -120,10 +120,10 @@ TEST(FrameTimingTrackerTest, NoRectIdsYieldsNoMainFrameEvents) {
}
TEST(FrameTimingTrackerTest, OneFrameId) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
scoped_ptr<FrameTimingTracker> tracker(
@@ -138,10 +138,10 @@ TEST(FrameTimingTrackerTest, OneFrameId) {
}
TEST(FrameTimingTrackerTest, OneMainFrameRect) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
scoped_ptr<FrameTimingTracker> tracker(
@@ -158,10 +158,10 @@ TEST(FrameTimingTrackerTest, OneMainFrameRect) {
}
TEST(FrameTimingTrackerTest, UnsortedTimestampsIds) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
scoped_ptr<FrameTimingTracker> tracker(
@@ -180,10 +180,10 @@ TEST(FrameTimingTrackerTest, UnsortedTimestampsIds) {
}
TEST(FrameTimingTrackerTest, MainFrameUnsortedTimestamps) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
scoped_ptr<FrameTimingTracker> tracker(
@@ -208,10 +208,10 @@ TEST(FrameTimingTrackerTest, MainFrameUnsortedTimestamps) {
}
TEST(FrameTimingTrackerTest, MultipleFrameIds) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
scoped_ptr<FrameTimingTracker> tracker(
@@ -247,10 +247,10 @@ TEST(FrameTimingTrackerTest, MultipleFrameIds) {
}
TEST(FrameTimingTrackerTest, MultipleMainFrameEvents) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
scoped_ptr<FrameTimingTracker> tracker(
diff --git a/cc/debug/micro_benchmark_controller_unittest.cc b/cc/debug/micro_benchmark_controller_unittest.cc
index 61f34f4..9c5b0a5 100644
--- a/cc/debug/micro_benchmark_controller_unittest.cc
+++ b/cc/debug/micro_benchmark_controller_unittest.cc
@@ -7,6 +7,7 @@
#include "cc/debug/micro_benchmark.h"
#include "cc/debug/micro_benchmark_controller.h"
#include "cc/layers/layer.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_proxy.h"
@@ -22,9 +23,11 @@ class MicroBenchmarkControllerTest : public testing::Test {
: layer_tree_host_client_(FakeLayerTreeHostClient::DIRECT_3D) {}
void SetUp() override {
- impl_proxy_ = make_scoped_ptr(new FakeImplProxy);
+ impl_task_runner_provider_ =
+ make_scoped_ptr(new FakeImplTaskRunnerProvider);
layer_tree_host_impl_ = make_scoped_ptr(new FakeLayerTreeHostImpl(
- impl_proxy_.get(), &shared_bitmap_manager_, &task_graph_runner_));
+ impl_task_runner_provider_.get(), &shared_bitmap_manager_,
+ &task_graph_runner_));
layer_tree_host_ = FakeLayerTreeHost::Create(&layer_tree_host_client_,
&task_graph_runner_);
@@ -35,7 +38,7 @@ class MicroBenchmarkControllerTest : public testing::Test {
void TearDown() override {
layer_tree_host_impl_ = nullptr;
layer_tree_host_ = nullptr;
- impl_proxy_ = nullptr;
+ impl_task_runner_provider_ = nullptr;
}
FakeLayerTreeHostClient layer_tree_host_client_;
@@ -43,7 +46,7 @@ class MicroBenchmarkControllerTest : public testing::Test {
TestSharedBitmapManager shared_bitmap_manager_;
scoped_ptr<FakeLayerTreeHost> layer_tree_host_;
scoped_ptr<FakeLayerTreeHostImpl> layer_tree_host_impl_;
- scoped_ptr<FakeImplProxy> impl_proxy_;
+ scoped_ptr<FakeImplTaskRunnerProvider> impl_task_runner_provider_;
};
void Noop(scoped_ptr<base::Value> value) {
diff --git a/cc/input/scroll_state_unittest.cc b/cc/input/scroll_state_unittest.cc
index 5e091df..314f4f3 100644
--- a/cc/input/scroll_state_unittest.cc
+++ b/cc/input/scroll_state_unittest.cc
@@ -5,7 +5,7 @@
#include "cc/input/scroll_state.h"
#include "cc/layers/layer_impl.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/test_task_graph_runner.h"
@@ -57,10 +57,10 @@ TEST_F(ScrollStateTest, ConsumeDeltaNative) {
TEST_F(ScrollStateTest, CurrentNativeScrollingScrollable) {
ScrollState scrollState(0, 0, 0, 0, false, false, false);
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
scoped_ptr<LayerImpl> layer_impl =
diff --git a/cc/input/top_controls_manager_unittest.cc b/cc/input/top_controls_manager_unittest.cc
index 788acbb..0d62a3c 100644
--- a/cc/input/top_controls_manager_unittest.cc
+++ b/cc/input/top_controls_manager_unittest.cc
@@ -12,7 +12,7 @@
#include "base/time/time.h"
#include "cc/input/top_controls_manager_client.h"
#include "cc/layers/layer_impl.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/test_task_graph_runner.h"
@@ -28,7 +28,9 @@ class MockTopControlsManagerClient : public TopControlsManagerClient {
MockTopControlsManagerClient(float top_controls_height,
float top_controls_show_threshold,
float top_controls_hide_threshold)
- : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_),
+ : host_impl_(&task_runner_provider_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_),
redraw_needed_(false),
update_draw_properties_needed_(false),
top_controls_shown_ratio_(1.f),
@@ -81,7 +83,7 @@ class MockTopControlsManagerClient : public TopControlsManagerClient {
void SetTopControlsHeight(float height) { top_controls_height_ = height; }
private:
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
TestSharedBitmapManager shared_bitmap_manager_;
TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
diff --git a/cc/layers/delegated_renderer_layer_impl_unittest.cc b/cc/layers/delegated_renderer_layer_impl_unittest.cc
index c5e33303..2ef2896 100644
--- a/cc/layers/delegated_renderer_layer_impl_unittest.cc
+++ b/cc/layers/delegated_renderer_layer_impl_unittest.cc
@@ -9,7 +9,7 @@
#include "cc/quads/render_pass_draw_quad.h"
#include "cc/quads/solid_color_draw_quad.h"
#include "cc/test/fake_delegated_renderer_layer_impl.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_layer_tree_host_impl_client.h"
#include "cc/test/fake_output_surface.h"
@@ -31,21 +31,22 @@ namespace {
class DelegatedRendererLayerImplTest : public testing::Test {
public:
DelegatedRendererLayerImplTest()
- : proxy_(),
- always_impl_thread_and_main_thread_blocked_(&proxy_),
+ : task_runner_provider_(),
+ always_impl_thread_and_main_thread_blocked_(&task_runner_provider_),
output_surface_(FakeOutputSurface::Create3d()) {
LayerTreeSettings settings;
settings.minimum_occlusion_tracking_size = gfx::Size();
- host_impl_.reset(new FakeLayerTreeHostImpl(
- settings, &proxy_, &shared_bitmap_manager_, &task_graph_runner_));
+ host_impl_.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_));
host_impl_->SetVisible(true);
host_impl_->InitializeRenderer(output_surface_.get());
host_impl_->SetViewportSize(gfx::Size(10, 10));
}
protected:
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
DebugScopedSetImplThreadAndMainThreadBlocked
always_impl_thread_and_main_thread_blocked_;
TestSharedBitmapManager shared_bitmap_manager_;
diff --git a/cc/layers/heads_up_display_layer_impl_unittest.cc b/cc/layers/heads_up_display_layer_impl_unittest.cc
index 6cbc840..77cfe55 100644
--- a/cc/layers/heads_up_display_layer_impl_unittest.cc
+++ b/cc/layers/heads_up_display_layer_impl_unittest.cc
@@ -4,7 +4,7 @@
#include "cc/layers/append_quads_data.h"
#include "cc/layers/heads_up_display_layer_impl.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/test_shared_bitmap_manager.h"
@@ -31,11 +31,11 @@ void CheckDrawLayer(HeadsUpDisplayLayerImpl* layer,
}
TEST(HeadsUpDisplayLayerImplTest, ResourcelessSoftwareDrawAfterResourceLoss) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
host_impl.CreatePendingTree();
host_impl.SetVisible(true);
diff --git a/cc/layers/layer_impl_unittest.cc b/cc/layers/layer_impl_unittest.cc
index 7089bbe..3c514cd 100644
--- a/cc/layers/layer_impl_unittest.cc
+++ b/cc/layers/layer_impl_unittest.cc
@@ -8,7 +8,7 @@
#include "cc/layers/solid_color_scrollbar_layer_impl.h"
#include "cc/output/filter_operation.h"
#include "cc/output/filter_operations.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/geometry_test_utils.h"
@@ -86,11 +86,11 @@ TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) {
// The constructor on this will fake that we are on the correct thread.
// Create a simple LayerImpl tree:
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
host_impl.SetVisible(true);
EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get()));
@@ -246,11 +246,11 @@ TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) {
}
TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
host_impl.SetVisible(true);
EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get()));
@@ -362,11 +362,11 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
}
TEST(LayerImplTest, SafeOpaqueBackgroundColor) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
host_impl.SetVisible(true);
EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get()));
@@ -397,10 +397,10 @@ TEST(LayerImplTest, SafeOpaqueBackgroundColor) {
}
TEST(LayerImplTest, TransformInvertibility) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
scoped_ptr<LayerImpl> layer = LayerImpl::Create(host_impl.active_tree(), 1);
@@ -432,7 +432,7 @@ class LayerImplScrollTest : public testing::Test {
public:
LayerImplScrollTest()
: host_impl_(settings(),
- &proxy_,
+ &task_runner_provider_,
&shared_bitmap_manager_,
&task_graph_runner_),
root_id_(7) {
@@ -463,7 +463,7 @@ class LayerImplScrollTest : public testing::Test {
}
private:
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
TestSharedBitmapManager shared_bitmap_manager_;
TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
diff --git a/cc/layers/layer_iterator_unittest.cc b/cc/layers/layer_iterator_unittest.cc
index ee429a2..1d71b12 100644
--- a/cc/layers/layer_iterator_unittest.cc
+++ b/cc/layers/layer_iterator_unittest.cc
@@ -93,7 +93,9 @@ void IterateFrontToBack(LayerImplList* render_surface_layer_list) {
class LayerIteratorTest : public testing::Test {
public:
LayerIteratorTest()
- : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_),
+ : host_impl_(&task_runner_provider_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_),
id_(1) {}
scoped_ptr<TestLayerImpl> CreateLayer() {
@@ -101,7 +103,7 @@ class LayerIteratorTest : public testing::Test {
}
protected:
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
TestSharedBitmapManager shared_bitmap_manager_;
TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
diff --git a/cc/layers/layer_perftest.cc b/cc/layers/layer_perftest.cc
index 0c0fb41..720b2c4 100644
--- a/cc/layers/layer_perftest.cc
+++ b/cc/layers/layer_perftest.cc
@@ -6,7 +6,7 @@
#include "base/thread_task_runner_handle.h"
#include "cc/debug/lap_timer.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host.h"
#include "cc/test/fake_layer_tree_host_client.h"
#include "cc/test/fake_layer_tree_host_impl.h"
@@ -24,7 +24,9 @@ static const int kTimeCheckInterval = 10;
class LayerPerfTest : public testing::Test {
public:
LayerPerfTest()
- : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_),
+ : host_impl_(&task_runner_provider_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_),
fake_client_(FakeLayerTreeHostClient::DIRECT_3D),
timer_(kWarmupRuns,
base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
@@ -43,7 +45,7 @@ class LayerPerfTest : public testing::Test {
layer_tree_host_ = nullptr;
}
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
TestSharedBitmapManager shared_bitmap_manager_;
TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
diff --git a/cc/layers/layer_position_constraint_unittest.cc b/cc/layers/layer_position_constraint_unittest.cc
index 377d3f4..594dac2 100644
--- a/cc/layers/layer_position_constraint_unittest.cc
+++ b/cc/layers/layer_position_constraint_unittest.cc
@@ -9,6 +9,7 @@
#include "cc/layers/layer.h"
#include "cc/layers/layer_impl.h"
#include "cc/test/fake_layer_tree_host.h"
+#include "cc/test/fake_proxy.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/test_task_graph_runner.h"
#include "cc/trees/layer_tree_host_common.h"
diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc
index 6f81e8e..d81463d 100644
--- a/cc/layers/layer_unittest.cc
+++ b/cc/layers/layer_unittest.cc
@@ -11,7 +11,7 @@
#include "cc/output/copy_output_request.h"
#include "cc/output/copy_output_result.h"
#include "cc/test/animation_test_common.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_client.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/geometry_test_utils.h"
@@ -58,7 +58,9 @@ class MockLayerTreeHost : public LayerTreeHost {
class LayerTest : public testing::Test {
public:
LayerTest()
- : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_),
+ : host_impl_(&task_runner_provider_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_),
fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {}
protected:
@@ -133,7 +135,7 @@ class LayerTest : public testing::Test {
VerifyTestTreeInitialState();
}
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
TestSharedBitmapManager shared_bitmap_manager_;
TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
diff --git a/cc/layers/layer_utils_unittest.cc b/cc/layers/layer_utils_unittest.cc
index 534a691..842688e 100644
--- a/cc/layers/layer_utils_unittest.cc
+++ b/cc/layers/layer_utils_unittest.cc
@@ -7,7 +7,7 @@
#include "cc/animation/transform_operations.h"
#include "cc/layers/layer_impl.h"
#include "cc/test/animation_test_common.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/test_task_graph_runner.h"
@@ -25,7 +25,9 @@ float diagonal(float width, float height) {
class LayerUtilsGetAnimationBoundsTest : public testing::Test {
public:
LayerUtilsGetAnimationBoundsTest()
- : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_),
+ : host_impl_(&task_runner_provider_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_),
root_(CreateThreeNodeTree(&host_impl_)),
parent_(root_->children()[0]),
child_(parent_->children()[0]) {}
@@ -44,7 +46,7 @@ class LayerUtilsGetAnimationBoundsTest : public testing::Test {
return root.Pass();
}
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
TestSharedBitmapManager shared_bitmap_manager_;
TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
diff --git a/cc/layers/nine_patch_layer_impl_unittest.cc b/cc/layers/nine_patch_layer_impl_unittest.cc
index 50162f0..bed02d0 100644
--- a/cc/layers/nine_patch_layer_impl_unittest.cc
+++ b/cc/layers/nine_patch_layer_impl_unittest.cc
@@ -8,7 +8,7 @@
#include "cc/quads/texture_draw_quad.h"
#include "cc/resources/ui_resource_bitmap.h"
#include "cc/resources/ui_resource_client.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_ui_resource_layer_tree_host_impl.h"
#include "cc/test/geometry_test_utils.h"
@@ -43,12 +43,12 @@ void NinePatchLayerLayoutTest(const gfx::Size& bitmap_size,
layer_size.width() - border.width(),
layer_size.height() - border.height());
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
- FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
- &task_graph_runner);
+ FakeUIResourceLayerTreeHostImpl host_impl(
+ &task_runner_provider, &shared_bitmap_manager, &task_graph_runner);
host_impl.SetVisible(true);
host_impl.InitializeRenderer(output_surface.get());
diff --git a/cc/layers/picture_image_layer_impl_unittest.cc b/cc/layers/picture_image_layer_impl_unittest.cc
index 57af9c2..58d7004 100644
--- a/cc/layers/picture_image_layer_impl_unittest.cc
+++ b/cc/layers/picture_image_layer_impl_unittest.cc
@@ -8,7 +8,7 @@
#include "cc/layers/append_quads_data.h"
#include "cc/quads/draw_quad.h"
#include "cc/test/fake_display_list_raster_source.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/test_shared_bitmap_manager.h"
@@ -42,10 +42,10 @@ class PictureLayerImplImageTestSettings : public LayerTreeSettings {
class PictureImageLayerImplTest : public testing::Test {
public:
PictureImageLayerImplTest()
- : proxy_(base::ThreadTaskRunnerHandle::Get()),
+ : task_runner_provider_(base::ThreadTaskRunnerHandle::Get()),
output_surface_(FakeOutputSurface::Create3d()),
host_impl_(PictureLayerImplImageTestSettings(),
- &proxy_,
+ &task_runner_provider_,
&shared_bitmap_manager_,
&task_graph_runner_) {
host_impl_.CreatePendingTree();
@@ -92,7 +92,7 @@ class PictureImageLayerImplTest : public testing::Test {
}
protected:
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
TestSharedBitmapManager shared_bitmap_manager_;
TestTaskGraphRunner task_graph_runner_;
scoped_ptr<OutputSurface> output_surface_;
diff --git a/cc/layers/picture_layer_impl_perftest.cc b/cc/layers/picture_layer_impl_perftest.cc
index ef41efc..92f6282 100644
--- a/cc/layers/picture_layer_impl_perftest.cc
+++ b/cc/layers/picture_layer_impl_perftest.cc
@@ -7,7 +7,7 @@
#include "base/thread_task_runner_handle.h"
#include "cc/debug/lap_timer.h"
#include "cc/test/fake_display_list_raster_source.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_picture_layer_impl.h"
@@ -40,10 +40,10 @@ void AddTiling(float scale,
class PictureLayerImplPerfTest : public testing::Test {
public:
PictureLayerImplPerfTest()
- : proxy_(base::ThreadTaskRunnerHandle::Get()),
+ : task_runner_provider_(base::ThreadTaskRunnerHandle::Get()),
output_surface_(FakeOutputSurface::Create3d()),
host_impl_(LayerTreeSettings(),
- &proxy_,
+ &task_runner_provider_,
&shared_bitmap_manager_,
&task_graph_runner_),
timer_(kWarmupRuns,
@@ -164,7 +164,7 @@ class PictureLayerImplPerfTest : public testing::Test {
protected:
TestSharedBitmapManager shared_bitmap_manager_;
TestTaskGraphRunner task_graph_runner_;
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
scoped_ptr<OutputSurface> output_surface_;
FakeLayerTreeHostImpl host_impl_;
FakePictureLayerImpl* pending_layer_;
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index 10c916f..6e1b4c9 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -20,7 +20,7 @@
#include "cc/test/fake_content_layer_client.h"
#include "cc/test/fake_display_list_raster_source.h"
#include "cc/test/fake_display_list_recording_source.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_picture_layer_impl.h"
@@ -93,10 +93,10 @@ class LowResTilingsSettings : public PictureLayerImplTestSettings {
class PictureLayerImplTest : public testing::Test {
public:
PictureLayerImplTest()
- : proxy_(base::ThreadTaskRunnerHandle::Get()),
+ : task_runner_provider_(base::ThreadTaskRunnerHandle::Get()),
output_surface_(FakeOutputSurface::Create3d()),
host_impl_(LowResTilingsSettings(),
- &proxy_,
+ &task_runner_provider_,
&shared_bitmap_manager_,
&task_graph_runner_),
root_id_(6),
@@ -108,10 +108,10 @@ class PictureLayerImplTest : public testing::Test {
}
explicit PictureLayerImplTest(const LayerTreeSettings& settings)
- : proxy_(base::ThreadTaskRunnerHandle::Get()),
+ : task_runner_provider_(base::ThreadTaskRunnerHandle::Get()),
output_surface_(FakeOutputSurface::Create3d()),
host_impl_(settings,
- &proxy_,
+ &task_runner_provider_,
&shared_bitmap_manager_,
&task_graph_runner_),
root_id_(6),
@@ -371,7 +371,7 @@ class PictureLayerImplTest : public testing::Test {
protected:
void TestQuadsForSolidColor(bool test_for_solid);
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
TestSharedBitmapManager shared_bitmap_manager_;
TestTaskGraphRunner task_graph_runner_;
scoped_ptr<OutputSurface> output_surface_;
diff --git a/cc/layers/render_surface_unittest.cc b/cc/layers/render_surface_unittest.cc
index 5ecf2f7..f4b9411 100644
--- a/cc/layers/render_surface_unittest.cc
+++ b/cc/layers/render_surface_unittest.cc
@@ -8,7 +8,7 @@
#include "cc/layers/render_pass_sink.h"
#include "cc/layers/render_surface_impl.h"
#include "cc/quads/shared_quad_state.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/mock_occlusion_tracker.h"
@@ -37,10 +37,10 @@ TEST(RenderSurfaceTest, VerifySurfaceChangesAreTrackedProperly) {
// This test checks that SurfacePropertyChanged() has the correct behavior.
//
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
scoped_ptr<LayerImpl> owning_layer =
LayerImpl::Create(host_impl.active_tree(), 1);
@@ -84,10 +84,10 @@ TEST(RenderSurfaceTest, VerifySurfaceChangesAreTrackedProperly) {
}
TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectSharedQuadState) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
scoped_ptr<LayerImpl> root_layer =
LayerImpl::Create(host_impl.active_tree(), 1);
@@ -151,10 +151,10 @@ class TestRenderPassSink : public RenderPassSink {
};
TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectRenderPass) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
scoped_ptr<LayerImpl> root_layer =
LayerImpl::Create(host_impl.active_tree(), 1);
diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc
index 2574b98..53e2714 100644
--- a/cc/layers/scrollbar_layer_unittest.cc
+++ b/cc/layers/scrollbar_layer_unittest.cc
@@ -12,7 +12,7 @@
#include "cc/layers/solid_color_scrollbar_layer.h"
#include "cc/layers/solid_color_scrollbar_layer_impl.h"
#include "cc/quads/solid_color_draw_quad.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host.h"
#include "cc/test/fake_layer_tree_host_client.h"
#include "cc/test/fake_layer_tree_host_impl.h"
@@ -479,9 +479,9 @@ class ScrollbarLayerSolidColorThumbTest : public testing::Test {
public:
ScrollbarLayerSolidColorThumbTest() {
LayerTreeSettings layer_tree_settings;
- host_impl_.reset(new FakeLayerTreeHostImpl(layer_tree_settings, &proxy_,
- &shared_bitmap_manager_,
- &task_graph_runner_));
+ host_impl_.reset(new FakeLayerTreeHostImpl(
+ layer_tree_settings, &task_runner_provider_, &shared_bitmap_manager_,
+ &task_graph_runner_));
const int kThumbThickness = 3;
const int kTrackStart = 0;
@@ -507,7 +507,7 @@ class ScrollbarLayerSolidColorThumbTest : public testing::Test {
}
protected:
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
TestSharedBitmapManager shared_bitmap_manager_;
TestTaskGraphRunner task_graph_runner_;
scoped_ptr<FakeLayerTreeHostImpl> host_impl_;
diff --git a/cc/layers/solid_color_layer_impl_unittest.cc b/cc/layers/solid_color_layer_impl_unittest.cc
index a27f229..f81713b 100644
--- a/cc/layers/solid_color_layer_impl_unittest.cc
+++ b/cc/layers/solid_color_layer_impl_unittest.cc
@@ -9,7 +9,7 @@
#include "cc/layers/append_quads_data.h"
#include "cc/layers/solid_color_layer.h"
#include "cc/quads/solid_color_draw_quad.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host.h"
#include "cc/test/layer_test_common.h"
#include "cc/test/test_task_graph_runner.h"
@@ -26,9 +26,10 @@ TEST(SolidColorLayerImplTest, VerifyTilingCompleteAndNoOverlap) {
gfx::Size layer_size = gfx::Size(800, 600);
gfx::Rect visible_layer_rect = gfx::Rect(layer_size);
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, nullptr, &task_graph_runner);
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, nullptr,
+ &task_graph_runner);
scoped_ptr<SolidColorLayerImpl> layer =
SolidColorLayerImpl::Create(host_impl.active_tree(), 1);
layer->draw_properties().visible_layer_rect = visible_layer_rect;
@@ -51,9 +52,10 @@ TEST(SolidColorLayerImplTest, VerifyCorrectBackgroundColorInQuad) {
gfx::Size layer_size = gfx::Size(100, 100);
gfx::Rect visible_layer_rect = gfx::Rect(layer_size);
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, nullptr, &task_graph_runner);
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, nullptr,
+ &task_graph_runner);
scoped_ptr<SolidColorLayerImpl> layer =
SolidColorLayerImpl::Create(host_impl.active_tree(), 1);
layer->draw_properties().visible_layer_rect = visible_layer_rect;
@@ -79,9 +81,10 @@ TEST(SolidColorLayerImplTest, VerifyCorrectOpacityInQuad) {
gfx::Size layer_size = gfx::Size(100, 100);
gfx::Rect visible_layer_rect = gfx::Rect(layer_size);
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, nullptr, &task_graph_runner);
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, nullptr,
+ &task_graph_runner);
scoped_ptr<SolidColorLayerImpl> layer =
SolidColorLayerImpl::Create(host_impl.active_tree(), 1);
layer->draw_properties().visible_layer_rect = visible_layer_rect;
@@ -107,9 +110,10 @@ TEST(SolidColorLayerImplTest, VerifyCorrectBlendModeInQuad) {
gfx::Size layer_size = gfx::Size(100, 100);
gfx::Rect visible_layer_rect = gfx::Rect(layer_size);
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, nullptr, &task_graph_runner);
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, nullptr,
+ &task_graph_runner);
scoped_ptr<SolidColorLayerImpl> layer =
SolidColorLayerImpl::Create(host_impl.active_tree(), 1);
layer->SetBounds(layer_size);
diff --git a/cc/layers/surface_layer_unittest.cc b/cc/layers/surface_layer_unittest.cc
index e35b886..2348909 100644
--- a/cc/layers/surface_layer_unittest.cc
+++ b/cc/layers/surface_layer_unittest.cc
@@ -10,7 +10,7 @@
#include "base/thread_task_runner_handle.h"
#include "cc/layers/solid_color_layer.h"
#include "cc/layers/surface_layer.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host.h"
#include "cc/test/fake_layer_tree_host_client.h"
#include "cc/test/fake_layer_tree_host_impl.h"
diff --git a/cc/layers/texture_layer_impl.cc b/cc/layers/texture_layer_impl.cc
index e864219..0cc5c9f 100644
--- a/cc/layers/texture_layer_impl.cc
+++ b/cc/layers/texture_layer_impl.cc
@@ -247,9 +247,10 @@ void TextureLayerImpl::FreeTextureMailbox() {
if (own_mailbox_) {
DCHECK(!external_texture_resource_);
if (release_callback_) {
- release_callback_->Run(texture_mailbox_.sync_point(),
- false,
- layer_tree_impl()->BlockingMainThreadTaskRunner());
+ release_callback_->Run(texture_mailbox_.sync_point(), false,
+ layer_tree_impl()
+ ->task_runner_provider()
+ ->blocking_main_thread_task_runner());
}
texture_mailbox_ = TextureMailbox();
release_callback_ = nullptr;
diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc
index 81758641..2af2df1 100644
--- a/cc/layers/texture_layer_unittest.cc
+++ b/cc/layers/texture_layer_unittest.cc
@@ -22,7 +22,7 @@
#include "cc/output/compositor_frame_ack.h"
#include "cc/output/context_provider.h"
#include "cc/resources/returned_resource.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_client.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
@@ -190,7 +190,9 @@ class TextureLayerTest : public testing::Test {
: fake_client_(
FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)),
output_surface_(FakeOutputSurface::Create3d()),
- host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_),
+ host_impl_(&task_runner_provider_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_),
test_data_(&shared_bitmap_manager_) {}
protected:
@@ -211,7 +213,7 @@ class TextureLayerTest : public testing::Test {
}
scoped_ptr<MockLayerTreeHost> layer_tree_host_;
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
FakeLayerTreeHostClient fake_client_;
TestSharedBitmapManager shared_bitmap_manager_;
TestTaskGraphRunner task_graph_runner_;
diff --git a/cc/layers/ui_resource_layer_impl_unittest.cc b/cc/layers/ui_resource_layer_impl_unittest.cc
index 95a5967..ee351e3 100644
--- a/cc/layers/ui_resource_layer_impl_unittest.cc
+++ b/cc/layers/ui_resource_layer_impl_unittest.cc
@@ -7,7 +7,7 @@
#include "cc/quads/draw_quad.h"
#include "cc/resources/ui_resource_bitmap.h"
#include "cc/resources/ui_resource_client.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_ui_resource_layer_tree_host_impl.h"
@@ -57,12 +57,12 @@ void QuadSizeTest(scoped_ptr<UIResourceLayerImpl> layer,
}
TEST(UIResourceLayerImplTest, VerifyDrawQuads) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
- FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
- &task_graph_runner);
+ FakeUIResourceLayerTreeHostImpl host_impl(
+ &task_runner_provider, &shared_bitmap_manager, &task_graph_runner);
host_impl.SetVisible(true);
host_impl.InitializeRenderer(output_surface.get());
@@ -105,12 +105,12 @@ void OpaqueBoundsTest(scoped_ptr<UIResourceLayerImpl> layer,
}
TEST(UIResourceLayerImplTest, VerifySetOpaqueOnSkBitmap) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
- FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
- &task_graph_runner);
+ FakeUIResourceLayerTreeHostImpl host_impl(
+ &task_runner_provider, &shared_bitmap_manager, &task_graph_runner);
host_impl.SetVisible(true);
host_impl.InitializeRenderer(output_surface.get());
@@ -137,12 +137,12 @@ TEST(UIResourceLayerImplTest, VerifySetOpaqueOnSkBitmap) {
}
TEST(UIResourceLayerImplTest, VerifySetOpaqueOnLayer) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
- FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
- &task_graph_runner);
+ FakeUIResourceLayerTreeHostImpl host_impl(
+ &task_runner_provider, &shared_bitmap_manager, &task_graph_runner);
host_impl.SetVisible(true);
host_impl.InitializeRenderer(output_surface.get());
diff --git a/cc/layers/video_frame_provider_client_impl_unittest.cc b/cc/layers/video_frame_provider_client_impl_unittest.cc
index 4cbd493..3cc4709 100644
--- a/cc/layers/video_frame_provider_client_impl_unittest.cc
+++ b/cc/layers/video_frame_provider_client_impl_unittest.cc
@@ -18,10 +18,11 @@ namespace cc {
// NOTE: We cannot use DebugScopedSetImplThreadAndMainThreadBlocked in these
// tests because it gets destroyed before the VideoLayerImpl is destroyed. This
// causes a DCHECK in VideoLayerImpl's destructor to fail.
-static void DebugSetImplThreadAndMainThreadBlocked(Proxy* proxy) {
+static void DebugSetImplThreadAndMainThreadBlocked(
+ TaskRunnerProvider* task_runner_provider) {
#if DCHECK_IS_ON()
- proxy->SetCurrentThreadIsImplThread(true);
- proxy->SetMainThreadBlocked(true);
+ task_runner_provider->SetCurrentThreadIsImplThread(true);
+ task_runner_provider->SetMainThreadBlocked(true);
#endif
}
@@ -36,7 +37,7 @@ class VideoFrameProviderClientImplTest : public testing::Test,
gfx::Rect(10, 10),
gfx::Size(10, 10),
base::TimeDelta())) {
- DebugSetImplThreadAndMainThreadBlocked(impl_.proxy());
+ DebugSetImplThreadAndMainThreadBlocked(impl_.task_runner_provider());
}
~VideoFrameProviderClientImplTest() {
diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc
index d6aa570..63d8a18 100644
--- a/cc/layers/video_layer_impl.cc
+++ b/cc/layers/video_layer_impl.cc
@@ -15,7 +15,7 @@
#include "cc/resources/single_release_callback_impl.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/occlusion.h"
-#include "cc/trees/proxy.h"
+#include "cc/trees/task_runner_provider.h"
#include "media/base/video_frame.h"
#if defined(VIDEO_HOLE)
@@ -30,8 +30,8 @@ scoped_ptr<VideoLayerImpl> VideoLayerImpl::Create(
int id,
VideoFrameProvider* provider,
media::VideoRotation video_rotation) {
- DCHECK(tree_impl->proxy()->IsMainThreadBlocked());
- DCHECK(tree_impl->proxy()->IsImplThread());
+ DCHECK(tree_impl->task_runner_provider()->IsMainThreadBlocked());
+ DCHECK(tree_impl->task_runner_provider()->IsImplThread());
scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl =
VideoFrameProviderClientImpl::Create(
@@ -59,8 +59,8 @@ VideoLayerImpl::~VideoLayerImpl() {
// on the VideoFrameProviderClientImpl, but we stop when the first
// LayerImpl (the one on the pending tree) is destroyed since we know
// the main thread is blocked for this commit.
- DCHECK(layer_tree_impl()->proxy()->IsImplThread());
- DCHECK(layer_tree_impl()->proxy()->IsMainThreadBlocked());
+ DCHECK(layer_tree_impl()->task_runner_provider()->IsImplThread());
+ DCHECK(layer_tree_impl()->task_runner_provider()->IsMainThreadBlocked());
provider_client_impl_->Stop();
}
}
@@ -369,8 +369,10 @@ void VideoLayerImpl::DidDraw(ResourceProvider* resource_provider) {
if (frame_resource_type_ ==
VideoFrameExternalResources::SOFTWARE_RESOURCE) {
for (size_t i = 0; i < software_resources_.size(); ++i) {
- software_release_callback_.Run(
- 0, false, layer_tree_impl()->BlockingMainThreadTaskRunner());
+ software_release_callback_.Run(0, false,
+ layer_tree_impl()
+ ->task_runner_provider()
+ ->blocking_main_thread_task_runner());
}
software_resources_.clear();
diff --git a/cc/layers/video_layer_impl_unittest.cc b/cc/layers/video_layer_impl_unittest.cc
index 28ba58a..f13af9b 100644
--- a/cc/layers/video_layer_impl_unittest.cc
+++ b/cc/layers/video_layer_impl_unittest.cc
@@ -21,10 +21,11 @@ namespace {
// NOTE: We cannot use DebugScopedSetImplThreadAndMainThreadBlocked in these
// tests because it gets destroyed before the VideoLayerImpl is destroyed. This
// causes a DCHECK in VideoLayerImpl's destructor to fail.
-static void DebugSetImplThreadAndMainThreadBlocked(Proxy* proxy) {
+static void DebugSetImplThreadAndMainThreadBlocked(
+ TaskRunnerProvider* task_runner_provider) {
#if DCHECK_IS_ON()
- proxy->SetCurrentThreadIsImplThread(true);
- proxy->SetMainThreadBlocked(true);
+ task_runner_provider->SetCurrentThreadIsImplThread(true);
+ task_runner_provider->SetMainThreadBlocked(true);
#endif
}
@@ -33,7 +34,7 @@ TEST(VideoLayerImplTest, Occlusion) {
gfx::Size viewport_size(1000, 1000);
LayerTestCommon::LayerImplTest impl;
- DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
+ DebugSetImplThreadAndMainThreadBlocked(impl.task_runner_provider());
scoped_refptr<media::VideoFrame> video_frame = media::VideoFrame::CreateFrame(
media::PIXEL_FORMAT_YV12, gfx::Size(10, 10), gfx::Rect(10, 10),
@@ -87,7 +88,7 @@ TEST(VideoLayerImplTest, OccludesOtherLayers) {
LayerTestCommon::LayerImplTest impl;
impl.host_impl()->SetViewportSize(layer_size);
- DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
+ DebugSetImplThreadAndMainThreadBlocked(impl.task_runner_provider());
auto active_tree = impl.host_impl()->active_tree();
// Create a video layer with no frame on top of another layer.
@@ -127,7 +128,7 @@ TEST(VideoLayerImplTest, OccludesOtherLayers) {
TEST(VideoLayerImplTest, DidBecomeActiveShouldSetActiveVideoLayer) {
LayerTestCommon::LayerImplTest impl;
- DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
+ DebugSetImplThreadAndMainThreadBlocked(impl.task_runner_provider());
FakeVideoFrameProvider provider;
VideoLayerImpl* video_layer_impl =
@@ -147,7 +148,7 @@ TEST(VideoLayerImplTest, Rotated0) {
gfx::Size viewport_size(1000, 500);
LayerTestCommon::LayerImplTest impl;
- DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
+ DebugSetImplThreadAndMainThreadBlocked(impl.task_runner_provider());
scoped_refptr<media::VideoFrame> video_frame = media::VideoFrame::CreateFrame(
media::PIXEL_FORMAT_YV12, gfx::Size(20, 10), gfx::Rect(20, 10),
@@ -183,7 +184,7 @@ TEST(VideoLayerImplTest, Rotated90) {
gfx::Size viewport_size(1000, 500);
LayerTestCommon::LayerImplTest impl;
- DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
+ DebugSetImplThreadAndMainThreadBlocked(impl.task_runner_provider());
scoped_refptr<media::VideoFrame> video_frame = media::VideoFrame::CreateFrame(
media::PIXEL_FORMAT_YV12, gfx::Size(20, 10), gfx::Rect(20, 10),
@@ -219,7 +220,7 @@ TEST(VideoLayerImplTest, Rotated180) {
gfx::Size viewport_size(1000, 500);
LayerTestCommon::LayerImplTest impl;
- DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
+ DebugSetImplThreadAndMainThreadBlocked(impl.task_runner_provider());
scoped_refptr<media::VideoFrame> video_frame = media::VideoFrame::CreateFrame(
media::PIXEL_FORMAT_YV12, gfx::Size(20, 10), gfx::Rect(20, 10),
@@ -255,7 +256,7 @@ TEST(VideoLayerImplTest, Rotated270) {
gfx::Size viewport_size(1000, 500);
LayerTestCommon::LayerImplTest impl;
- DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
+ DebugSetImplThreadAndMainThreadBlocked(impl.task_runner_provider());
scoped_refptr<media::VideoFrame> video_frame = media::VideoFrame::CreateFrame(
media::PIXEL_FORMAT_YV12, gfx::Size(20, 10), gfx::Rect(20, 10),
@@ -294,7 +295,7 @@ TEST(VideoLayerImplTest, SoftwareVideoFrameGeneratesYUVQuad) {
gfx::Size viewport_size(1000, 1000);
LayerTestCommon::LayerImplTest impl;
- DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
+ DebugSetImplThreadAndMainThreadBlocked(impl.task_runner_provider());
gpu::MailboxHolder mailbox_holder;
mailbox_holder.mailbox.name[0] = 1;
@@ -331,7 +332,7 @@ TEST(VideoLayerImplTest, NativeYUVFrameGeneratesYUVQuad) {
gfx::Size viewport_size(1000, 1000);
LayerTestCommon::LayerImplTest impl;
- DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
+ DebugSetImplThreadAndMainThreadBlocked(impl.task_runner_provider());
gpu::MailboxHolder mailbox_holder;
mailbox_holder.mailbox.name[0] = 1;
diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc
index 9a86d07..6d80d81 100644
--- a/cc/output/gl_renderer_unittest.cc
+++ b/cc/output/gl_renderer_unittest.cc
@@ -18,7 +18,7 @@
#include "cc/output/texture_mailbox_deleter.h"
#include "cc/quads/texture_draw_quad.h"
#include "cc/resources/resource_provider.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_output_surface_client.h"
diff --git a/cc/test/fake_impl_proxy.h b/cc/test/fake_impl_proxy.h
deleted file mode 100644
index 6cbf9a3..0000000
--- a/cc/test/fake_impl_proxy.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CC_TEST_FAKE_IMPL_PROXY_H_
-#define CC_TEST_FAKE_IMPL_PROXY_H_
-
-#include "base/thread_task_runner_handle.h"
-#include "cc/test/fake_proxy.h"
-#include "cc/trees/single_thread_proxy.h"
-
-namespace base {
-class SingleThreadIdleTaskRunner;
-}
-
-namespace cc {
-
-class FakeImplProxy : public FakeProxy {
- public:
- FakeImplProxy()
- : FakeProxy(base::ThreadTaskRunnerHandle::Get(), nullptr),
- set_impl_thread_(this) {}
-
- explicit FakeImplProxy(
- scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner)
- : FakeProxy(base::ThreadTaskRunnerHandle::Get(), impl_task_runner),
- set_impl_thread_(this) {}
-
- private:
- DebugScopedSetImplThread set_impl_thread_;
-};
-
-} // namespace cc
-
-#endif // CC_TEST_FAKE_IMPL_PROXY_H_
diff --git a/cc/test/fake_impl_task_runner_provider.h b/cc/test/fake_impl_task_runner_provider.h
new file mode 100644
index 0000000..49ddcaa
--- /dev/null
+++ b/cc/test/fake_impl_task_runner_provider.h
@@ -0,0 +1,35 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_TEST_FAKE_IMPL_TASK_RUNNER_PROVIDER_H_
+#define CC_TEST_FAKE_IMPL_TASK_RUNNER_PROVIDER_H_
+
+#include "base/thread_task_runner_handle.h"
+#include "cc/trees/single_thread_proxy.h"
+#include "cc/trees/task_runner_provider.h"
+
+namespace base {
+class SingleThreadIdleTaskRunner;
+}
+
+namespace cc {
+
+class FakeImplTaskRunnerProvider : public TaskRunnerProvider {
+ public:
+ FakeImplTaskRunnerProvider()
+ : TaskRunnerProvider(base::ThreadTaskRunnerHandle::Get(), nullptr),
+ set_impl_thread_(this) {}
+
+ explicit FakeImplTaskRunnerProvider(
+ scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner)
+ : TaskRunnerProvider(base::ThreadTaskRunnerHandle::Get(),
+ impl_task_runner),
+ set_impl_thread_(this) {}
+
+ private:
+ DebugScopedSetImplThread set_impl_thread_;
+};
+
+} // namespace cc
+#endif // CC_TEST_FAKE_IMPL_TASK_RUNNER_PROVIDER_H_
diff --git a/cc/test/fake_layer_tree_host.cc b/cc/test/fake_layer_tree_host.cc
index 220b556f..30083d6 100644
--- a/cc/test/fake_layer_tree_host.cc
+++ b/cc/test/fake_layer_tree_host.cc
@@ -13,7 +13,7 @@ FakeLayerTreeHost::FakeLayerTreeHost(FakeLayerTreeHostClient* client,
: LayerTreeHost(params),
client_(client),
host_impl_(*params->settings,
- &proxy_,
+ &task_runner_provider_,
&manager_,
params->task_graph_runner),
needs_commit_(false) {
diff --git a/cc/test/fake_layer_tree_host.h b/cc/test/fake_layer_tree_host.h
index a50219c..5927dec6 100644
--- a/cc/test/fake_layer_tree_host.h
+++ b/cc/test/fake_layer_tree_host.h
@@ -6,7 +6,7 @@
#define CC_TEST_FAKE_LAYER_TREE_HOST_H_
#include "cc/debug/micro_benchmark_controller.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_client.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/test_shared_bitmap_manager.h"
@@ -59,7 +59,7 @@ class FakeLayerTreeHost : public LayerTreeHost {
LayerTreeHost::InitParams* params);
private:
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
FakeLayerTreeHostClient* client_;
TestSharedBitmapManager manager_;
FakeLayerTreeHostImpl host_impl_;
diff --git a/cc/test/fake_layer_tree_host_impl.cc b/cc/test/fake_layer_tree_host_impl.cc
index e210a76..56a93cd 100644
--- a/cc/test/fake_layer_tree_host_impl.cc
+++ b/cc/test/fake_layer_tree_host_impl.cc
@@ -9,34 +9,36 @@
namespace cc {
-FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy,
- SharedBitmapManager* manager,
- TaskGraphRunner* task_graph_runner)
+FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(
+ TaskRunnerProvider* task_runner_provider,
+ SharedBitmapManager* manager,
+ TaskGraphRunner* task_graph_runner)
: FakeLayerTreeHostImpl(LayerTreeSettings(),
- proxy,
+ task_runner_provider,
manager,
task_graph_runner,
nullptr) {}
-FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(const LayerTreeSettings& settings,
- Proxy* proxy,
- SharedBitmapManager* manager,
- TaskGraphRunner* task_graph_runner)
+FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(
+ const LayerTreeSettings& settings,
+ TaskRunnerProvider* task_runner_provider,
+ SharedBitmapManager* manager,
+ TaskGraphRunner* task_graph_runner)
: FakeLayerTreeHostImpl(settings,
- proxy,
+ task_runner_provider,
manager,
task_graph_runner,
nullptr) {}
FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(
const LayerTreeSettings& settings,
- Proxy* proxy,
+ TaskRunnerProvider* task_runner_provider,
SharedBitmapManager* manager,
TaskGraphRunner* task_graph_runner,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager)
: LayerTreeHostImpl(settings,
&client_,
- proxy,
+ task_runner_provider,
&stats_instrumentation_,
manager,
gpu_memory_buffer_manager,
diff --git a/cc/test/fake_layer_tree_host_impl.h b/cc/test/fake_layer_tree_host_impl.h
index f47a098..2f068ee 100644
--- a/cc/test/fake_layer_tree_host_impl.h
+++ b/cc/test/fake_layer_tree_host_impl.h
@@ -18,15 +18,15 @@ namespace cc {
class FakeLayerTreeHostImpl : public LayerTreeHostImpl {
public:
- FakeLayerTreeHostImpl(Proxy* proxy,
+ FakeLayerTreeHostImpl(TaskRunnerProvider* task_runner_provider,
SharedBitmapManager* manager,
TaskGraphRunner* task_graph_runner);
FakeLayerTreeHostImpl(const LayerTreeSettings& settings,
- Proxy* proxy,
+ TaskRunnerProvider* task_runner_provider,
SharedBitmapManager* manager,
TaskGraphRunner* task_graph_runner);
FakeLayerTreeHostImpl(const LayerTreeSettings& settings,
- Proxy* proxy,
+ TaskRunnerProvider* task_runner_provider,
SharedBitmapManager* manager,
TaskGraphRunner* task_graph_runner,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager);
diff --git a/cc/test/fake_ui_resource_layer_tree_host_impl.cc b/cc/test/fake_ui_resource_layer_tree_host_impl.cc
index a5320f4..fd60c35 100644
--- a/cc/test/fake_ui_resource_layer_tree_host_impl.cc
+++ b/cc/test/fake_ui_resource_layer_tree_host_impl.cc
@@ -10,11 +10,10 @@
namespace cc {
FakeUIResourceLayerTreeHostImpl::FakeUIResourceLayerTreeHostImpl(
- Proxy* proxy,
+ TaskRunnerProvider* task_runner_provider,
SharedBitmapManager* manager,
TaskGraphRunner* task_graph_runner)
- : FakeLayerTreeHostImpl(proxy, manager, task_graph_runner) {
-}
+ : FakeLayerTreeHostImpl(task_runner_provider, manager, task_graph_runner) {}
FakeUIResourceLayerTreeHostImpl::~FakeUIResourceLayerTreeHostImpl() {}
diff --git a/cc/test/fake_ui_resource_layer_tree_host_impl.h b/cc/test/fake_ui_resource_layer_tree_host_impl.h
index ae12eaf..7db2ff0 100644
--- a/cc/test/fake_ui_resource_layer_tree_host_impl.h
+++ b/cc/test/fake_ui_resource_layer_tree_host_impl.h
@@ -13,9 +13,10 @@ class TaskGraphRunner;
class FakeUIResourceLayerTreeHostImpl : public FakeLayerTreeHostImpl {
public:
- explicit FakeUIResourceLayerTreeHostImpl(Proxy* proxy,
- SharedBitmapManager* manager,
- TaskGraphRunner* task_graph_runner);
+ explicit FakeUIResourceLayerTreeHostImpl(
+ TaskRunnerProvider* task_runner_provider,
+ SharedBitmapManager* manager,
+ TaskGraphRunner* task_graph_runner);
~FakeUIResourceLayerTreeHostImpl() override;
void CreateUIResource(UIResourceId uid,
diff --git a/cc/test/layer_test_common.h b/cc/test/layer_test_common.h
index f801461..e322632 100644
--- a/cc/test/layer_test_common.h
+++ b/cc/test/layer_test_common.h
@@ -133,7 +133,9 @@ class LayerTestCommon {
LayerImpl* root_layer() const { return root_layer_impl_.get(); }
FakeLayerTreeHost* host() { return host_.get(); }
FakeLayerTreeHostImpl* host_impl() const { return host_->host_impl(); }
- Proxy* proxy() const { return host_->host_impl()->proxy(); }
+ TaskRunnerProvider* task_runner_provider() const {
+ return host_->host_impl()->task_runner_provider();
+ }
const QuadList& quad_list() const { return render_pass_->quad_list; }
private:
diff --git a/cc/test/layer_tree_json_parser_unittest.cc b/cc/test/layer_tree_json_parser_unittest.cc
index f1388c0..5521b37 100644
--- a/cc/test/layer_tree_json_parser_unittest.cc
+++ b/cc/test/layer_tree_json_parser_unittest.cc
@@ -5,7 +5,7 @@
#include "cc/test/layer_tree_json_parser.h"
#include "cc/layers/layer.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/geometry_test_utils.h"
@@ -63,10 +63,10 @@ class LayerTreeJsonParserSanityCheck : public testing::Test {
};
TEST_F(LayerTreeJsonParserSanityCheck, Basic) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
LayerTreeImpl* tree = host_impl.active_tree();
@@ -94,10 +94,10 @@ TEST_F(LayerTreeJsonParserSanityCheck, Basic) {
}
TEST_F(LayerTreeJsonParserSanityCheck, EventHandlerRegions) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
LayerTreeImpl* tree = host_impl.active_tree();
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index 86ba7c1..381eb0d 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -388,7 +388,7 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
}
void BlockNotifyReadyToActivateForTesting(bool block) override {
- CHECK(proxy()->ImplThreadTaskRunner())
+ CHECK(task_runner_provider()->ImplThreadTaskRunner())
<< "Not supported for single-threaded mode.";
block_notify_ready_to_activate_for_testing_ = block;
if (!block && notify_ready_to_activate_was_blocked_) {
diff --git a/cc/tiles/tile_manager_perftest.cc b/cc/tiles/tile_manager_perftest.cc
index 3bb46e4..6e7bed3 100644
--- a/cc/tiles/tile_manager_perftest.cc
+++ b/cc/tiles/tile_manager_perftest.cc
@@ -10,7 +10,7 @@
#include "cc/raster/raster_buffer.h"
#include "cc/test/begin_frame_args_test.h"
#include "cc/test/fake_display_list_raster_source.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_output_surface_client.h"
@@ -92,10 +92,10 @@ class TileManagerPerfTest : public testing::Test {
: memory_limit_policy_(ALLOW_ANYTHING),
max_tiles_(10000),
id_(7),
- proxy_(base::ThreadTaskRunnerHandle::Get()),
+ task_runner_provider_(base::ThreadTaskRunnerHandle::Get()),
output_surface_(FakeOutputSurface::Create3d()),
host_impl_(LayerTreeSettings(),
- &proxy_,
+ &task_runner_provider_,
&shared_bitmap_manager_,
&task_graph_runner_),
timer_(kWarmupRuns,
@@ -418,7 +418,7 @@ class TileManagerPerfTest : public testing::Test {
TileMemoryLimitPolicy memory_limit_policy_;
int max_tiles_;
int id_;
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
scoped_ptr<OutputSurface> output_surface_;
FakeLayerTreeHostImpl host_impl_;
FakePictureLayerImpl* pending_root_layer_;
diff --git a/cc/tiles/tile_manager_unittest.cc b/cc/tiles/tile_manager_unittest.cc
index 951426b..95c3e56 100644
--- a/cc/tiles/tile_manager_unittest.cc
+++ b/cc/tiles/tile_manager_unittest.cc
@@ -11,7 +11,7 @@
#include "cc/test/begin_frame_args_test.h"
#include "cc/test/fake_display_list_raster_source.h"
#include "cc/test/fake_display_list_recording_source.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_output_surface_client.h"
@@ -50,10 +50,10 @@ class TileManagerTilePriorityQueueTest : public testing::Test {
max_tiles_(10000),
ready_to_activate_(false),
id_(7),
- proxy_(base::ThreadTaskRunnerHandle::Get()),
+ task_runner_provider_(base::ThreadTaskRunnerHandle::Get()),
output_surface_(FakeOutputSurface::Create3d()),
host_impl_(LowResTilingsSettings(),
- &proxy_,
+ &task_runner_provider_,
&shared_bitmap_manager_,
&task_graph_runner_,
&gpu_memory_buffer_manager_) {}
@@ -163,7 +163,7 @@ class TileManagerTilePriorityQueueTest : public testing::Test {
int max_tiles_;
bool ready_to_activate_;
int id_;
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
scoped_ptr<OutputSurface> output_surface_;
FakeLayerTreeHostImpl host_impl_;
FakePictureLayerImpl* pending_layer_;
@@ -1457,8 +1457,9 @@ class TileManagerTest : public testing::Test {
void SetUp() override {
LayerTreeSettings settings;
CustomizeSettings(&settings);
- host_impl_.reset(new MockLayerTreeHostImpl(
- settings, &proxy_, &shared_bitmap_manager_, &task_graph_runner_));
+ host_impl_.reset(new MockLayerTreeHostImpl(settings, &task_runner_provider_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_));
host_impl_->SetVisible(true);
host_impl_->InitializeRenderer(output_surface_.get());
}
@@ -1468,10 +1469,13 @@ class TileManagerTest : public testing::Test {
class MockLayerTreeHostImpl : public FakeLayerTreeHostImpl {
public:
MockLayerTreeHostImpl(const LayerTreeSettings& settings,
- Proxy* proxy,
+ TaskRunnerProvider* task_runner_provider,
SharedBitmapManager* manager,
TaskGraphRunner* task_graph_runner)
- : FakeLayerTreeHostImpl(settings, proxy, manager, task_graph_runner) {}
+ : FakeLayerTreeHostImpl(settings,
+ task_runner_provider,
+ manager,
+ task_graph_runner) {}
MOCK_METHOD0(NotifyAllTileTasksCompleted, void());
};
@@ -1481,7 +1485,7 @@ class TileManagerTest : public testing::Test {
TestSharedBitmapManager shared_bitmap_manager_;
TestTaskGraphRunner task_graph_runner_;
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
scoped_ptr<OutputSurface> output_surface_;
scoped_ptr<MockLayerTreeHostImpl> host_impl_;
};
diff --git a/cc/trees/damage_tracker_unittest.cc b/cc/trees/damage_tracker_unittest.cc
index 9935e86..949baa2 100644
--- a/cc/trees/damage_tracker_unittest.cc
+++ b/cc/trees/damage_tracker_unittest.cc
@@ -8,7 +8,7 @@
#include "cc/layers/layer_impl.h"
#include "cc/output/filter_operation.h"
#include "cc/output/filter_operations.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/test_shared_bitmap_manager.h"
@@ -79,7 +79,9 @@ void EmulateDrawingOneFrame(LayerImpl* root) {
class DamageTrackerTest : public testing::Test {
public:
DamageTrackerTest()
- : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_) {}
+ : host_impl_(&task_runner_provider_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_) {}
scoped_ptr<LayerImpl> CreateTestTreeWithOneSurface() {
scoped_ptr<LayerImpl> root =
@@ -172,7 +174,7 @@ class DamageTrackerTest : public testing::Test {
}
protected:
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
TestSharedBitmapManager shared_bitmap_manager_;
TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 714e811..032a5df 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -21,7 +21,7 @@
#include "cc/output/copy_output_result.h"
#include "cc/test/animation_test_common.h"
#include "cc/test/fake_content_layer_client.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
@@ -32,8 +32,8 @@
#include "cc/test/test_task_graph_runner.h"
#include "cc/trees/draw_property_utils.h"
#include "cc/trees/layer_tree_impl.h"
-#include "cc/trees/proxy.h"
#include "cc/trees/single_thread_proxy.h"
+#include "cc/trees/task_runner_provider.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/quad_f.h"
@@ -277,10 +277,10 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
const float kPageScale = 0.888f;
const float kDeviceScale = 1.666f;
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
gfx::Transform identity_matrix;
@@ -3213,11 +3213,11 @@ TEST_F(LayerTreeHostCommonTest,
TEST_F(LayerTreeHostCommonTest,
OcclusionForLayerWithUninvertibleDrawTransform) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 2);
@@ -4864,10 +4864,10 @@ TEST_F(LayerTreeHostCommonTest, TransparentChildRenderSurfaceCreation) {
}
TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
host_impl.CreatePendingTree();
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1);
@@ -4910,7 +4910,9 @@ class LCDTextTest : public LayerTreeHostCommonTestBase,
public:
LCDTextTest()
: LayerTreeHostCommonTestBase(LayerTreeSettings()),
- host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_),
+ host_impl_(&task_runner_provider_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_),
root_(nullptr),
child_(nullptr),
grand_child_(nullptr) {}
@@ -4959,7 +4961,7 @@ class LCDTextTest : public LayerTreeHostCommonTestBase,
bool can_use_lcd_text_;
bool layers_always_allowed_lcd_text_;
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
TestSharedBitmapManager shared_bitmap_manager_;
TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
@@ -5129,10 +5131,10 @@ INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest,
testing::Bool()));
TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -5176,10 +5178,10 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
}
TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -5223,10 +5225,10 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {}
TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -5356,10 +5358,10 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) {
}
TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -5419,10 +5421,10 @@ TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) {
}
TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -5871,10 +5873,10 @@ TEST_F(LayerTreeHostCommonTest,
}
TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
scoped_ptr<LayerImpl> root =
LayerImpl::Create(host_impl.active_tree(), 12345);
@@ -6431,10 +6433,10 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) {
// + scroller
// + fixed
//
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
host_impl.CreatePendingTree();
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
@@ -6577,10 +6579,10 @@ TEST_F(LayerTreeHostCommonTest,
// + scroller
// + fixed
//
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
host_impl.CreatePendingTree();
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
@@ -6730,13 +6732,13 @@ class AnimationScaleFactorTrackingLayerImpl : public LayerImpl {
};
TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
LayerTreeSettings settings;
settings.layer_transforms_should_scale_layer_contents = true;
- FakeLayerTreeHostImpl host_impl(settings, &proxy, &shared_bitmap_manager,
- &task_graph_runner);
+ FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider,
+ &shared_bitmap_manager, &task_graph_runner);
gfx::Transform identity_matrix;
scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent =
AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1);
@@ -7058,10 +7060,10 @@ static void GatherDrawnLayers(LayerImplList* rsll,
}
TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
gfx::Transform identity_matrix;
@@ -7308,13 +7310,13 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
}
TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
LayerTreeSettings settings;
settings.layer_transforms_should_scale_layer_contents = true;
- FakeLayerTreeHostImpl host_impl(settings, &proxy, &shared_bitmap_manager,
- &task_graph_runner);
+ FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider,
+ &shared_bitmap_manager, &task_graph_runner);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
LayerImpl* root_layer = root.get();
@@ -7513,10 +7515,10 @@ TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) {
}
TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
// Set two layers: the root layer clips it's child,
@@ -8282,10 +8284,10 @@ TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) {
}
TEST_F(LayerTreeHostCommonTest, SkippingSubtreeImpl) {
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
&task_graph_runner);
gfx::Transform identity;
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index e1aae1a..acad50a 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -139,28 +139,28 @@ LayerTreeHostImpl::FrameData::~FrameData() {}
scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create(
const LayerTreeSettings& settings,
LayerTreeHostImplClient* client,
- Proxy* proxy,
+ TaskRunnerProvider* task_runner_provider,
RenderingStatsInstrumentation* rendering_stats_instrumentation,
SharedBitmapManager* shared_bitmap_manager,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
TaskGraphRunner* task_graph_runner,
int id) {
return make_scoped_ptr(new LayerTreeHostImpl(
- settings, client, proxy, rendering_stats_instrumentation,
+ settings, client, task_runner_provider, rendering_stats_instrumentation,
shared_bitmap_manager, gpu_memory_buffer_manager, task_graph_runner, id));
}
LayerTreeHostImpl::LayerTreeHostImpl(
const LayerTreeSettings& settings,
LayerTreeHostImplClient* client,
- Proxy* proxy,
+ TaskRunnerProvider* task_runner_provider,
RenderingStatsInstrumentation* rendering_stats_instrumentation,
SharedBitmapManager* shared_bitmap_manager,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
TaskGraphRunner* task_graph_runner,
int id)
: client_(client),
- proxy_(proxy),
+ task_runner_provider_(task_runner_provider),
current_begin_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE),
output_surface_(nullptr),
content_is_suitable_for_gpu_rasterization_(true),
@@ -178,9 +178,10 @@ LayerTreeHostImpl::LayerTreeHostImpl(
settings_(settings),
visible_(false),
cached_managed_memory_policy_(settings.memory_policy_),
- is_synchronous_single_threaded_(!proxy->HasImplThread() &&
+ is_synchronous_single_threaded_(!task_runner_provider->HasImplThread() &&
!settings.single_thread_proxy_scheduler),
- // Must be initialized after is_synchronous_single_threaded_ and proxy_.
+ // Must be initialized after is_synchronous_single_threaded_ and
+ // task_runner_provider_.
tile_manager_(
TileManager::Create(this,
GetTaskRunner(),
@@ -190,7 +191,8 @@ LayerTreeHostImpl::LayerTreeHostImpl(
settings.use_partial_raster)),
pinch_gesture_active_(false),
pinch_gesture_end_should_clear_scrolling_layer_(false),
- fps_counter_(FrameRateCounter::Create(proxy_->HasImplThread())),
+ fps_counter_(
+ FrameRateCounter::Create(task_runner_provider_->HasImplThread())),
memory_history_(MemoryHistory::Create()),
debug_rect_history_(DebugRectHistory::Create()),
texture_mailbox_deleter_(new TextureMailboxDeleter(GetTaskRunner())),
@@ -210,16 +212,15 @@ LayerTreeHostImpl::LayerTreeHostImpl(
if (settings.accelerated_animation_enabled) {
animation_host_ = AnimationHost::Create(ThreadInstance::IMPL);
animation_host_->SetMutatorHostClient(this);
- animation_host_->SetSupportsScrollAnimations(
- proxy_->SupportsImplScrolling());
+ animation_host_->SetSupportsScrollAnimations(SupportsImplScrolling());
}
} else {
animation_registrar_ = AnimationRegistrar::Create();
animation_registrar_->set_supports_scroll_animations(
- proxy_->SupportsImplScrolling());
+ SupportsImplScrolling());
}
- DCHECK(proxy_->IsImplThread());
+ DCHECK(task_runner_provider_->IsImplThread());
DidVisibilityChange(this, visible_);
SetDebugState(settings.initial_debug_state);
@@ -241,7 +242,7 @@ LayerTreeHostImpl::LayerTreeHostImpl(
}
LayerTreeHostImpl::~LayerTreeHostImpl() {
- DCHECK(proxy_->IsImplThread());
+ DCHECK(task_runner_provider_->IsImplThread());
TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()");
TRACE_EVENT_OBJECT_DELETED_WITH_ID(
TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_);
@@ -300,14 +301,14 @@ void LayerTreeHostImpl::BeginCommit() {
if (output_surface_)
output_surface_->ForceReclaimResources();
- if (!proxy_->CommitToActiveTree())
+ if (!CommitToActiveTree())
CreatePendingTree();
}
void LayerTreeHostImpl::CommitComplete() {
TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete");
- if (proxy_->CommitToActiveTree()) {
+ if (CommitToActiveTree()) {
// We have to activate animations here or "IsActive()" is true on the layers
// but the animations aren't activated yet so they get ignored by
// UpdateDrawProperties.
@@ -342,7 +343,7 @@ void LayerTreeHostImpl::CommitComplete() {
// is important for SingleThreadProxy and impl-side painting case. For
// STP, we commit to active tree and RequiresHighResToDraw, and set
// Scheduler to wait for ReadyToDraw signal to avoid Checkerboard.
- if (proxy_->CommitToActiveTree())
+ if (CommitToActiveTree())
NotifyReadyToDraw();
}
@@ -396,7 +397,7 @@ bool LayerTreeHostImpl::CanDraw() const {
}
void LayerTreeHostImpl::Animate() {
- DCHECK(proxy_->IsImplThread());
+ DCHECK(task_runner_provider_->IsImplThread());
base::TimeTicks monotonic_time = CurrentBeginFrameArgs().frame_time;
// mithro(TODO): Enable these checks.
@@ -1355,7 +1356,7 @@ void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) {
void LayerTreeHostImpl::SetTreeActivationCallback(
const base::Closure& callback) {
- DCHECK(proxy_->IsImplThread());
+ DCHECK(task_runner_provider_->IsImplThread());
tree_activation_callback_ = callback;
}
@@ -1372,13 +1373,13 @@ void LayerTreeHostImpl::SetManagedMemoryPolicy(
if (old_policy == actual_policy)
return;
- if (!proxy_->HasImplThread()) {
+ if (!task_runner_provider_->HasImplThread()) {
// In single-thread mode, this can be called on the main thread by
// GLRenderer::OnMemoryAllocationChanged.
- DebugScopedSetImplThread impl_thread(proxy_);
+ DebugScopedSetImplThread impl_thread(task_runner_provider_);
UpdateTileManagerMemoryPolicy(actual_policy);
} else {
- DCHECK(proxy_->IsImplThread());
+ DCHECK(task_runner_provider_->IsImplThread());
UpdateTileManagerMemoryPolicy(actual_policy);
}
@@ -1986,7 +1987,7 @@ void LayerTreeHostImpl::ActivateSyncTree() {
}
void LayerTreeHostImpl::SetVisible(bool visible) {
- DCHECK(proxy_->IsImplThread());
+ DCHECK(task_runner_provider_->IsImplThread());
if (visible_ == visible)
return;
@@ -2238,7 +2239,7 @@ bool LayerTreeHostImpl::InitializeRenderer(OutputSurface* output_surface) {
output_surface_ = output_surface;
resource_provider_ = ResourceProvider::Create(
output_surface_, shared_bitmap_manager_, gpu_memory_buffer_manager_,
- proxy_->blocking_main_thread_task_runner(),
+ task_runner_provider_->blocking_main_thread_task_runner(),
settings_.renderer_settings.highp_threshold_min,
settings_.renderer_settings.texture_id_allocation_chunk_size,
settings_.use_image_texture_targets);
@@ -3648,4 +3649,15 @@ gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation(
return gfx::ScrollOffset();
}
+bool LayerTreeHostImpl::SupportsImplScrolling() const {
+ // Supported in threaded mode.
+ return task_runner_provider_->HasImplThread();
+}
+
+bool LayerTreeHostImpl::CommitToActiveTree() const {
+ // In single threaded mode we skip the pending tree and commit directly to the
+ // active tree.
+ return !task_runner_provider_->HasImplThread();
+}
+
} // namespace cc
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index 231a54b..8d50bc2 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -38,7 +38,7 @@
#include "cc/tiles/tile_manager.h"
#include "cc/trees/layer_tree_settings.h"
#include "cc/trees/mutator_host_client.h"
-#include "cc/trees/proxy.h"
+#include "cc/trees/task_runner_provider.h"
#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/rect.h"
@@ -148,7 +148,7 @@ class CC_EXPORT LayerTreeHostImpl
static scoped_ptr<LayerTreeHostImpl> Create(
const LayerTreeSettings& settings,
LayerTreeHostImplClient* client,
- Proxy* proxy,
+ TaskRunnerProvider* task_runner_provider,
RenderingStatsInstrumentation* rendering_stats_instrumentation,
SharedBitmapManager* shared_bitmap_manager,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
@@ -413,7 +413,7 @@ class CC_EXPORT LayerTreeHostImpl
// Returns the tree LTH synchronizes with.
LayerTreeImpl* sync_tree() {
// TODO(enne): This is bogus. It should return based on the value of
- // Proxy::CommitToActiveTree and not whether the pending tree exists.
+ // CommitToActiveTree() and not whether the pending tree exists.
return pending_tree_ ? pending_tree_.get() : active_tree_.get();
}
virtual void CreatePendingTree();
@@ -477,7 +477,9 @@ class CC_EXPORT LayerTreeHostImpl
return global_tile_state_;
}
- Proxy* proxy() const { return proxy_; }
+ TaskRunnerProvider* task_runner_provider() const {
+ return task_runner_provider_;
+ }
AnimationRegistrar* animation_registrar() const {
return animation_registrar_.get();
@@ -553,6 +555,9 @@ class CC_EXPORT LayerTreeHostImpl
// Only valid for synchronous (non-scheduled) single-threaded case.
void SynchronouslyInitializeAllTiles();
+ bool SupportsImplScrolling() const;
+ bool CommitToActiveTree() const;
+
virtual void CreateResourceAndTileTaskWorkerPool(
scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool,
scoped_ptr<ResourcePool>* resource_pool);
@@ -586,11 +591,18 @@ class CC_EXPORT LayerTreeHostImpl
scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events);
+ base::SingleThreadTaskRunner* GetTaskRunner() const {
+ DCHECK(task_runner_provider_);
+ return task_runner_provider_->HasImplThread()
+ ? task_runner_provider_->ImplThreadTaskRunner()
+ : task_runner_provider_->MainThreadTaskRunner();
+ }
+
protected:
LayerTreeHostImpl(
const LayerTreeSettings& settings,
LayerTreeHostImplClient* client,
- Proxy* proxy,
+ TaskRunnerProvider* task_runner_provider,
RenderingStatsInstrumentation* rendering_stats_instrumentation,
SharedBitmapManager* shared_bitmap_manager,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
@@ -608,7 +620,7 @@ class CC_EXPORT LayerTreeHostImpl
static void RemoveRenderPasses(FrameData* frame);
LayerTreeHostImplClient* client_;
- Proxy* proxy_;
+ TaskRunnerProvider* task_runner_provider_;
BeginFrameTracker current_begin_frame_tracker_;
@@ -682,12 +694,6 @@ class CC_EXPORT LayerTreeHostImpl
bool ScrollAnimationUpdateTarget(LayerImpl* layer_impl,
const gfx::Vector2dF& scroll_delta);
- base::SingleThreadTaskRunner* GetTaskRunner() const {
- DCHECK(proxy_);
- return proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner()
- : proxy_->MainThreadTaskRunner();
- }
-
typedef base::hash_map<UIResourceId, UIResourceData>
UIResourceMap;
UIResourceMap ui_resource_map_;
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 2eae9ac..019c969 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -48,7 +48,6 @@
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_output_surface_client.h"
#include "cc/test/fake_picture_layer_impl.h"
-#include "cc/test/fake_proxy.h"
#include "cc/test/fake_video_frame_provider.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/gpu_rasterization_enabled_settings.h"
@@ -82,10 +81,10 @@ class LayerTreeHostImplTest : public testing::Test,
public LayerTreeHostImplClient {
public:
LayerTreeHostImplTest()
- : proxy_(base::ThreadTaskRunnerHandle::Get(),
- base::ThreadTaskRunnerHandle::Get()),
- always_impl_thread_(&proxy_),
- always_main_thread_blocked_(&proxy_),
+ : task_runner_provider_(base::ThreadTaskRunnerHandle::Get(),
+ base::ThreadTaskRunnerHandle::Get()),
+ always_impl_thread_(&task_runner_provider_),
+ always_main_thread_blocked_(&task_runner_provider_),
on_can_draw_state_changed_called_(false),
did_notify_ready_to_activate_(false),
did_request_commit_(false),
@@ -166,7 +165,7 @@ class LayerTreeHostImplTest : public testing::Test,
virtual bool CreateHostImpl(const LayerTreeSettings& settings,
scoped_ptr<OutputSurface> output_surface) {
host_impl_ = LayerTreeHostImpl::Create(
- settings, this, &proxy_, &stats_instrumentation_,
+ settings, this, &task_runner_provider_, &stats_instrumentation_,
&shared_bitmap_manager_, &gpu_memory_buffer_manager_,
&task_graph_runner_, 0);
output_surface_ = output_surface.Pass();
@@ -429,7 +428,7 @@ class LayerTreeHostImplTest : public testing::Test,
host_impl_->DidDrawAllLayers(frame_data);
}
- FakeProxy proxy_;
+ TaskRunnerProvider task_runner_provider_;
DebugScopedSetImplThread always_impl_thread_;
DebugScopedSetMainThreadBlocked always_main_thread_blocked_;
@@ -2149,13 +2148,13 @@ class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl {
LayerTreeHostImplOverridePhysicalTime(
const LayerTreeSettings& settings,
LayerTreeHostImplClient* client,
- Proxy* proxy,
+ TaskRunnerProvider* task_runner_provider,
SharedBitmapManager* manager,
TaskGraphRunner* task_graph_runner,
RenderingStatsInstrumentation* rendering_stats_instrumentation)
: LayerTreeHostImpl(settings,
client,
- proxy,
+ task_runner_provider,
rendering_stats_instrumentation,
manager,
nullptr,
@@ -2182,7 +2181,7 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest {
LayerTreeHostImplOverridePhysicalTime* host_impl_override_time =
new LayerTreeHostImplOverridePhysicalTime(
- settings, this, &proxy_, &shared_bitmap_manager_,
+ settings, this, &task_runner_provider_, &shared_bitmap_manager_,
&task_graph_runner_, &stats_instrumentation_);
host_impl_ = make_scoped_ptr(host_impl_override_time);
output_surface_ = CreateOutputSurface();
@@ -5842,7 +5841,7 @@ TEST_F(LayerTreeHostImplTest, PartialSwapReceivesDamageRect) {
settings.renderer_settings.partial_swap_enabled = true;
scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl =
LayerTreeHostImpl::Create(
- settings, this, &proxy_, &stats_instrumentation_,
+ settings, this, &task_runner_provider_, &stats_instrumentation_,
&shared_bitmap_manager_, NULL, &task_graph_runner_, 0);
layer_tree_host_impl->SetVisible(true);
layer_tree_host_impl->InitializeRenderer(output_surface.get());
@@ -6118,16 +6117,16 @@ TEST_F(LayerTreeHostImplTest, PartialSwap) {
static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity(
bool partial_swap,
LayerTreeHostImplClient* client,
- Proxy* proxy,
+ TaskRunnerProvider* task_runner_provider,
SharedBitmapManager* manager,
TaskGraphRunner* task_graph_runner,
RenderingStatsInstrumentation* stats_instrumentation,
OutputSurface* output_surface) {
LayerTreeSettings settings;
settings.renderer_settings.partial_swap_enabled = partial_swap;
- scoped_ptr<LayerTreeHostImpl> my_host_impl =
- LayerTreeHostImpl::Create(settings, client, proxy, stats_instrumentation,
- manager, nullptr, task_graph_runner, 0);
+ scoped_ptr<LayerTreeHostImpl> my_host_impl = LayerTreeHostImpl::Create(
+ settings, client, task_runner_provider, stats_instrumentation, manager,
+ nullptr, task_graph_runner, 0);
my_host_impl->SetVisible(true);
my_host_impl->InitializeRenderer(output_surface);
my_host_impl->WillBeginImplFrame(
@@ -6198,8 +6197,8 @@ TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) {
scoped_ptr<OutputSurface> output_surface(
FakeOutputSurface::Create3d(provider));
scoped_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity(
- true, this, &proxy_, &shared_bitmap_manager, &task_graph_runner,
- &stats_instrumentation_, output_surface.get());
+ true, this, &task_runner_provider_, &shared_bitmap_manager,
+ &task_graph_runner, &stats_instrumentation_, output_surface.get());
{
LayerTreeHostImpl::FrameData frame;
EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame));
@@ -6227,8 +6226,8 @@ TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) {
scoped_ptr<OutputSurface> output_surface(
FakeOutputSurface::Create3d(provider));
scoped_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity(
- false, this, &proxy_, &shared_bitmap_manager, &task_graph_runner,
- &stats_instrumentation_, output_surface.get());
+ false, this, &task_runner_provider_, &shared_bitmap_manager,
+ &task_graph_runner, &stats_instrumentation_, output_surface.get());
{
LayerTreeHostImpl::FrameData frame;
EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame));
@@ -6644,8 +6643,9 @@ TEST_F(LayerTreeHostImplTest,
TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) {
LayerTreeSettings settings;
host_impl_ = LayerTreeHostImpl::Create(
- settings, this, &proxy_, &stats_instrumentation_, &shared_bitmap_manager_,
- &gpu_memory_buffer_manager_, &task_graph_runner_, 0);
+ settings, this, &task_runner_provider_, &stats_instrumentation_,
+ &shared_bitmap_manager_, &gpu_memory_buffer_manager_, &task_graph_runner_,
+ 0);
output_surface_ =
FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create());
@@ -6708,7 +6708,7 @@ class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest {
public:
void SetUp() override {
fake_host_impl_ =
- new FakeLayerTreeHostImpl(LayerTreeSettings(), &proxy_,
+ new FakeLayerTreeHostImpl(LayerTreeSettings(), &task_runner_provider_,
&shared_bitmap_manager_, &task_graph_runner_);
host_impl_.reset(fake_host_impl_);
output_surface_ = CreateOutputSurface();
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index 1a20465..624009d 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -111,7 +111,7 @@ class LayerTreeHostContextTest : public LayerTreeTest {
if (draw_result == DRAW_ABORTED_MISSING_HIGH_RES_CONTENT) {
// Only valid for single-threaded compositing, which activates
// immediately and will try to draw again when content has finished.
- DCHECK(!host_impl->proxy()->HasImplThread());
+ DCHECK(!host_impl->task_runner_provider()->HasImplThread());
return draw_result;
}
EXPECT_EQ(DRAW_SUCCESS, draw_result);
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 73cb9e0..cf22019a 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -731,10 +731,9 @@ bool LayerTreeImpl::UpdateDrawProperties(bool update_lcd_text) {
// raster source due to draw properties.
if (update_lcd_text) {
// TODO(enne): Make LTHI::sync_tree return this value.
- LayerTreeImpl* sync_tree =
- layer_tree_host_impl_->proxy()->CommitToActiveTree()
- ? layer_tree_host_impl_->active_tree()
- : layer_tree_host_impl_->pending_tree();
+ LayerTreeImpl* sync_tree = layer_tree_host_impl_->CommitToActiveTree()
+ ? layer_tree_host_impl_->active_tree()
+ : layer_tree_host_impl_->pending_tree();
// If this is not the sync tree, then it is not safe to update lcd text
// as it causes invalidations and the tiles may be in use.
DCHECK_EQ(this, sync_tree);
@@ -874,8 +873,8 @@ void LayerTreeImpl::ResetViewportSizeInvalid() {
layer_tree_host_impl_->OnCanDrawStateChangedForTree();
}
-Proxy* LayerTreeImpl::proxy() const {
- return layer_tree_host_impl_->proxy();
+TaskRunnerProvider* LayerTreeImpl::task_runner_provider() const {
+ return layer_tree_host_impl_->task_runner_provider();
}
const LayerTreeSettings& LayerTreeImpl::settings() const {
@@ -1714,10 +1713,6 @@ bool LayerTreeImpl::SmoothnessTakesPriority() const {
return layer_tree_host_impl_->GetTreePriority() == SMOOTHNESS_TAKES_PRIORITY;
}
-BlockingTaskRunner* LayerTreeImpl::BlockingMainThreadTaskRunner() const {
- return proxy()->blocking_main_thread_task_runner();
-}
-
VideoFrameControllerClient* LayerTreeImpl::GetVideoFrameControllerClient()
const {
return layer_tree_host_impl_;
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h
index 6d54438..e642e9b 100644
--- a/cc/trees/layer_tree_impl.h
+++ b/cc/trees/layer_tree_impl.h
@@ -44,7 +44,7 @@ class MemoryHistory;
class OutputSurface;
class PageScaleAnimation;
class PictureLayerImpl;
-class Proxy;
+class TaskRunnerProvider;
class ResourceProvider;
class TileManager;
class UIResourceRequest;
@@ -106,7 +106,6 @@ class CC_EXPORT LayerTreeImpl {
bool use_gpu_rasterization() const;
GpuRasterizationStatus GetGpuRasterizationStatus() const;
bool create_low_res_tiling() const;
- BlockingTaskRunner* BlockingMainThreadTaskRunner() const;
bool RequiresHighResToDraw() const;
bool SmoothnessTakesPriority() const;
VideoFrameControllerClient* GetVideoFrameControllerClient() const;
@@ -266,8 +265,8 @@ class CC_EXPORT LayerTreeImpl {
void SetViewportSizeInvalid();
void ResetViewportSizeInvalid();
- // Useful for debug assertions, probably shouldn't be used for anything else.
- Proxy* proxy() const;
+ // Used for accessing the task runner and debug assertions.
+ TaskRunnerProvider* task_runner_provider() const;
// Distribute the root scroll between outer and inner viewport scroll layer.
// The outer viewport scroll layer scrolls first.
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
index 70898cb..5f12d0e 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -7,7 +7,7 @@
#include "cc/layers/heads_up_display_layer_impl.h"
#include "cc/layers/layer.h"
#include "cc/layers/solid_color_scrollbar_layer_impl.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/geometry_test_utils.h"
@@ -26,8 +26,9 @@ class LayerTreeImplTest : public LayerTreeHostCommonTest {
LayerTreeSettings settings;
settings.layer_transforms_should_scale_layer_contents = true;
settings.verify_property_trees = true;
- host_impl_.reset(new FakeLayerTreeHostImpl(
- settings, &proxy_, &shared_bitmap_manager_, &task_graph_runner_));
+ host_impl_.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_));
host_impl_->SetVisible(true);
EXPECT_TRUE(host_impl_->InitializeRenderer(output_surface_.get()));
}
@@ -43,7 +44,7 @@ class LayerTreeImplTest : public LayerTreeHostCommonTest {
private:
TestSharedBitmapManager shared_bitmap_manager_;
TestTaskGraphRunner task_graph_runner_;
- FakeImplProxy proxy_;
+ FakeImplTaskRunnerProvider task_runner_provider_;
scoped_ptr<OutputSurface> output_surface_;
scoped_ptr<FakeLayerTreeHostImpl> host_impl_;
};
@@ -97,13 +98,14 @@ TEST_F(LayerTreeImplTest, UpdateViewportAndHitTest) {
// Ensures that the viewport rect is correctly updated by the clip tree.
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- FakeImplProxy proxy;
+ FakeImplTaskRunnerProvider task_runner_provider;
LayerTreeSettings settings;
settings.verify_property_trees = true;
scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
scoped_ptr<FakeLayerTreeHostImpl> host_impl;
- host_impl.reset(new FakeLayerTreeHostImpl(
- settings, &proxy, &shared_bitmap_manager, &task_graph_runner));
+ host_impl.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider,
+ &shared_bitmap_manager,
+ &task_graph_runner));
host_impl->SetVisible(true);
EXPECT_TRUE(host_impl->InitializeRenderer(output_surface.get()));
scoped_ptr<LayerImpl> root =
diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc
index dd3c028..680b782 100644
--- a/cc/trees/occlusion_tracker_unittest.cc
+++ b/cc/trees/occlusion_tracker_unittest.cc
@@ -13,7 +13,7 @@
#include "cc/output/filter_operation.h"
#include "cc/output/filter_operations.h"
#include "cc/test/animation_test_common.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/geometry_test_utils.h"
diff --git a/cc/trees/proxy.cc b/cc/trees/proxy.cc
index 58d10b9..149f6f9 100644
--- a/cc/trees/proxy.cc
+++ b/cc/trees/proxy.cc
@@ -9,80 +9,9 @@
namespace cc {
-base::SingleThreadTaskRunner* Proxy::MainThreadTaskRunner() const {
- return main_task_runner_.get();
-}
-
-bool Proxy::HasImplThread() const { return !!impl_task_runner_.get(); }
-
-base::SingleThreadTaskRunner* Proxy::ImplThreadTaskRunner() const {
- return impl_task_runner_.get();
-}
-
-bool Proxy::IsMainThread() const {
-#if DCHECK_IS_ON()
- if (impl_thread_is_overridden_)
- return false;
-
- bool is_main_thread = base::PlatformThread::CurrentId() == main_thread_id_;
- if (is_main_thread && main_task_runner_.get()) {
- DCHECK(main_task_runner_->BelongsToCurrentThread());
- }
- return is_main_thread;
-#else
- return true;
-#endif
-}
-
-bool Proxy::IsImplThread() const {
-#if DCHECK_IS_ON()
- if (impl_thread_is_overridden_)
- return true;
- if (!impl_task_runner_.get())
- return false;
- return impl_task_runner_->BelongsToCurrentThread();
-#else
- return true;
-#endif
-}
-
-#if DCHECK_IS_ON()
-void Proxy::SetCurrentThreadIsImplThread(bool is_impl_thread) {
- impl_thread_is_overridden_ = is_impl_thread;
-}
-#endif
-
-bool Proxy::IsMainThreadBlocked() const {
-#if DCHECK_IS_ON()
- return is_main_thread_blocked_;
-#else
- return true;
-#endif
-}
-
-#if DCHECK_IS_ON()
-void Proxy::SetMainThreadBlocked(bool is_main_thread_blocked) {
- is_main_thread_blocked_ = is_main_thread_blocked;
-}
-#endif
-
Proxy::Proxy(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner)
-#if !DCHECK_IS_ON()
- : main_task_runner_(main_task_runner),
- impl_task_runner_(impl_task_runner),
- blocking_main_thread_task_runner_(
- BlockingTaskRunner::Create(main_task_runner)) {
-#else
- : main_task_runner_(main_task_runner),
- impl_task_runner_(impl_task_runner),
- blocking_main_thread_task_runner_(
- BlockingTaskRunner::Create(main_task_runner)),
- main_thread_id_(base::PlatformThread::CurrentId()),
- impl_thread_is_overridden_(false),
- is_main_thread_blocked_(false) {
-#endif
-}
+ : TaskRunnerProvider(main_task_runner, impl_task_runner) {}
Proxy::~Proxy() {
DCHECK(IsMainThread());
diff --git a/cc/trees/proxy.h b/cc/trees/proxy.h
index 2750df3..8780281 100644
--- a/cc/trees/proxy.h
+++ b/cc/trees/proxy.h
@@ -16,13 +16,7 @@
#include "base/values.h"
#include "cc/base/cc_export.h"
#include "cc/input/top_controls_state.h"
-
-namespace base {
-namespace trace_event {
-class TracedValue;
-}
-class SingleThreadTaskRunner;
-}
+#include "cc/trees/task_runner_provider.h"
namespace gfx {
class Rect;
@@ -30,29 +24,15 @@ class Vector2d;
}
namespace cc {
-class BlockingTaskRunner;
class LayerTreeDebugState;
class OutputSurface;
struct RendererCapabilities;
// Abstract class responsible for proxying commands from the main-thread side of
// the compositor over to the compositor implementation.
-class CC_EXPORT Proxy {
+class CC_EXPORT Proxy : public TaskRunnerProvider {
public:
- base::SingleThreadTaskRunner* MainThreadTaskRunner() const;
- bool HasImplThread() const;
- base::SingleThreadTaskRunner* ImplThreadTaskRunner() const;
-
- // Debug hooks.
- bool IsMainThread() const;
- bool IsImplThread() const;
- bool IsMainThreadBlocked() const;
-#if DCHECK_IS_ON()
- void SetMainThreadBlocked(bool is_main_thread_blocked);
- void SetCurrentThreadIsImplThread(bool is_impl_thread);
-#endif
-
- virtual ~Proxy();
+ ~Proxy() override;
virtual void FinishAllRendering() = 0;
@@ -106,56 +86,14 @@ class CC_EXPORT Proxy {
// Testing hooks
virtual bool MainFrameWillHappenForTesting() = 0;
- BlockingTaskRunner* blocking_main_thread_task_runner() const {
- return blocking_main_thread_task_runner_.get();
- }
-
protected:
Proxy(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
- friend class DebugScopedSetImplThread;
- friend class DebugScopedSetMainThread;
- friend class DebugScopedSetMainThreadBlocked;
private:
- scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
- scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_;
- scoped_ptr<BlockingTaskRunner> blocking_main_thread_task_runner_;
-
-#if DCHECK_IS_ON()
- const base::PlatformThreadId main_thread_id_;
- bool impl_thread_is_overridden_;
- bool is_main_thread_blocked_;
-#endif
-
DISALLOW_COPY_AND_ASSIGN(Proxy);
};
-#if DCHECK_IS_ON()
-class DebugScopedSetMainThreadBlocked {
- public:
- explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) : proxy_(proxy) {
- DCHECK(!proxy_->IsMainThreadBlocked());
- proxy_->SetMainThreadBlocked(true);
- }
- ~DebugScopedSetMainThreadBlocked() {
- DCHECK(proxy_->IsMainThreadBlocked());
- proxy_->SetMainThreadBlocked(false);
- }
- private:
- Proxy* proxy_;
- DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThreadBlocked);
-};
-#else
-class DebugScopedSetMainThreadBlocked {
- public:
- explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) {}
- ~DebugScopedSetMainThreadBlocked() {}
- private:
- DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThreadBlocked);
-};
-#endif
-
} // namespace cc
#endif // CC_TREES_PROXY_H_
diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h
index 4ce4ab3..ee424fd 100644
--- a/cc/trees/single_thread_proxy.h
+++ b/cc/trees/single_thread_proxy.h
@@ -179,21 +179,22 @@ class CC_EXPORT SingleThreadProxy : public Proxy,
// code is running on the impl thread to satisfy assertion checks.
class DebugScopedSetImplThread {
public:
- explicit DebugScopedSetImplThread(Proxy* proxy) : proxy_(proxy) {
+ explicit DebugScopedSetImplThread(TaskRunnerProvider* task_runner_provider)
+ : task_runner_provider_(task_runner_provider) {
#if DCHECK_IS_ON()
- previous_value_ = proxy_->impl_thread_is_overridden_;
- proxy_->SetCurrentThreadIsImplThread(true);
+ previous_value_ = task_runner_provider_->impl_thread_is_overridden_;
+ task_runner_provider_->SetCurrentThreadIsImplThread(true);
#endif
}
~DebugScopedSetImplThread() {
#if DCHECK_IS_ON()
- proxy_->SetCurrentThreadIsImplThread(previous_value_);
+ task_runner_provider_->SetCurrentThreadIsImplThread(previous_value_);
#endif
}
private:
bool previous_value_;
- Proxy* proxy_;
+ TaskRunnerProvider* task_runner_provider_;
DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThread);
};
@@ -202,21 +203,22 @@ class DebugScopedSetImplThread {
// code is running on the main thread to satisfy assertion checks.
class DebugScopedSetMainThread {
public:
- explicit DebugScopedSetMainThread(Proxy* proxy) : proxy_(proxy) {
+ explicit DebugScopedSetMainThread(TaskRunnerProvider* task_runner_provider)
+ : task_runner_provider_(task_runner_provider) {
#if DCHECK_IS_ON()
- previous_value_ = proxy_->impl_thread_is_overridden_;
- proxy_->SetCurrentThreadIsImplThread(false);
+ previous_value_ = task_runner_provider_->impl_thread_is_overridden_;
+ task_runner_provider_->SetCurrentThreadIsImplThread(false);
#endif
}
~DebugScopedSetMainThread() {
#if DCHECK_IS_ON()
- proxy_->SetCurrentThreadIsImplThread(previous_value_);
+ task_runner_provider_->SetCurrentThreadIsImplThread(previous_value_);
#endif
}
private:
bool previous_value_;
- Proxy* proxy_;
+ TaskRunnerProvider* task_runner_provider_;
DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThread);
};
@@ -226,8 +228,10 @@ class DebugScopedSetMainThread {
// satisfy assertion checks
class DebugScopedSetImplThreadAndMainThreadBlocked {
public:
- explicit DebugScopedSetImplThreadAndMainThreadBlocked(Proxy* proxy)
- : impl_thread_(proxy), main_thread_blocked_(proxy) {}
+ explicit DebugScopedSetImplThreadAndMainThreadBlocked(
+ TaskRunnerProvider* task_runner_provider)
+ : impl_thread_(task_runner_provider),
+ main_thread_blocked_(task_runner_provider) {}
private:
DebugScopedSetImplThread impl_thread_;
diff --git a/cc/trees/task_runner_provider.cc b/cc/trees/task_runner_provider.cc
new file mode 100644
index 0000000..053b047
--- /dev/null
+++ b/cc/trees/task_runner_provider.cc
@@ -0,0 +1,93 @@
+// Copyright 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/single_thread_task_runner.h"
+#include "cc/trees/blocking_task_runner.h"
+#include "cc/trees/task_runner_provider.h"
+
+namespace cc {
+
+base::SingleThreadTaskRunner* TaskRunnerProvider::MainThreadTaskRunner() const {
+ return main_task_runner_.get();
+}
+
+bool TaskRunnerProvider::HasImplThread() const {
+ return !!impl_task_runner_.get();
+}
+
+base::SingleThreadTaskRunner* TaskRunnerProvider::ImplThreadTaskRunner() const {
+ return impl_task_runner_.get();
+}
+
+bool TaskRunnerProvider::IsMainThread() const {
+#if DCHECK_IS_ON()
+ if (impl_thread_is_overridden_)
+ return false;
+
+ bool is_main_thread = base::PlatformThread::CurrentId() == main_thread_id_;
+ if (is_main_thread && main_task_runner_.get()) {
+ DCHECK(main_task_runner_->BelongsToCurrentThread());
+ }
+ return is_main_thread;
+#else
+ return true;
+#endif
+}
+
+bool TaskRunnerProvider::IsImplThread() const {
+#if DCHECK_IS_ON()
+ if (impl_thread_is_overridden_)
+ return true;
+ if (!impl_task_runner_.get())
+ return false;
+ return impl_task_runner_->BelongsToCurrentThread();
+#else
+ return true;
+#endif
+}
+
+#if DCHECK_IS_ON()
+void TaskRunnerProvider::SetCurrentThreadIsImplThread(bool is_impl_thread) {
+ impl_thread_is_overridden_ = is_impl_thread;
+}
+#endif
+
+bool TaskRunnerProvider::IsMainThreadBlocked() const {
+#if DCHECK_IS_ON()
+ return is_main_thread_blocked_;
+#else
+ return true;
+#endif
+}
+
+#if DCHECK_IS_ON()
+void TaskRunnerProvider::SetMainThreadBlocked(bool is_main_thread_blocked) {
+ is_main_thread_blocked_ = is_main_thread_blocked;
+}
+#endif
+
+TaskRunnerProvider::TaskRunnerProvider(
+ scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner)
+#if !DCHECK_IS_ON()
+ : main_task_runner_(main_task_runner),
+ impl_task_runner_(impl_task_runner),
+ blocking_main_thread_task_runner_(
+ BlockingTaskRunner::Create(main_task_runner)) {
+#else
+ : main_task_runner_(main_task_runner),
+ impl_task_runner_(impl_task_runner),
+ blocking_main_thread_task_runner_(
+ BlockingTaskRunner::Create(main_task_runner)),
+ main_thread_id_(base::PlatformThread::CurrentId()),
+ impl_thread_is_overridden_(false),
+ is_main_thread_blocked_(false) {
+#endif
+}
+
+TaskRunnerProvider::~TaskRunnerProvider() {
+ DCHECK(IsMainThread());
+}
+
+} // namespace cc
diff --git a/cc/trees/task_runner_provider.h b/cc/trees/task_runner_provider.h
new file mode 100644
index 0000000..884a242
--- /dev/null
+++ b/cc/trees/task_runner_provider.h
@@ -0,0 +1,107 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_TREES_TASK_RUNNER_PROVIDER_H_
+#define CC_TREES_TASK_RUNNER_PROVIDER_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/logging.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/threading/platform_thread.h"
+#include "base/time/time.h"
+#include "base/values.h"
+#include "cc/base/cc_export.h"
+
+namespace base {
+namespace trace_event {
+class TracedValue;
+}
+class SingleThreadTaskRunner;
+}
+
+namespace cc {
+class BlockingTaskRunner;
+
+// Class responsible for controlling access to the main and impl task runners.
+// Useful for assertion checks.
+class CC_EXPORT TaskRunnerProvider {
+ public:
+ base::SingleThreadTaskRunner* MainThreadTaskRunner() const;
+ bool HasImplThread() const;
+ base::SingleThreadTaskRunner* ImplThreadTaskRunner() const;
+
+ // Debug hooks.
+ bool IsMainThread() const;
+ bool IsImplThread() const;
+ bool IsMainThreadBlocked() const;
+#if DCHECK_IS_ON()
+ void SetMainThreadBlocked(bool is_main_thread_blocked);
+ void SetCurrentThreadIsImplThread(bool is_impl_thread);
+#endif
+
+ virtual ~TaskRunnerProvider();
+
+ BlockingTaskRunner* blocking_main_thread_task_runner() const {
+ return blocking_main_thread_task_runner_.get();
+ }
+
+ TaskRunnerProvider(
+ scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
+
+ protected:
+ friend class DebugScopedSetImplThread;
+ friend class DebugScopedSetMainThread;
+ friend class DebugScopedSetMainThreadBlocked;
+
+ private:
+ scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_;
+ scoped_ptr<BlockingTaskRunner> blocking_main_thread_task_runner_;
+
+#if DCHECK_IS_ON()
+ const base::PlatformThreadId main_thread_id_;
+ bool impl_thread_is_overridden_;
+ bool is_main_thread_blocked_;
+#endif
+
+ DISALLOW_COPY_AND_ASSIGN(TaskRunnerProvider);
+};
+
+#if DCHECK_IS_ON()
+class DebugScopedSetMainThreadBlocked {
+ public:
+ explicit DebugScopedSetMainThreadBlocked(
+ TaskRunnerProvider* task_runner_provider)
+ : task_runner_provider_(task_runner_provider) {
+ DCHECK(!task_runner_provider_->IsMainThreadBlocked());
+ task_runner_provider_->SetMainThreadBlocked(true);
+ }
+ ~DebugScopedSetMainThreadBlocked() {
+ DCHECK(task_runner_provider_->IsMainThreadBlocked());
+ task_runner_provider_->SetMainThreadBlocked(false);
+ }
+
+ private:
+ TaskRunnerProvider* task_runner_provider_;
+ DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThreadBlocked);
+};
+#else
+class DebugScopedSetMainThreadBlocked {
+ public:
+ explicit DebugScopedSetMainThreadBlocked(
+ TaskRunnerProvider* task_runner_provider) {}
+ ~DebugScopedSetMainThreadBlocked() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThreadBlocked);
+};
+#endif
+
+} // namespace cc
+
+#endif // CC_TREES_TASK_RUNNER_PROVIDER_H_
diff --git a/cc/trees/tree_synchronizer_unittest.cc b/cc/trees/tree_synchronizer_unittest.cc
index 466a701..741de6b 100644
--- a/cc/trees/tree_synchronizer_unittest.cc
+++ b/cc/trees/tree_synchronizer_unittest.cc
@@ -14,13 +14,13 @@
#include "cc/layers/layer.h"
#include "cc/layers/layer_impl.h"
#include "cc/test/animation_test_common.h"
-#include "cc/test/fake_impl_proxy.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host.h"
#include "cc/test/fake_rendering_stats_instrumentation.h"
#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/test_task_graph_runner.h"
-#include "cc/trees/proxy.h"
#include "cc/trees/single_thread_proxy.h"
+#include "cc/trees/task_runner_provider.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace cc {
@@ -565,14 +565,13 @@ TEST_F(TreeSynchronizerTest, SyncMaskReplicaAndReplicaMaskLayers) {
TEST_F(TreeSynchronizerTest, SynchronizeAnimations) {
LayerTreeSettings settings;
- FakeProxy proxy;
- DebugScopedSetImplThread impl(&proxy);
+ FakeImplTaskRunnerProvider task_runner_provider;
FakeRenderingStatsInstrumentation stats_instrumentation;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create(
- settings, nullptr, &proxy, &stats_instrumentation, &shared_bitmap_manager,
- nullptr, &task_graph_runner, 0);
+ settings, nullptr, &task_runner_provider, &stats_instrumentation,
+ &shared_bitmap_manager, nullptr, &task_graph_runner, 0);
scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings_);
host_->SetRootLayer(layer_tree_root);
@@ -599,14 +598,13 @@ TEST_F(TreeSynchronizerTest, SynchronizeAnimations) {
TEST_F(TreeSynchronizerTest, SynchronizeScrollParent) {
LayerTreeSettings settings;
- FakeProxy proxy;
- DebugScopedSetImplThread impl(&proxy);
+ FakeImplTaskRunnerProvider task_runner_provider;
FakeRenderingStatsInstrumentation stats_instrumentation;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create(
- settings, nullptr, &proxy, &stats_instrumentation, &shared_bitmap_manager,
- nullptr, &task_graph_runner, 0);
+ settings, nullptr, &task_runner_provider, &stats_instrumentation,
+ &shared_bitmap_manager, nullptr, &task_graph_runner, 0);
scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings_);
scoped_refptr<Layer> scroll_parent = Layer::Create(layer_settings_);
@@ -667,14 +665,13 @@ TEST_F(TreeSynchronizerTest, SynchronizeScrollParent) {
TEST_F(TreeSynchronizerTest, SynchronizeClipParent) {
LayerTreeSettings settings;
- FakeProxy proxy;
- DebugScopedSetImplThread impl(&proxy);
+ FakeImplTaskRunnerProvider task_runner_provider;
FakeRenderingStatsInstrumentation stats_instrumentation;
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create(
- settings, nullptr, &proxy, &stats_instrumentation, &shared_bitmap_manager,
- nullptr, &task_graph_runner, 0);
+ settings, nullptr, &task_runner_provider, &stats_instrumentation,
+ &shared_bitmap_manager, nullptr, &task_graph_runner, 0);
scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings_);
scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings_);