| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 } | 414 } |
| 415 | 415 |
| 416 // static | 416 // static |
| 417 RenderWidgetHostImpl* RenderWidgetHostImpl::From(RenderWidgetHost* rwh) { | 417 RenderWidgetHostImpl* RenderWidgetHostImpl::From(RenderWidgetHost* rwh) { |
| 418 return static_cast<RenderWidgetHostImpl*>(rwh); | 418 return static_cast<RenderWidgetHostImpl*>(rwh); |
| 419 } | 419 } |
| 420 | 420 |
| 421 void RenderWidgetHostImpl::SetView(RenderWidgetHostViewBase* view) { | 421 void RenderWidgetHostImpl::SetView(RenderWidgetHostViewBase* view) { |
| 422 if (view) { | 422 if (view) { |
| 423 view_ = view->GetWeakPtr(); | 423 view_ = view->GetWeakPtr(); |
| 424 if (renderer_compositor_frame_sink_.is_bound()) { | 424 if (renderer_compositor_frame_sink_.is_bound() && |
| 425 target_frame_for_input_delegate_.is_bound()) { |
| 425 view->DidCreateNewRendererCompositorFrameSink( | 426 view->DidCreateNewRendererCompositorFrameSink( |
| 426 renderer_compositor_frame_sink_.get()); | 427 renderer_compositor_frame_sink_.get(), |
| 428 target_frame_for_input_delegate_.get()); |
| 427 } | 429 } |
| 428 // Views start out not needing begin frames, so only update its state | 430 // Views start out not needing begin frames, so only update its state |
| 429 // if the value has changed. | 431 // if the value has changed. |
| 430 if (needs_begin_frames_) | 432 if (needs_begin_frames_) |
| 431 view_->SetNeedsBeginFrames(needs_begin_frames_); | 433 view_->SetNeedsBeginFrames(needs_begin_frames_); |
| 432 } else { | 434 } else { |
| 433 view_.reset(); | 435 view_.reset(); |
| 434 } | 436 } |
| 435 | 437 |
| 436 synthetic_gesture_controller_.reset(); | 438 synthetic_gesture_controller_.reset(); |
| (...skipping 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2543 bool monitor_updates) { | 2545 bool monitor_updates) { |
| 2544 if (!immediate_request && monitor_updates == monitoring_composition_info_) | 2546 if (!immediate_request && monitor_updates == monitoring_composition_info_) |
| 2545 return; | 2547 return; |
| 2546 monitoring_composition_info_ = monitor_updates; | 2548 monitoring_composition_info_ = monitor_updates; |
| 2547 GetWidgetInputHandler()->RequestCompositionUpdates(immediate_request, | 2549 GetWidgetInputHandler()->RequestCompositionUpdates(immediate_request, |
| 2548 monitor_updates); | 2550 monitor_updates); |
| 2549 } | 2551 } |
| 2550 | 2552 |
| 2551 void RenderWidgetHostImpl::RequestCompositorFrameSink( | 2553 void RenderWidgetHostImpl::RequestCompositorFrameSink( |
| 2552 viz::mojom::CompositorFrameSinkRequest request, | 2554 viz::mojom::CompositorFrameSinkRequest request, |
| 2553 viz::mojom::CompositorFrameSinkClientPtr client) { | 2555 viz::mojom::CompositorFrameSinkClientPtr client, |
| 2556 viz::mojom::TargetFrameForInputDelegatePtr input_delegate) { |
| 2554 if (compositor_frame_sink_binding_.is_bound()) | 2557 if (compositor_frame_sink_binding_.is_bound()) |
| 2555 compositor_frame_sink_binding_.Close(); | 2558 compositor_frame_sink_binding_.Close(); |
| 2556 compositor_frame_sink_binding_.Bind( | 2559 compositor_frame_sink_binding_.Bind( |
| 2557 std::move(request), | 2560 std::move(request), |
| 2558 BrowserMainLoop::GetInstance()->GetResizeTaskRunner()); | 2561 BrowserMainLoop::GetInstance()->GetResizeTaskRunner()); |
| 2559 if (view_) | 2562 if (view_) |
| 2560 view_->DidCreateNewRendererCompositorFrameSink(client.get()); | 2563 view_->DidCreateNewRendererCompositorFrameSink(client.get(), |
| 2564 input_delegate.get()); |
| 2561 renderer_compositor_frame_sink_ = std::move(client); | 2565 renderer_compositor_frame_sink_ = std::move(client); |
| 2566 target_frame_for_input_delegate_ = std::move(input_delegate); |
| 2562 } | 2567 } |
| 2563 | 2568 |
| 2564 bool RenderWidgetHostImpl::HasGestureStopped() { | 2569 bool RenderWidgetHostImpl::HasGestureStopped() { |
| 2565 return !input_router_->HasPendingEvents(); | 2570 return !input_router_->HasPendingEvents(); |
| 2566 } | 2571 } |
| 2567 | 2572 |
| 2568 void RenderWidgetHostImpl::SetNeedsBeginFrame(bool needs_begin_frame) { | 2573 void RenderWidgetHostImpl::SetNeedsBeginFrame(bool needs_begin_frame) { |
| 2569 OnSetNeedsBeginFrames(needs_begin_frame); | 2574 OnSetNeedsBeginFrames(needs_begin_frame); |
| 2570 } | 2575 } |
| 2571 | 2576 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2708 sequence_number >= saved_frame_.max_shared_bitmap_sequence_number) { | 2713 sequence_number >= saved_frame_.max_shared_bitmap_sequence_number) { |
| 2709 SubmitCompositorFrame(saved_frame_.local_surface_id, | 2714 SubmitCompositorFrame(saved_frame_.local_surface_id, |
| 2710 std::move(saved_frame_.frame)); | 2715 std::move(saved_frame_.frame)); |
| 2711 saved_frame_.local_surface_id = viz::LocalSurfaceId(); | 2716 saved_frame_.local_surface_id = viz::LocalSurfaceId(); |
| 2712 compositor_frame_sink_binding_.ResumeIncomingMethodCallProcessing(); | 2717 compositor_frame_sink_binding_.ResumeIncomingMethodCallProcessing(); |
| 2713 TRACE_EVENT_ASYNC_END0("renderer_host", "PauseCompositorFrameSink", this); | 2718 TRACE_EVENT_ASYNC_END0("renderer_host", "PauseCompositorFrameSink", this); |
| 2714 } | 2719 } |
| 2715 } | 2720 } |
| 2716 | 2721 |
| 2717 } // namespace content | 2722 } // namespace content |
| OLD | NEW |