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