OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "cc/trees/remote_channel_impl.h" | 5 #include "cc/trees/remote_channel_impl.h" |
6 | 6 |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "cc/animation/animation_events.h" | 10 #include "cc/animation/animation_events.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 void RemoteChannelImpl::SetVisible(bool visible) { | 187 void RemoteChannelImpl::SetVisible(bool visible) { |
188 DCHECK(task_runner_provider_->IsMainThread()); | 188 DCHECK(task_runner_provider_->IsMainThread()); |
189 VLOG(1) << "Setting visibility to: " << visible; | 189 VLOG(1) << "Setting visibility to: " << visible; |
190 | 190 |
191 ImplThreadTaskRunner()->PostTask( | 191 ImplThreadTaskRunner()->PostTask( |
192 FROM_HERE, | 192 FROM_HERE, |
193 base::Bind(&ProxyImpl::SetVisibleOnImpl, proxy_impl_weak_ptr_, visible)); | 193 base::Bind(&ProxyImpl::SetVisibleOnImpl, proxy_impl_weak_ptr_, visible)); |
194 } | 194 } |
195 | 195 |
196 const RendererCapabilities& RemoteChannelImpl::GetRendererCapabilities() const { | |
197 NOTREACHED() << "Should not be called on the remote client LayerTreeHost"; | |
198 return main().renderer_capabilities; | |
199 } | |
200 | |
201 void RemoteChannelImpl::SetNeedsAnimate() { | 196 void RemoteChannelImpl::SetNeedsAnimate() { |
202 NOTREACHED() << "Should not be called on the remote client LayerTreeHost"; | 197 NOTREACHED() << "Should not be called on the remote client LayerTreeHost"; |
203 } | 198 } |
204 | 199 |
205 void RemoteChannelImpl::SetNeedsUpdateLayers() { | 200 void RemoteChannelImpl::SetNeedsUpdateLayers() { |
206 NOTREACHED() << "Should not be called on the remote client LayerTreeHost"; | 201 NOTREACHED() << "Should not be called on the remote client LayerTreeHost"; |
207 } | 202 } |
208 | 203 |
209 void RemoteChannelImpl::SetNeedsCommit() { | 204 void RemoteChannelImpl::SetNeedsCommit() { |
210 // Ideally commits should be requested only on the server. But we have to | 205 // Ideally commits should be requested only on the server. But we have to |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 return main_frame_will_happen; | 312 return main_frame_will_happen; |
318 } | 313 } |
319 | 314 |
320 void RemoteChannelImpl::DidCompleteSwapBuffers() { | 315 void RemoteChannelImpl::DidCompleteSwapBuffers() { |
321 DCHECK(task_runner_provider_->IsImplThread()); | 316 DCHECK(task_runner_provider_->IsImplThread()); |
322 MainThreadTaskRunner()->PostTask( | 317 MainThreadTaskRunner()->PostTask( |
323 FROM_HERE, base::Bind(&RemoteChannelImpl::DidCompleteSwapBuffersOnMain, | 318 FROM_HERE, base::Bind(&RemoteChannelImpl::DidCompleteSwapBuffersOnMain, |
324 impl().remote_channel_weak_ptr)); | 319 impl().remote_channel_weak_ptr)); |
325 } | 320 } |
326 | 321 |
327 void RemoteChannelImpl::SetRendererCapabilitiesMainCopy( | |
328 const RendererCapabilities& capabilities) {} | |
329 | |
330 void RemoteChannelImpl::BeginMainFrameNotExpectedSoon() {} | 322 void RemoteChannelImpl::BeginMainFrameNotExpectedSoon() {} |
331 | 323 |
332 void RemoteChannelImpl::DidCommitAndDrawFrame() { | 324 void RemoteChannelImpl::DidCommitAndDrawFrame() { |
333 DCHECK(task_runner_provider_->IsImplThread()); | 325 DCHECK(task_runner_provider_->IsImplThread()); |
334 MainThreadTaskRunner()->PostTask( | 326 MainThreadTaskRunner()->PostTask( |
335 FROM_HERE, base::Bind(&RemoteChannelImpl::DidCommitAndDrawFrameOnMain, | 327 FROM_HERE, base::Bind(&RemoteChannelImpl::DidCommitAndDrawFrameOnMain, |
336 impl().remote_channel_weak_ptr)); | 328 impl().remote_channel_weak_ptr)); |
337 } | 329 } |
338 | 330 |
339 void RemoteChannelImpl::SetAnimationEvents( | 331 void RemoteChannelImpl::SetAnimationEvents( |
340 std::unique_ptr<AnimationEvents> queue) {} | 332 std::unique_ptr<AnimationEvents> queue) {} |
341 | 333 |
342 void RemoteChannelImpl::DidLoseOutputSurface() { | 334 void RemoteChannelImpl::DidLoseOutputSurface() { |
343 DCHECK(task_runner_provider_->IsImplThread()); | 335 DCHECK(task_runner_provider_->IsImplThread()); |
344 | 336 |
345 MainThreadTaskRunner()->PostTask( | 337 MainThreadTaskRunner()->PostTask( |
346 FROM_HERE, base::Bind(&RemoteChannelImpl::DidLoseOutputSurfaceOnMain, | 338 FROM_HERE, base::Bind(&RemoteChannelImpl::DidLoseOutputSurfaceOnMain, |
347 impl().remote_channel_weak_ptr)); | 339 impl().remote_channel_weak_ptr)); |
348 } | 340 } |
349 | 341 |
350 void RemoteChannelImpl::RequestNewOutputSurface() { | 342 void RemoteChannelImpl::RequestNewOutputSurface() { |
351 DCHECK(task_runner_provider_->IsImplThread()); | 343 DCHECK(task_runner_provider_->IsImplThread()); |
352 | 344 |
353 MainThreadTaskRunner()->PostTask( | 345 MainThreadTaskRunner()->PostTask( |
354 FROM_HERE, base::Bind(&RemoteChannelImpl::RequestNewOutputSurfaceOnMain, | 346 FROM_HERE, base::Bind(&RemoteChannelImpl::RequestNewOutputSurfaceOnMain, |
355 impl().remote_channel_weak_ptr)); | 347 impl().remote_channel_weak_ptr)); |
356 } | 348 } |
357 | 349 |
358 void RemoteChannelImpl::DidInitializeOutputSurface( | 350 void RemoteChannelImpl::DidInitializeOutputSurface(bool success) { |
359 bool success, | |
360 const RendererCapabilities& capabilities) { | |
361 DCHECK(task_runner_provider_->IsImplThread()); | 351 DCHECK(task_runner_provider_->IsImplThread()); |
362 | 352 |
363 MainThreadTaskRunner()->PostTask( | 353 MainThreadTaskRunner()->PostTask( |
364 FROM_HERE, | 354 FROM_HERE, |
365 base::Bind(&RemoteChannelImpl::DidInitializeOutputSurfaceOnMain, | 355 base::Bind(&RemoteChannelImpl::DidInitializeOutputSurfaceOnMain, |
366 impl().remote_channel_weak_ptr, success, capabilities)); | 356 impl().remote_channel_weak_ptr, success)); |
367 } | 357 } |
368 | 358 |
369 void RemoteChannelImpl::DidCompletePageScaleAnimation() {} | 359 void RemoteChannelImpl::DidCompletePageScaleAnimation() {} |
370 | 360 |
371 void RemoteChannelImpl::BeginMainFrame( | 361 void RemoteChannelImpl::BeginMainFrame( |
372 std::unique_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { | 362 std::unique_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { |
373 std::unique_ptr<proto::CompositorMessage> proto; | 363 std::unique_ptr<proto::CompositorMessage> proto; |
374 proto.reset(new proto::CompositorMessage); | 364 proto.reset(new proto::CompositorMessage); |
375 proto::CompositorMessageToMain* to_main_proto = proto->mutable_to_main(); | 365 proto::CompositorMessageToMain* to_main_proto = proto->mutable_to_main(); |
376 | 366 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 | 399 |
410 main().layer_tree_host->DidLoseOutputSurface(); | 400 main().layer_tree_host->DidLoseOutputSurface(); |
411 } | 401 } |
412 | 402 |
413 void RemoteChannelImpl::RequestNewOutputSurfaceOnMain() { | 403 void RemoteChannelImpl::RequestNewOutputSurfaceOnMain() { |
414 DCHECK(task_runner_provider_->IsMainThread()); | 404 DCHECK(task_runner_provider_->IsMainThread()); |
415 | 405 |
416 main().layer_tree_host->RequestNewOutputSurface(); | 406 main().layer_tree_host->RequestNewOutputSurface(); |
417 } | 407 } |
418 | 408 |
419 void RemoteChannelImpl::DidInitializeOutputSurfaceOnMain( | 409 void RemoteChannelImpl::DidInitializeOutputSurfaceOnMain(bool success) { |
420 bool success, | |
421 const RendererCapabilities& capabilities) { | |
422 DCHECK(task_runner_provider_->IsMainThread()); | 410 DCHECK(task_runner_provider_->IsMainThread()); |
423 | 411 |
424 if (!success) { | 412 if (!success) { |
425 main().layer_tree_host->DidFailToInitializeOutputSurface(); | 413 main().layer_tree_host->DidFailToInitializeOutputSurface(); |
426 return; | 414 return; |
427 } | 415 } |
428 | 416 |
429 VLOG(1) << "OutputSurface initialized successfully"; | 417 VLOG(1) << "OutputSurface initialized successfully"; |
430 main().renderer_capabilities = capabilities; | |
431 main().layer_tree_host->DidInitializeOutputSurface(); | 418 main().layer_tree_host->DidInitializeOutputSurface(); |
432 | 419 |
433 // If we were waiting for output surface initialization, we might have queued | 420 // If we were waiting for output surface initialization, we might have queued |
434 // some messages. Relay them now that a new output surface has been | 421 // some messages. Relay them now that a new output surface has been |
435 // initialized. | 422 // initialized. |
436 main().waiting_for_output_surface_initialization = false; | 423 main().waiting_for_output_surface_initialization = false; |
437 while (!main().pending_messages.empty()) { | 424 while (!main().pending_messages.empty()) { |
438 VLOG(1) << "Handling queued message"; | 425 VLOG(1) << "Handling queued message"; |
439 HandleProto(main().pending_messages.front()); | 426 HandleProto(main().pending_messages.front()); |
440 main().pending_messages.pop(); | 427 main().pending_messages.pop(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 522 |
536 RemoteChannelImpl::CompositorThreadOnly::CompositorThreadOnly( | 523 RemoteChannelImpl::CompositorThreadOnly::CompositorThreadOnly( |
537 base::WeakPtr<RemoteChannelImpl> remote_channel_weak_ptr) | 524 base::WeakPtr<RemoteChannelImpl> remote_channel_weak_ptr) |
538 : proxy_impl(nullptr), | 525 : proxy_impl(nullptr), |
539 proxy_impl_weak_factory(nullptr), | 526 proxy_impl_weak_factory(nullptr), |
540 remote_channel_weak_ptr(remote_channel_weak_ptr) {} | 527 remote_channel_weak_ptr(remote_channel_weak_ptr) {} |
541 | 528 |
542 RemoteChannelImpl::CompositorThreadOnly::~CompositorThreadOnly() {} | 529 RemoteChannelImpl::CompositorThreadOnly::~CompositorThreadOnly() {} |
543 | 530 |
544 } // namespace cc | 531 } // namespace cc |
OLD | NEW |