| 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 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 .ToRECT(); | 883 .ToRECT(); |
| 884 ::ClipCursor(&window_rect); | 884 ::ClipCursor(&window_rect); |
| 885 } | 885 } |
| 886 | 886 |
| 887 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { | 887 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { |
| 888 legacy_render_widget_host_HWND_ = NULL; | 888 legacy_render_widget_host_HWND_ = NULL; |
| 889 legacy_window_destroyed_ = true; | 889 legacy_window_destroyed_ = true; |
| 890 } | 890 } |
| 891 #endif | 891 #endif |
| 892 | 892 |
| 893 void RenderWidgetHostViewAura::DidCreateNewRendererCompositorFrameSink( | 893 void RenderWidgetHostViewAura::DidCreateNewRendererCompositorFrameSink() { |
| 894 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink) { | 894 if (delegated_frame_host_) |
| 895 renderer_compositor_frame_sink_ = renderer_compositor_frame_sink; | 895 delegated_frame_host_->DidCreateNewRendererCompositorFrameSink(); |
| 896 if (delegated_frame_host_) { | |
| 897 delegated_frame_host_->DidCreateNewRendererCompositorFrameSink( | |
| 898 renderer_compositor_frame_sink_); | |
| 899 } | |
| 900 } | 896 } |
| 901 | 897 |
| 902 void RenderWidgetHostViewAura::SubmitCompositorFrame( | 898 void RenderWidgetHostViewAura::SubmitCompositorFrame( |
| 903 const cc::LocalSurfaceId& local_surface_id, | 899 const cc::LocalSurfaceId& local_surface_id, |
| 904 cc::CompositorFrame frame) { | 900 cc::CompositorFrame frame) { |
| 905 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); | 901 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); |
| 906 | 902 |
| 907 // Override the background color to the current compositor background. | 903 // Override the background color to the current compositor background. |
| 908 // This allows us to, when navigating to a new page, transfer this color to | 904 // This allows us to, when navigating to a new page, transfer this color to |
| 909 // that page. This allows us to pass this background color to new views on | 905 // that page. This allows us to pass this background color to new views on |
| (...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1935 cc::FrameSinkId frame_sink_id = | 1931 cc::FrameSinkId frame_sink_id = |
| 1936 host_->AllocateFrameSinkId(is_guest_view_hack_); | 1932 host_->AllocateFrameSinkId(is_guest_view_hack_); |
| 1937 | 1933 |
| 1938 // Tests may set |delegated_frame_host_client_|. | 1934 // Tests may set |delegated_frame_host_client_|. |
| 1939 if (!delegated_frame_host_client_) { | 1935 if (!delegated_frame_host_client_) { |
| 1940 delegated_frame_host_client_ = | 1936 delegated_frame_host_client_ = |
| 1941 base::MakeUnique<DelegatedFrameHostClientAura>(this); | 1937 base::MakeUnique<DelegatedFrameHostClientAura>(this); |
| 1942 } | 1938 } |
| 1943 delegated_frame_host_ = base::MakeUnique<DelegatedFrameHost>( | 1939 delegated_frame_host_ = base::MakeUnique<DelegatedFrameHost>( |
| 1944 frame_sink_id, delegated_frame_host_client_.get()); | 1940 frame_sink_id, delegated_frame_host_client_.get()); |
| 1945 if (renderer_compositor_frame_sink_) { | |
| 1946 delegated_frame_host_->DidCreateNewRendererCompositorFrameSink( | |
| 1947 renderer_compositor_frame_sink_); | |
| 1948 } | |
| 1949 UpdateNeedsBeginFramesInternal(); | 1941 UpdateNeedsBeginFramesInternal(); |
| 1950 | 1942 |
| 1951 // Let the page-level input event router know about our surface ID | 1943 // Let the page-level input event router know about our surface ID |
| 1952 // namespace for surface-based hit testing. | 1944 // namespace for surface-based hit testing. |
| 1953 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { | 1945 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { |
| 1954 host_->delegate()->GetInputEventRouter()->AddFrameSinkIdOwner( | 1946 host_->delegate()->GetInputEventRouter()->AddFrameSinkIdOwner( |
| 1955 GetFrameSinkId(), this); | 1947 GetFrameSinkId(), this); |
| 1956 } | 1948 } |
| 1957 } | 1949 } |
| 1958 | 1950 |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2377 } | 2369 } |
| 2378 | 2370 |
| 2379 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { | 2371 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { |
| 2380 if (!delegated_frame_host_) | 2372 if (!delegated_frame_host_) |
| 2381 return; | 2373 return; |
| 2382 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ || | 2374 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ || |
| 2383 needs_flush_input_); | 2375 needs_flush_input_); |
| 2384 } | 2376 } |
| 2385 | 2377 |
| 2386 } // namespace content | 2378 } // namespace content |
| OLD | NEW |