Index: cc/layers/tiled_layer_unittest.cc |
diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc |
index a9a1e781577888502b8749d8d26973b37b639903..b4ee30f037895b4073e7bbe2ad34629a9691ca95 100644 |
--- a/cc/layers/tiled_layer_unittest.cc |
+++ b/cc/layers/tiled_layer_unittest.cc |
@@ -45,18 +45,10 @@ class TestOcclusionTracker : public OcclusionTracker<Layer> { |
} |
}; |
-class SynchronousOutputSurfaceLayerTreeHost : public LayerTreeHost { |
+class SynchronousOutputSurfaceClient : public FakeLayerTreeHostClient { |
public: |
- static scoped_ptr<SynchronousOutputSurfaceLayerTreeHost> Create( |
- LayerTreeHostClient* client, |
- SharedBitmapManager* manager, |
- const LayerTreeSettings& settings, |
- scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { |
- return make_scoped_ptr(new SynchronousOutputSurfaceLayerTreeHost( |
- client, manager, settings, impl_task_runner)); |
- } |
- |
- ~SynchronousOutputSurfaceLayerTreeHost() override {} |
+ SynchronousOutputSurfaceClient() |
+ : FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D) {} |
bool EnsureOutputSurfaceCreated() { |
base::MessageLoop::current()->PostDelayedTask( |
@@ -67,25 +59,19 @@ class SynchronousOutputSurfaceLayerTreeHost : public LayerTreeHost { |
return output_surface_created_; |
} |
- void OnCreateAndInitializeOutputSurfaceAttempted(bool success) override { |
- LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(success); |
- output_surface_created_ = success; |
+ void DidInitializeOutputSurface() override { |
+ FakeLayerTreeHostClient::DidInitializeOutputSurface(); |
+ output_surface_created_ = true; |
run_loop_.Quit(); |
} |
- private: |
- SynchronousOutputSurfaceLayerTreeHost( |
- LayerTreeHostClient* client, |
- SharedBitmapManager* manager, |
- const LayerTreeSettings& settings, |
- scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) |
- : LayerTreeHost(client, manager, NULL, settings), |
- output_surface_created_(false) { |
- LayerTreeHost::InitializeThreaded(base::MessageLoopProxy::current(), |
- impl_task_runner, |
- nullptr); |
+ void DidFailToInitializeOutputSurface() override { |
+ FakeLayerTreeHostClient::DidFailToInitializeOutputSurface(); |
+ output_surface_created_ = false; |
+ run_loop_.Quit(); |
} |
+ private: |
bool output_surface_created_; |
base::RunLoop run_loop_; |
}; |
@@ -97,7 +83,6 @@ class TiledLayerTest : public testing::Test { |
output_surface_(FakeOutputSurface::Create3d()), |
queue_(make_scoped_ptr(new ResourceUpdateQueue)), |
impl_thread_("ImplThread"), |
- fake_layer_tree_host_client_(FakeLayerTreeHostClient::DIRECT_3D), |
occlusion_(nullptr) { |
settings_.max_partial_texture_updates = std::numeric_limits<size_t>::max(); |
settings_.layer_transforms_should_scale_layer_contents = true; |
@@ -106,16 +91,16 @@ class TiledLayerTest : public testing::Test { |
void SetUp() override { |
impl_thread_.Start(); |
shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
- layer_tree_host_ = SynchronousOutputSurfaceLayerTreeHost::Create( |
- &fake_layer_tree_host_client_, |
- shared_bitmap_manager_.get(), |
- settings_, |
- impl_thread_.message_loop_proxy()); |
- fake_layer_tree_host_client_.SetLayerTreeHost(layer_tree_host_.get()); |
+ layer_tree_host_ = LayerTreeHost::CreateThreaded( |
+ &synchonous_output_surface_client_, shared_bitmap_manager_.get(), |
+ nullptr, settings_, base::MessageLoopProxy::current(), |
+ impl_thread_.message_loop_proxy(), nullptr); |
+ synchonous_output_surface_client_.SetLayerTreeHost(layer_tree_host_.get()); |
proxy_ = layer_tree_host_->proxy(); |
resource_manager_ = PrioritizedResourceManager::Create(proxy_); |
layer_tree_host_->SetLayerTreeHostClientReady(); |
- CHECK(layer_tree_host_->EnsureOutputSurfaceCreated()); |
+ CHECK(synchonous_output_surface_client_.EnsureOutputSurfaceCreated()); |
+ |
layer_tree_host_->SetRootLayer(Layer::Create()); |
CHECK(output_surface_->BindToClient(&output_surface_client_)); |
@@ -253,8 +238,8 @@ class TiledLayerTest : public testing::Test { |
scoped_ptr<ResourceUpdateQueue> queue_; |
PriorityCalculator priority_calculator_; |
base::Thread impl_thread_; |
- FakeLayerTreeHostClient fake_layer_tree_host_client_; |
- scoped_ptr<SynchronousOutputSurfaceLayerTreeHost> layer_tree_host_; |
+ SynchronousOutputSurfaceClient synchonous_output_surface_client_; |
+ scoped_ptr<LayerTreeHost> layer_tree_host_; |
scoped_ptr<FakeLayerTreeHostImpl> host_impl_; |
scoped_ptr<PrioritizedResourceManager> resource_manager_; |
TestOcclusionTracker* occlusion_; |