summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc5
-rw-r--r--cc/animation/scrollbar_animation_controller_thinning_unittest.cc5
-rw-r--r--cc/cc_tests.gyp2
-rw-r--r--cc/debug/micro_benchmark_controller_unittest.cc6
-rw-r--r--cc/input/top_controls_manager_unittest.cc4
-rw-r--r--cc/layers/delegated_renderer_layer_impl_unittest.cc5
-rw-r--r--cc/layers/heads_up_display_layer_impl_unittest.cc4
-rw-r--r--cc/layers/layer_impl_unittest.cc18
-rw-r--r--cc/layers/layer_perftest.cc3
-rw-r--r--cc/layers/layer_position_constraint_unittest.cc5
-rw-r--r--cc/layers/layer_unittest.cc17
-rw-r--r--cc/layers/layer_utils_unittest.cc4
-rw-r--r--cc/layers/nine_patch_layer_impl_unittest.cc3
-rw-r--r--cc/layers/nine_patch_layer_unittest.cc1
-rw-r--r--cc/layers/picture_image_layer_impl_unittest.cc6
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc8
-rw-r--r--cc/layers/picture_layer_unittest.cc4
-rw-r--r--cc/layers/render_surface_unittest.cc10
-rw-r--r--cc/layers/scrollbar_layer_unittest.cc4
-rw-r--r--cc/layers/solid_color_layer_impl_unittest.cc10
-rw-r--r--cc/layers/texture_layer_unittest.cc5
-rw-r--r--cc/layers/tiled_layer_impl_unittest.cc3
-rw-r--r--cc/layers/tiled_layer_unittest.cc12
-rw-r--r--cc/layers/ui_resource_layer_impl_unittest.cc10
-rw-r--r--cc/output/gl_renderer_unittest.cc88
-rw-r--r--cc/output/software_renderer_unittest.cc7
-rw-r--r--cc/resources/picture_layer_tiling_set_unittest.cc7
-rw-r--r--cc/resources/prioritized_resource_unittest.cc7
-rw-r--r--cc/resources/prioritized_tile_set_unittest.cc11
-rw-r--r--cc/resources/raster_worker_pool_perftest.cc9
-rw-r--r--cc/resources/raster_worker_pool_unittest.cc9
-rw-r--r--cc/resources/resource_provider_unittest.cc136
-rw-r--r--cc/resources/resource_update_controller_unittest.cc7
-rw-r--r--cc/resources/scoped_resource_unittest.cc25
-rw-r--r--cc/resources/shared_bitmap_manager.h1
-rw-r--r--cc/resources/tile_manager_perftest.cc7
-rw-r--r--cc/resources/tile_manager_unittest.cc10
-rw-r--r--cc/resources/video_resource_updater_unittest.cc7
-rw-r--r--cc/test/fake_layer_tree_host.cc5
-rw-r--r--cc/test/fake_layer_tree_host.h7
-rw-r--r--cc/test/fake_layer_tree_host_impl.cc11
-rw-r--r--cc/test/fake_layer_tree_host_impl.h6
-rw-r--r--cc/test/fake_ui_resource_layer_tree_host_impl.cc6
-rw-r--r--cc/test/fake_ui_resource_layer_tree_host_impl.h3
-rw-r--r--cc/test/layer_tree_json_parser_unittest.cc6
-rw-r--r--cc/test/layer_tree_test.cc27
-rw-r--r--cc/test/pixel_test.cc18
-rw-r--r--cc/test/pixel_test.h2
-rw-r--r--cc/test/test_shared_bitmap_manager.cc51
-rw-r--r--cc/test/test_shared_bitmap_manager.h37
-rw-r--r--cc/trees/damage_tracker_unittest.cc4
-rw-r--r--cc/trees/layer_sorter_unittest.cc7
-rw-r--r--cc/trees/layer_tree_host_common_unittest.cc96
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc61
-rw-r--r--cc/trees/layer_tree_host_unittest.cc25
-rw-r--r--cc/trees/layer_tree_host_unittest_context.cc5
-rw-r--r--cc/trees/layer_tree_host_unittest_scroll.cc10
-rw-r--r--cc/trees/occlusion_tracker_perftest.cc5
-rw-r--r--cc/trees/quad_culler_unittest.cc5
-rw-r--r--cc/trees/tree_synchronizer_unittest.cc34
60 files changed, 622 insertions, 294 deletions
diff --git a/cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc b/cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc
index 9fdb2e9..05e6155 100644
--- a/cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc
+++ b/cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc
@@ -7,6 +7,7 @@
#include "cc/layers/solid_color_scrollbar_layer_impl.h"
#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 "testing/gtest/include/gtest/gtest.h"
namespace cc {
@@ -14,7 +15,8 @@ namespace {
class ScrollbarAnimationControllerLinearFadeTest : public testing::Test {
public:
- ScrollbarAnimationControllerLinearFadeTest() : host_impl_(&proxy_) {}
+ ScrollbarAnimationControllerLinearFadeTest()
+ : host_impl_(&proxy_, &shared_bitmap_manager_) {}
protected:
virtual void SetUp() {
@@ -48,6 +50,7 @@ class ScrollbarAnimationControllerLinearFadeTest : public testing::Test {
}
FakeImplProxy proxy_;
+ TestSharedBitmapManager shared_bitmap_manager_;
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 c50c9b4..383ce22 100644
--- a/cc/animation/scrollbar_animation_controller_thinning_unittest.cc
+++ b/cc/animation/scrollbar_animation_controller_thinning_unittest.cc
@@ -7,6 +7,7 @@
#include "cc/layers/solid_color_scrollbar_layer_impl.h"
#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 "testing/gtest/include/gtest/gtest.h"
namespace cc {
@@ -14,7 +15,8 @@ namespace {
class ScrollbarAnimationControllerThinningTest : public testing::Test {
public:
- ScrollbarAnimationControllerThinningTest() : host_impl_(&proxy_) {}
+ ScrollbarAnimationControllerThinningTest()
+ : host_impl_(&proxy_, &shared_bitmap_manager_) {}
protected:
virtual void SetUp() {
@@ -49,6 +51,7 @@ class ScrollbarAnimationControllerThinningTest : public testing::Test {
}
FakeImplProxy proxy_;
+ TestSharedBitmapManager shared_bitmap_manager_;
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 7c29f9c..d7e6e72 100644
--- a/cc/cc_tests.gyp
+++ b/cc/cc_tests.gyp
@@ -212,6 +212,8 @@
'test/test_gles2_interface.cc',
'test/test_gles2_interface.h',
'test/test_occlusion_tracker.h',
+ 'test/test_shared_bitmap_manager.cc',
+ 'test/test_shared_bitmap_manager.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 4894947..9af2d8d 100644
--- a/cc/debug/micro_benchmark_controller_unittest.cc
+++ b/cc/debug/micro_benchmark_controller_unittest.cc
@@ -20,8 +20,9 @@ class MicroBenchmarkControllerTest : public testing::Test {
public:
virtual void SetUp() OVERRIDE {
impl_proxy_ = make_scoped_ptr(new FakeImplProxy);
- layer_tree_host_impl_ =
- make_scoped_ptr(new FakeLayerTreeHostImpl(impl_proxy_.get()));
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
+ layer_tree_host_impl_ = make_scoped_ptr(new FakeLayerTreeHostImpl(
+ impl_proxy_.get(), shared_bitmap_manager_.get()));
layer_tree_host_ = FakeLayerTreeHost::Create();
layer_tree_host_->SetRootLayer(Layer::Create());
@@ -35,6 +36,7 @@ class MicroBenchmarkControllerTest : public testing::Test {
}
scoped_ptr<FakeLayerTreeHost> layer_tree_host_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<FakeLayerTreeHostImpl> layer_tree_host_impl_;
scoped_ptr<FakeImplProxy> impl_proxy_;
};
diff --git a/cc/input/top_controls_manager_unittest.cc b/cc/input/top_controls_manager_unittest.cc
index 74687ad..28155d3 100644
--- a/cc/input/top_controls_manager_unittest.cc
+++ b/cc/input/top_controls_manager_unittest.cc
@@ -10,6 +10,7 @@
#include "cc/layers/layer_impl.h"
#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/trees/layer_tree_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/frame_time.h"
@@ -24,7 +25,7 @@ class MockTopControlsManagerClient : public TopControlsManagerClient {
public:
MockTopControlsManagerClient(float top_controls_show_threshold,
float top_controls_hide_threshold)
- : host_impl_(&proxy_),
+ : host_impl_(&proxy_, &shared_bitmap_manager_),
redraw_needed_(false),
update_draw_properties_needed_(false),
top_controls_show_threshold_(top_controls_show_threshold),
@@ -60,6 +61,7 @@ class MockTopControlsManagerClient : public TopControlsManagerClient {
private:
FakeImplProxy proxy_;
+ TestSharedBitmapManager shared_bitmap_manager_;
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 84a862f..fea1531 100644
--- a/cc/layers/delegated_renderer_layer_impl_unittest.cc
+++ b/cc/layers/delegated_renderer_layer_impl_unittest.cc
@@ -19,6 +19,7 @@
#include "cc/test/mock_quad_culler.h"
#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_web_graphics_context_3d.h"
#include "cc/trees/layer_tree_host_impl.h"
#include "cc/trees/layer_tree_impl.h"
@@ -38,7 +39,8 @@ class DelegatedRendererLayerImplTest : public testing::Test {
LayerTreeSettings settings;
settings.minimum_occlusion_tracking_size = gfx::Size();
- host_impl_.reset(new FakeLayerTreeHostImpl(settings, &proxy_));
+ host_impl_.reset(
+ new FakeLayerTreeHostImpl(settings, &proxy_, &shared_bitmap_manager_));
host_impl_->InitializeRenderer(
FakeOutputSurface::Create3d().PassAs<OutputSurface>());
host_impl_->SetViewportSize(gfx::Size(10, 10));
@@ -48,6 +50,7 @@ class DelegatedRendererLayerImplTest : public testing::Test {
FakeProxy proxy_;
DebugScopedSetImplThreadAndMainThreadBlocked
always_impl_thread_and_main_thread_blocked_;
+ TestSharedBitmapManager shared_bitmap_manager_;
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 29d6772..0db80f5 100644
--- a/cc/layers/heads_up_display_layer_impl_unittest.cc
+++ b/cc/layers/heads_up_display_layer_impl_unittest.cc
@@ -8,6 +8,7 @@
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/mock_quad_culler.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace cc {
@@ -31,7 +32,8 @@ void CheckDrawLayer(HeadsUpDisplayLayerImpl* layer,
TEST(HeadsUpDisplayLayerImplTest, ResourcelessSoftwareDrawAfterResourceLoss) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
host_impl.CreatePendingTree();
host_impl.InitializeRenderer(
FakeOutputSurface::Create3d().PassAs<OutputSurface>());
diff --git a/cc/layers/layer_impl_unittest.cc b/cc/layers/layer_impl_unittest.cc
index 064b807..9fb61d0 100644
--- a/cc/layers/layer_impl_unittest.cc
+++ b/cc/layers/layer_impl_unittest.cc
@@ -10,6 +10,7 @@
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/geometry_test_utils.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/single_thread_proxy.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -82,7 +83,8 @@ TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) {
// The constructor on this will fake that we are on the correct thread.
// Create a simple LayerImpl tree:
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
EXPECT_TRUE(host_impl.InitializeRenderer(
FakeOutputSurface::Create3d().PassAs<OutputSurface>()));
scoped_ptr<LayerImpl> root_clip =
@@ -241,7 +243,8 @@ TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) {
TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
EXPECT_TRUE(host_impl.InitializeRenderer(
FakeOutputSurface::Create3d().PassAs<OutputSurface>()));
host_impl.active_tree()->SetRootLayer(
@@ -353,7 +356,8 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
TEST(LayerImplTest, SafeOpaqueBackgroundColor) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
EXPECT_TRUE(host_impl.InitializeRenderer(
FakeOutputSurface::Create3d().PassAs<OutputSurface>()));
scoped_ptr<LayerImpl> layer = LayerImpl::Create(host_impl.active_tree(), 1);
@@ -384,9 +388,10 @@ TEST(LayerImplTest, SafeOpaqueBackgroundColor) {
class LayerImplScrollTest : public testing::Test {
public:
- LayerImplScrollTest() : host_impl_(&proxy_), root_id_(7) {
- host_impl_.active_tree()
- ->SetRootLayer(LayerImpl::Create(host_impl_.active_tree(), root_id_));
+ LayerImplScrollTest()
+ : host_impl_(&proxy_, &shared_bitmap_manager_), root_id_(7) {
+ host_impl_.active_tree()->SetRootLayer(
+ LayerImpl::Create(host_impl_.active_tree(), root_id_));
host_impl_.active_tree()->root_layer()->AddChild(
LayerImpl::Create(host_impl_.active_tree(), root_id_ + 1));
layer()->SetScrollClipLayer(root_id_);
@@ -404,6 +409,7 @@ class LayerImplScrollTest : public testing::Test {
private:
FakeImplProxy proxy_;
+ TestSharedBitmapManager shared_bitmap_manager_;
FakeLayerTreeHostImpl host_impl_;
int root_id_;
};
diff --git a/cc/layers/layer_perftest.cc b/cc/layers/layer_perftest.cc
index 04ce82c..05753bb 100644
--- a/cc/layers/layer_perftest.cc
+++ b/cc/layers/layer_perftest.cc
@@ -32,7 +32,7 @@ class MockLayerPainter : public LayerPainter {
class LayerPerfTest : public testing::Test {
public:
LayerPerfTest()
- : host_impl_(&proxy_),
+ : host_impl_(&proxy_, &shared_bitmap_manager_),
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_;
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 84bf944..cc112d1 100644
--- a/cc/layers/layer_position_constraint_unittest.cc
+++ b/cc/layers/layer_position_constraint_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/geometry_test_utils.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/trees/layer_tree_host_common.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -64,8 +65,7 @@ void ExecuteCalculateDrawProperties(LayerImpl* root_layer) {
class LayerPositionConstraintTest : public testing::Test {
public:
- LayerPositionConstraintTest()
- : host_impl_(&proxy_) {
+ LayerPositionConstraintTest() : host_impl_(&proxy_, &shared_bitmap_manager_) {
root_ = CreateTreeForTest();
scroll_ = root_->children()[0];
fixed_to_top_left_.set_is_fixed_position(true);
@@ -135,6 +135,7 @@ class LayerPositionConstraintTest : public testing::Test {
protected:
FakeImplProxy proxy_;
+ TestSharedBitmapManager shared_bitmap_manager_;
FakeLayerTreeHostImpl host_impl_;
scoped_ptr<LayerImpl> root_;
LayerImpl* scroll_;
diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc
index e439e8d..906ed8c 100644
--- a/cc/layers/layer_unittest.cc
+++ b/cc/layers/layer_unittest.cc
@@ -14,6 +14,7 @@
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/layer_test_common.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/single_thread_proxy.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -59,7 +60,7 @@ class MockLayerPainter : public LayerPainter {
class LayerTest : public testing::Test {
public:
LayerTest()
- : host_impl_(&proxy_),
+ : host_impl_(&proxy_, &shared_bitmap_manager_),
fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {}
protected:
@@ -129,6 +130,7 @@ class LayerTest : public testing::Test {
}
FakeImplProxy proxy_;
+ TestSharedBitmapManager shared_bitmap_manager_;
FakeLayerTreeHostImpl host_impl_;
FakeLayerTreeHostClient fake_client_;
@@ -804,24 +806,25 @@ TEST_F(LayerTest, MaskAndReplicaHasParent) {
class LayerTreeHostFactory {
public:
LayerTreeHostFactory()
- : client_(FakeLayerTreeHostClient::DIRECT_3D) {}
+ : client_(FakeLayerTreeHostClient::DIRECT_3D),
+ shared_bitmap_manager_(new TestSharedBitmapManager()) {}
scoped_ptr<LayerTreeHost> Create() {
return LayerTreeHost::CreateSingleThreaded(&client_,
&client_,
- NULL,
+ shared_bitmap_manager_.get(),
LayerTreeSettings()).Pass();
}
scoped_ptr<LayerTreeHost> Create(LayerTreeSettings settings) {
- return LayerTreeHost::CreateSingleThreaded(&client_,
- &client_,
- NULL,
- settings).Pass();
+ return LayerTreeHost::CreateSingleThreaded(
+ &client_, &client_, shared_bitmap_manager_.get(), settings)
+ .Pass();
}
private:
FakeLayerTreeHostClient client_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
};
void AssertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) {
diff --git a/cc/layers/layer_utils_unittest.cc b/cc/layers/layer_utils_unittest.cc
index 8c7501c..3a8d99c 100644
--- a/cc/layers/layer_utils_unittest.cc
+++ b/cc/layers/layer_utils_unittest.cc
@@ -9,6 +9,7 @@
#include "cc/test/animation_test_common.h"
#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 "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/box_f.h"
#include "ui/gfx/test/gfx_util.h"
@@ -23,7 +24,7 @@ float diagonal(float width, float height) {
class LayerUtilsGetAnimationBoundsTest : public testing::Test {
public:
LayerUtilsGetAnimationBoundsTest()
- : host_impl_(&proxy_),
+ : host_impl_(&proxy_, &shared_bitmap_manager_),
root_(CreateThreeNodeTree(host_impl_)),
parent_(root_->children()[0]),
child_(parent_->children()[0]) {}
@@ -43,6 +44,7 @@ class LayerUtilsGetAnimationBoundsTest : public testing::Test {
}
FakeImplProxy proxy_;
+ TestSharedBitmapManager shared_bitmap_manager_;
FakeLayerTreeHostImpl host_impl_;
scoped_ptr<LayerImpl> root_;
LayerImpl* parent_;
diff --git a/cc/layers/nine_patch_layer_impl_unittest.cc b/cc/layers/nine_patch_layer_impl_unittest.cc
index 0755cfa..614f5ed 100644
--- a/cc/layers/nine_patch_layer_impl_unittest.cc
+++ b/cc/layers/nine_patch_layer_impl_unittest.cc
@@ -44,7 +44,8 @@ void NinePatchLayerLayoutTest(const gfx::Size& bitmap_size,
layer_size.height() - border.height());
FakeImplProxy proxy;
- FakeUIResourceLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<NinePatchLayerImpl> layer =
NinePatchLayerImpl::Create(host_impl.active_tree(), 1);
layer->draw_properties().visible_content_rect = visible_content_rect;
diff --git a/cc/layers/nine_patch_layer_unittest.cc b/cc/layers/nine_patch_layer_unittest.cc
index 1f93b4c..cdb2af3 100644
--- a/cc/layers/nine_patch_layer_unittest.cc
+++ b/cc/layers/nine_patch_layer_unittest.cc
@@ -13,6 +13,7 @@
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_output_surface_client.h"
#include "cc/test/geometry_test_utils.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/occlusion_tracker.h"
#include "cc/trees/single_thread_proxy.h"
diff --git a/cc/layers/picture_image_layer_impl_unittest.cc b/cc/layers/picture_image_layer_impl_unittest.cc
index 4eefa7f..cd28f90 100644
--- a/cc/layers/picture_image_layer_impl_unittest.cc
+++ b/cc/layers/picture_image_layer_impl_unittest.cc
@@ -12,6 +12,7 @@
#include "cc/test/fake_picture_layer_tiling_client.h"
#include "cc/test/impl_side_painting_settings.h"
#include "cc/test/mock_quad_culler.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/trees/layer_tree_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -33,7 +34,9 @@ class PictureImageLayerImplTest : public testing::Test {
public:
PictureImageLayerImplTest()
: proxy_(base::MessageLoopProxy::current()),
- host_impl_(ImplSidePaintingSettings(), &proxy_) {
+ host_impl_(ImplSidePaintingSettings(),
+ &proxy_,
+ &shared_bitmap_manager_) {
tiling_client_.SetTileSize(ImplSidePaintingSettings().default_tile_size);
host_impl_.CreatePendingTree();
host_impl_.InitializeRenderer(
@@ -70,6 +73,7 @@ class PictureImageLayerImplTest : public testing::Test {
protected:
FakeImplProxy proxy_;
FakeLayerTreeHostImpl host_impl_;
+ TestSharedBitmapManager shared_bitmap_manager_;
FakePictureLayerTilingClient tiling_client_;
};
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index 9ea4e30..1fa309b 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -19,6 +19,7 @@
#include "cc/test/hybrid_rasterization_settings.h"
#include "cc/test/impl_side_painting_settings.h"
#include "cc/test/mock_quad_culler.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/test_web_graphics_context_3d.h"
#include "cc/trees/layer_tree_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -43,12 +44,14 @@ class PictureLayerImplTest : public testing::Test {
public:
PictureLayerImplTest()
: proxy_(base::MessageLoopProxy::current()),
- host_impl_(ImplSidePaintingSettings(), &proxy_),
+ host_impl_(ImplSidePaintingSettings(),
+ &proxy_,
+ &shared_bitmap_manager_),
id_(7) {}
explicit PictureLayerImplTest(const LayerTreeSettings& settings)
: proxy_(base::MessageLoopProxy::current()),
- host_impl_(settings, &proxy_),
+ host_impl_(settings, &proxy_, &shared_bitmap_manager_),
id_(7) {}
virtual ~PictureLayerImplTest() {
@@ -242,6 +245,7 @@ class PictureLayerImplTest : public testing::Test {
}
FakeImplProxy proxy_;
+ TestSharedBitmapManager shared_bitmap_manager_;
FakeLayerTreeHostImpl host_impl_;
int id_;
FakePictureLayerImpl* pending_layer_;
diff --git a/cc/layers/picture_layer_unittest.cc b/cc/layers/picture_layer_unittest.cc
index 71973b2..25bfd99 100644
--- a/cc/layers/picture_layer_unittest.cc
+++ b/cc/layers/picture_layer_unittest.cc
@@ -49,7 +49,9 @@ TEST(PictureLayerTest, NoTilesIfEmptyBounds) {
{
DebugScopedSetImplThread impl_thread(&proxy);
- FakeLayerTreeHostImpl host_impl(ImplSidePaintingSettings(), &proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(
+ ImplSidePaintingSettings(), &proxy, &shared_bitmap_manager);
host_impl.CreatePendingTree();
scoped_ptr<FakePictureLayerImpl> layer_impl =
FakePictureLayerImpl::Create(host_impl.pending_tree(), 1);
diff --git a/cc/layers/render_surface_unittest.cc b/cc/layers/render_surface_unittest.cc
index 70f63f7..7056b1d0 100644
--- a/cc/layers/render_surface_unittest.cc
+++ b/cc/layers/render_surface_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/mock_quad_culler.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/trees/single_thread_proxy.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -36,7 +37,8 @@ TEST(RenderSurfaceTest, VerifySurfaceChangesAreTrackedProperly) {
//
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> owning_layer =
LayerImpl::Create(host_impl.active_tree(), 1);
owning_layer->CreateRenderSurface();
@@ -80,7 +82,8 @@ TEST(RenderSurfaceTest, VerifySurfaceChangesAreTrackedProperly) {
TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectSharedQuadState) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root_layer =
LayerImpl::Create(host_impl.active_tree(), 1);
@@ -143,7 +146,8 @@ class TestRenderPassSink : public RenderPassSink {
TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectRenderPass) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
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 ccba3ae..a92229a 100644
--- a/cc/layers/scrollbar_layer_unittest.cc
+++ b/cc/layers/scrollbar_layer_unittest.cc
@@ -390,7 +390,8 @@ class ScrollbarLayerSolidColorThumbTest : public testing::Test {
public:
ScrollbarLayerSolidColorThumbTest() {
LayerTreeSettings layer_tree_settings;
- host_impl_.reset(new FakeLayerTreeHostImpl(layer_tree_settings, &proxy_));
+ host_impl_.reset(new FakeLayerTreeHostImpl(
+ layer_tree_settings, &proxy_, &shared_bitmap_manager_));
const int kThumbThickness = 3;
const bool kIsLeftSideVerticalScrollbar = false;
@@ -414,6 +415,7 @@ class ScrollbarLayerSolidColorThumbTest : public testing::Test {
protected:
FakeImplProxy proxy_;
+ TestSharedBitmapManager shared_bitmap_manager_;
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 713e8fb..8e4ebc9 100644
--- a/cc/layers/solid_color_layer_impl_unittest.cc
+++ b/cc/layers/solid_color_layer_impl_unittest.cc
@@ -13,6 +13,7 @@
#include "cc/test/fake_layer_tree_host.h"
#include "cc/test/layer_test_common.h"
#include "cc/test/mock_quad_culler.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/trees/single_thread_proxy.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -26,7 +27,8 @@ TEST(SolidColorLayerImplTest, VerifyTilingCompleteAndNoOverlap) {
gfx::Rect visible_content_rect = gfx::Rect(layer_size);
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<SolidColorLayerImpl> layer =
SolidColorLayerImpl::Create(host_impl.active_tree(), 1);
layer->draw_properties().visible_content_rect = visible_content_rect;
@@ -50,7 +52,8 @@ TEST(SolidColorLayerImplTest, VerifyCorrectBackgroundColorInQuad) {
gfx::Rect visible_content_rect = gfx::Rect(layer_size);
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<SolidColorLayerImpl> layer =
SolidColorLayerImpl::Create(host_impl.active_tree(), 1);
layer->draw_properties().visible_content_rect = visible_content_rect;
@@ -76,7 +79,8 @@ TEST(SolidColorLayerImplTest, VerifyCorrectOpacityInQuad) {
gfx::Rect visible_content_rect = gfx::Rect(layer_size);
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<SolidColorLayerImpl> layer =
SolidColorLayerImpl::Create(host_impl.active_tree(), 1);
layer->draw_properties().visible_content_rect = visible_content_rect;
diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc
index 73c6f73..e037693 100644
--- a/cc/layers/texture_layer_unittest.cc
+++ b/cc/layers/texture_layer_unittest.cc
@@ -65,8 +65,8 @@ class TextureLayerTest : public testing::Test {
public:
TextureLayerTest()
: fake_client_(
- FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)),
- host_impl_(&proxy_) {}
+ FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)),
+ host_impl_(&proxy_, &shared_bitmap_manager_) {}
protected:
virtual void SetUp() {
@@ -85,6 +85,7 @@ class TextureLayerTest : public testing::Test {
scoped_ptr<MockLayerTreeHost> layer_tree_host_;
FakeImplProxy proxy_;
FakeLayerTreeHostClient fake_client_;
+ TestSharedBitmapManager shared_bitmap_manager_;
FakeLayerTreeHostImpl host_impl_;
};
diff --git a/cc/layers/tiled_layer_impl_unittest.cc b/cc/layers/tiled_layer_impl_unittest.cc
index 948ab37..ff9d35e 100644
--- a/cc/layers/tiled_layer_impl_unittest.cc
+++ b/cc/layers/tiled_layer_impl_unittest.cc
@@ -20,7 +20,7 @@ namespace {
class TiledLayerImplTest : public testing::Test {
public:
- TiledLayerImplTest() : host_impl_(&proxy_) {}
+ TiledLayerImplTest() : host_impl_(&proxy_, &shared_bitmap_manager_) {}
scoped_ptr<TiledLayerImpl> CreateLayerNoTiles(
const gfx::Size& tile_size,
@@ -85,6 +85,7 @@ class TiledLayerImplTest : public testing::Test {
protected:
FakeImplProxy proxy_;
+ TestSharedBitmapManager shared_bitmap_manager_;
FakeLayerTreeHostImpl host_impl_;
};
diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc
index 0e5d4a28..a0c469f 100644
--- a/cc/layers/tiled_layer_unittest.cc
+++ b/cc/layers/tiled_layer_unittest.cc
@@ -20,6 +20,7 @@
#include "cc/test/fake_proxy.h"
#include "cc/test/fake_rendering_stats_instrumentation.h"
#include "cc/test/geometry_test_utils.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/tiled_layer_test_common.h"
#include "cc/trees/occlusion_tracker.h"
#include "cc/trees/single_thread_proxy.h"
@@ -106,9 +107,10 @@ class TiledLayerTest : public testing::Test {
virtual void SetUp() {
impl_thread_.Start();
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
layer_tree_host_ = SynchronousOutputSurfaceLayerTreeHost::Create(
&fake_layer_tree_host_client_,
- NULL,
+ shared_bitmap_manager_.get(),
settings_,
impl_thread_.message_loop_proxy());
proxy_ = layer_tree_host_->proxy();
@@ -121,9 +123,10 @@ class TiledLayerTest : public testing::Test {
DebugScopedSetImplThreadAndMainThreadBlocked
impl_thread_and_main_thread_blocked(proxy_);
- resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1);
- host_impl_ = make_scoped_ptr(new FakeLayerTreeHostImpl(proxy_));
+ resource_provider_ = ResourceProvider::Create(
+ output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1);
+ host_impl_ = make_scoped_ptr(
+ new FakeLayerTreeHostImpl(proxy_, shared_bitmap_manager_.get()));
}
virtual ~TiledLayerTest() {
@@ -241,6 +244,7 @@ class TiledLayerTest : public testing::Test {
LayerTreeSettings settings_;
FakeOutputSurfaceClient output_surface_client_;
scoped_ptr<OutputSurface> output_surface_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> resource_provider_;
scoped_ptr<ResourceUpdateQueue> queue_;
PriorityCalculator priority_calculator_;
diff --git a/cc/layers/ui_resource_layer_impl_unittest.cc b/cc/layers/ui_resource_layer_impl_unittest.cc
index 01c7c40..c5933b6 100644
--- a/cc/layers/ui_resource_layer_impl_unittest.cc
+++ b/cc/layers/ui_resource_layer_impl_unittest.cc
@@ -11,6 +11,7 @@
#include "cc/test/fake_ui_resource_layer_tree_host_impl.h"
#include "cc/test/layer_test_common.h"
#include "cc/test/mock_quad_culler.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/trees/single_thread_proxy.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -63,7 +64,8 @@ void QuadSizeTest(scoped_ptr<UIResourceLayerImpl> layer,
TEST(UIResourceLayerImplTest, VerifyDrawQuads) {
FakeImplProxy proxy;
- FakeUIResourceLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
// Make sure we're appending quads when there are valid values.
gfx::Size bitmap_size(100, 100);
gfx::Size layer_size(100, 100);;
@@ -103,7 +105,8 @@ void OpaqueBoundsTest(scoped_ptr<UIResourceLayerImpl> layer,
TEST(UIResourceLayerImplTest, VerifySetOpaqueOnSkBitmap) {
FakeImplProxy proxy;
- FakeUIResourceLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
gfx::Size bitmap_size(100, 100);
gfx::Size layer_size(100, 100);;
@@ -129,7 +132,8 @@ TEST(UIResourceLayerImplTest, VerifySetOpaqueOnSkBitmap) {
TEST(UIResourceLayerImplTest, VerifySetOpaqueOnLayer) {
FakeImplProxy proxy;
- FakeUIResourceLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
gfx::Size bitmap_size(100, 100);
gfx::Size layer_size(100, 100);
diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc
index d5f848c..5527af9 100644
--- a/cc/output/gl_renderer_unittest.cc
+++ b/cc/output/gl_renderer_unittest.cc
@@ -18,6 +18,7 @@
#include "cc/test/pixel_test.h"
#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_web_graphics_context_3d.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/context_support.h"
@@ -171,8 +172,11 @@ class GLRendererWithDefaultHarnessTest : public GLRendererTest {
FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create()).Pass();
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ = ResourceProvider::Create(
- output_surface_.get(), NULL, 0, false, 1).Pass();
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
+ resource_provider_ =
+ ResourceProvider::Create(
+ output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1)
+ .Pass();
renderer_ = make_scoped_ptr(new FakeRendererGL(&renderer_client_,
&settings_,
output_surface_.get(),
@@ -185,6 +189,7 @@ class GLRendererWithDefaultHarnessTest : public GLRendererTest {
FakeOutputSurfaceClient output_surface_client_;
scoped_ptr<FakeOutputSurface> output_surface_;
FakeRendererClient renderer_client_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> resource_provider_;
scoped_ptr<FakeRendererGL> renderer_;
};
@@ -200,8 +205,11 @@ class GLRendererShaderTest : public GLRendererTest {
output_surface_ = FakeOutputSurface::Create3d().Pass();
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ = ResourceProvider::Create(
- output_surface_.get(), NULL, 0, false, 1).Pass();
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
+ resource_provider_ =
+ ResourceProvider::Create(
+ output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1)
+ .Pass();
renderer_.reset(new FakeRendererGL(&renderer_client_,
&settings_,
output_surface_.get(),
@@ -273,6 +281,7 @@ class GLRendererShaderTest : public GLRendererTest {
FakeOutputSurfaceClient output_surface_client_;
scoped_ptr<FakeOutputSurface> output_surface_;
FakeRendererClient renderer_client_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> resource_provider_;
scoped_ptr<FakeRendererGL> renderer_;
};
@@ -512,8 +521,10 @@ TEST_F(GLRendererTest, InitializationDoesNotMakeSynchronousCalls) {
scoped_ptr<TestWebGraphicsContext3D>(new ForbidSynchronousCallContext)));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager.get(), 0, false, 1));
LayerTreeSettings settings;
FakeRendererClient renderer_client;
@@ -546,8 +557,10 @@ TEST_F(GLRendererTest, InitializationWithQuicklyLostContextDoesNotAssert) {
scoped_ptr<TestWebGraphicsContext3D>(new LoseContextOnFirstGetContext)));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager.get(), 0, false, 1));
LayerTreeSettings settings;
FakeRendererClient renderer_client;
@@ -577,8 +590,10 @@ TEST_F(GLRendererTest, OpaqueBackground) {
context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager.get(), 0, false, 1));
LayerTreeSettings settings;
FakeRendererClient renderer_client;
@@ -622,8 +637,10 @@ TEST_F(GLRendererTest, TransparentBackground) {
context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager.get(), 0, false, 1));
LayerTreeSettings settings;
FakeRendererClient renderer_client;
@@ -660,8 +677,10 @@ TEST_F(GLRendererTest, OffscreenOutputSurface) {
context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager.get(), 0, false, 1));
LayerTreeSettings settings;
FakeRendererClient renderer_client;
@@ -740,8 +759,10 @@ TEST_F(GLRendererTest, VisibilityChangeIsLastCall) {
FakeOutputSurface::Create3d(provider));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager.get(), 0, false, 1));
LayerTreeSettings settings;
FakeRendererClient renderer_client;
@@ -803,8 +824,10 @@ TEST_F(GLRendererTest, ActiveTextureState) {
context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager.get(), 0, false, 1));
LayerTreeSettings settings;
FakeRendererClient renderer_client;
@@ -881,8 +904,10 @@ TEST_F(GLRendererTest, ShouldClearRootRenderPass) {
mock_context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager.get(), 0, false, 1));
LayerTreeSettings settings;
settings.should_clear_root_render_pass = false;
@@ -972,8 +997,10 @@ TEST_F(GLRendererTest, ScissorTestWhenClearing) {
context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager.get(), 0, false, 1));
LayerTreeSettings settings;
FakeRendererClient renderer_client;
@@ -1064,8 +1091,10 @@ TEST_F(GLRendererTest, NoDiscardOnPartialUpdates) {
CHECK(output_surface->BindToClient(&output_surface_client));
output_surface->set_fixed_size(gfx::Size(100, 100));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager.get(), 0, false, 1));
LayerTreeSettings settings;
settings.partial_swap_enabled = true;
@@ -1253,8 +1282,10 @@ TEST_F(GLRendererTest, ScissorAndViewportWithinNonreshapableSurface) {
context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager.get(), 0, false, 1));
LayerTreeSettings settings;
FakeRendererClient renderer_client;
@@ -1637,8 +1668,10 @@ class MockOutputSurfaceTest : public GLRendererTest {
FakeOutputSurfaceClient output_surface_client_;
CHECK(output_surface_.BindToClient(&output_surface_client_));
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
resource_provider_ =
- ResourceProvider::Create(&output_surface_, NULL, 0, false, 1).Pass();
+ ResourceProvider::Create(
+ &output_surface_, shared_bitmap_manager_.get(), 0, false, 1).Pass();
renderer_.reset(new FakeRendererGL(&renderer_client_,
&settings_,
@@ -1686,6 +1719,7 @@ class MockOutputSurfaceTest : public GLRendererTest {
LayerTreeSettings settings_;
FakeOutputSurfaceClient output_surface_client_;
StrictMock<MockOutputSurface> output_surface_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> resource_provider_;
FakeRendererClient renderer_client_;
scoped_ptr<FakeRendererGL> renderer_;
diff --git a/cc/output/software_renderer_unittest.cc b/cc/output/software_renderer_unittest.cc
index 4dd7fbb..2db2864 100644
--- a/cc/output/software_renderer_unittest.cc
+++ b/cc/output/software_renderer_unittest.cc
@@ -17,6 +17,7 @@
#include "cc/test/geometry_test_utils.h"
#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 "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkCanvas.h"
@@ -32,8 +33,9 @@ class SoftwareRendererTest : public testing::Test, public RendererClient {
software_output_device.Pass());
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1);
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
+ resource_provider_ = ResourceProvider::Create(
+ output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1);
renderer_ = SoftwareRenderer::Create(
this, &settings_, output_surface_.get(), resource_provider());
}
@@ -51,6 +53,7 @@ class SoftwareRendererTest : public testing::Test, public RendererClient {
LayerTreeSettings settings_;
FakeOutputSurfaceClient output_surface_client_;
scoped_ptr<FakeOutputSurface> output_surface_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> resource_provider_;
scoped_ptr<SoftwareRenderer> renderer_;
};
diff --git a/cc/resources/picture_layer_tiling_set_unittest.cc b/cc/resources/picture_layer_tiling_set_unittest.cc
index 3939f09..4692283 100644
--- a/cc/resources/picture_layer_tiling_set_unittest.cc
+++ b/cc/resources/picture_layer_tiling_set_unittest.cc
@@ -13,6 +13,7 @@
#include "cc/test/fake_output_surface_client.h"
#include "cc/test/fake_picture_layer_tiling_client.h"
#include "cc/test/fake_tile_manager_client.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/size_conversions.h"
@@ -65,8 +66,10 @@ class PictureLayerTilingSetTestWithResources : public testing::Test {
FakeOutputSurface::Create3d();
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider =
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1);
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager.get(), 0, false, 1);
FakePictureLayerTilingClient client(resource_provider.get());
client.SetTileSize(gfx::Size(256, 256));
diff --git a/cc/resources/prioritized_resource_unittest.cc b/cc/resources/prioritized_resource_unittest.cc
index 5b0722b..7bbe70f 100644
--- a/cc/resources/prioritized_resource_unittest.cc
+++ b/cc/resources/prioritized_resource_unittest.cc
@@ -12,6 +12,7 @@
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_output_surface_client.h"
#include "cc/test/fake_proxy.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/tiled_layer_test_common.h"
#include "cc/trees/single_thread_proxy.h" // For DebugScopedSetImplThread
#include "testing/gtest/include/gtest/gtest.h"
@@ -26,8 +27,9 @@ class PrioritizedResourceTest : public testing::Test {
output_surface_(FakeOutputSurface::Create3d()) {
DebugScopedSetImplThread impl_thread(&proxy_);
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1);
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
+ resource_provider_ = ResourceProvider::Create(
+ output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1);
}
virtual ~PrioritizedResourceTest() {
@@ -109,6 +111,7 @@ class PrioritizedResourceTest : public testing::Test {
const ResourceFormat texture_format_;
FakeOutputSurfaceClient output_surface_client_;
scoped_ptr<OutputSurface> output_surface_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> resource_provider_;
};
diff --git a/cc/resources/prioritized_tile_set_unittest.cc b/cc/resources/prioritized_tile_set_unittest.cc
index 3f20dbe..58e8102 100644
--- a/cc/resources/prioritized_tile_set_unittest.cc
+++ b/cc/resources/prioritized_tile_set_unittest.cc
@@ -13,6 +13,7 @@
#include "cc/test/fake_picture_pile_impl.h"
#include "cc/test/fake_tile_manager.h"
#include "cc/test/fake_tile_manager_client.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/test_tile_priorities.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -53,12 +54,11 @@ class PrioritizedTileSetTest : public testing::Test {
output_surface_ = FakeOutputSurface::Create3d().Pass();
CHECK(output_surface_->BindToClient(&output_surface_client_));
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
resource_provider_ =
- ResourceProvider::Create(output_surface_.get(),
- NULL,
- 0,
- false,
- 1).Pass();
+ ResourceProvider::Create(
+ output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1)
+ .Pass();
tile_manager_.reset(
new FakeTileManager(&tile_manager_client_, resource_provider_.get()));
picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile();
@@ -79,6 +79,7 @@ class PrioritizedTileSetTest : public testing::Test {
LayerTreeSettings settings_;
FakeOutputSurfaceClient output_surface_client_;
scoped_ptr<FakeOutputSurface> output_surface_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> resource_provider_;
FakeTileManagerClient tile_manager_client_;
scoped_ptr<FakeTileManager> tile_manager_;
diff --git a/cc/resources/raster_worker_pool_perftest.cc b/cc/resources/raster_worker_pool_perftest.cc
index 0fdf4e8..f953406 100644
--- a/cc/resources/raster_worker_pool_perftest.cc
+++ b/cc/resources/raster_worker_pool_perftest.cc
@@ -15,6 +15,7 @@
#include "cc/test/fake_output_surface_client.h"
#include "cc/test/lap_timer.h"
#include "cc/test/test_context_support.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/test_web_graphics_context_3d.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/perf/perf_test.h"
@@ -164,8 +165,11 @@ class RasterWorkerPoolPerfTestBase {
output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass();
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ = ResourceProvider::Create(
- output_surface_.get(), NULL, 0, false, 1).Pass();
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
+ resource_provider_ =
+ ResourceProvider::Create(
+ output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1)
+ .Pass();
}
virtual ~RasterWorkerPoolPerfTestBase() { resource_provider_.reset(); }
@@ -207,6 +211,7 @@ class RasterWorkerPoolPerfTestBase {
scoped_refptr<ContextProvider> context_provider_;
FakeOutputSurfaceClient output_surface_client_;
scoped_ptr<FakeOutputSurface> output_surface_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> resource_provider_;
LapTimer timer_;
};
diff --git a/cc/resources/raster_worker_pool_unittest.cc b/cc/resources/raster_worker_pool_unittest.cc
index 8e47459..8728111 100644
--- a/cc/resources/raster_worker_pool_unittest.cc
+++ b/cc/resources/raster_worker_pool_unittest.cc
@@ -17,6 +17,7 @@
#include "cc/resources/scoped_resource.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_output_surface_client.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/test_web_graphics_context_3d.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -129,8 +130,11 @@ class RasterWorkerPoolTest
output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass();
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ = ResourceProvider::Create(
- output_surface_.get(), NULL, 0, false, 1).Pass();
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
+ resource_provider_ =
+ ResourceProvider::Create(
+ output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1)
+ .Pass();
switch (GetParam()) {
case RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER:
@@ -266,6 +270,7 @@ class RasterWorkerPoolTest
scoped_refptr<TestContextProvider> context_provider_;
FakeOutputSurfaceClient output_surface_client_;
scoped_ptr<FakeOutputSurface> output_surface_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> resource_provider_;
scoped_ptr<RasterWorkerPool> raster_worker_pool_;
base::CancelableClosure timeout_;
diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc
index fc746d7..cca0c5b 100644
--- a/cc/resources/resource_provider_unittest.cc
+++ b/cc/resources/resource_provider_unittest.cc
@@ -19,6 +19,7 @@
#include "cc/resources/single_release_callback.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_output_surface_client.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/test_texture.h"
#include "cc/test/test_web_graphics_context_3d.h"
#include "gpu/GLES2/gl2extchromium.h"
@@ -332,55 +333,6 @@ class ResourceProviderContext : public TestWebGraphicsContext3D {
PendingProduceTextureList pending_produce_textures_;
};
-void FreeSharedBitmap(SharedBitmap* shared_bitmap) {
- delete shared_bitmap->memory();
-}
-
-void IgnoreSharedBitmap(SharedBitmap* shared_bitmap) {}
-
-class TestSharedBitmapManager : public SharedBitmapManager {
- public:
- TestSharedBitmapManager() : count_(0) {}
- virtual ~TestSharedBitmapManager() {}
-
- virtual scoped_ptr<SharedBitmap> AllocateSharedBitmap(const gfx::Size& size)
- OVERRIDE {
- scoped_ptr<base::SharedMemory> memory(new base::SharedMemory);
- memory->CreateAndMapAnonymous(size.GetArea() * 4);
- int8 name[GL_MAILBOX_SIZE_CHROMIUM] = {0};
- name[0] = count_++;
- SharedBitmapId id;
- id.SetName(name);
- bitmap_map_[id] = memory.get();
- return scoped_ptr<SharedBitmap>(
- new SharedBitmap(memory.release(), id, base::Bind(&FreeSharedBitmap)));
- }
-
- virtual scoped_ptr<SharedBitmap> GetSharedBitmapFromId(
- const gfx::Size&,
- const SharedBitmapId& id) OVERRIDE {
- if (bitmap_map_.find(id) == bitmap_map_.end())
- return scoped_ptr<SharedBitmap>();
- return scoped_ptr<SharedBitmap>(
- new SharedBitmap(bitmap_map_[id], id, base::Bind(&IgnoreSharedBitmap)));
- }
-
- virtual scoped_ptr<SharedBitmap> GetBitmapForSharedMemory(
- base::SharedMemory* memory) OVERRIDE {
- int8 name[GL_MAILBOX_SIZE_CHROMIUM] = {0};
- name[0] = count_++;
- SharedBitmapId id;
- id.SetName(name);
- bitmap_map_[id] = memory;
- return scoped_ptr<SharedBitmap>(
- new SharedBitmap(memory, id, base::Bind(&IgnoreSharedBitmap)));
- }
-
- private:
- int count_;
- std::map<SharedBitmapId, base::SharedMemory*> bitmap_map_;
-};
-
void GetResourcePixels(ResourceProvider* resource_provider,
ResourceProviderContext* context,
ResourceProvider::ResourceId id,
@@ -1169,12 +1121,8 @@ TEST_P(ResourceProviderTest, TransferGLToSoftware) {
child_context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(child_output_surface->BindToClient(&child_output_surface_client));
- scoped_ptr<ResourceProvider> child_resource_provider(
- ResourceProvider::Create(child_output_surface.get(),
- NULL,
- 0,
- false,
- 1));
+ scoped_ptr<ResourceProvider> child_resource_provider(ResourceProvider::Create(
+ child_output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1));
gfx::Size size(1, 1);
ResourceFormat format = RGBA_8888;
@@ -1646,10 +1594,12 @@ class ResourceProviderTestTextureFilters : public ResourceProviderTest {
scoped_ptr<OutputSurface> child_output_surface(FakeOutputSurface::Create3d(
child_context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(child_output_surface->BindToClient(&child_output_surface_client));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
scoped_ptr<ResourceProvider> child_resource_provider(
ResourceProvider::Create(child_output_surface.get(),
- NULL,
+ shared_bitmap_manager.get(),
0,
false,
1));
@@ -1665,7 +1615,7 @@ class ResourceProviderTestTextureFilters : public ResourceProviderTest {
scoped_ptr<ResourceProvider> parent_resource_provider(
ResourceProvider::Create(parent_output_surface.get(),
- NULL,
+ shared_bitmap_manager.get(),
0,
false,
1));
@@ -2275,8 +2225,8 @@ TEST_P(ResourceProviderTest, ScopedSampler) {
context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1));
gfx::Size size(1, 1);
ResourceFormat format = RGBA_8888;
@@ -2356,8 +2306,8 @@ TEST_P(ResourceProviderTest, ManagedResource) {
context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1));
gfx::Size size(1, 1);
ResourceFormat format = RGBA_8888;
@@ -2405,8 +2355,8 @@ TEST_P(ResourceProviderTest, TextureWrapMode) {
context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1));
gfx::Size size(1, 1);
ResourceFormat format = RGBA_8888;
@@ -2459,8 +2409,8 @@ TEST_P(ResourceProviderTest, TextureMailbox_SharedMemory) {
new SoftwareOutputDevice)));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1));
scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
base::Bind(&EmptyReleaseCallback));
@@ -2494,8 +2444,8 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D) {
context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1));
unsigned texture_id = 1;
uint32 sync_point = 30;
@@ -2558,8 +2508,8 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTextureExternalOES) {
context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1));
unsigned texture_id = 1;
uint32 sync_point = 30;
@@ -2696,8 +2646,8 @@ TEST_P(ResourceProviderTest, TextureAllocation) {
context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1));
gfx::Size size(2, 2);
gfx::Vector2d offset(0, 0);
@@ -2769,8 +2719,8 @@ TEST_P(ResourceProviderTest, TextureAllocationStorageUsageAny) {
context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1));
gfx::Size size(2, 2);
ResourceFormat format = RGBA_8888;
@@ -2806,8 +2756,8 @@ TEST_P(ResourceProviderTest, TextureAllocationStorageUsageFramebuffer) {
context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1));
gfx::Size size(2, 2);
ResourceFormat format = RGBA_8888;
@@ -2849,8 +2799,8 @@ TEST_P(ResourceProviderTest, PixelBuffer_GLTexture) {
ResourceProvider::ResourceId id = 0;
int texture_id = 123;
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1));
id = resource_provider->CreateResource(
size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
@@ -2886,8 +2836,8 @@ TEST_P(ResourceProviderTest, PixelBuffer_Bitmap) {
ResourceProvider::ResourceId id = 0;
const uint32_t kBadBeef = 0xbadbeef;
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1));
id = resource_provider->CreateResource(
size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
@@ -2935,8 +2885,8 @@ TEST_P(ResourceProviderTest, ForcingAsyncUploadToComplete) {
ResourceProvider::ResourceId id = 0;
int texture_id = 123;
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1));
id = resource_provider->CreateResource(
size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
@@ -2976,8 +2926,8 @@ TEST_P(ResourceProviderTest, PixelBufferLostContext) {
ResourceProvider::ResourceId id = 0;
int texture_id = 123;
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1));
EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id));
@@ -3015,8 +2965,8 @@ TEST_P(ResourceProviderTest, Image_GLTexture) {
const unsigned kTextureId = 123u;
const unsigned kImageId = 234u;
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1));
id = resource_provider->CreateResource(
size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
@@ -3107,8 +3057,8 @@ TEST_P(ResourceProviderTest, Image_Bitmap) {
ResourceProvider::ResourceId id = 0;
const uint32_t kBadBeef = 0xbadbeef;
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1));
id = resource_provider->CreateResource(
size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
@@ -3156,8 +3106,10 @@ TEST(ResourceProviderTest, BasicInitializeGLSoftware) {
FakeOutputSurface::CreateDeferredGL(
scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice)));
EXPECT_TRUE(output_surface->BindToClient(&client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager.get(), 0, false, 1));
CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL);
@@ -3274,6 +3226,8 @@ TEST(ResourceProviderTest, TextureAllocationChunkSize) {
scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
context_owned.PassAs<TestWebGraphicsContext3D>()));
CHECK(output_surface->BindToClient(&output_surface_client));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
gfx::Size size(1, 1);
ResourceFormat format = RGBA_8888;
@@ -3282,7 +3236,7 @@ TEST(ResourceProviderTest, TextureAllocationChunkSize) {
size_t kTextureAllocationChunkSize = 1;
scoped_ptr<ResourceProvider> resource_provider(
ResourceProvider::Create(output_surface.get(),
- NULL,
+ shared_bitmap_manager.get(),
0,
false,
kTextureAllocationChunkSize));
@@ -3300,7 +3254,7 @@ TEST(ResourceProviderTest, TextureAllocationChunkSize) {
size_t kTextureAllocationChunkSize = 8;
scoped_ptr<ResourceProvider> resource_provider(
ResourceProvider::Create(output_surface.get(),
- NULL,
+ shared_bitmap_manager.get(),
0,
false,
kTextureAllocationChunkSize));
diff --git a/cc/resources/resource_update_controller_unittest.cc b/cc/resources/resource_update_controller_unittest.cc
index 69e4b8b..80e8a76 100644
--- a/cc/resources/resource_update_controller_unittest.cc
+++ b/cc/resources/resource_update_controller_unittest.cc
@@ -10,6 +10,7 @@
#include "cc/test/fake_output_surface_client.h"
#include "cc/test/fake_proxy.h"
#include "cc/test/scheduler_test_common.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/test_web_graphics_context_3d.h"
#include "cc/test/tiled_layer_test_common.h"
#include "cc/trees/single_thread_proxy.h" // For DebugScopedSetImplThread
@@ -124,8 +125,9 @@ class ResourceUpdateControllerTest : public Test {
new WebGraphicsContext3DForUploadTest(this)));
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1);
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
+ resource_provider_ = ResourceProvider::Create(
+ output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1);
}
void AppendFullUploadsOfIndexedTextureToUpdateQueue(int count,
@@ -182,6 +184,7 @@ class ResourceUpdateControllerTest : public Test {
FakeProxy proxy_;
FakeOutputSurfaceClient output_surface_client_;
scoped_ptr<OutputSurface> output_surface_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> resource_provider_;
scoped_ptr<ResourceUpdateQueue> queue_;
scoped_ptr<PrioritizedResource> textures_[4];
diff --git a/cc/resources/scoped_resource_unittest.cc b/cc/resources/scoped_resource_unittest.cc
index 93ad320..8c97d8e 100644
--- a/cc/resources/scoped_resource_unittest.cc
+++ b/cc/resources/scoped_resource_unittest.cc
@@ -7,6 +7,7 @@
#include "cc/output/renderer.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_output_surface_client.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/tiled_layer_test_common.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -18,8 +19,10 @@ TEST(ScopedResourceTest, NewScopedResource) {
scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d());
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager.get(), 0, false, 1));
scoped_ptr<ScopedResource> texture =
ScopedResource::Create(resource_provider.get());
@@ -36,8 +39,10 @@ TEST(ScopedResourceTest, CreateScopedResource) {
scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d());
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager.get(), 0, false, 1));
scoped_ptr<ScopedResource> texture =
ScopedResource::Create(resource_provider.get());
texture->Allocate(gfx::Size(30, 30),
@@ -58,8 +63,10 @@ TEST(ScopedResourceTest, ScopedResourceIsDeleted) {
scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d());
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager.get(), 0, false, 1));
{
scoped_ptr<ScopedResource> texture =
ScopedResource::Create(resource_provider.get());
@@ -92,8 +99,10 @@ TEST(ScopedResourceTest, LeakScopedResource) {
scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d());
CHECK(output_surface->BindToClient(&output_surface_client));
- scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
+ output_surface.get(), shared_bitmap_manager.get(), 0, false, 1));
{
scoped_ptr<ScopedResource> texture =
ScopedResource::Create(resource_provider.get());
diff --git a/cc/resources/shared_bitmap_manager.h b/cc/resources/shared_bitmap_manager.h
index 70eaed5..e6e49af 100644
--- a/cc/resources/shared_bitmap_manager.h
+++ b/cc/resources/shared_bitmap_manager.h
@@ -15,6 +15,7 @@ namespace cc {
class CC_EXPORT SharedBitmapManager {
public:
SharedBitmapManager() {}
+ virtual ~SharedBitmapManager() {}
virtual scoped_ptr<SharedBitmap> AllocateSharedBitmap(const gfx::Size&) = 0;
virtual scoped_ptr<SharedBitmap> GetSharedBitmapFromId(
diff --git a/cc/resources/tile_manager_perftest.cc b/cc/resources/tile_manager_perftest.cc
index d2a8ccd..6d80229 100644
--- a/cc/resources/tile_manager_perftest.cc
+++ b/cc/resources/tile_manager_perftest.cc
@@ -11,6 +11,7 @@
#include "cc/test/fake_tile_manager.h"
#include "cc/test/fake_tile_manager_client.h"
#include "cc/test/lap_timer.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/test_tile_priorities.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -39,8 +40,9 @@ class TileManagerPerfTest : public testing::Test {
output_surface_ = FakeOutputSurface::Create3d();
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1);
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
+ resource_provider_ = ResourceProvider::Create(
+ output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1);
size_t raster_task_limit_bytes = 32 * 1024 * 1024; // 16-64MB in practice.
tile_manager_ =
make_scoped_ptr(new FakeTileManager(&tile_manager_client_,
@@ -170,6 +172,7 @@ class TileManagerPerfTest : public testing::Test {
scoped_refptr<FakePicturePileImpl> picture_pile_;
FakeOutputSurfaceClient output_surface_client_;
scoped_ptr<FakeOutputSurface> output_surface_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> resource_provider_;
LapTimer timer_;
};
diff --git a/cc/resources/tile_manager_unittest.cc b/cc/resources/tile_manager_unittest.cc
index a992850..3626cc1 100644
--- a/cc/resources/tile_manager_unittest.cc
+++ b/cc/resources/tile_manager_unittest.cc
@@ -11,6 +11,7 @@
#include "cc/test/fake_picture_layer_impl.h"
#include "cc/test/fake_picture_pile_impl.h"
#include "cc/test/fake_tile_manager.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/test_tile_priorities.h"
#include "cc/trees/layer_tree_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -35,8 +36,9 @@ class TileManagerTest : public testing::TestWithParam<bool>,
output_surface_ = FakeOutputSurface::Create3d();
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1);
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
+ resource_provider_ = ResourceProvider::Create(
+ output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1);
tile_manager_ = make_scoped_ptr(new FakeTileManager(
this, resource_provider_.get(), allow_on_demand_raster));
@@ -144,6 +146,7 @@ class TileManagerTest : public testing::TestWithParam<bool>,
scoped_refptr<FakePicturePileImpl> picture_pile_;
FakeOutputSurfaceClient output_surface_client_;
scoped_ptr<FakeOutputSurface> output_surface_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> resource_provider_;
TileMemoryLimitPolicy memory_limit_policy_;
int max_tiles_;
@@ -628,7 +631,8 @@ TEST_P(TileManagerTest, PairedPictureLayers) {
Initialize(10, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY);
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
host_impl.CreatePendingTree();
host_impl.ActivatePendingTree();
host_impl.CreatePendingTree();
diff --git a/cc/resources/video_resource_updater_unittest.cc b/cc/resources/video_resource_updater_unittest.cc
index af1cea4..ed53eb9 100644
--- a/cc/resources/video_resource_updater_unittest.cc
+++ b/cc/resources/video_resource_updater_unittest.cc
@@ -8,6 +8,7 @@
#include "cc/resources/resource_provider.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_output_surface_client.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/test_web_graphics_context_3d.h"
#include "media/base/video_frame.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -25,8 +26,9 @@ class VideoResourceUpdaterTest : public testing::Test {
output_surface3d_ =
FakeOutputSurface::Create3d(context3d.Pass());
CHECK(output_surface3d_->BindToClient(&client_));
- resource_provider3d_ =
- ResourceProvider::Create(output_surface3d_.get(), NULL, 0, false, 1);
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
+ resource_provider3d_ = ResourceProvider::Create(
+ output_surface3d_.get(), shared_bitmap_manager_.get(), 0, false, 1);
}
scoped_refptr<media::VideoFrame> CreateTestYUVVideoFrame() {
@@ -54,6 +56,7 @@ class VideoResourceUpdaterTest : public testing::Test {
TestWebGraphicsContext3D* context3d_;
FakeOutputSurfaceClient client_;
scoped_ptr<FakeOutputSurface> output_surface3d_;
+ scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> resource_provider3d_;
};
diff --git a/cc/test/fake_layer_tree_host.cc b/cc/test/fake_layer_tree_host.cc
index c6d92ab..28a7a52 100644
--- a/cc/test/fake_layer_tree_host.cc
+++ b/cc/test/fake_layer_tree_host.cc
@@ -5,6 +5,11 @@
#include "cc/test/fake_layer_tree_host.h"
namespace cc {
+FakeLayerTreeHost::FakeLayerTreeHost(LayerTreeHostClient* client,
+ const LayerTreeSettings& settings)
+ : LayerTreeHost(client, NULL, settings),
+ host_impl_(settings, &proxy_, &manager_),
+ needs_commit_(false) {}
scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create() {
static FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
diff --git a/cc/test/fake_layer_tree_host.h b/cc/test/fake_layer_tree_host.h
index 29426e8..05fefc34 100644
--- a/cc/test/fake_layer_tree_host.h
+++ b/cc/test/fake_layer_tree_host.h
@@ -9,6 +9,7 @@
#include "cc/test/fake_impl_proxy.h"
#include "cc/test/fake_layer_tree_host_client.h"
#include "cc/test/fake_layer_tree_host_impl.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/tree_synchronizer.h"
@@ -51,12 +52,10 @@ class FakeLayerTreeHost : public LayerTreeHost {
private:
FakeLayerTreeHost(LayerTreeHostClient* client,
- const LayerTreeSettings& settings)
- : LayerTreeHost(client, NULL, settings),
- host_impl_(settings, &proxy_),
- needs_commit_(false) {}
+ const LayerTreeSettings& settings);
FakeImplProxy proxy_;
+ TestSharedBitmapManager manager_;
FakeLayerTreeHostImpl host_impl_;
bool needs_commit_;
};
diff --git a/cc/test/fake_layer_tree_host_impl.cc b/cc/test/fake_layer_tree_host_impl.cc
index 8c39d2e..7361794 100644
--- a/cc/test/fake_layer_tree_host_impl.cc
+++ b/cc/test/fake_layer_tree_host_impl.cc
@@ -3,16 +3,18 @@
// found in the LICENSE file.
#include "cc/test/fake_layer_tree_host_impl.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/trees/layer_tree_impl.h"
namespace cc {
-FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy)
+FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy,
+ SharedBitmapManager* manager)
: LayerTreeHostImpl(LayerTreeSettings(),
&client_,
proxy,
&stats_instrumentation_,
- NULL,
+ manager,
0) {
// Explicitly clear all debug settings.
SetDebugState(LayerTreeDebugState());
@@ -20,12 +22,13 @@ FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy)
}
FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(const LayerTreeSettings& settings,
- Proxy* proxy)
+ Proxy* proxy,
+ SharedBitmapManager* manager)
: LayerTreeHostImpl(settings,
&client_,
proxy,
&stats_instrumentation_,
- NULL,
+ manager,
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 b652a91..7ddd5bb 100644
--- a/cc/test/fake_layer_tree_host_impl.h
+++ b/cc/test/fake_layer_tree_host_impl.h
@@ -14,8 +14,10 @@ namespace cc {
class FakeLayerTreeHostImpl : public LayerTreeHostImpl {
public:
- explicit FakeLayerTreeHostImpl(Proxy* proxy);
- FakeLayerTreeHostImpl(const LayerTreeSettings& settings, Proxy* proxy);
+ FakeLayerTreeHostImpl(Proxy* proxy, SharedBitmapManager* manager);
+ FakeLayerTreeHostImpl(const LayerTreeSettings& settings,
+ Proxy* proxy,
+ SharedBitmapManager* manager);
virtual ~FakeLayerTreeHostImpl();
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 c1d3e75..c95ad89 100644
--- a/cc/test/fake_ui_resource_layer_tree_host_impl.cc
+++ b/cc/test/fake_ui_resource_layer_tree_host_impl.cc
@@ -8,8 +8,10 @@
namespace cc {
-FakeUIResourceLayerTreeHostImpl::FakeUIResourceLayerTreeHostImpl(Proxy* proxy)
- : FakeLayerTreeHostImpl(proxy), fake_next_resource_id_(1) {}
+FakeUIResourceLayerTreeHostImpl::FakeUIResourceLayerTreeHostImpl(
+ Proxy* proxy,
+ SharedBitmapManager* manager)
+ : FakeLayerTreeHostImpl(proxy, manager), fake_next_resource_id_(1) {}
FakeUIResourceLayerTreeHostImpl::~FakeUIResourceLayerTreeHostImpl() {}
diff --git a/cc/test/fake_ui_resource_layer_tree_host_impl.h b/cc/test/fake_ui_resource_layer_tree_host_impl.h
index 7e461df..e6cfafb 100644
--- a/cc/test/fake_ui_resource_layer_tree_host_impl.h
+++ b/cc/test/fake_ui_resource_layer_tree_host_impl.h
@@ -12,7 +12,8 @@ namespace cc {
class FakeUIResourceLayerTreeHostImpl : public FakeLayerTreeHostImpl {
public:
- explicit FakeUIResourceLayerTreeHostImpl(Proxy* proxy);
+ explicit FakeUIResourceLayerTreeHostImpl(Proxy* proxy,
+ SharedBitmapManager* manager);
virtual ~FakeUIResourceLayerTreeHostImpl();
virtual void CreateUIResource(UIResourceId uid,
diff --git a/cc/test/layer_tree_json_parser_unittest.cc b/cc/test/layer_tree_json_parser_unittest.cc
index 3fd6725..10efbaa 100644
--- a/cc/test/layer_tree_json_parser_unittest.cc
+++ b/cc/test/layer_tree_json_parser_unittest.cc
@@ -63,7 +63,8 @@ class LayerTreeJsonParserSanityCheck : public testing::Test {
TEST_F(LayerTreeJsonParserSanityCheck, Basic) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
LayerTreeImpl* tree = host_impl.active_tree();
scoped_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1));
@@ -90,7 +91,8 @@ TEST_F(LayerTreeJsonParserSanityCheck, Basic) {
TEST_F(LayerTreeJsonParserSanityCheck, EventHandlerRegions) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
LayerTreeImpl* tree = host_impl.active_tree();
scoped_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1));
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index 1290802..d6eac97 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -18,6 +18,7 @@
#include "cc/test/fake_layer_tree_host_client.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/test_context_provider.h"
+#include "cc/test/test_shared_bitmap_manager.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"
@@ -53,9 +54,15 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
const LayerTreeSettings& settings,
LayerTreeHostImplClient* host_impl_client,
Proxy* proxy,
+ SharedBitmapManager* manager,
RenderingStatsInstrumentation* stats_instrumentation) {
- return make_scoped_ptr(new LayerTreeHostImplForTesting(
- test_hooks, settings, host_impl_client, proxy, stats_instrumentation));
+ return make_scoped_ptr(
+ new LayerTreeHostImplForTesting(test_hooks,
+ settings,
+ host_impl_client,
+ proxy,
+ manager,
+ stats_instrumentation));
}
protected:
@@ -64,12 +71,13 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
const LayerTreeSettings& settings,
LayerTreeHostImplClient* host_impl_client,
Proxy* proxy,
+ SharedBitmapManager* manager,
RenderingStatsInstrumentation* stats_instrumentation)
: LayerTreeHostImpl(settings,
host_impl_client,
proxy,
stats_instrumentation,
- NULL,
+ manager,
0),
test_hooks_(test_hooks),
block_notify_ready_to_activate_for_testing_(false),
@@ -295,11 +303,12 @@ class LayerTreeHostForTesting : public LayerTreeHost {
virtual scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl(
LayerTreeHostImplClient* host_impl_client) OVERRIDE {
return LayerTreeHostImplForTesting::Create(
- test_hooks_,
- settings(),
- host_impl_client,
- proxy(),
- rendering_stats_instrumentation()).PassAs<LayerTreeHostImpl>();
+ test_hooks_,
+ settings(),
+ host_impl_client,
+ proxy(),
+ shared_bitmap_manager_.get(),
+ rendering_stats_instrumentation()).PassAs<LayerTreeHostImpl>();
}
virtual void SetNeedsCommit() OVERRIDE {
@@ -317,9 +326,11 @@ class LayerTreeHostForTesting : public LayerTreeHost {
LayerTreeHostClient* client,
const LayerTreeSettings& settings)
: LayerTreeHost(client, NULL, settings),
+ shared_bitmap_manager_(new TestSharedBitmapManager()),
test_hooks_(test_hooks),
test_started_(false) {}
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
TestHooks* test_hooks_;
bool test_started_;
};
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc
index 782a144..112d391 100644
--- a/cc/test/pixel_test.cc
+++ b/cc/test/pixel_test.cc
@@ -23,6 +23,7 @@
#include "cc/test/pixel_test_software_output_device.h"
#include "cc/test/pixel_test_utils.h"
#include "cc/test/test_in_process_context_provider.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace cc {
@@ -121,8 +122,9 @@ void PixelTest::SetUpGLRenderer(bool use_skia_gpu_backend) {
new PixelTestOutputSurface(new TestInProcessContextProvider));
output_surface_->BindToClient(output_surface_client_.get());
- resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1);
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
+ resource_provider_ = ResourceProvider::Create(
+ output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1);
texture_mailbox_deleter_ = make_scoped_ptr(
new TextureMailboxDeleter(base::MessageLoopProxy::current()));
@@ -162,11 +164,13 @@ void PixelTest::SetUpSoftwareRenderer() {
scoped_ptr<SoftwareOutputDevice> device(new PixelTestSoftwareOutputDevice());
output_surface_.reset(new PixelTestOutputSurface(device.Pass()));
output_surface_->BindToClient(output_surface_client_.get());
- resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1);
- renderer_ = SoftwareRenderer::Create(
- this, &settings_, output_surface_.get(), resource_provider_.get())
- .PassAs<DirectRenderer>();
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
+ resource_provider_ = ResourceProvider::Create(
+ output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1);
+ renderer_ =
+ SoftwareRenderer::Create(
+ this, &settings_, output_surface_.get(), resource_provider_.get())
+ .PassAs<DirectRenderer>();
}
} // namespace cc
diff --git a/cc/test/pixel_test.h b/cc/test/pixel_test.h
index 07af714..dc01098 100644
--- a/cc/test/pixel_test.h
+++ b/cc/test/pixel_test.h
@@ -21,6 +21,7 @@ class FakeOutputSurfaceClient;
class OutputSurface;
class ResourceProvider;
class SoftwareRenderer;
+class SharedBitmapManager;
class PixelTest : public testing::Test, RendererClient {
protected:
@@ -50,6 +51,7 @@ class PixelTest : public testing::Test, RendererClient {
class PixelTestRendererClient;
scoped_ptr<FakeOutputSurfaceClient> output_surface_client_;
scoped_ptr<OutputSurface> output_surface_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> resource_provider_;
scoped_ptr<TextureMailboxDeleter> texture_mailbox_deleter_;
scoped_ptr<DirectRenderer> renderer_;
diff --git a/cc/test/test_shared_bitmap_manager.cc b/cc/test/test_shared_bitmap_manager.cc
new file mode 100644
index 0000000..e985572
--- /dev/null
+++ b/cc/test/test_shared_bitmap_manager.cc
@@ -0,0 +1,51 @@
+// Copyright 2014 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_shared_bitmap_manager.h"
+
+#include "base/bind.h"
+
+namespace cc {
+
+void FreeSharedBitmap(SharedBitmap* shared_bitmap) {
+ delete shared_bitmap->memory();
+}
+
+void IgnoreSharedBitmap(SharedBitmap* shared_bitmap) {}
+
+TestSharedBitmapManager::TestSharedBitmapManager() {}
+
+TestSharedBitmapManager::~TestSharedBitmapManager() {}
+
+scoped_ptr<SharedBitmap> TestSharedBitmapManager::AllocateSharedBitmap(
+ const gfx::Size& size) {
+ base::AutoLock lock(lock_);
+ scoped_ptr<base::SharedMemory> memory(new base::SharedMemory);
+ memory->CreateAndMapAnonymous(size.GetArea() * 4);
+ SharedBitmapId id = SharedBitmap::GenerateId();
+ bitmap_map_[id] = memory.get();
+ return scoped_ptr<SharedBitmap>(
+ new SharedBitmap(memory.release(), id, base::Bind(&FreeSharedBitmap)));
+}
+
+scoped_ptr<SharedBitmap> TestSharedBitmapManager::GetSharedBitmapFromId(
+ const gfx::Size&,
+ const SharedBitmapId& id) {
+ base::AutoLock lock(lock_);
+ if (bitmap_map_.find(id) == bitmap_map_.end())
+ return scoped_ptr<SharedBitmap>();
+ return scoped_ptr<SharedBitmap>(
+ new SharedBitmap(bitmap_map_[id], id, base::Bind(&IgnoreSharedBitmap)));
+}
+
+scoped_ptr<SharedBitmap> TestSharedBitmapManager::GetBitmapForSharedMemory(
+ base::SharedMemory* memory) {
+ base::AutoLock lock(lock_);
+ SharedBitmapId id = SharedBitmap::GenerateId();
+ bitmap_map_[id] = memory;
+ return scoped_ptr<SharedBitmap>(
+ new SharedBitmap(memory, id, base::Bind(&IgnoreSharedBitmap)));
+}
+
+} // namespace cc
diff --git a/cc/test/test_shared_bitmap_manager.h b/cc/test/test_shared_bitmap_manager.h
new file mode 100644
index 0000000..29529409
--- /dev/null
+++ b/cc/test/test_shared_bitmap_manager.h
@@ -0,0 +1,37 @@
+// Copyright 2014 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_SHARED_BITMAP_MANAGER_H_
+#define CC_TEST_TEST_SHARED_BITMAP_MANAGER_H_
+
+#include <map>
+
+#include "base/synchronization/lock.h"
+#include "cc/resources/shared_bitmap_manager.h"
+
+namespace cc {
+
+class TestSharedBitmapManager : public SharedBitmapManager {
+ public:
+ TestSharedBitmapManager();
+ virtual ~TestSharedBitmapManager();
+
+ virtual scoped_ptr<SharedBitmap> AllocateSharedBitmap(const gfx::Size& size)
+ OVERRIDE;
+
+ virtual scoped_ptr<SharedBitmap> GetSharedBitmapFromId(
+ const gfx::Size&,
+ const SharedBitmapId& id) OVERRIDE;
+
+ virtual scoped_ptr<SharedBitmap> GetBitmapForSharedMemory(
+ base::SharedMemory* memory) OVERRIDE;
+
+ private:
+ base::Lock lock_;
+ std::map<SharedBitmapId, base::SharedMemory*> bitmap_map_;
+};
+
+} // namespace cc
+
+#endif // CC_TEST_TEST_SHARED_BITMAP_MANAGER_H_
diff --git a/cc/trees/damage_tracker_unittest.cc b/cc/trees/damage_tracker_unittest.cc
index 31d2b46..2dd52ca 100644
--- a/cc/trees/damage_tracker_unittest.cc
+++ b/cc/trees/damage_tracker_unittest.cc
@@ -11,6 +11,7 @@
#include "cc/test/fake_impl_proxy.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/geometry_test_utils.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/trees/layer_tree_host_common.h"
#include "cc/trees/single_thread_proxy.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -71,7 +72,7 @@ void EmulateDrawingOneFrame(LayerImpl* root) {
class DamageTrackerTest : public testing::Test {
public:
- DamageTrackerTest() : host_impl_(&proxy_) {}
+ DamageTrackerTest() : host_impl_(&proxy_, &shared_bitmap_manager_) {}
scoped_ptr<LayerImpl> CreateTestTreeWithOneSurface() {
scoped_ptr<LayerImpl> root =
@@ -181,6 +182,7 @@ class DamageTrackerTest : public testing::Test {
protected:
FakeImplProxy proxy_;
+ TestSharedBitmapManager shared_bitmap_manager_;
FakeLayerTreeHostImpl host_impl_;
};
diff --git a/cc/trees/layer_sorter_unittest.cc b/cc/trees/layer_sorter_unittest.cc
index 6669100..ba7765b 100644
--- a/cc/trees/layer_sorter_unittest.cc
+++ b/cc/trees/layer_sorter_unittest.cc
@@ -8,6 +8,7 @@
#include "cc/layers/layer_impl.h"
#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/trees/single_thread_proxy.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/transform.h"
@@ -210,7 +211,8 @@ TEST(LayerSorterTest, VerifyExistingOrderingPreservedWhenNoZDiff) {
// - 3 and 4 should be re-sorted so they are in front of 1, 2, and 5.
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> layer1 = LayerImpl::Create(host_impl.active_tree(), 1);
scoped_ptr<LayerImpl> layer2 = LayerImpl::Create(host_impl.active_tree(), 2);
@@ -275,7 +277,8 @@ TEST(LayerSorterTest, VerifyExistingOrderingPreservedWhenNoZDiff) {
TEST(LayerSorterTest, VerifyConcidentLayerPrecisionLossResultsInDocumentOrder) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> layer1 = LayerImpl::Create(host_impl.active_tree(), 1);
scoped_ptr<LayerImpl> layer2 = LayerImpl::Create(host_impl.active_tree(), 2);
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 7099883..d6c7cf7 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -388,7 +388,8 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
const float kDeviceScale = 1.666f;
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
gfx::Transform identity_matrix;
scoped_ptr<LayerImpl> sublayer_scoped_ptr(
@@ -4041,7 +4042,8 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForEmptyLayerList) {
TEST_F(LayerTreeHostCommonTest, HitTestingForSingleLayer) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root =
LayerImpl::Create(host_impl.active_tree(), 12345);
@@ -4095,7 +4097,8 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForSingleLayer) {
TEST_F(LayerTreeHostCommonTest, HitTestingForSingleLayerAndHud) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root =
LayerImpl::Create(host_impl.active_tree(), 12345);
scoped_ptr<HeadsUpDisplayLayerImpl> hud =
@@ -4166,7 +4169,8 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForSingleLayerAndHud) {
TEST_F(LayerTreeHostCommonTest, HitTestingForUninvertibleTransform) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root =
LayerImpl::Create(host_impl.active_tree(), 12345);
@@ -4242,7 +4246,8 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForUninvertibleTransform) {
TEST_F(LayerTreeHostCommonTest, HitTestingForSinglePositionedLayer) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root =
LayerImpl::Create(host_impl.active_tree(), 12345);
@@ -4300,7 +4305,8 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForSinglePositionedLayer) {
TEST_F(LayerTreeHostCommonTest, HitTestingForSingleRotatedLayer) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root =
LayerImpl::Create(host_impl.active_tree(), 12345);
@@ -4366,7 +4372,8 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForSingleRotatedLayer) {
TEST_F(LayerTreeHostCommonTest, HitTestingForSinglePerspectiveLayer) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root =
LayerImpl::Create(host_impl.active_tree(), 12345);
@@ -4444,7 +4451,8 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForSingleLayerWithScaledContents) {
// content rect as being larger than the actual bounds of the layer.
//
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
gfx::Transform identity_matrix;
@@ -4532,7 +4540,8 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForSimpleClippedLayer) {
gfx::PointF anchor;
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
SetLayerPropertiesForTesting(root.get(),
identity_matrix,
@@ -4625,7 +4634,8 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForMultiClippedRotatedLayer) {
// only be visible where it overlaps this triangle.
//
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 123);
gfx::Transform identity_matrix;
@@ -4778,7 +4788,8 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForNonClippingIntermediateLayer) {
gfx::PointF anchor;
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
SetLayerPropertiesForTesting(root.get(),
identity_matrix,
@@ -4862,7 +4873,8 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForNonClippingIntermediateLayer) {
TEST_F(LayerTreeHostCommonTest, HitTestingForMultipleLayers) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
gfx::Transform identity_matrix;
@@ -5009,7 +5021,8 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForMultipleLayerLists) {
// all layers are forced to be render surfaces now.
//
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
gfx::Transform identity_matrix;
@@ -5162,7 +5175,8 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForMultipleLayerLists) {
TEST_F(LayerTreeHostCommonTest, HitTestingForEmptyLayers) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
// Layer 1 - root
scoped_ptr<LayerImpl> root =
@@ -5296,7 +5310,8 @@ TEST_F(LayerTreeHostCommonTest,
TEST_F(LayerTreeHostCommonTest, HitCheckingTouchHandlerRegionsForSingleLayer) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root =
LayerImpl::Create(host_impl.active_tree(), 12345);
@@ -5380,7 +5395,8 @@ TEST_F(LayerTreeHostCommonTest, HitCheckingTouchHandlerRegionsForSingleLayer) {
TEST_F(LayerTreeHostCommonTest,
HitCheckingTouchHandlerRegionsForUninvertibleTransform) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root =
LayerImpl::Create(host_impl.active_tree(), 12345);
@@ -5467,7 +5483,8 @@ TEST_F(LayerTreeHostCommonTest,
TEST_F(LayerTreeHostCommonTest,
HitCheckingTouchHandlerRegionsForSinglePositionedLayer) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root =
LayerImpl::Create(host_impl.active_tree(), 12345);
@@ -5552,7 +5569,8 @@ TEST_F(LayerTreeHostCommonTest,
// content rect as being larger than the actual bounds of the layer.
//
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
gfx::Transform identity_matrix;
@@ -5659,7 +5677,8 @@ TEST_F(LayerTreeHostCommonTest,
// content rect and we should be able to hit the touch handler region by
// scaling the points accordingly.
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
gfx::Transform identity_matrix;
@@ -5790,7 +5809,8 @@ TEST_F(LayerTreeHostCommonTest,
gfx::PointF anchor;
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
SetLayerPropertiesForTesting(root.get(),
identity_matrix,
@@ -5890,7 +5910,8 @@ TEST_F(LayerTreeHostCommonTest,
gfx::PointF anchor;
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
SetLayerPropertiesForTesting(root.get(),
identity_matrix,
@@ -7588,7 +7609,8 @@ TEST_F(LayerTreeHostCommonTest, TransparentChildRenderSurfaceCreation) {
TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
host_impl.CreatePendingTree();
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1);
@@ -7787,7 +7809,8 @@ INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest,
TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -7844,7 +7867,8 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) {
TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -7899,7 +7923,8 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -7955,7 +7980,8 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) {
TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -8011,7 +8037,8 @@ void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {}
TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -8157,7 +8184,8 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) {
TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -8231,7 +8259,8 @@ TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) {
TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
host_impl.CreatePendingTree();
const gfx::Transform identity_matrix;
@@ -8841,7 +8870,8 @@ TEST_F(LayerTreeHostCommonTest,
TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
scoped_ptr<LayerImpl> root =
LayerImpl::Create(host_impl.active_tree(), 12345);
scoped_ptr<LayerImpl> child1 =
@@ -9430,7 +9460,8 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
// + scroll_parent
//
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
host_impl.CreatePendingTree();
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
scoped_ptr<LayerImpl> scroll_parent_border =
@@ -9556,7 +9587,8 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) {
// + fixed
//
FakeImplProxy proxy;
- FakeLayerTreeHostImpl host_impl(&proxy);
+ TestSharedBitmapManager shared_bitmap_manager;
+ FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
host_impl.CreatePendingTree();
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
scoped_ptr<LayerImpl> container =
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index e62c532..bcbc6c3 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -49,6 +49,7 @@
#include "cc/test/geometry_test_utils.h"
#include "cc/test/layer_test_common.h"
#include "cc/test/render_pass_test_common.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/test_web_graphics_context_3d.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/single_thread_proxy.h"
@@ -78,6 +79,7 @@ class LayerTreeHostImplTest : public testing::Test,
: proxy_(base::MessageLoopProxy::current()),
always_impl_thread_(&proxy_),
always_main_thread_blocked_(&proxy_),
+ shared_bitmap_manager_(new TestSharedBitmapManager()),
on_can_draw_state_changed_called_(false),
did_notify_ready_to_activate_(false),
did_request_commit_(false),
@@ -154,8 +156,12 @@ class LayerTreeHostImplTest : public testing::Test,
bool CreateHostImpl(const LayerTreeSettings& settings,
scoped_ptr<OutputSurface> output_surface) {
- host_impl_ = LayerTreeHostImpl::Create(
- settings, this, &proxy_, &stats_instrumentation_, NULL, 0);
+ host_impl_ = LayerTreeHostImpl::Create(settings,
+ this,
+ &proxy_,
+ &stats_instrumentation_,
+ shared_bitmap_manager_.get(),
+ 0);
bool init = host_impl_->InitializeRenderer(output_surface.Pass());
host_impl_->SetViewportSize(gfx::Size(10, 10));
return init;
@@ -377,6 +383,7 @@ class LayerTreeHostImplTest : public testing::Test,
DebugScopedSetImplThread always_impl_thread_;
DebugScopedSetMainThreadBlocked always_main_thread_blocked_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<LayerTreeHostImpl> host_impl_;
FakeRenderingStatsInstrumentation stats_instrumentation_;
bool on_can_draw_state_changed_called_;
@@ -1162,12 +1169,13 @@ class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl {
const LayerTreeSettings& settings,
LayerTreeHostImplClient* client,
Proxy* proxy,
+ SharedBitmapManager* manager,
RenderingStatsInstrumentation* rendering_stats_instrumentation)
: LayerTreeHostImpl(settings,
client,
proxy,
rendering_stats_instrumentation,
- NULL,
+ manager,
0) {}
virtual base::TimeTicks CurrentPhysicalTimeTicks() const OVERRIDE {
@@ -1192,8 +1200,11 @@ TEST_F(LayerTreeHostImplTest, ScrollbarLinearFadeScheduling) {
gfx::Size content_size(100, 100);
LayerTreeHostImplOverridePhysicalTime* host_impl_override_time =
- new LayerTreeHostImplOverridePhysicalTime(
- settings, this, &proxy_, &stats_instrumentation_);
+ new LayerTreeHostImplOverridePhysicalTime(settings,
+ this,
+ &proxy_,
+ shared_bitmap_manager_.get(),
+ &stats_instrumentation_);
host_impl_ = make_scoped_ptr(host_impl_override_time);
host_impl_->InitializeRenderer(CreateOutputSurface());
host_impl_->SetViewportSize(viewport_size);
@@ -3847,9 +3858,15 @@ TEST_F(LayerTreeHostImplTest, PartialSwapReceivesDamageRect) {
// that we can force partial swap enabled.
LayerTreeSettings settings;
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_, NULL, 0);
+ LayerTreeHostImpl::Create(settings,
+ this,
+ &proxy_,
+ &stats_instrumentation_,
+ shared_bitmap_manager.get(),
+ 0);
layer_tree_host_impl->InitializeRenderer(output_surface.Pass());
layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500));
@@ -4141,6 +4158,7 @@ static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity(
bool partial_swap,
LayerTreeHostImplClient* client,
Proxy* proxy,
+ SharedBitmapManager* manager,
RenderingStatsInstrumentation* stats_instrumentation) {
scoped_refptr<TestContextProvider> provider(TestContextProvider::Create());
scoped_ptr<OutputSurface> output_surface(
@@ -4151,7 +4169,7 @@ static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity(
LayerTreeSettings settings;
settings.partial_swap_enabled = partial_swap;
scoped_ptr<LayerTreeHostImpl> my_host_impl = LayerTreeHostImpl::Create(
- settings, client, proxy, stats_instrumentation, NULL, 0);
+ settings, client, proxy, stats_instrumentation, manager, 0);
my_host_impl->InitializeRenderer(output_surface.Pass());
my_host_impl->SetViewportSize(gfx::Size(100, 100));
@@ -4217,8 +4235,14 @@ static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity(
}
TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) {
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
scoped_ptr<LayerTreeHostImpl> my_host_impl =
- SetupLayersForOpacity(true, this, &proxy_, &stats_instrumentation_);
+ SetupLayersForOpacity(true,
+ this,
+ &proxy_,
+ shared_bitmap_manager.get(),
+ &stats_instrumentation_);
{
LayerTreeHostImpl::FrameData frame;
EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
@@ -4239,8 +4263,14 @@ TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) {
}
TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) {
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
scoped_ptr<LayerTreeHostImpl> my_host_impl =
- SetupLayersForOpacity(false, this, &proxy_, &stats_instrumentation_);
+ SetupLayersForOpacity(false,
+ this,
+ &proxy_,
+ shared_bitmap_manager.get(),
+ &stats_instrumentation_);
{
LayerTreeHostImpl::FrameData frame;
EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
@@ -5513,8 +5543,12 @@ TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails_OffscreenContext) {
// doesn't support memory management extensions.
TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) {
LayerTreeSettings settings;
- host_impl_ = LayerTreeHostImpl::Create(
- settings, this, &proxy_, &stats_instrumentation_, NULL, 0);
+ host_impl_ = LayerTreeHostImpl::Create(settings,
+ this,
+ &proxy_,
+ &stats_instrumentation_,
+ shared_bitmap_manager_.get(),
+ 0);
scoped_ptr<OutputSurface> output_surface(
FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create()));
@@ -5572,7 +5606,8 @@ class LayerTreeHostImplTestManageTiles : public LayerTreeHostImplTest {
LayerTreeSettings settings;
settings.impl_side_painting = true;
- fake_host_impl_ = new FakeLayerTreeHostImpl(settings, &proxy_);
+ fake_host_impl_ = new FakeLayerTreeHostImpl(
+ settings, &proxy_, shared_bitmap_manager_.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 316c021..c3734df 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -40,6 +40,7 @@
#include "cc/test/fake_video_frame_provider.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/layer_tree_test.h"
+#include "cc/test/test_shared_bitmap_manager.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"
@@ -2439,8 +2440,10 @@ TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) {
LayerTreeSettings settings;
settings.max_partial_texture_updates = 4;
- scoped_ptr<LayerTreeHost> host =
- LayerTreeHost::CreateSingleThreaded(&client, &client, NULL, settings);
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded(
+ &client, &client, shared_bitmap_manager.get(), settings);
EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded());
EXPECT_EQ(4u, host->settings().max_partial_texture_updates);
}
@@ -2451,8 +2454,10 @@ TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) {
LayerTreeSettings settings;
settings.max_partial_texture_updates = 4;
- scoped_ptr<LayerTreeHost> host =
- LayerTreeHost::CreateSingleThreaded(&client, &client, NULL, settings);
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded(
+ &client, &client, shared_bitmap_manager.get(), settings);
EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded());
EXPECT_EQ(4u, host->settings().max_partial_texture_updates);
}
@@ -2463,8 +2468,10 @@ TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) {
LayerTreeSettings settings;
settings.max_partial_texture_updates = 4;
- scoped_ptr<LayerTreeHost> host =
- LayerTreeHost::CreateSingleThreaded(&client, &client, NULL, settings);
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded(
+ &client, &client, shared_bitmap_manager.get(), settings);
EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded());
EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
}
@@ -2476,8 +2483,10 @@ TEST(LayerTreeHostTest,
LayerTreeSettings settings;
settings.max_partial_texture_updates = 4;
- scoped_ptr<LayerTreeHost> host =
- LayerTreeHost::CreateSingleThreaded(&client, &client, NULL, settings);
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded(
+ &client, &client, shared_bitmap_manager.get(), settings);
EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded());
EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
}
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index 925eda4..34dec8d 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -33,6 +33,7 @@
#include "cc/test/layer_tree_test.h"
#include "cc/test/render_pass_test_common.h"
#include "cc/test/test_context_provider.h"
+#include "cc/test/test_shared_bitmap_manager.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"
@@ -933,8 +934,9 @@ class LayerTreeHostContextTestDontUseLostResources
child_output_surface_ = FakeOutputSurface::Create3d();
child_output_surface_->BindToClient(&output_surface_client_);
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
child_resource_provider_ = ResourceProvider::Create(
- child_output_surface_.get(), NULL, 0, false, 1);
+ child_output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1);
}
static void EmptyReleaseCallback(unsigned sync_point, bool lost) {}
@@ -1151,6 +1153,7 @@ class LayerTreeHostContextTestDontUseLostResources
FakeOutputSurfaceClient output_surface_client_;
scoped_ptr<FakeOutputSurface> child_output_surface_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> child_resource_provider_;
scoped_refptr<DelegatedFrameResourceCollection>
diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc
index cf2ac87..adda9bd 100644
--- a/cc/trees/layer_tree_host_unittest_scroll.cc
+++ b/cc/trees/layer_tree_host_unittest_scroll.cc
@@ -12,6 +12,7 @@
#include "cc/test/fake_layer_tree_host_client.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/layer_tree_test.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/trees/layer_tree_impl.h"
#include "ui/gfx/point_conversions.h"
#include "ui/gfx/size_conversions.h"
@@ -1115,8 +1116,13 @@ TEST(LayerTreeHostFlingTest, DidStopFlingingThread) {
FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
ASSERT_TRUE(impl_thread.message_loop_proxy().get());
- scoped_ptr<LayerTreeHost> layer_tree_host = LayerTreeHost::CreateThreaded(
- &client, NULL, settings, impl_thread.message_loop_proxy());
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<LayerTreeHost> layer_tree_host =
+ LayerTreeHost::CreateThreaded(&client,
+ shared_bitmap_manager.get(),
+ settings,
+ impl_thread.message_loop_proxy());
impl_thread.message_loop_proxy()
->PostTask(FROM_HERE,
diff --git a/cc/trees/occlusion_tracker_perftest.cc b/cc/trees/occlusion_tracker_perftest.cc
index 8e3bc48..f6e5492 100644
--- a/cc/trees/occlusion_tracker_perftest.cc
+++ b/cc/trees/occlusion_tracker_perftest.cc
@@ -12,6 +12,7 @@
#include "cc/test/fake_proxy.h"
#include "cc/test/fake_rendering_stats_instrumentation.h"
#include "cc/test/lap_timer.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/trees/layer_tree_host_impl.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/single_thread_proxy.h"
@@ -34,8 +35,9 @@ class OcclusionTrackerPerfTest : public testing::Test {
impl_(&proxy_) {}
void CreateHost() {
LayerTreeSettings settings;
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager());
host_impl_ = LayerTreeHostImpl::Create(
- settings, &client_, &proxy_, &stats_, NULL, 1);
+ settings, &client_, &proxy_, &stats_, shared_bitmap_manager_.get(), 1);
host_impl_->InitializeRenderer(
FakeOutputSurface::Create3d().PassAs<OutputSurface>());
@@ -64,6 +66,7 @@ class OcclusionTrackerPerfTest : public testing::Test {
FakeProxy proxy_;
DebugScopedSetImplThread impl_;
FakeRenderingStatsInstrumentation stats_;
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<LayerTreeHostImpl> host_impl_;
};
diff --git a/cc/trees/quad_culler_unittest.cc b/cc/trees/quad_culler_unittest.cc
index 0401df1..a3cc443 100644
--- a/cc/trees/quad_culler_unittest.cc
+++ b/cc/trees/quad_culler_unittest.cc
@@ -17,6 +17,7 @@
#include "cc/test/fake_impl_proxy.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/test_occlusion_tracker.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/trees/occlusion_tracker.h"
#include "cc/trees/single_thread_proxy.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -31,8 +32,7 @@ typedef LayerIterator<LayerImpl> LayerIteratorType;
class QuadCullerTest : public testing::Test {
public:
QuadCullerTest()
- : host_impl_(&proxy_),
- layer_id_(1) {}
+ : host_impl_(&proxy_, &shared_bitmap_manager_), layer_id_(1) {}
scoped_ptr<TiledLayerImpl> MakeLayer(TiledLayerImpl* parent,
const gfx::Transform& draw_transform,
@@ -103,6 +103,7 @@ class QuadCullerTest : public testing::Test {
protected:
FakeImplProxy proxy_;
+ TestSharedBitmapManager shared_bitmap_manager_;
FakeLayerTreeHostImpl host_impl_;
int layer_id_;
diff --git a/cc/trees/tree_synchronizer_unittest.cc b/cc/trees/tree_synchronizer_unittest.cc
index 2e853ea..4689554 100644
--- a/cc/trees/tree_synchronizer_unittest.cc
+++ b/cc/trees/tree_synchronizer_unittest.cc
@@ -16,6 +16,7 @@
#include "cc/test/animation_test_common.h"
#include "cc/test/fake_impl_proxy.h"
#include "cc/test/fake_layer_tree_host.h"
+#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/trees/proxy.h"
#include "cc/trees/single_thread_proxy.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -557,8 +558,15 @@ TEST_F(TreeSynchronizerTest, SynchronizeAnimations) {
FakeProxy proxy;
DebugScopedSetImplThread impl(&proxy);
FakeRenderingStatsInstrumentation stats_instrumentation;
- scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create(
- settings, NULL, &proxy, &stats_instrumentation, NULL, 0);
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<LayerTreeHostImpl> host_impl =
+ LayerTreeHostImpl::Create(settings,
+ NULL,
+ &proxy,
+ &stats_instrumentation,
+ shared_bitmap_manager.get(),
+ 0);
scoped_refptr<Layer> layer_tree_root = Layer::Create();
host_->SetRootLayer(layer_tree_root);
@@ -589,8 +597,15 @@ TEST_F(TreeSynchronizerTest, SynchronizeScrollParent) {
FakeProxy proxy;
DebugScopedSetImplThread impl(&proxy);
FakeRenderingStatsInstrumentation stats_instrumentation;
- scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create(
- settings, NULL, &proxy, &stats_instrumentation, NULL, 0);
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<LayerTreeHostImpl> host_impl =
+ LayerTreeHostImpl::Create(settings,
+ NULL,
+ &proxy,
+ &stats_instrumentation,
+ shared_bitmap_manager.get(),
+ 0);
scoped_refptr<Layer> layer_tree_root = Layer::Create();
scoped_refptr<Layer> scroll_parent = Layer::Create();
@@ -655,8 +670,15 @@ TEST_F(TreeSynchronizerTest, SynchronizeClipParent) {
FakeProxy proxy;
DebugScopedSetImplThread impl(&proxy);
FakeRenderingStatsInstrumentation stats_instrumentation;
- scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create(
- settings, NULL, &proxy, &stats_instrumentation, NULL, 0);
+ scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
+ new TestSharedBitmapManager());
+ scoped_ptr<LayerTreeHostImpl> host_impl =
+ LayerTreeHostImpl::Create(settings,
+ NULL,
+ &proxy,
+ &stats_instrumentation,
+ shared_bitmap_manager.get(),
+ 0);
scoped_refptr<Layer> layer_tree_root = Layer::Create();
scoped_refptr<Layer> clip_parent = Layer::Create();