| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "blimp/client/core/compositor/blimp_compositor.h" | 5 #include "blimp/client/core/compositor/blimp_compositor.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 std::unique_ptr<cc::CopyOutputRequest> copy_request_; | 114 std::unique_ptr<cc::CopyOutputRequest> copy_request_; |
| 115 base::WeakPtr<BlimpCompositor> compositor_weak_ptr_; | 115 base::WeakPtr<BlimpCompositor> compositor_weak_ptr_; |
| 116 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 116 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 // static | 119 // static |
| 120 std::unique_ptr<BlimpCompositor> BlimpCompositor::Create( | 120 std::unique_ptr<BlimpCompositor> BlimpCompositor::Create( |
| 121 BlimpCompositorDependencies* compositor_dependencies, | 121 BlimpCompositorDependencies* compositor_dependencies, |
| 122 BlimpCompositorClient* client, | 122 BlimpCompositorClient* client) { |
| 123 bool use_threaded_layer_tree_host) { | |
| 124 std::unique_ptr<BlimpCompositor> compositor = | 123 std::unique_ptr<BlimpCompositor> compositor = |
| 125 base::WrapUnique(new BlimpCompositor(compositor_dependencies, client, | 124 base::WrapUnique(new BlimpCompositor(compositor_dependencies, client)); |
| 126 use_threaded_layer_tree_host)); | |
| 127 compositor->Initialize(); | 125 compositor->Initialize(); |
| 128 return compositor; | 126 return compositor; |
| 129 } | 127 } |
| 130 | 128 |
| 131 BlimpCompositor::BlimpCompositor( | 129 BlimpCompositor::BlimpCompositor( |
| 132 BlimpCompositorDependencies* compositor_dependencies, | 130 BlimpCompositorDependencies* compositor_dependencies, |
| 133 BlimpCompositorClient* client, | 131 BlimpCompositorClient* client) |
| 134 bool use_threaded_layer_tree_host) | 132 : client_(client), |
| 135 : use_threaded_layer_tree_host_(use_threaded_layer_tree_host), | |
| 136 client_(client), | |
| 137 compositor_dependencies_(compositor_dependencies), | 133 compositor_dependencies_(compositor_dependencies), |
| 138 frame_sink_id_(compositor_dependencies_->GetEmbedderDependencies() | 134 frame_sink_id_(compositor_dependencies_->GetEmbedderDependencies() |
| 139 ->AllocateFrameSinkId()), | 135 ->AllocateFrameSinkId()), |
| 140 proxy_client_(nullptr), | 136 proxy_client_(nullptr), |
| 141 bound_to_proxy_(false), | 137 bound_to_proxy_(false), |
| 142 compositor_frame_sink_request_pending_(false), | 138 compositor_frame_sink_request_pending_(false), |
| 143 layer_(cc::Layer::Create()), | 139 layer_(cc::Layer::Create()), |
| 144 remote_proto_channel_receiver_(nullptr), | |
| 145 outstanding_commits_(0U), | |
| 146 weak_ptr_factory_(this) { | 140 weak_ptr_factory_(this) { |
| 147 DCHECK(thread_checker_.CalledOnValidThread()); | 141 DCHECK(thread_checker_.CalledOnValidThread()); |
| 148 } | 142 } |
| 149 | 143 |
| 150 void BlimpCompositor::Initialize() { | 144 void BlimpCompositor::Initialize() { |
| 151 surface_id_allocator_ = base::MakeUnique<cc::SurfaceIdAllocator>(); | 145 surface_id_allocator_ = base::MakeUnique<cc::SurfaceIdAllocator>(); |
| 152 GetEmbedderDeps()->GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); | 146 GetEmbedderDeps()->GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); |
| 153 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>( | 147 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>( |
| 154 frame_sink_id_, GetEmbedderDeps()->GetSurfaceManager(), this); | 148 frame_sink_id_, GetEmbedderDeps()->GetSurfaceManager(), this); |
| 155 animation_host_ = cc::AnimationHost::CreateMainInstance(); | 149 animation_host_ = cc::AnimationHost::CreateMainInstance(); |
| 156 host_ = CreateLayerTreeHost(); | 150 host_ = CreateLayerTreeHost(); |
| 157 | 151 |
| 158 if (use_threaded_layer_tree_host_) { | |
| 159 std::unique_ptr<cc::ClientPictureCache> client_picture_cache = | 152 std::unique_ptr<cc::ClientPictureCache> client_picture_cache = |
| 160 compositor_dependencies_->GetImageSerializationProcessor() | 153 compositor_dependencies_->GetImageSerializationProcessor() |
| 161 ->CreateClientPictureCache(); | 154 ->CreateClientPictureCache(); |
| 162 compositor_state_deserializer_ = | 155 compositor_state_deserializer_ = |
| 163 base::MakeUnique<cc::CompositorStateDeserializer>( | 156 base::MakeUnique<cc::CompositorStateDeserializer>( |
| 164 host_.get(), std::move(client_picture_cache), this); | 157 host_.get(), std::move(client_picture_cache), this); |
| 165 } | |
| 166 } | 158 } |
| 167 | 159 |
| 168 BlimpCompositor::~BlimpCompositor() { | 160 BlimpCompositor::~BlimpCompositor() { |
| 169 DCHECK(thread_checker_.CalledOnValidThread()); | 161 DCHECK(thread_checker_.CalledOnValidThread()); |
| 170 | 162 |
| 171 DestroyLayerTreeHost(); | 163 DestroyLayerTreeHost(); |
| 172 GetEmbedderDeps()->GetSurfaceManager()->InvalidateFrameSinkId(frame_sink_id_); | 164 GetEmbedderDeps()->GetSurfaceManager()->InvalidateFrameSinkId(frame_sink_id_); |
| 173 } | 165 } |
| 174 | 166 |
| 175 void BlimpCompositor::SetVisible(bool visible) { | 167 void BlimpCompositor::SetVisible(bool visible) { |
| 176 host_->SetVisible(visible); | 168 host_->SetVisible(visible); |
| 177 } | 169 } |
| 178 | 170 |
| 179 bool BlimpCompositor::IsVisible() const { | 171 bool BlimpCompositor::IsVisible() const { |
| 180 return host_->IsVisible(); | 172 return host_->IsVisible(); |
| 181 } | 173 } |
| 182 | 174 |
| 183 bool BlimpCompositor::HasPendingFrameUpdateFromEngine() const { | 175 bool BlimpCompositor::HasPendingFrameUpdateFromEngine() const { |
| 184 return pending_frame_update_.get() != nullptr; | 176 return pending_frame_update_.get() != nullptr; |
| 185 } | 177 } |
| 186 | 178 |
| 187 void BlimpCompositor::RequestCopyOfOutput( | 179 void BlimpCompositor::RequestCopyOfOutput( |
| 188 std::unique_ptr<cc::CopyOutputRequest> copy_request, | 180 std::unique_ptr<cc::CopyOutputRequest> copy_request, |
| 189 bool flush_pending_update) { | 181 bool flush_pending_update) { |
| 190 // If we don't have a FrameSink, fail right away. | 182 // If we don't have a FrameSink, fail right away. |
| 191 if (!bound_to_proxy_) | 183 if (!bound_to_proxy_) |
| 192 return; | 184 return; |
| 193 | 185 |
| 194 if (!use_threaded_layer_tree_host_) { | |
| 195 RequestCopyOfOutputDeprecated(std::move(copy_request)); | |
| 196 return; | |
| 197 } | |
| 198 | |
| 199 if (flush_pending_update) { | 186 if (flush_pending_update) { |
| 200 // Always request a commit when queuing the promise to make sure that any | 187 // Always request a commit when queuing the promise to make sure that any |
| 201 // frames pending draws are cleared from the pipeline. | 188 // frames pending draws are cleared from the pipeline. |
| 202 host_->QueueSwapPromise(base::MakeUnique<FrameTrackingSwapPromise>( | 189 host_->QueueSwapPromise(base::MakeUnique<FrameTrackingSwapPromise>( |
| 203 std::move(copy_request), weak_ptr_factory_.GetWeakPtr(), | 190 std::move(copy_request), weak_ptr_factory_.GetWeakPtr(), |
| 204 base::ThreadTaskRunnerHandle::Get())); | 191 base::ThreadTaskRunnerHandle::Get())); |
| 205 host_->SetNeedsCommit(); | 192 host_->SetNeedsCommit(); |
| 206 } else if (!local_frame_id_.is_null()) { | 193 } else if (!local_frame_id_.is_null()) { |
| 207 // Make a copy request for the surface directly. | 194 // Make a copy request for the surface directly. |
| 208 surface_factory_->RequestCopyOfSurface(local_frame_id_, | 195 surface_factory_->RequestCopyOfSurface(local_frame_id_, |
| 209 std::move(copy_request)); | 196 std::move(copy_request)); |
| 210 } | 197 } |
| 211 } | 198 } |
| 212 | 199 |
| 213 void BlimpCompositor::RequestCopyOfOutputDeprecated( | |
| 214 std::unique_ptr<cc::CopyOutputRequest> copy_request) { | |
| 215 DCHECK(!use_threaded_layer_tree_host_); | |
| 216 | |
| 217 if (outstanding_commits_ == 0) { | |
| 218 surface_factory_->RequestCopyOfSurface(local_frame_id_, | |
| 219 std::move(copy_request)); | |
| 220 return; | |
| 221 } | |
| 222 | |
| 223 pending_commit_trackers_.push_back( | |
| 224 std::make_pair(outstanding_commits_, std::move(copy_request))); | |
| 225 } | |
| 226 | |
| 227 void BlimpCompositor::UpdateLayerTreeHost() { | 200 void BlimpCompositor::UpdateLayerTreeHost() { |
| 228 DCHECK(use_threaded_layer_tree_host_); | |
| 229 | |
| 230 // UpdateLayerTreeHost marks the end of reporting of any deltas from the impl | 201 // UpdateLayerTreeHost marks the end of reporting of any deltas from the impl |
| 231 // thread. So send a client state update if the local state was modified now. | 202 // thread. So send a client state update if the local state was modified now. |
| 232 FlushClientState(); | 203 FlushClientState(); |
| 233 | 204 |
| 234 if (pending_frame_update_) { | 205 if (pending_frame_update_) { |
| 235 DCHECK(use_threaded_layer_tree_host_); | |
| 236 compositor_state_deserializer_->DeserializeCompositorUpdate( | 206 compositor_state_deserializer_->DeserializeCompositorUpdate( |
| 237 pending_frame_update_->layer_tree_host()); | 207 pending_frame_update_->layer_tree_host()); |
| 238 pending_frame_update_ = nullptr; | 208 pending_frame_update_ = nullptr; |
| 239 cc::proto::CompositorMessage frame_ack; | 209 cc::proto::CompositorMessage frame_ack; |
| 240 frame_ack.set_frame_ack(true); | 210 frame_ack.set_frame_ack(true); |
| 241 client_->SendCompositorMessage(frame_ack); | 211 client_->SendCompositorMessage(frame_ack); |
| 242 } | 212 } |
| 243 | 213 |
| 244 // Send back any deltas that have not yet been resolved on the main thread | 214 // Send back any deltas that have not yet been resolved on the main thread |
| 245 // back to the impl thread. | 215 // back to the impl thread. |
| 246 compositor_state_deserializer_->SendUnappliedDeltasToLayerTreeHost(); | 216 compositor_state_deserializer_->SendUnappliedDeltasToLayerTreeHost(); |
| 247 } | 217 } |
| 248 | 218 |
| 249 void BlimpCompositor::ApplyViewportDeltas( | 219 void BlimpCompositor::ApplyViewportDeltas( |
| 250 const gfx::Vector2dF& inner_delta, | 220 const gfx::Vector2dF& inner_delta, |
| 251 const gfx::Vector2dF& outer_delta, | 221 const gfx::Vector2dF& outer_delta, |
| 252 const gfx::Vector2dF& elastic_overscroll_delta, | 222 const gfx::Vector2dF& elastic_overscroll_delta, |
| 253 float page_scale, | 223 float page_scale, |
| 254 float top_controls_delta) { | 224 float top_controls_delta) { |
| 255 DCHECK(use_threaded_layer_tree_host_); | |
| 256 compositor_state_deserializer_->ApplyViewportDeltas( | 225 compositor_state_deserializer_->ApplyViewportDeltas( |
| 257 inner_delta, outer_delta, elastic_overscroll_delta, page_scale, | 226 inner_delta, outer_delta, elastic_overscroll_delta, page_scale, |
| 258 top_controls_delta); | 227 top_controls_delta); |
| 259 } | 228 } |
| 260 | 229 |
| 261 void BlimpCompositor::RequestNewCompositorFrameSink() { | 230 void BlimpCompositor::RequestNewCompositorFrameSink() { |
| 262 DCHECK(!bound_to_proxy_); | 231 DCHECK(!bound_to_proxy_); |
| 263 DCHECK(!compositor_frame_sink_request_pending_); | 232 DCHECK(!compositor_frame_sink_request_pending_); |
| 264 | 233 |
| 265 compositor_frame_sink_request_pending_ = true; | 234 compositor_frame_sink_request_pending_ = true; |
| 266 GetEmbedderDeps()->GetContextProviders( | 235 GetEmbedderDeps()->GetContextProviders( |
| 267 base::Bind(&BlimpCompositor::OnContextProvidersCreated, | 236 base::Bind(&BlimpCompositor::OnContextProvidersCreated, |
| 268 weak_ptr_factory_.GetWeakPtr())); | 237 weak_ptr_factory_.GetWeakPtr())); |
| 269 } | 238 } |
| 270 | 239 |
| 271 void BlimpCompositor::DidInitializeCompositorFrameSink() { | 240 void BlimpCompositor::DidInitializeCompositorFrameSink() { |
| 272 compositor_frame_sink_request_pending_ = false; | 241 compositor_frame_sink_request_pending_ = false; |
| 273 } | 242 } |
| 274 | 243 |
| 275 void BlimpCompositor::DidCommitAndDrawFrame() { | 244 void BlimpCompositor::DidCommitAndDrawFrame() {} |
| 276 if (use_threaded_layer_tree_host_) | |
| 277 return; | |
| 278 | |
| 279 DCHECK_GT(outstanding_commits_, 0U); | |
| 280 outstanding_commits_--; | |
| 281 | |
| 282 for (auto it = pending_commit_trackers_.begin(); | |
| 283 it != pending_commit_trackers_.end();) { | |
| 284 if (--it->first == 0) { | |
| 285 if (bound_to_proxy_) { | |
| 286 surface_factory_->RequestCopyOfSurface(local_frame_id_, | |
| 287 std::move(it->second)); | |
| 288 } | |
| 289 it = pending_commit_trackers_.erase(it); | |
| 290 } else { | |
| 291 ++it; | |
| 292 } | |
| 293 } | |
| 294 } | |
| 295 | |
| 296 void BlimpCompositor::SetProtoReceiver(ProtoReceiver* receiver) { | |
| 297 DCHECK(!use_threaded_layer_tree_host_); | |
| 298 remote_proto_channel_receiver_ = receiver; | |
| 299 } | |
| 300 | |
| 301 void BlimpCompositor::SendCompositorProto( | |
| 302 const cc::proto::CompositorMessage& proto) { | |
| 303 DCHECK(!use_threaded_layer_tree_host_); | |
| 304 client_->SendCompositorMessage(proto); | |
| 305 } | |
| 306 | 245 |
| 307 void BlimpCompositor::OnCompositorMessageReceived( | 246 void BlimpCompositor::OnCompositorMessageReceived( |
| 308 std::unique_ptr<cc::proto::CompositorMessage> message) { | 247 std::unique_ptr<cc::proto::CompositorMessage> message) { |
| 309 if (message->has_to_impl()) { | |
| 310 HandleCompositorMessageToImpl(std::move(message)); | |
| 311 return; | |
| 312 } | |
| 313 | |
| 314 DCHECK(use_threaded_layer_tree_host_); | |
| 315 cc::proto::CompositorMessage* message_received = message.get(); | 248 cc::proto::CompositorMessage* message_received = message.get(); |
| 316 | 249 |
| 317 if (message_received->has_layer_tree_host()) { | 250 if (message_received->has_layer_tree_host()) { |
| 318 DCHECK(!pending_frame_update_) | 251 DCHECK(!pending_frame_update_) |
| 319 << "We should have only a single frame in flight"; | 252 << "We should have only a single frame in flight"; |
| 320 | 253 |
| 321 UMA_HISTOGRAM_MEMORY_KB("Blimp.Compositor.CommitSizeKb", | 254 UMA_HISTOGRAM_MEMORY_KB("Blimp.Compositor.CommitSizeKb", |
| 322 (float)message->ByteSize() / 1024); | 255 (float)message->ByteSize() / 1024); |
| 323 BlimpStats::GetInstance()->Add(BlimpStats::COMMIT, 1); | 256 BlimpStats::GetInstance()->Add(BlimpStats::COMMIT, 1); |
| 324 | 257 |
| 325 pending_frame_update_ = std::move(message); | 258 pending_frame_update_ = std::move(message); |
| 326 outstanding_commits_++; | |
| 327 host_->SetNeedsAnimate(); | 259 host_->SetNeedsAnimate(); |
| 328 } | 260 } |
| 329 | 261 |
| 330 if (message_received->client_state_update_ack()) { | 262 if (message_received->client_state_update_ack()) { |
| 331 DCHECK(client_state_update_ack_pending_); | 263 DCHECK(client_state_update_ack_pending_); |
| 332 | 264 |
| 333 client_state_update_ack_pending_ = false; | 265 client_state_update_ack_pending_ = false; |
| 334 compositor_state_deserializer_->DidApplyStateUpdatesOnEngine(); | 266 compositor_state_deserializer_->DidApplyStateUpdatesOnEngine(); |
| 335 | 267 |
| 336 // If there are any updates that we have queued because we were waiting for | 268 // If there are any updates that we have queued because we were waiting for |
| 337 // an ack, send them now. | 269 // an ack, send them now. |
| 338 FlushClientState(); | 270 FlushClientState(); |
| 339 } | 271 } |
| 340 } | 272 } |
| 341 | 273 |
| 342 void BlimpCompositor::HandleCompositorMessageToImpl( | |
| 343 std::unique_ptr<cc::proto::CompositorMessage> message) { | |
| 344 DCHECK(!use_threaded_layer_tree_host_); | |
| 345 DCHECK(message->has_to_impl()); | |
| 346 | |
| 347 const cc::proto::CompositorMessageToImpl to_impl_proto = message->to_impl(); | |
| 348 DCHECK(to_impl_proto.has_message_type()); | |
| 349 | |
| 350 if (to_impl_proto.message_type() == | |
| 351 cc::proto::CompositorMessageToImpl::START_COMMIT) { | |
| 352 BlimpStats::GetInstance()->Add(BlimpStats::COMMIT, 1); | |
| 353 outstanding_commits_++; | |
| 354 } | |
| 355 | |
| 356 switch (to_impl_proto.message_type()) { | |
| 357 case cc::proto::CompositorMessageToImpl::UNKNOWN: | |
| 358 NOTIMPLEMENTED() << "Ignoring message of UNKNOWN type"; | |
| 359 break; | |
| 360 case cc::proto::CompositorMessageToImpl::START_COMMIT: | |
| 361 UMA_HISTOGRAM_MEMORY_KB("Blimp.Compositor.CommitSizeKb", | |
| 362 (float)message->ByteSize() / 1024); | |
| 363 default: | |
| 364 // We should have a receiver if we're getting compositor messages that | |
| 365 // are not INITIALIZE_IMPL or CLOSE_IMPL. | |
| 366 DCHECK(remote_proto_channel_receiver_); | |
| 367 remote_proto_channel_receiver_->OnProtoReceived(std::move(message)); | |
| 368 } | |
| 369 } | |
| 370 | |
| 371 // Returns a reference to the InputHandler owned by layer tree host. | |
| 372 const base::WeakPtr<cc::InputHandler>& BlimpCompositor::GetInputHandler() { | 274 const base::WeakPtr<cc::InputHandler>& BlimpCompositor::GetInputHandler() { |
| 373 return host_->GetInputHandler(); | 275 return host_->GetInputHandler(); |
| 374 } | 276 } |
| 375 | 277 |
| 376 void BlimpCompositor::OnContextProvidersCreated( | 278 void BlimpCompositor::OnContextProvidersCreated( |
| 377 const scoped_refptr<cc::ContextProvider>& compositor_context_provider, | 279 const scoped_refptr<cc::ContextProvider>& compositor_context_provider, |
| 378 const scoped_refptr<cc::ContextProvider>& worker_context_provider) { | 280 const scoped_refptr<cc::ContextProvider>& worker_context_provider) { |
| 379 DCHECK(!bound_to_proxy_) << "Any connection to the old CompositorFrameSink " | 281 DCHECK(!bound_to_proxy_) << "Any connection to the old CompositorFrameSink " |
| 380 "should have been destroyed"; | 282 "should have been destroyed"; |
| 381 | 283 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 | 429 |
| 528 std::unique_ptr<cc::LayerTreeHostInProcess> | 430 std::unique_ptr<cc::LayerTreeHostInProcess> |
| 529 BlimpCompositor::CreateLayerTreeHost() { | 431 BlimpCompositor::CreateLayerTreeHost() { |
| 530 DCHECK(animation_host_); | 432 DCHECK(animation_host_); |
| 531 std::unique_ptr<cc::LayerTreeHostInProcess> host; | 433 std::unique_ptr<cc::LayerTreeHostInProcess> host; |
| 532 | 434 |
| 533 cc::LayerTreeHostInProcess::InitParams params; | 435 cc::LayerTreeHostInProcess::InitParams params; |
| 534 params.client = this; | 436 params.client = this; |
| 535 params.task_graph_runner = compositor_dependencies_->GetTaskGraphRunner(); | 437 params.task_graph_runner = compositor_dependencies_->GetTaskGraphRunner(); |
| 536 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); | 438 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 537 if (!use_threaded_layer_tree_host_) { | |
| 538 params.image_serialization_processor = | 439 params.image_serialization_processor = |
| 539 compositor_dependencies_->GetImageSerializationProcessor(); | 440 compositor_dependencies_->GetImageSerializationProcessor(); |
| 540 } | |
| 541 | 441 |
| 542 cc::LayerTreeSettings* settings = | 442 cc::LayerTreeSettings* settings = |
| 543 compositor_dependencies_->GetLayerTreeSettings(); | 443 compositor_dependencies_->GetLayerTreeSettings(); |
| 544 params.settings = settings; | 444 params.settings = settings; |
| 545 params.mutator_host = animation_host_.get(); | 445 params.mutator_host = animation_host_.get(); |
| 546 | 446 |
| 547 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner = | 447 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner = |
| 548 compositor_dependencies_->GetCompositorTaskRunner(); | 448 compositor_dependencies_->GetCompositorTaskRunner(); |
| 549 | 449 |
| 550 if (use_threaded_layer_tree_host_) { | |
| 551 host = cc::LayerTreeHostInProcess::CreateThreaded(compositor_task_runner, | 450 host = cc::LayerTreeHostInProcess::CreateThreaded(compositor_task_runner, |
| 552 ¶ms); | 451 ¶ms); |
| 553 } else { | |
| 554 host = cc::LayerTreeHostInProcess::CreateRemoteClient( | |
| 555 this /* remote_proto_channel */, compositor_task_runner, ¶ms); | |
| 556 } | |
| 557 | 452 |
| 558 return host; | 453 return host; |
| 559 } | 454 } |
| 560 | 455 |
| 561 void BlimpCompositor::DestroyLayerTreeHost() { | 456 void BlimpCompositor::DestroyLayerTreeHost() { |
| 562 DCHECK(host_); | 457 DCHECK(host_); |
| 563 | 458 |
| 564 // Tear down the output surface connection with the old LayerTreeHost | 459 // Tear down the output surface connection with the old LayerTreeHost |
| 565 // instance. | 460 // instance. |
| 566 DestroyDelegatedContent(); | 461 DestroyDelegatedContent(); |
| 567 | 462 |
| 568 // Destroy the old LayerTreeHost state. | 463 // Destroy the old LayerTreeHost state. |
| 569 host_.reset(); | 464 host_.reset(); |
| 570 | 465 |
| 571 // Cancel any outstanding CompositorFrameSink requests. That way if we get an | 466 // Cancel any outstanding CompositorFrameSink requests. That way if we get an |
| 572 // async callback related to the old request we know to drop it. | 467 // async callback related to the old request we know to drop it. |
| 573 compositor_frame_sink_request_pending_ = false; | 468 compositor_frame_sink_request_pending_ = false; |
| 574 | |
| 575 // Make sure we don't have a receiver at this point. | |
| 576 DCHECK(!remote_proto_channel_receiver_); | |
| 577 } | 469 } |
| 578 | 470 |
| 579 } // namespace client | 471 } // namespace client |
| 580 } // namespace blimp | 472 } // namespace blimp |
| OLD | NEW |