Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 2725763003: DelegatedFrameHostAndroid should use CompositorFrameSinkSupport (Closed)
Patch Set: c Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 void RenderWidgetHostViewAndroid::SendReclaimCompositorResources( 994 void RenderWidgetHostViewAndroid::SendReclaimCompositorResources(
995 uint32_t compositor_frame_sink_id, 995 uint32_t compositor_frame_sink_id,
996 bool is_swap_ack) { 996 bool is_swap_ack) {
997 DCHECK(host_); 997 DCHECK(host_);
998 host_->Send(new ViewMsg_ReclaimCompositorResources( 998 host_->Send(new ViewMsg_ReclaimCompositorResources(
999 host_->GetRoutingID(), compositor_frame_sink_id, is_swap_ack, 999 host_->GetRoutingID(), compositor_frame_sink_id, is_swap_ack,
1000 surface_returned_resources_)); 1000 surface_returned_resources_));
1001 surface_returned_resources_.clear(); 1001 surface_returned_resources_.clear();
1002 } 1002 }
1003 1003
1004 void RenderWidgetHostViewAndroid::ReturnResources( 1004 void RenderWidgetHostViewAndroid::DidReceiveCompositorFrameAck() {
1005 RunAckCallbacks();
1006 }
1007
1008 void RenderWidgetHostViewAndroid::ReclaimResources(
1005 const cc::ReturnedResourceArray& resources) { 1009 const cc::ReturnedResourceArray& resources) {
1006 if (resources.empty()) 1010 if (resources.empty())
1007 return; 1011 return;
1008 std::copy(resources.begin(), resources.end(), 1012 std::copy(resources.begin(), resources.end(),
1009 std::back_inserter(surface_returned_resources_)); 1013 std::back_inserter(surface_returned_resources_));
1010 if (ack_callbacks_.empty()) 1014 if (ack_callbacks_.empty())
1011 SendReclaimCompositorResources(last_compositor_frame_sink_id_, 1015 SendReclaimCompositorResources(last_compositor_frame_sink_id_,
1012 false /* is_swap_ack */); 1016 false /* is_swap_ack */);
1013 } 1017 }
1014 1018
(...skipping 30 matching lines...) Expand all
1045 base::Closure ack_callback = 1049 base::Closure ack_callback =
1046 base::Bind(&RenderWidgetHostViewAndroid::SendReclaimCompositorResources, 1050 base::Bind(&RenderWidgetHostViewAndroid::SendReclaimCompositorResources,
1047 weak_ptr_factory_.GetWeakPtr(), compositor_frame_sink_id, 1051 weak_ptr_factory_.GetWeakPtr(), compositor_frame_sink_id,
1048 true /* is_swap_ack */); 1052 true /* is_swap_ack */);
1049 1053
1050 ack_callbacks_.push(ack_callback); 1054 ack_callbacks_.push(ack_callback);
1051 1055
1052 if (!has_content) { 1056 if (!has_content) {
1053 DestroyDelegatedContent(); 1057 DestroyDelegatedContent();
1054 } else { 1058 } else {
1055 cc::SurfaceFactory::DrawCallback ack_callback = 1059 delegated_frame_host_->SubmitCompositorFrame(std::move(frame));
1056 base::Bind(&RenderWidgetHostViewAndroid::RunAckCallbacks,
1057 weak_ptr_factory_.GetWeakPtr());
1058 delegated_frame_host_->SubmitCompositorFrame(std::move(frame),
1059 ack_callback);
1060 frame_evictor_->SwappedFrame(!host_->is_hidden()); 1060 frame_evictor_->SwappedFrame(!host_->is_hidden());
1061 } 1061 }
1062 1062
1063 if (host_->is_hidden()) 1063 if (host_->is_hidden())
1064 RunAckCallbacks(); 1064 RunAckCallbacks();
1065 1065
1066 // As the metadata update may trigger view invalidation, always call it after 1066 // As the metadata update may trigger view invalidation, always call it after
1067 // any potential compositor scheduling. 1067 // any potential compositor scheduling.
1068 OnFrameMetadataUpdated(std::move(metadata), is_transparent); 1068 OnFrameMetadataUpdated(std::move(metadata), is_transparent);
1069 } 1069 }
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1986 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); 1986 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor();
1987 if (!compositor) 1987 if (!compositor)
1988 return; 1988 return;
1989 1989
1990 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( 1990 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>(
1991 overscroll_refresh_handler, compositor, 1991 overscroll_refresh_handler, compositor,
1992 ui::GetScaleFactorForNativeView(GetNativeView())); 1992 ui::GetScaleFactorForNativeView(GetNativeView()));
1993 } 1993 }
1994 1994
1995 } // namespace content 1995 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | ui/android/delegated_frame_host_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698