diff options
author | enne <enne@chromium.org> | 2014-09-25 13:16:31 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-25 20:16:48 +0000 |
commit | 2097cab4982cc0ad92b878ad88e39d724dd047f7 (patch) | |
tree | 05eaaf4a03c4c32ad0ab5f24b79958a043bd0b65 /cc/test/fake_layer_tree_host_client.cc | |
parent | dea7b93642a46bdaaecad4a438bba1bfc8cc8516 (diff) | |
download | chromium_src-2097cab4982cc0ad92b878ad88e39d724dd047f7.zip chromium_src-2097cab4982cc0ad92b878ad88e39d724dd047f7.tar.gz chromium_src-2097cab4982cc0ad92b878ad88e39d724dd047f7.tar.bz2 |
Make cc output surface creation async
As a part of making Android CompositorImpl use cc's scheduler and not
post its own composite calls manually, cc needs to be able to handle
asynchronous output surface creation.
This change modifies CreateOutputSurface to instead be
RequestNewOutputSurface, which the LayerTreeHostClient must respond to
and call SetOutputSurface on the host with the new output surface once
it is ready.
Because the LayerTreeHostClient must now talk to the host as a part of
output surface creation, a bunch of unit test code needed to be
refactored to handle this.
BUG=none
Review URL: https://codereview.chromium.org/348093004
Cr-Commit-Position: refs/heads/master@{#296780}
Diffstat (limited to 'cc/test/fake_layer_tree_host_client.cc')
-rw-r--r-- | cc/test/fake_layer_tree_host_client.cc | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/cc/test/fake_layer_tree_host_client.cc b/cc/test/fake_layer_tree_host_client.cc index 975f687..087cbb1 100644 --- a/cc/test/fake_layer_tree_host_client.cc +++ b/cc/test/fake_layer_tree_host_client.cc @@ -7,6 +7,7 @@ #include "cc/output/context_provider.h" #include "cc/test/fake_output_surface.h" #include "cc/test/test_web_graphics_context_3d.h" +#include "cc/trees/layer_tree_host.h" namespace cc { @@ -14,25 +15,31 @@ FakeLayerTreeHostClient::FakeLayerTreeHostClient(RendererOptions options) : use_software_rendering_(options == DIRECT_SOFTWARE || options == DELEGATED_SOFTWARE), use_delegating_renderer_(options == DELEGATED_3D || - options == DELEGATED_SOFTWARE) {} + options == DELEGATED_SOFTWARE), + host_(NULL) { +} FakeLayerTreeHostClient::~FakeLayerTreeHostClient() {} -scoped_ptr<OutputSurface> FakeLayerTreeHostClient::CreateOutputSurface( - bool fallback) { +void FakeLayerTreeHostClient::RequestNewOutputSurface(bool fallback) { + DCHECK(host_); + scoped_ptr<OutputSurface> surface; if (use_software_rendering_) { if (use_delegating_renderer_) { - return FakeOutputSurface::CreateDelegatingSoftware( - make_scoped_ptr(new SoftwareOutputDevice)).PassAs<OutputSurface>(); + surface = FakeOutputSurface::CreateDelegatingSoftware( + make_scoped_ptr(new SoftwareOutputDevice)) + .PassAs<OutputSurface>(); + } else { + surface = FakeOutputSurface::CreateSoftware( + make_scoped_ptr(new SoftwareOutputDevice)) + .PassAs<OutputSurface>(); } - - return FakeOutputSurface::CreateSoftware( - make_scoped_ptr(new SoftwareOutputDevice)).PassAs<OutputSurface>(); + } else if (use_delegating_renderer_) { + surface = FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>(); + } else { + surface = FakeOutputSurface::Create3d().PassAs<OutputSurface>(); } - - if (use_delegating_renderer_) - return FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>(); - return FakeOutputSurface::Create3d().PassAs<OutputSurface>(); + host_->SetOutputSurface(surface.Pass()); } } // namespace cc |