| 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_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 void RenderWidgetHostViewAura::OnSetNeedsFlushInput() { | 646 void RenderWidgetHostViewAura::OnSetNeedsFlushInput() { |
| 647 needs_flush_input_ = true; | 647 needs_flush_input_ = true; |
| 648 UpdateNeedsBeginFramesInternal(); | 648 UpdateNeedsBeginFramesInternal(); |
| 649 } | 649 } |
| 650 | 650 |
| 651 void RenderWidgetHostViewAura::OnBeginFrame( | 651 void RenderWidgetHostViewAura::OnBeginFrame( |
| 652 const cc::BeginFrameArgs& args) { | 652 const cc::BeginFrameArgs& args) { |
| 653 needs_flush_input_ = false; | 653 needs_flush_input_ = false; |
| 654 host_->FlushInput(); | 654 host_->FlushInput(); |
| 655 UpdateNeedsBeginFramesInternal(); | 655 UpdateNeedsBeginFramesInternal(); |
| 656 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); | 656 if (renderer_compositor_frame_sink_) |
| 657 renderer_compositor_frame_sink_->OnBeginFrame(args); |
| 657 } | 658 } |
| 658 | 659 |
| 659 RenderFrameHostImpl* RenderWidgetHostViewAura::GetFocusedFrame() { | 660 RenderFrameHostImpl* RenderWidgetHostViewAura::GetFocusedFrame() { |
| 660 RenderViewHost* rvh = RenderViewHost::From(host_); | 661 RenderViewHost* rvh = RenderViewHost::From(host_); |
| 661 if (!rvh) | 662 if (!rvh) |
| 662 return nullptr; | 663 return nullptr; |
| 663 FrameTreeNode* focused_frame = | 664 FrameTreeNode* focused_frame = |
| 664 rvh->GetDelegate()->GetFrameTree()->GetFocusedFrame(); | 665 rvh->GetDelegate()->GetFrameTree()->GetFocusedFrame(); |
| 665 if (!focused_frame) | 666 if (!focused_frame) |
| 666 return nullptr; | 667 return nullptr; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 .ToRECT(); | 884 .ToRECT(); |
| 884 ::ClipCursor(&window_rect); | 885 ::ClipCursor(&window_rect); |
| 885 } | 886 } |
| 886 | 887 |
| 887 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { | 888 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { |
| 888 legacy_render_widget_host_HWND_ = NULL; | 889 legacy_render_widget_host_HWND_ = NULL; |
| 889 legacy_window_destroyed_ = true; | 890 legacy_window_destroyed_ = true; |
| 890 } | 891 } |
| 891 #endif | 892 #endif |
| 892 | 893 |
| 893 void RenderWidgetHostViewAura::DidCreateNewRendererCompositorFrameSink() { | 894 void RenderWidgetHostViewAura::DidCreateNewRendererCompositorFrameSink( |
| 894 if (delegated_frame_host_) | 895 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink) { |
| 895 delegated_frame_host_->DidCreateNewRendererCompositorFrameSink(); | 896 renderer_compositor_frame_sink_ = renderer_compositor_frame_sink; |
| 897 if (delegated_frame_host_) { |
| 898 delegated_frame_host_->DidCreateNewRendererCompositorFrameSink( |
| 899 renderer_compositor_frame_sink_); |
| 900 } |
| 896 } | 901 } |
| 897 | 902 |
| 898 void RenderWidgetHostViewAura::SubmitCompositorFrame( | 903 void RenderWidgetHostViewAura::SubmitCompositorFrame( |
| 899 const cc::LocalSurfaceId& local_surface_id, | 904 const cc::LocalSurfaceId& local_surface_id, |
| 900 cc::CompositorFrame frame) { | 905 cc::CompositorFrame frame) { |
| 901 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); | 906 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); |
| 902 | 907 |
| 903 // Override the background color to the current compositor background. | 908 // Override the background color to the current compositor background. |
| 904 // This allows us to, when navigating to a new page, transfer this color to | 909 // This allows us to, when navigating to a new page, transfer this color to |
| 905 // that page. This allows us to pass this background color to new views on | 910 // that page. This allows us to pass this background color to new views on |
| (...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1924 cc::FrameSinkId frame_sink_id = | 1929 cc::FrameSinkId frame_sink_id = |
| 1925 host_->AllocateFrameSinkId(is_guest_view_hack_); | 1930 host_->AllocateFrameSinkId(is_guest_view_hack_); |
| 1926 | 1931 |
| 1927 // Tests may set |delegated_frame_host_client_|. | 1932 // Tests may set |delegated_frame_host_client_|. |
| 1928 if (!delegated_frame_host_client_) { | 1933 if (!delegated_frame_host_client_) { |
| 1929 delegated_frame_host_client_ = | 1934 delegated_frame_host_client_ = |
| 1930 base::MakeUnique<DelegatedFrameHostClientAura>(this); | 1935 base::MakeUnique<DelegatedFrameHostClientAura>(this); |
| 1931 } | 1936 } |
| 1932 delegated_frame_host_ = base::MakeUnique<DelegatedFrameHost>( | 1937 delegated_frame_host_ = base::MakeUnique<DelegatedFrameHost>( |
| 1933 frame_sink_id, delegated_frame_host_client_.get()); | 1938 frame_sink_id, delegated_frame_host_client_.get()); |
| 1939 if (renderer_compositor_frame_sink_) { |
| 1940 delegated_frame_host_->DidCreateNewRendererCompositorFrameSink( |
| 1941 renderer_compositor_frame_sink_); |
| 1942 } |
| 1934 UpdateNeedsBeginFramesInternal(); | 1943 UpdateNeedsBeginFramesInternal(); |
| 1935 | 1944 |
| 1936 // Let the page-level input event router know about our surface ID | 1945 // Let the page-level input event router know about our surface ID |
| 1937 // namespace for surface-based hit testing. | 1946 // namespace for surface-based hit testing. |
| 1938 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { | 1947 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { |
| 1939 host_->delegate()->GetInputEventRouter()->AddFrameSinkIdOwner( | 1948 host_->delegate()->GetInputEventRouter()->AddFrameSinkIdOwner( |
| 1940 GetFrameSinkId(), this); | 1949 GetFrameSinkId(), this); |
| 1941 } | 1950 } |
| 1942 } | 1951 } |
| 1943 | 1952 |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2362 } | 2371 } |
| 2363 | 2372 |
| 2364 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { | 2373 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { |
| 2365 if (!delegated_frame_host_) | 2374 if (!delegated_frame_host_) |
| 2366 return; | 2375 return; |
| 2367 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ || | 2376 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ || |
| 2368 needs_flush_input_); | 2377 needs_flush_input_); |
| 2369 } | 2378 } |
| 2370 | 2379 |
| 2371 } // namespace content | 2380 } // namespace content |
| OLD | NEW |