Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Unified Diff: blimp/client/core/compositor/blimp_compositor.cc

Issue 2480203002: ui: Cleanup class/struct forward declarations (Closed)
Patch Set: Sync CL to position 430550 Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: blimp/client/core/compositor/blimp_compositor.cc
diff --git a/blimp/client/core/compositor/blimp_compositor.cc b/blimp/client/core/compositor/blimp_compositor.cc
index 4b94dbcfab23b67609f7b84d2dd4466f1e8ebbe5..9159663e20681493d86250020a5bc62b65cea886 100644
--- a/blimp/client/core/compositor/blimp_compositor.cc
+++ b/blimp/client/core/compositor/blimp_compositor.cc
@@ -138,6 +138,7 @@ BlimpCompositor::BlimpCompositor(
frame_sink_id_(compositor_dependencies_->GetEmbedderDependencies()
->AllocateFrameSinkId()),
proxy_client_(nullptr),
+ bound_to_proxy_(false),
compositor_frame_sink_request_pending_(false),
layer_(cc::Layer::Create()),
remote_proto_channel_receiver_(nullptr),
@@ -149,6 +150,9 @@ BlimpCompositor::BlimpCompositor(
void BlimpCompositor::Initialize() {
surface_id_allocator_ = base::MakeUnique<cc::SurfaceIdAllocator>();
GetEmbedderDeps()->GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_);
+ surface_factory_ = base::MakeUnique<cc::SurfaceFactory>(
+ frame_sink_id_, GetEmbedderDeps()->GetSurfaceManager(), this);
+ animation_host_ = cc::AnimationHost::CreateMainInstance();
host_ = CreateLayerTreeHost();
if (use_threaded_layer_tree_host_) {
@@ -184,7 +188,7 @@ void BlimpCompositor::RequestCopyOfOutput(
std::unique_ptr<cc::CopyOutputRequest> copy_request,
bool flush_pending_update) {
// If we don't have a FrameSink, fail right away.
- if (!surface_factory_)
+ if (!bound_to_proxy_)
return;
if (!use_threaded_layer_tree_host_) {
@@ -255,7 +259,7 @@ void BlimpCompositor::ApplyViewportDeltas(
}
void BlimpCompositor::RequestNewCompositorFrameSink() {
- DCHECK(!surface_factory_);
+ DCHECK(!bound_to_proxy_);
DCHECK(!compositor_frame_sink_request_pending_);
compositor_frame_sink_request_pending_ = true;
@@ -278,9 +282,10 @@ void BlimpCompositor::DidCommitAndDrawFrame() {
for (auto it = pending_commit_trackers_.begin();
it != pending_commit_trackers_.end();) {
if (--it->first == 0) {
- if (surface_factory_)
+ if (bound_to_proxy_) {
surface_factory_->RequestCopyOfSurface(local_frame_id_,
std::move(it->second));
+ }
it = pending_commit_trackers_.erase(it);
} else {
++it;
@@ -371,8 +376,8 @@ const base::WeakPtr<cc::InputHandler>& BlimpCompositor::GetInputHandler() {
void BlimpCompositor::OnContextProvidersCreated(
const scoped_refptr<cc::ContextProvider>& compositor_context_provider,
const scoped_refptr<cc::ContextProvider>& worker_context_provider) {
- DCHECK(!surface_factory_) << "Any connection to the old CompositorFrameSink "
- "should have been destroyed";
+ DCHECK(!bound_to_proxy_) << "Any connection to the old CompositorFrameSink "
+ "should have been destroyed";
// Make sure we still have a host and we're still expecting a
// CompositorFrameSink. This can happen if the host dies while the request is
@@ -400,16 +405,15 @@ void BlimpCompositor::OnContextProvidersCreated(
void BlimpCompositor::BindToProxyClient(
base::WeakPtr<BlimpCompositorFrameSinkProxyClient> proxy_client) {
DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(!surface_factory_);
+ DCHECK(!bound_to_proxy_);
+ bound_to_proxy_ = true;
proxy_client_ = proxy_client;
- surface_factory_ = base::MakeUnique<cc::SurfaceFactory>(
- frame_sink_id_, GetEmbedderDeps()->GetSurfaceManager(), this);
}
void BlimpCompositor::SubmitCompositorFrame(cc::CompositorFrame frame) {
DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(surface_factory_);
+ DCHECK(bound_to_proxy_);
cc::RenderPass* root_pass = frame.render_pass_list.back().get();
gfx::Size surface_size = root_pass->output_rect.size();
@@ -451,7 +455,6 @@ void BlimpCompositor::SubmitCompositorFrame(cc::CompositorFrame frame) {
}
void BlimpCompositor::SubmitCompositorFrameAck() {
- DCHECK(surface_factory_);
compositor_dependencies_->GetCompositorTaskRunner()->PostTask(
FROM_HERE,
base::Bind(&BlimpCompositorFrameSinkProxyClient::SubmitCompositorFrameAck,
@@ -465,16 +468,17 @@ void BlimpCompositor::MakeCopyRequestOnNextSwap(
void BlimpCompositor::UnbindProxyClient() {
DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(surface_factory_);
+ DCHECK(bound_to_proxy_);
DestroyDelegatedContent();
- surface_factory_.reset();
+ surface_factory_->Reset();
+ bound_to_proxy_ = false;
proxy_client_ = nullptr;
}
void BlimpCompositor::ReturnResources(
const cc::ReturnedResourceArray& resources) {
- DCHECK(surface_factory_);
+ DCHECK(bound_to_proxy_);
compositor_dependencies_->GetCompositorTaskRunner()->PostTask(
FROM_HERE,
base::Bind(
@@ -523,6 +527,7 @@ void BlimpCompositor::DestroyDelegatedContent() {
std::unique_ptr<cc::LayerTreeHostInProcess>
BlimpCompositor::CreateLayerTreeHost() {
+ DCHECK(animation_host_);
std::unique_ptr<cc::LayerTreeHostInProcess> host;
cc::LayerTreeHostInProcess::InitParams params;
@@ -537,8 +542,7 @@ BlimpCompositor::CreateLayerTreeHost() {
cc::LayerTreeSettings* settings =
compositor_dependencies_->GetLayerTreeSettings();
params.settings = settings;
-
- params.animation_host = cc::AnimationHost::CreateMainInstance();
+ params.mutator_host = animation_host_.get();
scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner =
compositor_dependencies_->GetCompositorTaskRunner();
@@ -560,7 +564,6 @@ void BlimpCompositor::DestroyLayerTreeHost() {
// Tear down the output surface connection with the old LayerTreeHost
// instance.
DestroyDelegatedContent();
- surface_factory_.reset();
// Destroy the old LayerTreeHost state.
host_.reset();
« no previous file with comments | « blimp/client/core/compositor/blimp_compositor.h ('k') | blimp/client/core/context/android/blimp_client_context_impl_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698