summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreveman <reveman@chromium.org>2015-03-23 13:27:47 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-23 20:29:01 +0000
commit34b7a15218828edc105d4c408556b05c52994840 (patch)
tree9abba677c77d4591e04d2a57e445d9ec10de64c6
parent15accba3b4eceb8527867e87573eabe13cb13b1b (diff)
downloadchromium_src-34b7a15218828edc105d4c408556b05c52994840.zip
chromium_src-34b7a15218828edc105d4c408556b05c52994840.tar.gz
chromium_src-34b7a15218828edc105d4c408556b05c52994840.tar.bz2
cc: Move worker threads to RenderThreadImpl.
This allows us to Join the threads when RenderThreadImpl is shutdown. BUG=468785 TEST=cc_unittests Review URL: https://codereview.chromium.org/999173004 Cr-Commit-Position: refs/heads/master@{#321836}
-rw-r--r--android_webview/browser/hardware_renderer.cc2
-rw-r--r--cc/BUILD.gn2
-rw-r--r--cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc4
-rw-r--r--cc/animation/scrollbar_animation_controller_thinning_unittest.cc4
-rw-r--r--cc/cc_tests.gyp2
-rw-r--r--cc/debug/micro_benchmark_controller_unittest.cc2
-rw-r--r--cc/input/top_controls_manager_unittest.cc4
-rw-r--r--cc/layers/delegated_renderer_layer_impl_unittest.cc6
-rw-r--r--cc/layers/heads_up_display_layer_impl_unittest.cc2
-rw-r--r--cc/layers/layer_impl_unittest.cc22
-rw-r--r--cc/layers/layer_perftest.cc5
-rw-r--r--cc/layers/layer_position_constraint_unittest.cc5
-rw-r--r--cc/layers/layer_unittest.cc26
-rw-r--r--cc/layers/layer_utils_unittest.cc4
-rw-r--r--cc/layers/picture_image_layer_impl_unittest.cc7
-rw-r--r--cc/layers/picture_layer.cc1
-rw-r--r--cc/layers/picture_layer_impl_perftest.cc5
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc12
-rw-r--r--cc/layers/picture_layer_unittest.cc8
-rw-r--r--cc/layers/render_surface_unittest.cc6
-rw-r--r--cc/layers/scrollbar_layer_unittest.cc7
-rw-r--r--cc/layers/solid_color_layer_impl_unittest.cc8
-rw-r--r--cc/layers/texture_layer_unittest.cc6
-rw-r--r--cc/layers/tiled_layer_impl_unittest.cc5
-rw-r--r--cc/layers/tiled_layer_unittest.cc6
-rw-r--r--cc/resources/display_list_recording_source.cc5
-rw-r--r--cc/resources/display_list_recording_source.h2
-rw-r--r--cc/resources/picture_pile.cc14
-rw-r--r--cc/resources/picture_pile.h2
-rw-r--r--cc/resources/recording_source.h1
-rw-r--r--cc/resources/tile_manager_perftest.cc5
-rw-r--r--cc/resources/tile_manager_unittest.cc7
-rw-r--r--cc/resources/tile_task_worker_pool.cc66
-rw-r--r--cc/resources/tile_task_worker_pool.h15
-rw-r--r--cc/resources/tile_task_worker_pool_unittest.cc25
-rw-r--r--cc/test/fake_layer_tree_host.cc4
-rw-r--r--cc/test/fake_layer_tree_host_impl.cc8
-rw-r--r--cc/test/fake_layer_tree_host_impl.h7
-rw-r--r--cc/test/fake_ui_resource_layer_tree_host_impl.cc4
-rw-r--r--cc/test/layer_tree_json_parser_unittest.cc4
-rw-r--r--cc/test/layer_tree_pixel_resource_test.cc16
-rw-r--r--cc/test/layer_tree_test.cc61
-rw-r--r--cc/test/layer_tree_test.h7
-rw-r--r--cc/test/test_task_graph_runner.cc23
-rw-r--r--cc/test/test_task_graph_runner.h30
-rw-r--r--cc/trees/damage_tracker_unittest.cc5
-rw-r--r--cc/trees/layer_tree_host.cc23
-rw-r--r--cc/trees/layer_tree_host.h5
-rw-r--r--cc/trees/layer_tree_host_common_unittest.cc36
-rw-r--r--cc/trees/layer_tree_host_impl.cc27
-rw-r--r--cc/trees/layer_tree_host_impl.h3
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc47
-rw-r--r--cc/trees/layer_tree_host_unittest.cc46
-rw-r--r--cc/trees/layer_tree_host_unittest_no_message_loop.cc2
-rw-r--r--cc/trees/layer_tree_host_unittest_scroll.cc12
-rw-r--r--cc/trees/layer_tree_impl_unittest.cc6
-rw-r--r--cc/trees/layer_tree_settings.cc3
-rw-r--r--cc/trees/layer_tree_settings.h1
-rw-r--r--cc/trees/occlusion_tracker_perftest.cc10
-rw-r--r--cc/trees/tree_synchronizer_unittest.cc27
-rw-r--r--content/browser/compositor/gpu_process_transport_factory.cc34
-rw-r--r--content/browser/compositor/gpu_process_transport_factory.h4
-rw-r--r--content/browser/renderer_host/compositor_impl_android.cc35
-rw-r--r--content/renderer/gpu/compositor_dependencies.h3
-rw-r--r--content/renderer/gpu/render_widget_compositor.cc14
-rw-r--r--content/renderer/render_thread_impl.cc70
-rw-r--r--content/renderer/render_thread_impl.h9
-rw-r--r--content/test/fake_compositor_dependencies.cc11
-rw-r--r--content/test/fake_compositor_dependencies.h5
-rw-r--r--content/test/web_layer_tree_view_impl_for_testing.cc9
-rw-r--r--mojo/services/html_viewer/weblayertreeview_impl.cc2
-rw-r--r--ui/compositor/compositor.cc7
-rw-r--r--ui/compositor/compositor.h4
-rw-r--r--ui/compositor/test/in_process_context_factory.cc4
-rw-r--r--ui/compositor/test/in_process_context_factory.h3
75 files changed, 554 insertions, 380 deletions
diff --git a/android_webview/browser/hardware_renderer.cc b/android_webview/browser/hardware_renderer.cc
index 1da0804..fc5f4d6 100644
--- a/android_webview/browser/hardware_renderer.cc
+++ b/android_webview/browser/hardware_renderer.cc
@@ -104,7 +104,7 @@ HardwareRenderer::HardwareRenderer(SharedRendererState* state)
settings.single_thread_proxy_scheduler = false;
layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded(
- this, this, nullptr, nullptr, settings, nullptr, nullptr);
+ this, this, nullptr, nullptr, nullptr, settings, nullptr, nullptr);
layer_tree_host_->SetRootLayer(root_layer_);
layer_tree_host_->SetLayerTreeHostClientReady();
layer_tree_host_->set_has_transparent_background(true);
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index 71cc6d0..df9f262 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -671,6 +671,8 @@ source_set("test_support") {
"test/test_occlusion_tracker.h",
"test/test_shared_bitmap_manager.cc",
"test/test_shared_bitmap_manager.h",
+ "test/test_task_graph_runner.cc",
+ "test/test_task_graph_runner.h",
"test/test_texture.cc",
"test/test_texture.h",
"test/test_tile_priorities.cc",
diff --git a/cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc b/cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc
index f7a5878..6d2d3e8 100644
--- a/cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc
+++ b/cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc
@@ -9,6 +9,7 @@
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/trees/layer_tree_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -20,7 +21,7 @@ class ScrollbarAnimationControllerLinearFadeTest
public ScrollbarAnimationControllerClient {
public:
ScrollbarAnimationControllerLinearFadeTest()
- : host_impl_(&proxy_, &shared_bitmap_manager_) {}
+ : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_) {}
void StartAnimatingScrollbarAnimationController(
ScrollbarAnimationController* controller) override {
@@ -75,6 +76,7 @@ class ScrollbarAnimationControllerLinearFadeTest
FakeImplProxy proxy_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
scoped_ptr<ScrollbarAnimationControllerLinearFade> scrollbar_controller_;
scoped_ptr<LayerImpl> clip_layer_;
diff --git a/cc/animation/scrollbar_animation_controller_thinning_unittest.cc b/cc/animation/scrollbar_animation_controller_thinning_unittest.cc
index 01763c9..04f81d3 100644
--- a/cc/animation/scrollbar_animation_controller_thinning_unittest.cc
+++ b/cc/animation/scrollbar_animation_controller_thinning_unittest.cc
@@ -9,6 +9,7 @@
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/trees/layer_tree_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -20,7 +21,7 @@ class ScrollbarAnimationControllerThinningTest
public ScrollbarAnimationControllerClient {
public:
ScrollbarAnimationControllerThinningTest()
- : host_impl_(&proxy_, &shared_bitmap_manager_) {}
+ : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_) {}
void StartAnimatingScrollbarAnimationController(
ScrollbarAnimationController* controller) override {
@@ -74,6 +75,7 @@ class ScrollbarAnimationControllerThinningTest
FakeImplProxy proxy_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
scoped_ptr<ScrollbarAnimationControllerThinning> scrollbar_controller_;
scoped_ptr<LayerImpl> clip_layer_;
diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp
index 72c37f8..cb84033 100644
--- a/cc/cc_tests.gyp
+++ b/cc/cc_tests.gyp
@@ -260,6 +260,8 @@
'test/test_occlusion_tracker.h',
'test/test_shared_bitmap_manager.cc',
'test/test_shared_bitmap_manager.h',
+ 'test/test_task_graph_runner.cc',
+ 'test/test_task_graph_runner.h',
'test/test_texture.cc',
'test/test_texture.h',
'test/test_tile_priorities.cc',
diff --git a/cc/debug/micro_benchmark_controller_unittest.cc b/cc/debug/micro_benchmark_controller_unittest.cc
index 31494ac..2a8dce4 100644
--- a/cc/debug/micro_benchmark_controller_unittest.cc
+++ b/cc/debug/micro_benchmark_controller_unittest.cc
@@ -25,7 +25,7 @@ class MicroBenchmarkControllerTest : public testing::Test {
impl_proxy_ = make_scoped_ptr(new FakeImplProxy);
shared_bitmap_manager_.reset(new TestSharedBitmapManager());
layer_tree_host_impl_ = make_scoped_ptr(new FakeLayerTreeHostImpl(
- impl_proxy_.get(), shared_bitmap_manager_.get()));
+ impl_proxy_.get(), shared_bitmap_manager_.get(), nullptr));
layer_tree_host_ = FakeLayerTreeHost::Create(&layer_tree_host_client_);
layer_tree_host_->SetRootLayer(Layer::Create());
diff --git a/cc/input/top_controls_manager_unittest.cc b/cc/input/top_controls_manager_unittest.cc
index 4145cac..52e46e6 100644
--- a/cc/input/top_controls_manager_unittest.cc
+++ b/cc/input/top_controls_manager_unittest.cc
@@ -15,6 +15,7 @@
#include "cc/test/fake_impl_proxy.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"
#include "cc/trees/layer_tree_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/frame_time.h"
@@ -28,7 +29,7 @@ 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_),
+ : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_),
redraw_needed_(false),
update_draw_properties_needed_(false),
top_controls_shown_ratio_(1.f),
@@ -83,6 +84,7 @@ class MockTopControlsManagerClient : public TopControlsManagerClient {
private:
FakeImplProxy proxy_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
scoped_ptr<LayerTreeImpl> active_tree_;
scoped_ptr<LayerImpl> root_scroll_layer_;
diff --git a/cc/layers/delegated_renderer_layer_impl_unittest.cc b/cc/layers/delegated_renderer_layer_impl_unittest.cc
index 87e559a..9e2d553 100644
--- a/cc/layers/delegated_renderer_layer_impl_unittest.cc
+++ b/cc/layers/delegated_renderer_layer_impl_unittest.cc
@@ -18,6 +18,7 @@
#include "cc/test/render_pass_test_common.h"
#include "cc/test/render_pass_test_utils.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/test/test_web_graphics_context_3d.h"
#include "cc/trees/layer_tree_host_impl.h"
#include "cc/trees/layer_tree_impl.h"
@@ -37,8 +38,8 @@ class DelegatedRendererLayerImplTest : public testing::Test {
LayerTreeSettings settings;
settings.minimum_occlusion_tracking_size = gfx::Size();
- host_impl_.reset(
- new FakeLayerTreeHostImpl(settings, &proxy_, &shared_bitmap_manager_));
+ host_impl_.reset(new FakeLayerTreeHostImpl(
+ settings, &proxy_, &shared_bitmap_manager_, &task_graph_runner_));
host_impl_->InitializeRenderer(FakeOutputSurface::Create3d());
host_impl_->SetViewportSize(gfx::Size(10, 10));
}
@@ -48,6 +49,7 @@ class DelegatedRendererLayerImplTest : public testing::Test {
DebugScopedSetImplThreadAndMainThreadBlocked
always_impl_thread_and_main_thread_blocked_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
scoped_ptr<LayerTreeHostImpl> host_impl_;
};
diff --git a/cc/layers/heads_up_display_layer_impl_unittest.cc b/cc/layers/heads_up_display_layer_impl_unittest.cc
index 4b07323..ab38fdd 100644
--- a/cc/layers/heads_up_display_layer_impl_unittest.cc
+++ b/cc/layers/heads_up_display_layer_impl_unittest.cc
@@ -32,7 +32,7 @@ void CheckDrawLayer(HeadsUpDisplayLayerImpl* layer,
TEST(HeadsUpDisplayLayerImplTest, ResourcelessSoftwareDrawAfterResourceLoss) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
host_impl.CreatePendingTree();
host_impl.InitializeRenderer(FakeOutputSurface::Create3d());
scoped_ptr<HeadsUpDisplayLayerImpl> layer =
diff --git a/cc/layers/layer_impl_unittest.cc b/cc/layers/layer_impl_unittest.cc
index 0dbf356..1cdbd59 100644
--- a/cc/layers/layer_impl_unittest.cc
+++ b/cc/layers/layer_impl_unittest.cc
@@ -13,6 +13,7 @@
#include "cc/test/fake_output_surface.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/single_thread_proxy.h"
#include "cc/trees/tree_synchronizer.h"
@@ -87,7 +88,7 @@ TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) {
// Create a simple LayerImpl tree:
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
EXPECT_TRUE(host_impl.InitializeRenderer(FakeOutputSurface::Create3d()));
scoped_ptr<LayerImpl> root_clip =
LayerImpl::Create(host_impl.active_tree(), 1);
@@ -250,7 +251,7 @@ TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) {
TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
EXPECT_TRUE(host_impl.InitializeRenderer(FakeOutputSurface::Create3d()));
host_impl.active_tree()->SetRootLayer(
LayerImpl::Create(host_impl.active_tree(), 1));
@@ -368,7 +369,7 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
TEST(LayerImplTest, SafeOpaqueBackgroundColor) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
EXPECT_TRUE(host_impl.InitializeRenderer(FakeOutputSurface::Create3d()));
scoped_ptr<LayerImpl> layer = LayerImpl::Create(host_impl.active_tree(), 1);
@@ -399,7 +400,7 @@ TEST(LayerImplTest, SafeOpaqueBackgroundColor) {
TEST(LayerImplTest, TransformInvertibility) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
scoped_ptr<LayerImpl> layer = LayerImpl::Create(host_impl.active_tree(), 1);
EXPECT_TRUE(layer->transform().IsInvertible());
@@ -429,7 +430,11 @@ TEST(LayerImplTest, TransformInvertibility) {
class LayerImplScrollTest : public testing::Test {
public:
LayerImplScrollTest()
- : host_impl_(settings(), &proxy_, &shared_bitmap_manager_), root_id_(7) {
+ : host_impl_(settings(),
+ &proxy_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_),
+ root_id_(7) {
host_impl_.active_tree()->SetRootLayer(
LayerImpl::Create(host_impl_.active_tree(), root_id_));
host_impl_.active_tree()->root_layer()->AddChild(
@@ -460,6 +465,7 @@ class LayerImplScrollTest : public testing::Test {
private:
FakeImplProxy proxy_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
int root_id_;
};
@@ -771,7 +777,10 @@ class LayerImplScrollbarSyncTest : public testing::Test {
};
LayerImplScrollbarSyncTest()
- : host_impl_(settings(), &proxy_, &shared_bitmap_manager_) {
+ : host_impl_(settings(),
+ &proxy_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_) {
host_impl_.CreatePendingTree();
CreateLayers(host_impl_.pending_tree());
@@ -836,6 +845,7 @@ class LayerImplScrollbarSyncTest : public testing::Test {
private:
FakeImplProxy proxy_;
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 0b4c852..72b2e13 100644
--- a/cc/layers/layer_perftest.cc
+++ b/cc/layers/layer_perftest.cc
@@ -10,7 +10,7 @@
#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"
-
+#include "cc/test/test_task_graph_runner.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/perf/perf_test.h"
@@ -30,7 +30,7 @@ class MockLayerPainter : public LayerPainter {
class LayerPerfTest : public testing::Test {
public:
LayerPerfTest()
- : host_impl_(&proxy_, &shared_bitmap_manager_),
+ : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_),
fake_client_(FakeLayerTreeHostClient::DIRECT_3D),
timer_(kWarmupRuns,
base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
@@ -50,6 +50,7 @@ class LayerPerfTest : public testing::Test {
FakeImplProxy proxy_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
FakeLayerTreeHostClient fake_client_;
diff --git a/cc/layers/layer_position_constraint_unittest.cc b/cc/layers/layer_position_constraint_unittest.cc
index 1c0619b..1eea9c9 100644
--- a/cc/layers/layer_position_constraint_unittest.cc
+++ b/cc/layers/layer_position_constraint_unittest.cc
@@ -11,6 +11,7 @@
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/trees/layer_tree_host_common.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -63,7 +64,8 @@ void ExecuteCalculateDrawProperties(LayerImpl* root_layer) {
class LayerPositionConstraintTest : public testing::Test {
public:
- LayerPositionConstraintTest() : host_impl_(&proxy_, &shared_bitmap_manager_) {
+ LayerPositionConstraintTest()
+ : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_) {
root_ = CreateTreeForTest();
scroll_ = root_->children()[0];
fixed_to_top_left_.set_is_fixed_position(true);
@@ -127,6 +129,7 @@ class LayerPositionConstraintTest : public testing::Test {
protected:
FakeImplProxy proxy_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
scoped_ptr<LayerImpl> root_;
LayerImpl* scroll_;
diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc
index 8a61510..10d774c 100644
--- a/cc/layers/layer_unittest.cc
+++ b/cc/layers/layer_unittest.cc
@@ -16,6 +16,7 @@
#include "cc/test/layer_test_common.h"
#include "cc/test/test_gpu_memory_buffer_manager.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/single_thread_proxy.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -41,7 +42,7 @@ namespace {
class MockLayerTreeHost : public LayerTreeHost {
public:
explicit MockLayerTreeHost(FakeLayerTreeHostClient* client)
- : LayerTreeHost(client, nullptr, nullptr, LayerTreeSettings()) {
+ : LayerTreeHost(client, nullptr, nullptr, nullptr, LayerTreeSettings()) {
InitializeSingleThreaded(client,
base::MessageLoopProxy::current(),
nullptr);
@@ -60,7 +61,7 @@ class MockLayerPainter : public LayerPainter {
class LayerTest : public testing::Test {
public:
LayerTest()
- : host_impl_(&proxy_, &shared_bitmap_manager_),
+ : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_),
fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {}
protected:
@@ -131,6 +132,7 @@ class LayerTest : public testing::Test {
FakeImplProxy proxy_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
FakeLayerTreeHostClient fake_client_;
@@ -935,24 +937,16 @@ class LayerTreeHostFactory {
scoped_ptr<LayerTreeHost> Create() {
return LayerTreeHost::CreateSingleThreaded(
- &client_,
- &client_,
- shared_bitmap_manager_.get(),
- gpu_memory_buffer_manager_.get(),
- LayerTreeSettings(),
- base::MessageLoopProxy::current(),
- nullptr);
+ &client_, &client_, shared_bitmap_manager_.get(),
+ gpu_memory_buffer_manager_.get(), nullptr, LayerTreeSettings(),
+ base::MessageLoopProxy::current(), nullptr);
}
scoped_ptr<LayerTreeHost> Create(LayerTreeSettings settings) {
return LayerTreeHost::CreateSingleThreaded(
- &client_,
- &client_,
- shared_bitmap_manager_.get(),
- gpu_memory_buffer_manager_.get(),
- settings,
- base::MessageLoopProxy::current(),
- nullptr);
+ &client_, &client_, shared_bitmap_manager_.get(),
+ gpu_memory_buffer_manager_.get(), nullptr, settings,
+ base::MessageLoopProxy::current(), nullptr);
}
private:
diff --git a/cc/layers/layer_utils_unittest.cc b/cc/layers/layer_utils_unittest.cc
index 5764bc6..534a691 100644
--- a/cc/layers/layer_utils_unittest.cc
+++ b/cc/layers/layer_utils_unittest.cc
@@ -10,6 +10,7 @@
#include "cc/test/fake_impl_proxy.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"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/box_f.h"
#include "ui/gfx/test/gfx_util.h"
@@ -24,7 +25,7 @@ float diagonal(float width, float height) {
class LayerUtilsGetAnimationBoundsTest : public testing::Test {
public:
LayerUtilsGetAnimationBoundsTest()
- : host_impl_(&proxy_, &shared_bitmap_manager_),
+ : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_),
root_(CreateThreeNodeTree(&host_impl_)),
parent_(root_->children()[0]),
child_(parent_->children()[0]) {}
@@ -45,6 +46,7 @@ class LayerUtilsGetAnimationBoundsTest : public testing::Test {
FakeImplProxy proxy_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
scoped_ptr<LayerImpl> root_;
LayerImpl* parent_;
diff --git a/cc/layers/picture_image_layer_impl_unittest.cc b/cc/layers/picture_image_layer_impl_unittest.cc
index 3d2d38e..87c4e58 100644
--- a/cc/layers/picture_image_layer_impl_unittest.cc
+++ b/cc/layers/picture_image_layer_impl_unittest.cc
@@ -13,6 +13,7 @@
#include "cc/test/fake_picture_pile_impl.h"
#include "cc/test/impl_side_painting_settings.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/trees/layer_tree_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -37,7 +38,8 @@ class PictureImageLayerImplTest : public testing::Test {
: proxy_(base::MessageLoopProxy::current()),
host_impl_(ImplSidePaintingSettings(),
&proxy_,
- &shared_bitmap_manager_) {
+ &shared_bitmap_manager_,
+ &task_graph_runner_) {
host_impl_.CreatePendingTree();
host_impl_.InitializeRenderer(FakeOutputSurface::Create3d());
}
@@ -82,8 +84,9 @@ class PictureImageLayerImplTest : public testing::Test {
protected:
FakeImplProxy proxy_;
- FakeLayerTreeHostImpl host_impl_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
+ FakeLayerTreeHostImpl host_impl_;
};
TEST_F(PictureImageLayerImplTest, CalculateContentsScale) {
diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
index 672aab4..a0d06eb 100644
--- a/cc/layers/picture_layer.cc
+++ b/cc/layers/picture_layer.cc
@@ -95,6 +95,7 @@ void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) {
recording_source_->DidMoveToNewCompositor();
recording_source_->SetSlowdownRasterScaleFactor(
host->debug_state().slow_down_raster_scale_factor);
+ recording_source_->SetGatherPixelRefs(host->settings().gather_pixel_refs);
DCHECK(host->settings().raster_enabled);
}
diff --git a/cc/layers/picture_layer_impl_perftest.cc b/cc/layers/picture_layer_impl_perftest.cc
index ea73cb2..47f49be 100644
--- a/cc/layers/picture_layer_impl_perftest.cc
+++ b/cc/layers/picture_layer_impl_perftest.cc
@@ -13,6 +13,7 @@
#include "cc/test/fake_picture_pile_impl.h"
#include "cc/test/impl_side_painting_settings.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/trees/layer_tree_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/perf/perf_test.h"
@@ -41,7 +42,8 @@ class PictureLayerImplPerfTest : public testing::Test {
: proxy_(base::MessageLoopProxy::current()),
host_impl_(ImplSidePaintingSettings(),
&proxy_,
- &shared_bitmap_manager_),
+ &shared_bitmap_manager_,
+ &task_graph_runner_),
timer_(kWarmupRuns,
base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
kTimeCheckInterval) {}
@@ -170,6 +172,7 @@ class PictureLayerImplPerfTest : public testing::Test {
protected:
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
FakeImplProxy proxy_;
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 26f3be5..8c2b3ab 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -27,6 +27,7 @@
#include "cc/test/impl_side_painting_settings.h"
#include "cc/test/layer_test_common.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/test/test_web_graphics_context_3d.h"
#include "cc/trees/layer_tree_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -71,7 +72,10 @@ class PictureLayerImplTest : public testing::Test {
public:
PictureLayerImplTest()
: proxy_(base::MessageLoopProxy::current()),
- host_impl_(LowResTilingsSettings(), &proxy_, &shared_bitmap_manager_),
+ host_impl_(LowResTilingsSettings(),
+ &proxy_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_),
root_id_(6),
id_(7),
pending_layer_(nullptr),
@@ -82,7 +86,10 @@ class PictureLayerImplTest : public testing::Test {
explicit PictureLayerImplTest(const LayerTreeSettings& settings)
: proxy_(base::MessageLoopProxy::current()),
- host_impl_(settings, &proxy_, &shared_bitmap_manager_),
+ host_impl_(settings,
+ &proxy_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_),
root_id_(6),
id_(7) {
host_impl_.SetViewportSize(gfx::Size(10000, 10000));
@@ -309,6 +316,7 @@ class PictureLayerImplTest : public testing::Test {
FakeImplProxy proxy_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
int root_id_;
int id_;
diff --git a/cc/layers/picture_layer_unittest.cc b/cc/layers/picture_layer_unittest.cc
index ab06bb0..48d4abc 100644
--- a/cc/layers/picture_layer_unittest.cc
+++ b/cc/layers/picture_layer_unittest.cc
@@ -62,8 +62,8 @@ TEST(PictureLayerTest, NoTilesIfEmptyBounds) {
DebugScopedSetImplThread impl_thread(&proxy);
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(
- ImplSidePaintingSettings(), &proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(ImplSidePaintingSettings(), &proxy,
+ &shared_bitmap_manager, nullptr);
host_impl.CreatePendingTree();
scoped_ptr<FakePictureLayerImpl> layer_impl =
FakePictureLayerImpl::Create(host_impl.pending_tree(), 1);
@@ -130,12 +130,12 @@ TEST(PictureLayerTest, NonMonotonicSourceFrameNumber) {
scoped_ptr<LayerTreeHost> host1 = LayerTreeHost::CreateSingleThreaded(
&host_client1, &host_client1, shared_bitmap_manager.get(), nullptr,
- settings, base::MessageLoopProxy::current(), nullptr);
+ nullptr, settings, base::MessageLoopProxy::current(), nullptr);
host_client1.SetLayerTreeHost(host1.get());
scoped_ptr<LayerTreeHost> host2 = LayerTreeHost::CreateSingleThreaded(
&host_client2, &host_client2, shared_bitmap_manager.get(), nullptr,
- settings, base::MessageLoopProxy::current(), nullptr);
+ nullptr, settings, base::MessageLoopProxy::current(), nullptr);
host_client2.SetLayerTreeHost(host2.get());
// The PictureLayer is put in one LayerTreeHost.
diff --git a/cc/layers/render_surface_unittest.cc b/cc/layers/render_surface_unittest.cc
index 81b15ad..929407c 100644
--- a/cc/layers/render_surface_unittest.cc
+++ b/cc/layers/render_surface_unittest.cc
@@ -38,7 +38,7 @@ TEST(RenderSurfaceTest, VerifySurfaceChangesAreTrackedProperly) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
scoped_ptr<LayerImpl> owning_layer =
LayerImpl::Create(host_impl.active_tree(), 1);
owning_layer->SetHasRenderSurface(true);
@@ -83,7 +83,7 @@ TEST(RenderSurfaceTest, VerifySurfaceChangesAreTrackedProperly) {
TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectSharedQuadState) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
scoped_ptr<LayerImpl> root_layer =
LayerImpl::Create(host_impl.active_tree(), 1);
@@ -147,7 +147,7 @@ class TestRenderPassSink : public RenderPassSink {
TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectRenderPass) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
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 36c37e9..009ec3b 100644
--- a/cc/layers/scrollbar_layer_unittest.cc
+++ b/cc/layers/scrollbar_layer_unittest.cc
@@ -21,6 +21,7 @@
#include "cc/test/geometry_test_utils.h"
#include "cc/test/layer_tree_test.h"
#include "cc/test/mock_occlusion_tracker.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/test/test_web_graphics_context_3d.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/layer_tree_impl.h"
@@ -516,8 +517,9 @@ class ScrollbarLayerSolidColorThumbTest : public testing::Test {
public:
ScrollbarLayerSolidColorThumbTest() {
LayerTreeSettings layer_tree_settings;
- host_impl_.reset(new FakeLayerTreeHostImpl(
- layer_tree_settings, &proxy_, &shared_bitmap_manager_));
+ host_impl_.reset(new FakeLayerTreeHostImpl(layer_tree_settings, &proxy_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_));
const int kThumbThickness = 3;
const int kTrackStart = 0;
@@ -545,6 +547,7 @@ class ScrollbarLayerSolidColorThumbTest : public testing::Test {
protected:
FakeImplProxy proxy_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
scoped_ptr<FakeLayerTreeHostImpl> host_impl_;
scoped_ptr<SolidColorScrollbarLayerImpl> horizontal_scrollbar_layer_;
scoped_ptr<SolidColorScrollbarLayerImpl> vertical_scrollbar_layer_;
diff --git a/cc/layers/solid_color_layer_impl_unittest.cc b/cc/layers/solid_color_layer_impl_unittest.cc
index d10f35d..f35b82a 100644
--- a/cc/layers/solid_color_layer_impl_unittest.cc
+++ b/cc/layers/solid_color_layer_impl_unittest.cc
@@ -28,7 +28,7 @@ TEST(SolidColorLayerImplTest, VerifyTilingCompleteAndNoOverlap) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
scoped_ptr<SolidColorLayerImpl> layer =
SolidColorLayerImpl::Create(host_impl.active_tree(), 1);
layer->draw_properties().visible_content_rect = visible_content_rect;
@@ -54,7 +54,7 @@ TEST(SolidColorLayerImplTest, VerifyCorrectBackgroundColorInQuad) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
scoped_ptr<SolidColorLayerImpl> layer =
SolidColorLayerImpl::Create(host_impl.active_tree(), 1);
layer->draw_properties().visible_content_rect = visible_content_rect;
@@ -83,7 +83,7 @@ TEST(SolidColorLayerImplTest, VerifyCorrectOpacityInQuad) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
scoped_ptr<SolidColorLayerImpl> layer =
SolidColorLayerImpl::Create(host_impl.active_tree(), 1);
layer->draw_properties().visible_content_rect = visible_content_rect;
@@ -112,7 +112,7 @@ TEST(SolidColorLayerImplTest, VerifyCorrectBlendModeInQuad) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
scoped_ptr<SolidColorLayerImpl> layer =
SolidColorLayerImpl::Create(host_impl.active_tree(), 1);
layer->SetBounds(layer_size);
diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc
index 6405db3..b088f6f 100644
--- a/cc/layers/texture_layer_unittest.cc
+++ b/cc/layers/texture_layer_unittest.cc
@@ -24,6 +24,7 @@
#include "cc/test/fake_output_surface.h"
#include "cc/test/layer_test_common.h"
#include "cc/test/layer_tree_test.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/test/test_web_graphics_context_3d.h"
#include "cc/trees/blocking_task_runner.h"
#include "cc/trees/layer_tree_host.h"
@@ -51,7 +52,7 @@ gpu::Mailbox MailboxFromChar(char value) {
class MockLayerTreeHost : public LayerTreeHost {
public:
explicit MockLayerTreeHost(FakeLayerTreeHostClient* client)
- : LayerTreeHost(client, nullptr, nullptr, LayerTreeSettings()) {
+ : LayerTreeHost(client, nullptr, nullptr, nullptr, LayerTreeSettings()) {
InitializeSingleThreaded(client,
base::MessageLoopProxy::current(),
nullptr);
@@ -172,7 +173,7 @@ class TextureLayerTest : public testing::Test {
TextureLayerTest()
: fake_client_(
FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)),
- host_impl_(&proxy_, &shared_bitmap_manager_),
+ host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_),
test_data_(&shared_bitmap_manager_) {}
protected:
@@ -195,6 +196,7 @@ class TextureLayerTest : public testing::Test {
FakeImplProxy proxy_;
FakeLayerTreeHostClient fake_client_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
CommonMailboxObjects test_data_;
};
diff --git a/cc/layers/tiled_layer_impl_unittest.cc b/cc/layers/tiled_layer_impl_unittest.cc
index e98fd09..7a47887 100644
--- a/cc/layers/tiled_layer_impl_unittest.cc
+++ b/cc/layers/tiled_layer_impl_unittest.cc
@@ -10,6 +10,7 @@
#include "cc/test/fake_impl_proxy.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/layer_test_common.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/trees/single_thread_proxy.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -19,7 +20,8 @@ namespace {
class TiledLayerImplTest : public testing::Test {
public:
- TiledLayerImplTest() : host_impl_(&proxy_, &shared_bitmap_manager_) {}
+ TiledLayerImplTest()
+ : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_) {}
scoped_ptr<TiledLayerImpl> CreateLayerNoTiles(
const gfx::Size& tile_size,
@@ -77,6 +79,7 @@ class TiledLayerImplTest : public testing::Test {
protected:
FakeImplProxy proxy_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
};
diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc
index 99cc0ca..511df0a 100644
--- a/cc/layers/tiled_layer_unittest.cc
+++ b/cc/layers/tiled_layer_unittest.cc
@@ -95,7 +95,7 @@ class TiledLayerTest : public testing::Test {
shared_bitmap_manager_.reset(new TestSharedBitmapManager());
layer_tree_host_ = LayerTreeHost::CreateThreaded(
&synchonous_output_surface_client_, shared_bitmap_manager_.get(),
- nullptr, settings_, base::MessageLoopProxy::current(),
+ nullptr, nullptr, settings_, base::MessageLoopProxy::current(),
impl_thread_.message_loop_proxy(), nullptr);
synchonous_output_surface_client_.SetLayerTreeHost(layer_tree_host_.get());
proxy_ = layer_tree_host_->proxy();
@@ -116,8 +116,8 @@ class TiledLayerTest : public testing::Test {
0,
false,
1);
- host_impl_ = make_scoped_ptr(
- new FakeLayerTreeHostImpl(proxy_, shared_bitmap_manager_.get()));
+ host_impl_ = make_scoped_ptr(new FakeLayerTreeHostImpl(
+ proxy_, shared_bitmap_manager_.get(), nullptr));
}
~TiledLayerTest() override {
diff --git a/cc/resources/display_list_recording_source.cc b/cc/resources/display_list_recording_source.cc
index 367b23d..296036d 100644
--- a/cc/resources/display_list_recording_source.cc
+++ b/cc/resources/display_list_recording_source.cc
@@ -28,6 +28,7 @@ namespace cc {
DisplayListRecordingSource::DisplayListRecordingSource()
: slow_down_raster_scale_factor_for_debug_(0),
+ gather_pixel_refs_(false),
requires_clear_(false),
is_solid_color_(false),
solid_color_(SK_ColorTRANSPARENT),
@@ -135,6 +136,10 @@ void DisplayListRecordingSource::SetSlowdownRasterScaleFactor(int factor) {
slow_down_raster_scale_factor_for_debug_ = factor;
}
+void DisplayListRecordingSource::SetGatherPixelRefs(bool gather_pixel_refs) {
+ gather_pixel_refs_ = gather_pixel_refs;
+}
+
void DisplayListRecordingSource::SetBackgroundColor(SkColor background_color) {
background_color_ = background_color;
}
diff --git a/cc/resources/display_list_recording_source.h b/cc/resources/display_list_recording_source.h
index e827d29..53d7fa5 100644
--- a/cc/resources/display_list_recording_source.h
+++ b/cc/resources/display_list_recording_source.h
@@ -30,6 +30,7 @@ class CC_EXPORT DisplayListRecordingSource : public RecordingSource {
gfx::Size GetSize() const final;
void SetEmptyBounds() override;
void SetSlowdownRasterScaleFactor(int factor) override;
+ void SetGatherPixelRefs(bool gather_pixel_refs) override;
void SetBackgroundColor(SkColor background_color) override;
void SetRequiresClear(bool requires_clear) override;
bool IsSuitableForGpuRasterization() const override;
@@ -42,6 +43,7 @@ class CC_EXPORT DisplayListRecordingSource : public RecordingSource {
gfx::Rect recorded_viewport_;
gfx::Size size_;
int slow_down_raster_scale_factor_for_debug_;
+ bool gather_pixel_refs_;
bool requires_clear_;
bool is_solid_color_;
SkColor solid_color_;
diff --git a/cc/resources/picture_pile.cc b/cc/resources/picture_pile.cc
index 04e0801..b5b9c79 100644
--- a/cc/resources/picture_pile.cc
+++ b/cc/resources/picture_pile.cc
@@ -10,7 +10,6 @@
#include "cc/base/region.h"
#include "cc/resources/picture_pile_impl.h"
-#include "cc/resources/tile_task_worker_pool.h"
#include "skia/ext/analysis_canvas.h"
namespace {
@@ -166,6 +165,7 @@ PicturePile::PicturePile(float min_contents_scale,
const gfx::Size& tile_grid_size)
: min_contents_scale_(0),
slow_down_raster_scale_factor_for_debug_(0),
+ gather_pixel_refs_(false),
has_any_recordings_(false),
clear_canvas_with_debug_color_(kDefaultClearCanvasSetting),
requires_clear_(true),
@@ -539,15 +539,9 @@ void PicturePile::CreatePictures(ContentLayerClient* painter,
int repeat_count = std::max(1, slow_down_raster_scale_factor_for_debug_);
scoped_refptr<Picture> picture;
- // Note: Currently, gathering of pixel refs when using a single
- // raster thread doesn't provide any benefit. This might change
- // in the future but we avoid it for now to reduce the cost of
- // Picture::Create.
- bool gather_pixel_refs = TileTaskWorkerPool::GetNumWorkerThreads() > 1;
-
for (int i = 0; i < repeat_count; i++) {
picture = Picture::Create(padded_record_rect, painter, tile_grid_size_,
- gather_pixel_refs, recording_mode);
+ gather_pixel_refs_, recording_mode);
// Note the '&&' with previous is-suitable state.
// This means that once a picture-pile becomes unsuitable for gpu
// rasterization due to some content, it will continue to be unsuitable
@@ -623,6 +617,10 @@ void PicturePile::SetSlowdownRasterScaleFactor(int factor) {
slow_down_raster_scale_factor_for_debug_ = factor;
}
+void PicturePile::SetGatherPixelRefs(bool gather_pixel_refs) {
+ gather_pixel_refs_ = gather_pixel_refs;
+}
+
void PicturePile::SetBackgroundColor(SkColor background_color) {
background_color_ = background_color;
}
diff --git a/cc/resources/picture_pile.h b/cc/resources/picture_pile.h
index bdba579..f3c9569 100644
--- a/cc/resources/picture_pile.h
+++ b/cc/resources/picture_pile.h
@@ -35,6 +35,7 @@ class CC_EXPORT PicturePile : public RecordingSource {
gfx::Size GetSize() const final;
void SetEmptyBounds() override;
void SetSlowdownRasterScaleFactor(int factor) override;
+ void SetGatherPixelRefs(bool gather_pixel_refs) override;
void SetBackgroundColor(SkColor background_color) override;
void SetRequiresClear(bool requires_clear) override;
bool IsSuitableForGpuRasterization() const override;
@@ -98,6 +99,7 @@ class CC_EXPORT PicturePile : public RecordingSource {
float min_contents_scale_;
gfx::Size tile_grid_size_;
int slow_down_raster_scale_factor_for_debug_;
+ bool gather_pixel_refs_;
// A hint about whether there are any recordings. This may be a false
// positive.
bool has_any_recordings_;
diff --git a/cc/resources/recording_source.h b/cc/resources/recording_source.h
index a202e63..98e4e87 100644
--- a/cc/resources/recording_source.h
+++ b/cc/resources/recording_source.h
@@ -47,6 +47,7 @@ class CC_EXPORT RecordingSource {
virtual gfx::Size GetSize() const = 0;
virtual void SetEmptyBounds() = 0;
virtual void SetSlowdownRasterScaleFactor(int factor) = 0;
+ virtual void SetGatherPixelRefs(bool gather_pixel_refs) = 0;
virtual void SetBackgroundColor(SkColor background_color) = 0;
virtual void SetRequiresClear(bool requires_clear) = 0;
virtual bool IsSuitableForGpuRasterization() const = 0;
diff --git a/cc/resources/tile_manager_perftest.cc b/cc/resources/tile_manager_perftest.cc
index 87d1837..236f918 100644
--- a/cc/resources/tile_manager_perftest.cc
+++ b/cc/resources/tile_manager_perftest.cc
@@ -18,6 +18,7 @@
#include "cc/test/fake_tile_manager_client.h"
#include "cc/test/impl_side_painting_settings.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/test/test_tile_priorities.h"
#include "cc/trees/layer_tree_impl.h"
@@ -90,7 +91,8 @@ class TileManagerPerfTest : public testing::Test {
proxy_(base::MessageLoopProxy::current()),
host_impl_(ImplSidePaintingSettings(10000),
&proxy_,
- &shared_bitmap_manager_),
+ &shared_bitmap_manager_,
+ &task_graph_runner_),
timer_(kWarmupRuns,
base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
kTimeCheckInterval) {}
@@ -407,6 +409,7 @@ class TileManagerPerfTest : public testing::Test {
GlobalStateThatImpactsTilePriority global_state_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
TileMemoryLimitPolicy memory_limit_policy_;
int max_tiles_;
int id_;
diff --git a/cc/resources/tile_manager_unittest.cc b/cc/resources/tile_manager_unittest.cc
index 2aa786f..e826f55 100644
--- a/cc/resources/tile_manager_unittest.cc
+++ b/cc/resources/tile_manager_unittest.cc
@@ -18,6 +18,7 @@
#include "cc/test/fake_tile_manager.h"
#include "cc/test/impl_side_painting_settings.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/test/test_tile_priorities.h"
#include "cc/trees/layer_tree_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -38,7 +39,10 @@ class TileManagerTilePriorityQueueTest : public testing::Test {
ready_to_activate_(false),
id_(7),
proxy_(base::MessageLoopProxy::current()),
- host_impl_(LowResTilingsSettings(), &proxy_, &shared_bitmap_manager_) {}
+ host_impl_(LowResTilingsSettings(),
+ &proxy_,
+ &shared_bitmap_manager_,
+ &task_graph_runner_) {}
void SetTreePriority(TreePriority tree_priority) {
GlobalStateThatImpactsTilePriority state;
@@ -137,6 +141,7 @@ class TileManagerTilePriorityQueueTest : public testing::Test {
GlobalStateThatImpactsTilePriority global_state_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
TileMemoryLimitPolicy memory_limit_policy_;
int max_tiles_;
bool ready_to_activate_;
diff --git a/cc/resources/tile_task_worker_pool.cc b/cc/resources/tile_task_worker_pool.cc
index 2775386..0fbc7be 100644
--- a/cc/resources/tile_task_worker_pool.cc
+++ b/cc/resources/tile_task_worker_pool.cc
@@ -6,11 +6,7 @@
#include <algorithm>
-#include "base/lazy_instance.h"
-#include "base/strings/stringprintf.h"
-#include "base/threading/simple_thread.h"
#include "base/trace_event/trace_event.h"
-#include "cc/base/scoped_ptr_deque.h"
#include "cc/resources/raster_source.h"
#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkCanvas.h"
@@ -19,41 +15,6 @@
namespace cc {
namespace {
-base::ThreadPriority g_worker_thread_priority = base::kThreadPriority_Normal;
-
-class TileTaskGraphRunner : public TaskGraphRunner,
- public base::DelegateSimpleThread::Delegate {
- public:
- TileTaskGraphRunner() {
- size_t num_threads = TileTaskWorkerPool::GetNumWorkerThreads();
- while (workers_.size() < num_threads) {
- scoped_ptr<base::DelegateSimpleThread> worker =
- make_scoped_ptr(new base::DelegateSimpleThread(
- this, base::StringPrintf(
- "CompositorTileWorker%u",
- static_cast<unsigned>(workers_.size() + 1)).c_str()));
- worker->Start();
- worker->SetThreadPriority(g_worker_thread_priority);
- workers_.push_back(worker.Pass());
- }
- }
-
- ~TileTaskGraphRunner() override { NOTREACHED(); }
-
- private:
- // Overridden from base::DelegateSimpleThread::Delegate:
- void Run() override { TaskGraphRunner::Run(); }
-
- ScopedPtrDeque<base::DelegateSimpleThread> workers_;
-};
-
-base::LazyInstance<TileTaskGraphRunner>::Leaky g_task_graph_runner =
- LAZY_INSTANCE_INITIALIZER;
-
-const int kDefaultNumWorkerThreads = 1;
-
-int g_num_worker_threads = 0;
-
class TaskSetFinishedTaskImpl : public TileTask {
public:
explicit TaskSetFinishedTaskImpl(
@@ -107,33 +68,6 @@ TileTaskWorkerPool::~TileTaskWorkerPool() {
}
// static
-void TileTaskWorkerPool::SetNumWorkerThreads(int num_threads) {
- DCHECK_LT(0, num_threads);
- DCHECK_EQ(0, g_num_worker_threads);
-
- g_num_worker_threads = num_threads;
-}
-
-// static
-int TileTaskWorkerPool::GetNumWorkerThreads() {
- if (!g_num_worker_threads)
- g_num_worker_threads = kDefaultNumWorkerThreads;
-
- return g_num_worker_threads;
-}
-
-// static
-void TileTaskWorkerPool::SetWorkerThreadPriority(
- base::ThreadPriority priority) {
- g_worker_thread_priority = priority;
-}
-
-// static
-TaskGraphRunner* TileTaskWorkerPool::GetTaskGraphRunner() {
- return g_task_graph_runner.Pointer();
-}
-
-// static
scoped_refptr<TileTask> TileTaskWorkerPool::CreateTaskSetFinishedTask(
base::SequencedTaskRunner* task_runner,
const base::Closure& on_task_set_finished_callback) {
diff --git a/cc/resources/tile_task_worker_pool.h b/cc/resources/tile_task_worker_pool.h
index 915a3fa..90adfd1 100644
--- a/cc/resources/tile_task_worker_pool.h
+++ b/cc/resources/tile_task_worker_pool.h
@@ -5,7 +5,6 @@
#ifndef CC_RESOURCES_TILE_TASK_WORKER_POOL_H_
#define CC_RESOURCES_TILE_TASK_WORKER_POOL_H_
-#include "base/threading/platform_thread.h"
#include "cc/resources/tile_task_runner.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -27,20 +26,6 @@ class CC_EXPORT TileTaskWorkerPool {
TileTaskWorkerPool();
virtual ~TileTaskWorkerPool();
- // Set the number of threads to use for the global TaskGraphRunner instance.
- // This can only be called once and must be called prior to
- // GetNumWorkerThreads().
- static void SetNumWorkerThreads(int num_threads);
-
- // Returns the number of threads used for the global TaskGraphRunner instance.
- static int GetNumWorkerThreads();
-
- // Set the priority of worker threads.
- static void SetWorkerThreadPriority(base::ThreadPriority priority);
-
- // Returns a pointer to the global TaskGraphRunner instance.
- static TaskGraphRunner* GetTaskGraphRunner();
-
// Utility function that can be used to create a "Task set finished" task that
// posts |callback| to |task_runner| when run.
static scoped_refptr<TileTask> CreateTaskSetFinishedTask(
diff --git a/cc/resources/tile_task_worker_pool_unittest.cc b/cc/resources/tile_task_worker_pool_unittest.cc
index 72f9d20..3d74daf 100644
--- a/cc/resources/tile_task_worker_pool_unittest.cc
+++ b/cc/resources/tile_task_worker_pool_unittest.cc
@@ -27,6 +27,7 @@
#include "cc/test/fake_picture_pile_impl.h"
#include "cc/test/test_gpu_memory_buffer_manager.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/test/test_web_graphics_context_3d.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -142,39 +143,38 @@ class TileTaskWorkerPoolTest
case TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER:
Create3dOutputSurfaceAndResourceProvider();
tile_task_worker_pool_ = PixelBufferTileTaskWorkerPool::Create(
- base::MessageLoopProxy::current().get(),
- TileTaskWorkerPool::GetTaskGraphRunner(), context_provider_.get(),
- resource_provider_.get(), kMaxTransferBufferUsageBytes);
+ base::MessageLoopProxy::current().get(), &task_graph_runner_,
+ context_provider_.get(), resource_provider_.get(),
+ kMaxTransferBufferUsageBytes);
break;
case TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY:
Create3dOutputSurfaceAndResourceProvider();
tile_task_worker_pool_ = ZeroCopyTileTaskWorkerPool::Create(
- base::MessageLoopProxy::current().get(),
- TileTaskWorkerPool::GetTaskGraphRunner(), resource_provider_.get());
+ base::MessageLoopProxy::current().get(), &task_graph_runner_,
+ resource_provider_.get());
break;
case TILE_TASK_WORKER_POOL_TYPE_ONE_COPY:
Create3dOutputSurfaceAndResourceProvider();
staging_resource_pool_ = ResourcePool::Create(resource_provider_.get(),
GL_TEXTURE_2D);
tile_task_worker_pool_ = OneCopyTileTaskWorkerPool::Create(
- base::MessageLoopProxy::current().get(),
- TileTaskWorkerPool::GetTaskGraphRunner(), context_provider_.get(),
- resource_provider_.get(), staging_resource_pool_.get());
+ base::MessageLoopProxy::current().get(), &task_graph_runner_,
+ context_provider_.get(), resource_provider_.get(),
+ staging_resource_pool_.get());
break;
case TILE_TASK_WORKER_POOL_TYPE_GPU:
Create3dOutputSurfaceAndResourceProvider();
rasterizer_ = GpuRasterizer::Create(
context_provider_.get(), resource_provider_.get(), false, false, 0);
tile_task_worker_pool_ = GpuTileTaskWorkerPool::Create(
- base::MessageLoopProxy::current().get(),
- TileTaskWorkerPool::GetTaskGraphRunner(),
+ base::MessageLoopProxy::current().get(), &task_graph_runner_,
static_cast<GpuRasterizer*>(rasterizer_.get()));
break;
case TILE_TASK_WORKER_POOL_TYPE_BITMAP:
CreateSoftwareOutputSurfaceAndResourceProvider();
tile_task_worker_pool_ = BitmapTileTaskWorkerPool::Create(
- base::MessageLoopProxy::current().get(),
- TileTaskWorkerPool::GetTaskGraphRunner(), resource_provider_.get());
+ base::MessageLoopProxy::current().get(), &task_graph_runner_,
+ resource_provider_.get());
break;
}
@@ -331,6 +331,7 @@ class TileTaskWorkerPoolTest
scoped_ptr<TileTaskWorkerPool> tile_task_worker_pool_;
TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
base::CancelableClosure timeout_;
UniqueNotifier all_tile_tasks_finished_;
int timeout_seconds_;
diff --git a/cc/test/fake_layer_tree_host.cc b/cc/test/fake_layer_tree_host.cc
index fe0351d..143d22e 100644
--- a/cc/test/fake_layer_tree_host.cc
+++ b/cc/test/fake_layer_tree_host.cc
@@ -7,9 +7,9 @@
namespace cc {
FakeLayerTreeHost::FakeLayerTreeHost(FakeLayerTreeHostClient* client,
const LayerTreeSettings& settings)
- : LayerTreeHost(client, NULL, NULL, settings),
+ : LayerTreeHost(client, NULL, NULL, NULL, settings),
client_(client),
- host_impl_(settings, &proxy_, &manager_),
+ host_impl_(settings, &proxy_, &manager_, nullptr),
needs_commit_(false) {
client_->SetLayerTreeHost(this);
}
diff --git a/cc/test/fake_layer_tree_host_impl.cc b/cc/test/fake_layer_tree_host_impl.cc
index ccfb203..d026120 100644
--- a/cc/test/fake_layer_tree_host_impl.cc
+++ b/cc/test/fake_layer_tree_host_impl.cc
@@ -10,13 +10,15 @@
namespace cc {
FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy,
- SharedBitmapManager* manager)
+ SharedBitmapManager* manager,
+ TaskGraphRunner* task_graph_runner)
: LayerTreeHostImpl(LayerTreeSettings(),
&client_,
proxy,
&stats_instrumentation_,
manager,
NULL,
+ task_graph_runner,
0) {
// Explicitly clear all debug settings.
SetDebugState(LayerTreeDebugState());
@@ -30,13 +32,15 @@ FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy,
FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(const LayerTreeSettings& settings,
Proxy* proxy,
- SharedBitmapManager* manager)
+ SharedBitmapManager* manager,
+ TaskGraphRunner* task_graph_runner)
: LayerTreeHostImpl(settings,
&client_,
proxy,
&stats_instrumentation_,
manager,
NULL,
+ task_graph_runner,
0) {
// Explicitly clear all debug settings.
SetDebugState(LayerTreeDebugState());
diff --git a/cc/test/fake_layer_tree_host_impl.h b/cc/test/fake_layer_tree_host_impl.h
index ee9232e..9c8f649 100644
--- a/cc/test/fake_layer_tree_host_impl.h
+++ b/cc/test/fake_layer_tree_host_impl.h
@@ -14,10 +14,13 @@ namespace cc {
class FakeLayerTreeHostImpl : public LayerTreeHostImpl {
public:
- FakeLayerTreeHostImpl(Proxy* proxy, SharedBitmapManager* manager);
+ FakeLayerTreeHostImpl(Proxy* proxy,
+ SharedBitmapManager* manager,
+ TaskGraphRunner* task_graph_runner);
FakeLayerTreeHostImpl(const LayerTreeSettings& settings,
Proxy* proxy,
- SharedBitmapManager* manager);
+ SharedBitmapManager* manager,
+ TaskGraphRunner* task_graph_runner);
~FakeLayerTreeHostImpl() override;
void ForcePrepareToDraw() {
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 9e7adde..43617a6 100644
--- a/cc/test/fake_ui_resource_layer_tree_host_impl.cc
+++ b/cc/test/fake_ui_resource_layer_tree_host_impl.cc
@@ -12,7 +12,9 @@ namespace cc {
FakeUIResourceLayerTreeHostImpl::FakeUIResourceLayerTreeHostImpl(
Proxy* proxy,
SharedBitmapManager* manager)
- : FakeLayerTreeHostImpl(proxy, manager), fake_next_resource_id_(1) {}
+ : FakeLayerTreeHostImpl(proxy, manager, nullptr),
+ fake_next_resource_id_(1) {
+}
FakeUIResourceLayerTreeHostImpl::~FakeUIResourceLayerTreeHostImpl() {}
diff --git a/cc/test/layer_tree_json_parser_unittest.cc b/cc/test/layer_tree_json_parser_unittest.cc
index a11d545..8286a0f 100644
--- a/cc/test/layer_tree_json_parser_unittest.cc
+++ b/cc/test/layer_tree_json_parser_unittest.cc
@@ -65,7 +65,7 @@ class LayerTreeJsonParserSanityCheck : public testing::Test {
TEST_F(LayerTreeJsonParserSanityCheck, Basic) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
LayerTreeImpl* tree = host_impl.active_tree();
scoped_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1));
@@ -94,7 +94,7 @@ TEST_F(LayerTreeJsonParserSanityCheck, Basic) {
TEST_F(LayerTreeJsonParserSanityCheck, EventHandlerRegions) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
LayerTreeImpl* tree = host_impl.active_tree();
scoped_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1));
diff --git a/cc/test/layer_tree_pixel_resource_test.cc b/cc/test/layer_tree_pixel_resource_test.cc
index 6b6c00b..2e12953 100644
--- a/cc/test/layer_tree_pixel_resource_test.cc
+++ b/cc/test/layer_tree_pixel_resource_test.cc
@@ -171,8 +171,7 @@ void LayerTreeHostPixelResourceTest::CreateResourceAndTileTaskWorkerPool(
draw_texture_target_);
*tile_task_worker_pool = BitmapTileTaskWorkerPool::Create(
- task_runner, TileTaskWorkerPool::GetTaskGraphRunner(),
- resource_provider);
+ task_runner, task_graph_runner(), resource_provider);
break;
case GPU_TILE_TASK_WORKER_POOL:
EXPECT_TRUE(context_provider);
@@ -182,7 +181,7 @@ void LayerTreeHostPixelResourceTest::CreateResourceAndTileTaskWorkerPool(
draw_texture_target_);
*tile_task_worker_pool = GpuTileTaskWorkerPool::Create(
- task_runner, TileTaskWorkerPool::GetTaskGraphRunner(),
+ task_runner, task_graph_runner(),
static_cast<GpuRasterizer*>(host_impl->rasterizer()));
break;
case ZERO_COPY_TILE_TASK_WORKER_POOL:
@@ -193,8 +192,7 @@ void LayerTreeHostPixelResourceTest::CreateResourceAndTileTaskWorkerPool(
ResourcePool::Create(resource_provider, draw_texture_target_);
*tile_task_worker_pool = ZeroCopyTileTaskWorkerPool::Create(
- task_runner, TileTaskWorkerPool::GetTaskGraphRunner(),
- resource_provider);
+ task_runner, task_graph_runner(), resource_provider);
break;
case ONE_COPY_TILE_TASK_WORKER_POOL:
EXPECT_TRUE(context_provider);
@@ -207,8 +205,8 @@ void LayerTreeHostPixelResourceTest::CreateResourceAndTileTaskWorkerPool(
ResourcePool::Create(resource_provider, draw_texture_target_);
*tile_task_worker_pool = OneCopyTileTaskWorkerPool::Create(
- task_runner, TileTaskWorkerPool::GetTaskGraphRunner(),
- context_provider, resource_provider, staging_resource_pool->get());
+ task_runner, task_graph_runner(), context_provider, resource_provider,
+ staging_resource_pool->get());
break;
case PIXEL_BUFFER_TILE_TASK_WORKER_POOL:
EXPECT_TRUE(context_provider);
@@ -217,8 +215,8 @@ void LayerTreeHostPixelResourceTest::CreateResourceAndTileTaskWorkerPool(
resource_provider, draw_texture_target_);
*tile_task_worker_pool = PixelBufferTileTaskWorkerPool::Create(
- task_runner, TileTaskWorkerPool::GetTaskGraphRunner(),
- context_provider, resource_provider, max_transfer_buffer_usage_bytes);
+ task_runner, task_graph_runner(), context_provider, resource_provider,
+ max_transfer_buffer_usage_bytes);
break;
}
}
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index 56ef2c1..2fff95f 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -22,6 +22,7 @@
#include "cc/test/test_context_provider.h"
#include "cc/test/test_gpu_memory_buffer_manager.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/test/tiled_layer_test_common.h"
#include "cc/trees/layer_tree_host_client.h"
#include "cc/trees/layer_tree_host_impl.h"
@@ -209,15 +210,11 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
Proxy* proxy,
SharedBitmapManager* shared_bitmap_manager,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
+ TaskGraphRunner* task_graph_runner,
RenderingStatsInstrumentation* stats_instrumentation) {
- return make_scoped_ptr(
- new LayerTreeHostImplForTesting(test_hooks,
- settings,
- host_impl_client,
- proxy,
- shared_bitmap_manager,
- gpu_memory_buffer_manager,
- stats_instrumentation));
+ return make_scoped_ptr(new LayerTreeHostImplForTesting(
+ test_hooks, settings, host_impl_client, proxy, shared_bitmap_manager,
+ gpu_memory_buffer_manager, task_graph_runner, stats_instrumentation));
}
protected:
@@ -228,6 +225,7 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
Proxy* proxy,
SharedBitmapManager* shared_bitmap_manager,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
+ TaskGraphRunner* task_graph_runner,
RenderingStatsInstrumentation* stats_instrumentation)
: LayerTreeHostImpl(settings,
host_impl_client,
@@ -235,6 +233,7 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
stats_instrumentation,
shared_bitmap_manager,
gpu_memory_buffer_manager,
+ task_graph_runner,
0),
test_hooks_(test_hooks),
block_notify_ready_to_activate_for_testing_(false),
@@ -455,12 +454,17 @@ class LayerTreeHostForTesting : public LayerTreeHost {
static scoped_ptr<LayerTreeHostForTesting> Create(
TestHooks* test_hooks,
LayerTreeHostClientForTesting* client,
+ SharedBitmapManager* shared_bitmap_manager,
+ gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
+ TaskGraphRunner* task_graph_runner,
const LayerTreeSettings& settings,
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
scoped_ptr<BeginFrameSource> external_begin_frame_source) {
scoped_ptr<LayerTreeHostForTesting> layer_tree_host(
- new LayerTreeHostForTesting(test_hooks, client, settings));
+ new LayerTreeHostForTesting(test_hooks, client, shared_bitmap_manager,
+ gpu_memory_buffer_manager,
+ task_graph_runner, settings));
if (impl_task_runner.get()) {
layer_tree_host->InitializeForTesting(
ThreadProxyForTest::Create(test_hooks,
@@ -483,12 +487,8 @@ class LayerTreeHostForTesting : public LayerTreeHost {
scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl(
LayerTreeHostImplClient* host_impl_client) override {
return LayerTreeHostImplForTesting::Create(
- test_hooks_,
- settings(),
- host_impl_client,
- proxy(),
- shared_bitmap_manager_.get(),
- gpu_memory_buffer_manager_.get(),
+ test_hooks_, settings(), host_impl_client, proxy(),
+ shared_bitmap_manager_, gpu_memory_buffer_manager_, task_graph_runner_,
rendering_stats_instrumentation());
}
@@ -501,17 +501,23 @@ class LayerTreeHostForTesting : public LayerTreeHost {
void set_test_started(bool started) { test_started_ = started; }
private:
- LayerTreeHostForTesting(TestHooks* test_hooks,
- LayerTreeHostClient* client,
- const LayerTreeSettings& settings)
- : LayerTreeHost(client, NULL, NULL, settings),
- shared_bitmap_manager_(new TestSharedBitmapManager),
- gpu_memory_buffer_manager_(new TestGpuMemoryBufferManager),
+ LayerTreeHostForTesting(
+ TestHooks* test_hooks,
+ LayerTreeHostClient* client,
+ SharedBitmapManager* shared_bitmap_manager,
+ gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
+ TaskGraphRunner* task_graph_runner,
+ const LayerTreeSettings& settings)
+ : LayerTreeHost(client, NULL, NULL, NULL, settings),
+ shared_bitmap_manager_(shared_bitmap_manager),
+ gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
+ task_graph_runner_(task_graph_runner),
test_hooks_(test_hooks),
test_started_(false) {}
- scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_;
- scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_;
+ SharedBitmapManager* shared_bitmap_manager_;
+ gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
+ TaskGraphRunner* task_graph_runner_;
TestHooks* test_hooks_;
bool test_started_;
};
@@ -663,9 +669,8 @@ void LayerTreeTest::DoBeginTest() {
DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get());
layer_tree_host_ = LayerTreeHostForTesting::Create(
- this,
- client_.get(),
- settings_,
+ this, client_.get(), shared_bitmap_manager_.get(),
+ gpu_memory_buffer_manager_.get(), task_graph_runner_.get(), settings_,
base::MessageLoopProxy::current(),
impl_thread_ ? impl_thread_->message_loop_proxy() : NULL,
external_begin_frame_source.Pass());
@@ -793,6 +798,10 @@ void LayerTreeTest::RunTest(bool threaded,
main_task_runner_ = base::MessageLoopProxy::current();
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager);
+ gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager);
+ task_graph_runner_.reset(new TestTaskGraphRunner);
+
delegating_renderer_ = delegating_renderer;
// Spend less time waiting for BeginFrame because the output is
diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h
index 1ce3dcf..35a3546 100644
--- a/cc/test/layer_tree_test.h
+++ b/cc/test/layer_tree_test.h
@@ -21,6 +21,7 @@ class LayerTreeHost;
class LayerTreeHostClient;
class LayerTreeHostImpl;
class TestContextProvider;
+class TestGpuMemoryBufferManager;
class TestWebGraphicsContext3D;
// Used by test stubs to notify the test when something interesting happens.
@@ -195,6 +196,9 @@ class LayerTreeTest : public testing::Test, public TestHooks {
Proxy* proxy() const {
return layer_tree_host_ ? layer_tree_host_->proxy() : NULL;
}
+ TaskGraphRunner* task_graph_runner() const {
+ return task_graph_runner_.get();
+ }
bool TestEnded() const { return ended_; }
@@ -234,6 +238,9 @@ class LayerTreeTest : public testing::Test, public TestHooks {
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
scoped_ptr<base::Thread> impl_thread_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
+ scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_;
+ scoped_ptr<TaskGraphRunner> task_graph_runner_;
base::CancelableClosure timeout_;
scoped_refptr<TestContextProvider> compositor_contexts_;
base::WeakPtr<LayerTreeTest> main_thread_weak_ptr_;
diff --git a/cc/test/test_task_graph_runner.cc b/cc/test/test_task_graph_runner.cc
new file mode 100644
index 0000000..fe9734e
--- /dev/null
+++ b/cc/test/test_task_graph_runner.cc
@@ -0,0 +1,23 @@
+// 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.
+
+#include "cc/test/test_task_graph_runner.h"
+
+namespace cc {
+
+TestTaskGraphRunner::TestTaskGraphRunner()
+ : worker_thread_(this, "CompositorWorker") {
+ worker_thread_.Start();
+}
+
+TestTaskGraphRunner::~TestTaskGraphRunner() {
+ TaskGraphRunner::Shutdown();
+ worker_thread_.Join();
+}
+
+void TestTaskGraphRunner::Run() {
+ TaskGraphRunner::Run();
+}
+
+} // namespace cc
diff --git a/cc/test/test_task_graph_runner.h b/cc/test/test_task_graph_runner.h
new file mode 100644
index 0000000..8314e11
--- /dev/null
+++ b/cc/test/test_task_graph_runner.h
@@ -0,0 +1,30 @@
+// 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_TEST_TASK_GRAPH_RUNNER_H_
+#define CC_TEST_TEST_TASK_GRAPH_RUNNER_H_
+
+#include "base/threading/simple_thread.h"
+#include "cc/resources/task_graph_runner.h"
+
+namespace cc {
+
+class TestTaskGraphRunner : public TaskGraphRunner,
+ public base::DelegateSimpleThread::Delegate {
+ public:
+ TestTaskGraphRunner();
+ ~TestTaskGraphRunner() override;
+
+ // Overridden from base::DelegateSimpleThread::Delegate:
+ void Run() override;
+
+ private:
+ base::DelegateSimpleThread worker_thread_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestTaskGraphRunner);
+};
+
+} // namespace cc
+
+#endif // CC_TEST_TEST_TASK_GRAPH_RUNNER_H_
diff --git a/cc/trees/damage_tracker_unittest.cc b/cc/trees/damage_tracker_unittest.cc
index 95609d3..2df71dd 100644
--- a/cc/trees/damage_tracker_unittest.cc
+++ b/cc/trees/damage_tracker_unittest.cc
@@ -12,6 +12,7 @@
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/trees/layer_tree_host_common.h"
#include "cc/trees/single_thread_proxy.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -74,7 +75,8 @@ void EmulateDrawingOneFrame(LayerImpl* root) {
class DamageTrackerTest : public testing::Test {
public:
- DamageTrackerTest() : host_impl_(&proxy_, &shared_bitmap_manager_) {}
+ DamageTrackerTest()
+ : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_) {}
scoped_ptr<LayerImpl> CreateTestTreeWithOneSurface() {
scoped_ptr<LayerImpl> root =
@@ -176,6 +178,7 @@ class DamageTrackerTest : public testing::Test {
protected:
FakeImplProxy proxy_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
};
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 7814dac..9d2be10 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -56,6 +56,7 @@ scoped_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded(
LayerTreeHostClient* client,
SharedBitmapManager* shared_bitmap_manager,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
+ TaskGraphRunner* task_graph_runner,
const LayerTreeSettings& settings,
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
@@ -63,7 +64,8 @@ scoped_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded(
DCHECK(main_task_runner.get());
DCHECK(impl_task_runner.get());
scoped_ptr<LayerTreeHost> layer_tree_host(new LayerTreeHost(
- client, shared_bitmap_manager, gpu_memory_buffer_manager, settings));
+ client, shared_bitmap_manager, gpu_memory_buffer_manager,
+ task_graph_runner, settings));
layer_tree_host->InitializeThreaded(main_task_runner,
impl_task_runner,
external_begin_frame_source.Pass());
@@ -75,11 +77,13 @@ scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded(
LayerTreeHostSingleThreadClient* single_thread_client,
SharedBitmapManager* shared_bitmap_manager,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
+ TaskGraphRunner* task_graph_runner,
const LayerTreeSettings& settings,
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
scoped_ptr<BeginFrameSource> external_begin_frame_source) {
scoped_ptr<LayerTreeHost> layer_tree_host(new LayerTreeHost(
- client, shared_bitmap_manager, gpu_memory_buffer_manager, settings));
+ client, shared_bitmap_manager, gpu_memory_buffer_manager,
+ task_graph_runner, settings));
layer_tree_host->InitializeSingleThreaded(single_thread_client,
main_task_runner,
external_begin_frame_source.Pass());
@@ -90,6 +94,7 @@ LayerTreeHost::LayerTreeHost(
LayerTreeHostClient* client,
SharedBitmapManager* shared_bitmap_manager,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
+ TaskGraphRunner* task_graph_runner,
const LayerTreeSettings& settings)
: micro_benchmark_controller_(this),
next_ui_resource_id_(1),
@@ -121,6 +126,7 @@ LayerTreeHost::LayerTreeHost(
next_commit_forces_redraw_(false),
shared_bitmap_manager_(shared_bitmap_manager),
gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
+ task_graph_runner_(task_graph_runner),
surface_id_namespace_(0u),
next_surface_sequence_(1u) {
if (settings_.accelerated_animation_enabled)
@@ -430,17 +436,14 @@ void LayerTreeHost::DidFailToInitializeOutputSurface() {
scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl(
LayerTreeHostImplClient* client) {
DCHECK(proxy_->IsImplThread());
- scoped_ptr<LayerTreeHostImpl> host_impl =
- LayerTreeHostImpl::Create(settings_,
- client,
- proxy_.get(),
- rendering_stats_instrumentation_.get(),
- shared_bitmap_manager_,
- gpu_memory_buffer_manager_,
- id_);
+ scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create(
+ settings_, client, proxy_.get(), rendering_stats_instrumentation_.get(),
+ shared_bitmap_manager_, gpu_memory_buffer_manager_, task_graph_runner_,
+ id_);
host_impl->SetUseGpuRasterization(UseGpuRasterization());
shared_bitmap_manager_ = NULL;
gpu_memory_buffer_manager_ = NULL;
+ task_graph_runner_ = NULL;
top_controls_manager_weak_ptr_ =
host_impl->top_controls_manager()->AsWeakPtr();
input_handler_weak_ptr_ = host_impl->AsWeakPtr();
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index 1379d08..e1bcad5 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -61,6 +61,7 @@ class RenderingStatsInstrumentation;
class ResourceProvider;
class ResourceUpdateQueue;
class SharedBitmapManager;
+class TaskGraphRunner;
class TopControlsManager;
class UIResourceRequest;
struct PendingPageScaleAnimation;
@@ -75,6 +76,7 @@ class CC_EXPORT LayerTreeHost {
LayerTreeHostClient* client,
SharedBitmapManager* shared_bitmap_manager,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
+ TaskGraphRunner* task_graph_runner,
const LayerTreeSettings& settings,
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
@@ -85,6 +87,7 @@ class CC_EXPORT LayerTreeHost {
LayerTreeHostSingleThreadClient* single_thread_client,
SharedBitmapManager* shared_bitmap_manager,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
+ TaskGraphRunner* task_graph_runner,
const LayerTreeSettings& settings,
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
scoped_ptr<BeginFrameSource> external_begin_frame_source);
@@ -307,6 +310,7 @@ class CC_EXPORT LayerTreeHost {
LayerTreeHost(LayerTreeHostClient* client,
SharedBitmapManager* shared_bitmap_manager,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
+ TaskGraphRunner* task_graph_runner,
const LayerTreeSettings& settings);
void InitializeThreaded(
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
@@ -440,6 +444,7 @@ class CC_EXPORT LayerTreeHost {
SharedBitmapManager* shared_bitmap_manager_;
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
+ TaskGraphRunner* task_graph_runner_;
ScopedPtrVector<SwapPromise> swap_promise_list_;
std::set<SwapPromiseMonitor*> swap_promise_monitor_;
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index d18c1c8..082d14f 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -28,6 +28,7 @@
#include "cc/test/fake_picture_layer_impl.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/layer_tree_host_common_test.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/proxy.h"
#include "cc/trees/single_thread_proxy.h"
@@ -315,7 +316,7 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
gfx::Transform identity_matrix;
scoped_ptr<LayerImpl> sublayer_scoped_ptr(
@@ -5721,7 +5722,7 @@ TEST_F(LayerTreeHostCommonTest, TransparentChildRenderSurfaceCreation) {
TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
host_impl.CreatePendingTree();
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1);
@@ -5763,7 +5764,7 @@ class LCDTextTest
public testing::TestWithParam<LCDTextTestParam> {
public:
LCDTextTest()
- : host_impl_(&proxy_, &shared_bitmap_manager_),
+ : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_),
root_(nullptr),
child_(nullptr),
grand_child_(nullptr) {}
@@ -5810,6 +5811,7 @@ class LCDTextTest
FakeImplProxy proxy_;
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
LayerImpl* root_;
@@ -5947,7 +5949,7 @@ INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest,
TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -6005,7 +6007,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) {
TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -6050,7 +6052,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -6107,7 +6109,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) {
TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -6152,7 +6154,7 @@ void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {}
TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -6299,7 +6301,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) {
TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -6374,7 +6376,7 @@ TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) {
TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -6985,7 +6987,7 @@ TEST_F(LayerTreeHostCommonTest,
TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
scoped_ptr<LayerImpl> root =
LayerImpl::Create(host_impl.active_tree(), 12345);
scoped_ptr<LayerImpl> child1 =
@@ -7706,7 +7708,7 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) {
//
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
host_impl.CreatePendingTree();
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
scoped_ptr<LayerImpl> container =
@@ -7850,7 +7852,7 @@ TEST_F(LayerTreeHostCommonTest,
//
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
host_impl.CreatePendingTree();
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
scoped_ptr<LayerImpl> container =
@@ -7944,7 +7946,7 @@ class AnimationScaleFactorTrackingLayerImpl : public LayerImpl {
TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
gfx::Transform identity_matrix;
scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent =
AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1);
@@ -8161,7 +8163,7 @@ static void GatherDrawnLayers(LayerImplList* rsll,
TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
gfx::Transform identity_matrix;
scoped_ptr<LayerImpl> grand_parent =
@@ -8404,7 +8406,7 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
LayerImpl* root_layer = root.get();
@@ -8684,7 +8686,7 @@ TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) {
TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
// Set two layers: the root layer clips it's child,
// the child draws its content.
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 9965d7a..2c13fcb 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -170,14 +170,11 @@ scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create(
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,
- shared_bitmap_manager,
- gpu_memory_buffer_manager,
- id));
+ return make_scoped_ptr(new LayerTreeHostImpl(
+ settings, client, proxy, rendering_stats_instrumentation,
+ shared_bitmap_manager, gpu_memory_buffer_manager, task_graph_runner, id));
}
LayerTreeHostImpl::LayerTreeHostImpl(
@@ -187,6 +184,7 @@ LayerTreeHostImpl::LayerTreeHostImpl(
RenderingStatsInstrumentation* rendering_stats_instrumentation,
SharedBitmapManager* shared_bitmap_manager,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
+ TaskGraphRunner* task_graph_runner,
int id)
: client_(client),
proxy_(proxy),
@@ -225,6 +223,7 @@ LayerTreeHostImpl::LayerTreeHostImpl(
micro_benchmark_controller_(this),
shared_bitmap_manager_(shared_bitmap_manager),
gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
+ task_graph_runner_(task_graph_runner),
id_(id),
requires_high_res_to_draw_(false),
is_likely_to_require_a_draw_(false),
@@ -2032,8 +2031,7 @@ void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool(
ResourcePool::Create(resource_provider_.get(), GL_TEXTURE_2D);
*tile_task_worker_pool = BitmapTileTaskWorkerPool::Create(
- task_runner, TileTaskWorkerPool::GetTaskGraphRunner(),
- resource_provider_.get());
+ task_runner, task_graph_runner_, resource_provider_.get());
return;
}
@@ -2042,7 +2040,7 @@ void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool(
ResourcePool::Create(resource_provider_.get(), GL_TEXTURE_2D);
*tile_task_worker_pool = GpuTileTaskWorkerPool::Create(
- task_runner, TileTaskWorkerPool::GetTaskGraphRunner(),
+ task_runner, task_graph_runner_,
static_cast<GpuRasterizer*>(rasterizer_.get()));
return;
}
@@ -2066,7 +2064,7 @@ void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool(
single_thread_synchronous_task_graph_runner_.reset(new TaskGraphRunner);
task_graph_runner = single_thread_synchronous_task_graph_runner_.get();
} else {
- task_graph_runner = TileTaskWorkerPool::GetTaskGraphRunner();
+ task_graph_runner = task_graph_runner_;
}
*tile_task_worker_pool = ZeroCopyTileTaskWorkerPool::Create(
@@ -2082,9 +2080,8 @@ void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool(
ResourcePool::Create(resource_provider_.get(), GL_TEXTURE_2D);
*tile_task_worker_pool = OneCopyTileTaskWorkerPool::Create(
- task_runner, TileTaskWorkerPool::GetTaskGraphRunner(),
- context_provider, resource_provider_.get(),
- staging_resource_pool_.get());
+ task_runner, task_graph_runner_, context_provider,
+ resource_provider_.get(), staging_resource_pool_.get());
return;
}
}
@@ -2098,7 +2095,7 @@ void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool(
resource_provider_.get(), GL_TEXTURE_2D);
*tile_task_worker_pool = PixelBufferTileTaskWorkerPool::Create(
- task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), context_provider,
+ task_runner, task_graph_runner_, context_provider,
resource_provider_.get(),
GetMaxTransferBufferUsageBytes(context_provider->ContextCapabilities(),
settings_.renderer_settings.refresh_rate));
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index b6e5903..2efe2da 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -142,6 +142,7 @@ class CC_EXPORT LayerTreeHostImpl
RenderingStatsInstrumentation* rendering_stats_instrumentation,
SharedBitmapManager* shared_bitmap_manager,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
+ TaskGraphRunner* task_graph_runner,
int id);
~LayerTreeHostImpl() override;
@@ -531,6 +532,7 @@ class CC_EXPORT LayerTreeHostImpl
RenderingStatsInstrumentation* rendering_stats_instrumentation,
SharedBitmapManager* shared_bitmap_manager,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
+ TaskGraphRunner* task_graph_runner,
int id);
// Virtual for testing.
@@ -734,6 +736,7 @@ class CC_EXPORT LayerTreeHostImpl
SharedBitmapManager* shared_bitmap_manager_;
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
+ TaskGraphRunner* task_graph_runner_;
int id_;
std::set<SwapPromiseMonitor*> swap_promise_monitor_;
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 1526f93..49628d1 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -54,6 +54,7 @@
#include "cc/test/render_pass_test_common.h"
#include "cc/test/test_gpu_memory_buffer_manager.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/test/test_web_graphics_context_3d.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/single_thread_proxy.h"
@@ -86,6 +87,7 @@ class LayerTreeHostImplTest : public testing::Test,
always_main_thread_blocked_(&proxy_),
shared_bitmap_manager_(new TestSharedBitmapManager),
gpu_memory_buffer_manager_(new TestGpuMemoryBufferManager),
+ task_graph_runner_(new TestTaskGraphRunner),
on_can_draw_state_changed_called_(false),
did_notify_ready_to_activate_(false),
did_request_commit_(false),
@@ -167,13 +169,10 @@ 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_,
- shared_bitmap_manager_.get(),
- gpu_memory_buffer_manager_.get(),
- 0);
+ host_impl_ = LayerTreeHostImpl::Create(
+ settings, this, &proxy_, &stats_instrumentation_,
+ shared_bitmap_manager_.get(), gpu_memory_buffer_manager_.get(),
+ task_graph_runner_.get(), 0);
bool init = host_impl_->InitializeRenderer(output_surface.Pass());
host_impl_->SetViewportSize(gfx::Size(10, 10));
return init;
@@ -395,6 +394,7 @@ class LayerTreeHostImplTest : public testing::Test,
scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_;
+ scoped_ptr<TestTaskGraphRunner> task_graph_runner_;
scoped_ptr<LayerTreeHostImpl> host_impl_;
FakeRenderingStatsInstrumentation stats_instrumentation_;
bool on_can_draw_state_changed_called_;
@@ -1547,6 +1547,7 @@ class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl {
rendering_stats_instrumentation,
manager,
NULL,
+ NULL,
0) {}
BeginFrameArgs CurrentBeginFrameArgs() const override {
@@ -5046,16 +5047,10 @@ TEST_F(LayerTreeHostImplTest, PartialSwapReceivesDamageRect) {
// that we can force partial swap enabled.
LayerTreeSettings settings;
settings.renderer_settings.partial_swap_enabled = true;
- scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
- new TestSharedBitmapManager());
scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl =
- LayerTreeHostImpl::Create(settings,
- this,
- &proxy_,
- &stats_instrumentation_,
- shared_bitmap_manager.get(),
- NULL,
- 0);
+ LayerTreeHostImpl::Create(
+ settings, this, &proxy_, &stats_instrumentation_,
+ shared_bitmap_manager_.get(), NULL, task_graph_runner_.get(), 0);
layer_tree_host_impl->InitializeRenderer(output_surface.Pass());
layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500));
@@ -5343,7 +5338,7 @@ static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity(
LayerTreeSettings settings;
settings.renderer_settings.partial_swap_enabled = partial_swap;
scoped_ptr<LayerTreeHostImpl> my_host_impl = LayerTreeHostImpl::Create(
- settings, client, proxy, stats_instrumentation, manager, NULL, 0);
+ settings, client, proxy, stats_instrumentation, manager, NULL, NULL, 0);
my_host_impl->InitializeRenderer(output_surface.Pass());
my_host_impl->SetViewportSize(gfx::Size(100, 100));
@@ -6669,13 +6664,10 @@ TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails) {
// doesn't support memory management extensions.
TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) {
LayerTreeSettings settings;
- host_impl_ = LayerTreeHostImpl::Create(settings,
- this,
- &proxy_,
- &stats_instrumentation_,
- shared_bitmap_manager_.get(),
- gpu_memory_buffer_manager_.get(),
- 0);
+ host_impl_ = LayerTreeHostImpl::Create(
+ settings, this, &proxy_, &stats_instrumentation_,
+ shared_bitmap_manager_.get(), gpu_memory_buffer_manager_.get(),
+ task_graph_runner_.get(), 0);
scoped_ptr<OutputSurface> output_surface(
FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create()));
@@ -6716,7 +6708,7 @@ TEST_F(LayerTreeHostImplTest, MemoryPolicy) {
LayerTreeSettings settings;
settings.gpu_rasterization_enabled = true;
host_impl_ = LayerTreeHostImpl::Create(
- settings, this, &proxy_, &stats_instrumentation_, NULL, NULL, 0);
+ settings, this, &proxy_, &stats_instrumentation_, NULL, NULL, NULL, 0);
host_impl_->SetUseGpuRasterization(true);
host_impl_->SetVisible(true);
host_impl_->SetMemoryPolicy(policy1);
@@ -6779,8 +6771,9 @@ class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest {
LayerTreeSettings settings;
settings.impl_side_painting = true;
- fake_host_impl_ = new FakeLayerTreeHostImpl(
- settings, &proxy_, shared_bitmap_manager_.get());
+ fake_host_impl_ = new FakeLayerTreeHostImpl(settings, &proxy_,
+ shared_bitmap_manager_.get(),
+ task_graph_runner_.get());
host_impl_.reset(fake_host_impl_);
host_impl_->InitializeRenderer(CreateOutputSurface());
host_impl_->SetViewportSize(gfx::Size(10, 10));
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 20ef496..415b23e 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -2209,7 +2209,7 @@ class LayerTreeHostWithProxy : public LayerTreeHost {
LayerTreeHostWithProxy(FakeLayerTreeHostClient* client,
const LayerTreeSettings& settings,
scoped_ptr<FakeProxy> proxy)
- : LayerTreeHost(client, NULL, NULL, settings) {
+ : LayerTreeHost(client, NULL, NULL, NULL, settings) {
proxy->SetLayerTreeHost(this);
client->SetLayerTreeHost(this);
InitializeForTesting(proxy.Pass());
@@ -2281,14 +2281,9 @@ TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) {
scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
new TestSharedBitmapManager());
- scoped_ptr<LayerTreeHost> host =
- LayerTreeHost::CreateSingleThreaded(&client,
- &client,
- shared_bitmap_manager.get(),
- NULL,
- settings,
- base::MessageLoopProxy::current(),
- nullptr);
+ scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded(
+ &client, &client, shared_bitmap_manager.get(), NULL, NULL, settings,
+ base::MessageLoopProxy::current(), nullptr);
client.SetLayerTreeHost(host.get());
host->Composite(base::TimeTicks::Now());
@@ -2305,14 +2300,9 @@ TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) {
scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
new TestSharedBitmapManager());
- scoped_ptr<LayerTreeHost> host =
- LayerTreeHost::CreateSingleThreaded(&client,
- &client,
- shared_bitmap_manager.get(),
- NULL,
- settings,
- base::MessageLoopProxy::current(),
- nullptr);
+ scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded(
+ &client, &client, shared_bitmap_manager.get(), NULL, NULL, settings,
+ base::MessageLoopProxy::current(), nullptr);
client.SetLayerTreeHost(host.get());
host->Composite(base::TimeTicks::Now());
@@ -2329,14 +2319,9 @@ TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) {
scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
new TestSharedBitmapManager());
- scoped_ptr<LayerTreeHost> host =
- LayerTreeHost::CreateSingleThreaded(&client,
- &client,
- shared_bitmap_manager.get(),
- NULL,
- settings,
- base::MessageLoopProxy::current(),
- nullptr);
+ scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded(
+ &client, &client, shared_bitmap_manager.get(), NULL, NULL, settings,
+ base::MessageLoopProxy::current(), nullptr);
client.SetLayerTreeHost(host.get());
host->Composite(base::TimeTicks::Now());
@@ -2354,14 +2339,9 @@ TEST(LayerTreeHostTest,
scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
new TestSharedBitmapManager());
- scoped_ptr<LayerTreeHost> host =
- LayerTreeHost::CreateSingleThreaded(&client,
- &client,
- shared_bitmap_manager.get(),
- NULL,
- settings,
- base::MessageLoopProxy::current(),
- nullptr);
+ scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded(
+ &client, &client, shared_bitmap_manager.get(), NULL, NULL, settings,
+ base::MessageLoopProxy::current(), nullptr);
client.SetLayerTreeHost(host.get());
host->Composite(base::TimeTicks::Now());
diff --git a/cc/trees/layer_tree_host_unittest_no_message_loop.cc b/cc/trees/layer_tree_host_unittest_no_message_loop.cc
index 622143d..3abc4dc 100644
--- a/cc/trees/layer_tree_host_unittest_no_message_loop.cc
+++ b/cc/trees/layer_tree_host_unittest_no_message_loop.cc
@@ -106,7 +106,7 @@ class LayerTreeHostNoMessageLoopTest
settings.verify_property_trees = true;
settings.raster_enabled = false;
layer_tree_host_ = LayerTreeHost::CreateSingleThreaded(
- this, this, nullptr, nullptr, settings, nullptr, nullptr);
+ this, this, nullptr, nullptr, nullptr, settings, nullptr, nullptr);
layer_tree_host_->SetViewportSize(size_);
layer_tree_host_->SetRootLayer(root_layer_);
}
diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc
index fce09d4..be972e9 100644
--- a/cc/trees/layer_tree_host_unittest_scroll.cc
+++ b/cc/trees/layer_tree_host_unittest_scroll.cc
@@ -1126,14 +1126,10 @@ TEST(LayerTreeHostFlingTest, DidStopFlingingThread) {
ASSERT_TRUE(impl_thread.message_loop_proxy().get());
scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
new TestSharedBitmapManager());
- scoped_ptr<LayerTreeHost> layer_tree_host =
- LayerTreeHost::CreateThreaded(&client,
- shared_bitmap_manager.get(),
- NULL,
- settings,
- base::MessageLoopProxy::current(),
- impl_thread.message_loop_proxy(),
- nullptr);
+ scoped_ptr<LayerTreeHost> layer_tree_host = LayerTreeHost::CreateThreaded(
+ &client, shared_bitmap_manager.get(), NULL, NULL, settings,
+ base::MessageLoopProxy::current(), impl_thread.message_loop_proxy(),
+ nullptr);
impl_thread.message_loop_proxy()
->PostTask(FROM_HERE,
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
index 06df3c2..c4abd52 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -13,6 +13,7 @@
#include "cc/test/geometry_test_utils.h"
#include "cc/test/layer_tree_host_common_test.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "cc/trees/layer_tree_host_impl.h"
#include "ui/gfx/geometry/size_conversions.h"
@@ -25,8 +26,8 @@ class LayerTreeImplTest : public LayerTreeHostCommonTest {
LayerTreeSettings settings;
settings.layer_transforms_should_scale_layer_contents = true;
settings.scrollbar_show_scale_threshold = 1.1f;
- host_impl_.reset(
- new FakeLayerTreeHostImpl(settings, &proxy_, &shared_bitmap_manager_));
+ host_impl_.reset(new FakeLayerTreeHostImpl(
+ settings, &proxy_, &shared_bitmap_manager_, &task_graph_runner_));
EXPECT_TRUE(host_impl_->InitializeRenderer(FakeOutputSurface::Create3d()));
}
@@ -40,6 +41,7 @@ class LayerTreeImplTest : public LayerTreeHostCommonTest {
private:
TestSharedBitmapManager shared_bitmap_manager_;
+ TestTaskGraphRunner task_graph_runner_;
FakeImplProxy proxy_;
scoped_ptr<FakeLayerTreeHostImpl> host_impl_;
};
diff --git a/cc/trees/layer_tree_settings.cc b/cc/trees/layer_tree_settings.cc
index d10a141..09314adc 100644
--- a/cc/trees/layer_tree_settings.cc
+++ b/cc/trees/layer_tree_settings.cc
@@ -70,7 +70,8 @@ LayerTreeSettings::LayerTreeSettings()
use_occlusion_for_tile_prioritization(false),
record_full_layer(false),
use_display_lists(false),
- verify_property_trees(false) {
+ verify_property_trees(false),
+ gather_pixel_refs(false) {
}
LayerTreeSettings::~LayerTreeSettings() {}
diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h
index c3dd38e5..1f61f89 100644
--- a/cc/trees/layer_tree_settings.h
+++ b/cc/trees/layer_tree_settings.h
@@ -83,6 +83,7 @@ class CC_EXPORT LayerTreeSettings {
bool record_full_layer;
bool use_display_lists;
bool verify_property_trees;
+ bool gather_pixel_refs;
LayerTreeDebugState initial_debug_state;
diff --git a/cc/trees/occlusion_tracker_perftest.cc b/cc/trees/occlusion_tracker_perftest.cc
index e53a05f..854dacd 100644
--- a/cc/trees/occlusion_tracker_perftest.cc
+++ b/cc/trees/occlusion_tracker_perftest.cc
@@ -36,13 +36,9 @@ class OcclusionTrackerPerfTest : public testing::Test {
void CreateHost() {
LayerTreeSettings settings;
shared_bitmap_manager_.reset(new TestSharedBitmapManager());
- host_impl_ = LayerTreeHostImpl::Create(settings,
- &client_,
- &proxy_,
- &stats_,
- shared_bitmap_manager_.get(),
- NULL,
- 1);
+ host_impl_ =
+ LayerTreeHostImpl::Create(settings, &client_, &proxy_, &stats_,
+ shared_bitmap_manager_.get(), NULL, NULL, 1);
host_impl_->InitializeRenderer(FakeOutputSurface::Create3d());
scoped_ptr<LayerImpl> root_layer = LayerImpl::Create(active_tree(), 1);
diff --git a/cc/trees/tree_synchronizer_unittest.cc b/cc/trees/tree_synchronizer_unittest.cc
index d48f821..a17bec8 100644
--- a/cc/trees/tree_synchronizer_unittest.cc
+++ b/cc/trees/tree_synchronizer_unittest.cc
@@ -556,13 +556,8 @@ TEST_F(TreeSynchronizerTest, SynchronizeAnimations) {
scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
new TestSharedBitmapManager());
scoped_ptr<LayerTreeHostImpl> host_impl =
- LayerTreeHostImpl::Create(settings,
- NULL,
- &proxy,
- &stats_instrumentation,
- shared_bitmap_manager.get(),
- NULL,
- 0);
+ LayerTreeHostImpl::Create(settings, NULL, &proxy, &stats_instrumentation,
+ shared_bitmap_manager.get(), NULL, NULL, 0);
scoped_refptr<Layer> layer_tree_root = Layer::Create();
host_->SetRootLayer(layer_tree_root);
@@ -595,13 +590,8 @@ TEST_F(TreeSynchronizerTest, SynchronizeScrollParent) {
scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
new TestSharedBitmapManager());
scoped_ptr<LayerTreeHostImpl> host_impl =
- LayerTreeHostImpl::Create(settings,
- NULL,
- &proxy,
- &stats_instrumentation,
- shared_bitmap_manager.get(),
- NULL,
- 0);
+ LayerTreeHostImpl::Create(settings, NULL, &proxy, &stats_instrumentation,
+ shared_bitmap_manager.get(), NULL, NULL, 0);
scoped_refptr<Layer> layer_tree_root = Layer::Create();
scoped_refptr<Layer> scroll_parent = Layer::Create();
@@ -668,13 +658,8 @@ TEST_F(TreeSynchronizerTest, SynchronizeClipParent) {
scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
new TestSharedBitmapManager());
scoped_ptr<LayerTreeHostImpl> host_impl =
- LayerTreeHostImpl::Create(settings,
- NULL,
- &proxy,
- &stats_instrumentation,
- shared_bitmap_manager.get(),
- NULL,
- 0);
+ LayerTreeHostImpl::Create(settings, NULL, &proxy, &stats_instrumentation,
+ shared_bitmap_manager.get(), NULL, NULL, 0);
scoped_refptr<Layer> layer_tree_root = Layer::Create();
scoped_refptr<Layer> clip_parent = Layer::Create();
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc
index dfb1041..f0cc4f7 100644
--- a/content/browser/compositor/gpu_process_transport_factory.cc
+++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -12,9 +12,11 @@
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/profiler/scoped_tracker.h"
+#include "base/threading/simple_thread.h"
#include "base/threading/thread.h"
#include "cc/output/compositor_frame.h"
#include "cc/output/output_surface.h"
+#include "cc/resources/task_graph_runner.h"
#include "cc/surfaces/onscreen_display_client.h"
#include "cc/surfaces/surface_display_output_surface.h"
#include "cc/surfaces/surface_manager.h"
@@ -65,6 +67,24 @@ using gpu::gles2::GLES2Interface;
static const int kNumRetriesBeforeSoftwareFallback = 4;
namespace content {
+namespace {
+
+class RasterThread : public base::SimpleThread {
+ public:
+ RasterThread(cc::TaskGraphRunner* task_graph_runner)
+ : base::SimpleThread("UICompositorWorker"),
+ task_graph_runner_(task_graph_runner) {}
+
+ // Overridden from base::SimpleThread:
+ void Run() override { task_graph_runner_->Run(); }
+
+ private:
+ cc::TaskGraphRunner* task_graph_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(RasterThread);
+};
+
+} // namespace
struct GpuProcessTransportFactory::PerCompositorData {
int surface_id;
@@ -77,9 +97,15 @@ struct GpuProcessTransportFactory::PerCompositorData {
GpuProcessTransportFactory::GpuProcessTransportFactory()
: next_surface_id_namespace_(1u),
+ task_graph_runner_(new cc::TaskGraphRunner),
callback_factory_(this) {
if (UseSurfacesEnabled())
surface_manager_ = make_scoped_ptr(new cc::SurfaceManager);
+
+ if (ui::IsUIImplSidePaintingEnabled()) {
+ raster_thread_.reset(new RasterThread(task_graph_runner_.get()));
+ raster_thread_->Start();
+ }
}
GpuProcessTransportFactory::~GpuProcessTransportFactory() {
@@ -87,6 +113,10 @@ GpuProcessTransportFactory::~GpuProcessTransportFactory() {
// Make sure the lost context callback doesn't try to run during destruction.
callback_factory_.InvalidateWeakPtrs();
+
+ task_graph_runner_->Shutdown();
+ if (raster_thread_)
+ raster_thread_->Join();
}
scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
@@ -371,6 +401,10 @@ GpuProcessTransportFactory::GetGpuMemoryBufferManager() {
return BrowserGpuMemoryBufferManager::current();
}
+cc::TaskGraphRunner* GpuProcessTransportFactory::GetTaskGraphRunner() {
+ return task_graph_runner_.get();
+}
+
ui::ContextFactory* GpuProcessTransportFactory::GetContextFactory() {
return this;
}
diff --git a/content/browser/compositor/gpu_process_transport_factory.h b/content/browser/compositor/gpu_process_transport_factory.h
index f96e766..7ed1af6 100644
--- a/content/browser/compositor/gpu_process_transport_factory.h
+++ b/content/browser/compositor/gpu_process_transport_factory.h
@@ -17,6 +17,7 @@
#include "ui/compositor/compositor.h"
namespace base {
+class SimpleThread;
class Thread;
}
@@ -53,6 +54,7 @@ class GpuProcessTransportFactory
uint32 GetImageTextureTarget() override;
cc::SharedBitmapManager* GetSharedBitmapManager() override;
gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
+ cc::TaskGraphRunner* GetTaskGraphRunner() override;
scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() override;
void ResizeDisplay(ui::Compositor* compositor,
const gfx::Size& size) override;
@@ -91,6 +93,8 @@ class GpuProcessTransportFactory
ObserverList<ImageTransportFactoryObserver> observer_list_;
scoped_ptr<cc::SurfaceManager> surface_manager_;
uint32_t next_surface_id_namespace_;
+ scoped_ptr<cc::TaskGraphRunner> task_graph_runner_;
+ scoped_ptr<base::SimpleThread> raster_thread_;
// The contents of this map and its methods may only be used on the compositor
// thread.
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index 010f8e2..33e5b5c 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -18,6 +18,7 @@
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/synchronization/lock.h"
+#include "base/threading/simple_thread.h"
#include "base/threading/thread.h"
#include "base/threading/thread_checker.h"
#include "cc/base/switches.h"
@@ -27,6 +28,7 @@
#include "cc/output/context_provider.h"
#include "cc/output/output_surface.h"
#include "cc/output/output_surface_client.h"
+#include "cc/resources/task_graph_runner.h"
#include "cc/scheduler/begin_frame_source.h"
#include "cc/surfaces/onscreen_display_client.h"
#include "cc/surfaces/surface_display_output_surface.h"
@@ -137,6 +139,29 @@ base::LazyInstance<cc::SurfaceManager> g_surface_manager =
int g_surface_id_namespace = 0;
+class SingleThreadTaskGraphRunner
+ : public cc::TaskGraphRunner,
+ public base::DelegateSimpleThread::Delegate {
+ public:
+ SingleThreadTaskGraphRunner() : worker_thread_(this, "CompositorWorker") {
+ worker_thread_.Start();
+ }
+
+ ~SingleThreadTaskGraphRunner() override {
+ Shutdown();
+ worker_thread_.Join();
+ }
+
+ private:
+ // Overridden from base::DelegateSimpleThread::Delegate:
+ void Run() override { cc::TaskGraphRunner::Run(); }
+
+ base::DelegateSimpleThread worker_thread_;
+};
+
+base::LazyInstance<SingleThreadTaskGraphRunner> g_task_graph_runner =
+ LAZY_INSTANCE_INITIALIZER;
+
} // anonymous namespace
// static
@@ -395,13 +420,9 @@ void CompositorImpl::CreateLayerTreeHost() {
settings.single_thread_proxy_scheduler = false;
host_ = cc::LayerTreeHost::CreateSingleThreaded(
- this,
- this,
- HostSharedBitmapManager::current(),
- BrowserGpuMemoryBufferManager::current(),
- settings,
- base::MessageLoopProxy::current(),
- nullptr);
+ this, this, HostSharedBitmapManager::current(),
+ BrowserGpuMemoryBufferManager::current(), g_task_graph_runner.Pointer(),
+ settings, base::MessageLoopProxy::current(), nullptr);
host_->SetRootLayer(root_layer_);
host_->SetVisible(true);
diff --git a/content/renderer/gpu/compositor_dependencies.h b/content/renderer/gpu/compositor_dependencies.h
index 9aae19f..ae2e4e5 100644
--- a/content/renderer/gpu/compositor_dependencies.h
+++ b/content/renderer/gpu/compositor_dependencies.h
@@ -16,6 +16,7 @@ namespace cc {
class BeginFrameSource;
class ContextProvider;
class SharedBitmapManager;
+class TaskGraphRunner;
}
namespace gpu {
@@ -52,6 +53,8 @@ class CompositorDependencies {
virtual cc::ContextProvider* GetSharedMainThreadContextProvider() = 0;
virtual scoped_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource(
int routing_id) = 0;
+ virtual cc::TaskGraphRunner* GetTaskGraphRunner() = 0;
+ virtual bool IsGatherPixelRefsEnabled() = 0;
virtual ~CompositorDependencies() {}
};
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc
index 3c0711a..56e655c 100644
--- a/content/renderer/gpu/render_widget_compositor.cc
+++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -269,6 +269,7 @@ void RenderWidgetCompositor::Initialize() {
settings.enable_elastic_overscroll =
compositor_deps_->IsElasticOverscrollEnabled();
settings.use_image_texture_target = compositor_deps_->GetImageTextureTarget();
+ settings.gather_pixel_refs = compositor_deps_->IsGatherPixelRefsEnabled();
if (cmd->HasSwitch(cc::switches::kTopControlsShowThreshold)) {
std::string top_threshold_str =
@@ -442,6 +443,8 @@ void RenderWidgetCompositor::Initialize() {
compositor_deps_->GetSharedBitmapManager();
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager =
compositor_deps_->GetGpuMemoryBufferManager();
+ cc::TaskGraphRunner* task_graph_runner =
+ compositor_deps_->GetTaskGraphRunner();
scoped_ptr<cc::BeginFrameSource> external_begin_frame_source;
if (settings.use_external_begin_frame_source) {
@@ -451,13 +454,14 @@ void RenderWidgetCompositor::Initialize() {
if (compositor_thread_task_runner.get()) {
layer_tree_host_ = cc::LayerTreeHost::CreateThreaded(
- this, shared_bitmap_manager, gpu_memory_buffer_manager, settings,
- main_thread_compositor_task_runner, compositor_thread_task_runner,
- external_begin_frame_source.Pass());
+ this, shared_bitmap_manager, gpu_memory_buffer_manager,
+ task_graph_runner, settings, main_thread_compositor_task_runner,
+ compositor_thread_task_runner, external_begin_frame_source.Pass());
} else {
layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded(
- this, this, shared_bitmap_manager, gpu_memory_buffer_manager, settings,
- main_thread_compositor_task_runner, external_begin_frame_source.Pass());
+ this, this, shared_bitmap_manager, gpu_memory_buffer_manager,
+ task_graph_runner, settings, main_thread_compositor_task_runner,
+ external_begin_frame_source.Pass());
}
DCHECK(layer_tree_host_);
}
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 4c739b3..498c4ca 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -24,6 +24,7 @@
#include "base/strings/string_tokenizer.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/threading/simple_thread.h"
#include "base/threading/thread_local.h"
#include "base/threading/thread_restrictions.h"
#include "base/trace_event/trace_event.h"
@@ -252,6 +253,22 @@ class RenderViewZoomer : public RenderViewVisitor {
DISALLOW_COPY_AND_ASSIGN(RenderViewZoomer);
};
+class CompositorRasterThread : public base::SimpleThread {
+ public:
+ CompositorRasterThread(cc::TaskGraphRunner* task_graph_runner,
+ const std::string& name_prefix)
+ : base::SimpleThread(name_prefix),
+ task_graph_runner_(task_graph_runner) {}
+
+ // Overridden from base::SimpleThread:
+ void Run() override { task_graph_runner_->Run(); }
+
+ private:
+ cc::TaskGraphRunner* task_graph_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(CompositorRasterThread);
+};
+
std::string HostToCustomHistogramSuffix(const std::string& host) {
if (host == "mail.google.com")
return ".gmail";
@@ -620,6 +637,10 @@ void RenderThreadImpl::Init() {
memory_pressure_listener_.reset(new base::MemoryPressureListener(
base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this))));
+ compositor_task_graph_runner_.reset(new cc::TaskGraphRunner);
+
+ is_gather_pixel_refs_enabled_ = false;
+
if (is_impl_side_painting_enabled_) {
int num_raster_threads = 0;
std::string string_value =
@@ -629,19 +650,30 @@ void RenderThreadImpl::Init() {
DCHECK(parsed_num_raster_threads) << string_value;
DCHECK_GT(num_raster_threads, 0);
- // In single process, browser compositor already initialized and set up
- // worker threads, can't change the number later for the renderer compistor
- // in the same process.
- if (!command_line.HasSwitch(switches::kSingleProcess))
- cc::TileTaskWorkerPool::SetNumWorkerThreads(num_raster_threads);
-
+ // Note: Currently, gathering of pixel refs when using a single
+ // raster thread doesn't provide any benefit. This might change
+ // in the future but we avoid it for now to reduce the cost of
+ // Picture::Create.
+ is_gather_pixel_refs_enabled_ = num_raster_threads > 1;
+
+ while (compositor_raster_threads_.size() <
+ static_cast<size_t>(num_raster_threads)) {
+ scoped_ptr<CompositorRasterThread> raster_thread(
+ new CompositorRasterThread(
+ compositor_task_graph_runner_.get(),
+ base::StringPrintf(
+ "CompositorWorker%u",
+ static_cast<unsigned>(compositor_raster_threads_.size() + 1))
+ .c_str()));
+ raster_thread->Start();
#if defined(OS_ANDROID) || defined(OS_LINUX)
- if (!command_line.HasSwitch(
- switches::kUseNormalPriorityForTileTaskWorkerThreads)) {
- cc::TileTaskWorkerPool::SetWorkerThreadPriority(
- base::kThreadPriority_Background);
- }
+ if (!command_line.HasSwitch(
+ switches::kUseNormalPriorityForTileTaskWorkerThreads)) {
+ raster_thread->SetThreadPriority(base::kThreadPriority_Background);
+ }
#endif
+ compositor_raster_threads_.push_back(raster_thread.Pass());
+ }
}
// In single process, browser main loop set up the discardable memory
@@ -722,6 +754,14 @@ void RenderThreadImpl::Shutdown() {
compositor_thread_.reset();
+ // Shutdown raster threads.
+ compositor_task_graph_runner_->Shutdown();
+ while (!compositor_raster_threads_.empty()) {
+ compositor_raster_threads_.back()->Join();
+ compositor_raster_threads_.pop_back();
+ }
+ compositor_task_graph_runner_.reset();
+
main_input_callback_.Cancel();
input_handler_manager_.reset();
if (input_event_filter_.get()) {
@@ -1393,6 +1433,14 @@ RenderThreadImpl::CreateExternalBeginFrameSource(int routing_id) {
compositor_message_filter_.get(), sync_message_filter(), routing_id));
}
+cc::TaskGraphRunner* RenderThreadImpl::GetTaskGraphRunner() {
+ return compositor_task_graph_runner_.get();
+}
+
+bool RenderThreadImpl::IsGatherPixelRefsEnabled() {
+ return is_gather_pixel_refs_enabled_;
+}
+
bool RenderThreadImpl::IsMainThread() {
return !!current();
}
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index 8d56582e..2ebf6fe 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -55,6 +55,7 @@ class Thread;
namespace cc {
class ContextProvider;
+class TaskGraphRunner;
}
namespace cc_blink {
@@ -200,6 +201,8 @@ class CONTENT_EXPORT RenderThreadImpl
cc::ContextProvider* GetSharedMainThreadContextProvider() override;
scoped_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource(
int routing_id) override;
+ cc::TaskGraphRunner* GetTaskGraphRunner() override;
+ bool IsGatherPixelRefsEnabled() override;
// Synchronously establish a channel to the GPU plugin if not previously
// established or if it has been lost (for example if the GPU plugin crashed).
@@ -562,6 +565,9 @@ class CONTENT_EXPORT RenderThreadImpl
// regardless of whether |compositor_thread_| is overriden.
scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy_;
+ // Threads used by compositor for rasterization.
+ ScopedVector<base::SimpleThread> compositor_raster_threads_;
+
base::CancelableCallback<void(const IPC::Message&)> main_input_callback_;
scoped_refptr<IPC::MessageFilter> input_event_filter_;
scoped_ptr<InputHandlerManager> input_handler_manager_;
@@ -592,6 +598,8 @@ class CONTENT_EXPORT RenderThreadImpl
scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_;
+ scoped_ptr<cc::TaskGraphRunner> compositor_task_graph_runner_;
+
// Compositor settings.
bool is_gpu_rasterization_enabled_;
bool is_gpu_rasterization_forced_;
@@ -604,6 +612,7 @@ class CONTENT_EXPORT RenderThreadImpl
bool is_one_copy_enabled_;
bool is_elastic_overscroll_enabled_;
unsigned use_image_texture_target_;
+ bool is_gather_pixel_refs_enabled_;
class PendingRenderFrameConnect
: public base::RefCounted<PendingRenderFrameConnect>,
diff --git a/content/test/fake_compositor_dependencies.cc b/content/test/fake_compositor_dependencies.cc
index e33b7ef..19613f0 100644
--- a/content/test/fake_compositor_dependencies.cc
+++ b/content/test/fake_compositor_dependencies.cc
@@ -14,6 +14,9 @@ FakeCompositorDependencies::FakeCompositorDependencies()
: use_single_thread_scheduler_(true) {
}
+FakeCompositorDependencies::~FakeCompositorDependencies() {
+}
+
bool FakeCompositorDependencies::IsImplSidePaintingEnabled() {
return true;
}
@@ -97,4 +100,12 @@ FakeCompositorDependencies::CreateExternalBeginFrameSource(int routing_id) {
return make_scoped_ptr(new cc::FakeExternalBeginFrameSource(refresh_rate));
}
+cc::TaskGraphRunner* FakeCompositorDependencies::GetTaskGraphRunner() {
+ return &task_graph_runner_;
+}
+
+bool FakeCompositorDependencies::IsGatherPixelRefsEnabled() {
+ return false;
+}
+
} // namespace content
diff --git a/content/test/fake_compositor_dependencies.h b/content/test/fake_compositor_dependencies.h
index 935c610..8c3bf59 100644
--- a/content/test/fake_compositor_dependencies.h
+++ b/content/test/fake_compositor_dependencies.h
@@ -7,6 +7,7 @@
#include "cc/test/test_gpu_memory_buffer_manager.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "content/renderer/gpu/compositor_dependencies.h"
#include "content/test/fake_renderer_scheduler.h"
@@ -15,6 +16,7 @@ namespace content {
class FakeCompositorDependencies : public CompositorDependencies {
public:
FakeCompositorDependencies();
+ ~FakeCompositorDependencies() override;
// CompositorDependencies implementation.
bool IsImplSidePaintingEnabled() override;
@@ -39,6 +41,8 @@ class FakeCompositorDependencies : public CompositorDependencies {
cc::ContextProvider* GetSharedMainThreadContextProvider() override;
scoped_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource(
int routing_id) override;
+ cc::TaskGraphRunner* GetTaskGraphRunner() override;
+ bool IsGatherPixelRefsEnabled() override;
void set_use_single_thread_scheduler(bool use) {
use_single_thread_scheduler_ = use;
@@ -47,6 +51,7 @@ class FakeCompositorDependencies : public CompositorDependencies {
private:
cc::TestSharedBitmapManager shared_bitmap_manager_;
cc::TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
+ cc::TestTaskGraphRunner task_graph_runner_;
FakeRendererScheduler renderer_scheduler_;
bool use_single_thread_scheduler_;
diff --git a/content/test/web_layer_tree_view_impl_for_testing.cc b/content/test/web_layer_tree_view_impl_for_testing.cc
index fb77dc1..20da3cd 100644
--- a/content/test/web_layer_tree_view_impl_for_testing.cc
+++ b/content/test/web_layer_tree_view_impl_for_testing.cc
@@ -44,13 +44,8 @@ void WebLayerTreeViewImplForTesting::Initialize() {
// Accelerated animations are enabled for unit tests.
settings.accelerated_animation_enabled = true;
layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded(
- this,
- this,
- nullptr,
- nullptr,
- settings,
- base::MessageLoopProxy::current(),
- nullptr);
+ this, this, nullptr, nullptr, nullptr, settings,
+ base::MessageLoopProxy::current(), nullptr);
DCHECK(layer_tree_host_);
}
diff --git a/mojo/services/html_viewer/weblayertreeview_impl.cc b/mojo/services/html_viewer/weblayertreeview_impl.cc
index 5769982..c529dfe 100644
--- a/mojo/services/html_viewer/weblayertreeview_impl.cc
+++ b/mojo/services/html_viewer/weblayertreeview_impl.cc
@@ -36,11 +36,13 @@ WebLayerTreeViewImpl::WebLayerTreeViewImpl(
cc::SharedBitmapManager* shared_bitmap_manager = NULL;
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = NULL;
+ cc::TaskGraphRunner* task_graph_runner = NULL;
layer_tree_host_ =
cc::LayerTreeHost::CreateThreaded(this,
shared_bitmap_manager,
gpu_memory_buffer_manager,
+ task_graph_runner,
settings,
base::MessageLoopProxy::current(),
compositor_message_loop_proxy,
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index 6102013..a380c41 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -134,12 +134,15 @@ Compositor::Compositor(gfx::AcceleratedWidget widget,
settings.use_zero_copy = IsUIZeroCopyEnabled();
settings.use_one_copy = IsUIOneCopyEnabled();
settings.use_image_texture_target = context_factory_->GetImageTextureTarget();
+ // Note: gathering of pixel refs is only needed when using multiple
+ // raster threads.
+ settings.gather_pixel_refs = false;
base::TimeTicks before_create = base::TimeTicks::Now();
host_ = cc::LayerTreeHost::CreateSingleThreaded(
this, this, context_factory_->GetSharedBitmapManager(),
- context_factory_->GetGpuMemoryBufferManager(), settings, task_runner_,
- nullptr);
+ context_factory_->GetGpuMemoryBufferManager(),
+ context_factory_->GetTaskGraphRunner(), settings, task_runner_, nullptr);
UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor",
base::TimeTicks::Now() - before_create);
host_->SetRootLayer(root_web_layer_);
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
index f46b496..5a6d932 100644
--- a/ui/compositor/compositor.h
+++ b/ui/compositor/compositor.h
@@ -40,6 +40,7 @@ class LayerTreeHost;
class RendererSettings;
class SharedBitmapManager;
class SurfaceIdAllocator;
+class TaskGraphRunner;
}
namespace gfx {
@@ -100,6 +101,9 @@ class COMPOSITOR_EXPORT ContextFactory {
// Gets the GPU memory buffer manager.
virtual gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() = 0;
+ // Gets the task graph runner.
+ virtual cc::TaskGraphRunner* GetTaskGraphRunner() = 0;
+
// Creates a Surface ID allocator with a new namespace.
virtual scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() = 0;
diff --git a/ui/compositor/test/in_process_context_factory.cc b/ui/compositor/test/in_process_context_factory.cc
index e9ba92e..145e25f 100644
--- a/ui/compositor/test/in_process_context_factory.cc
+++ b/ui/compositor/test/in_process_context_factory.cc
@@ -188,6 +188,10 @@ InProcessContextFactory::GetGpuMemoryBufferManager() {
return &gpu_memory_buffer_manager_;
}
+cc::TaskGraphRunner* InProcessContextFactory::GetTaskGraphRunner() {
+ return &task_graph_runner_;
+}
+
scoped_ptr<cc::SurfaceIdAllocator>
InProcessContextFactory::CreateSurfaceIdAllocator() {
return make_scoped_ptr(
diff --git a/ui/compositor/test/in_process_context_factory.h b/ui/compositor/test/in_process_context_factory.h
index 7be5078..fdfb5cd 100644
--- a/ui/compositor/test/in_process_context_factory.h
+++ b/ui/compositor/test/in_process_context_factory.h
@@ -7,6 +7,7 @@
#include "cc/test/test_gpu_memory_buffer_manager.h"
#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "ui/compositor/compositor.h"
namespace base {
@@ -47,6 +48,7 @@ class InProcessContextFactory : public ContextFactory {
uint32 GetImageTextureTarget() override;
cc::SharedBitmapManager* GetSharedBitmapManager() override;
gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
+ cc::TaskGraphRunner* GetTaskGraphRunner() override;
scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() override;
void ResizeDisplay(ui::Compositor* compositor,
const gfx::Size& size) override;
@@ -55,6 +57,7 @@ class InProcessContextFactory : public ContextFactory {
scoped_refptr<cc::ContextProvider> shared_main_thread_contexts_;
cc::TestSharedBitmapManager shared_bitmap_manager_;
cc::TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
+ cc::TestTaskGraphRunner task_graph_runner_;
uint32_t next_surface_id_namespace_;
bool use_test_surface_;
bool context_factory_for_test_;