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

Unified Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 2658293002: content: Remove Lock/Unlock CompositingSurface API from RWH. (Closed)
Patch Set: mac Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_android.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index e636d407a1a5579fe246d4f33d7fa0870e10a4f1..dbf62b9d6fa40e6ac89183f0dd6b9f2790e246bc 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -442,7 +442,6 @@ RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid(
using_browser_compositor_(CompositorImpl::IsInitialized()),
synchronous_compositor_client_(nullptr),
frame_evictor_(new DelegatedFrameEvictor(this)),
- locks_on_frame_count_(0),
observing_root_window_(false),
weak_ptr_factory_(this) {
// Set the layer which will hold the content layer for this view. The content
@@ -630,35 +629,6 @@ bool RenderWidgetHostViewAndroid::IsShowing() {
return is_showing_ && content_view_core_;
}
-void RenderWidgetHostViewAndroid::LockCompositingSurface() {
- DCHECK(HasValidFrame());
- DCHECK(host_);
- DCHECK(frame_evictor_->HasFrame());
- frame_evictor_->LockFrame();
- locks_on_frame_count_++;
-}
-
-void RenderWidgetHostViewAndroid::UnlockCompositingSurface() {
- if (!frame_evictor_->HasFrame()) {
- DCHECK_EQ(locks_on_frame_count_, 0u);
- return;
- }
-
- DCHECK_GT(locks_on_frame_count_, 0u);
- locks_on_frame_count_--;
- frame_evictor_->UnlockFrame();
-
- if (locks_on_frame_count_ == 0) {
- if (last_frame_info_) {
boliu 2017/02/02 22:58:47 looks like last_frame_info_ can be removed too?
Khushal 2017/02/02 23:25:00 Yup. Done.
- InternalSwapCompositorFrame(last_frame_info_->compositor_frame_sink_id,
- std::move(last_frame_info_->frame));
- last_frame_info_.reset();
- }
-
- view_.GetLayer()->SetHideLayerAndSubtree(!is_showing_);
- }
-}
-
void RenderWidgetHostViewAndroid::OnShowUnhandledTapUIIfNeeded(int x_dip,
int y_dip) {
if (!content_view_core_)
@@ -671,17 +641,6 @@ void RenderWidgetHostViewAndroid::OnShowUnhandledTapUIIfNeeded(int x_dip,
content_view_core_->OnShowUnhandledTapUIIfNeeded(x_dip, y_dip);
}
-void RenderWidgetHostViewAndroid::ReleaseLocksOnSurface() {
- if (!frame_evictor_->HasFrame()) {
- DCHECK_EQ(locks_on_frame_count_, 0u);
- return;
- }
- while (locks_on_frame_count_ > 0) {
- UnlockCompositingSurface();
- }
- RunAckCallbacks();
-}
-
gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const {
if (!content_view_core_)
return default_bounds_;
@@ -1091,13 +1050,6 @@ void RenderWidgetHostViewAndroid::InternalSwapCompositorFrame(
cc::CompositorFrame frame) {
last_scroll_offset_ = frame.metadata.root_scroll_offset;
DCHECK(delegated_frame_host_);
-
- if (locks_on_frame_count_ > 0) {
- DCHECK(HasValidFrame());
- RetainFrame(compositor_frame_sink_id, std::move(frame));
- return;
- }
-
DCHECK(!frame.render_pass_list.empty());
cc::RenderPass* root_pass = frame.render_pass_list.back().get();
@@ -1139,7 +1091,6 @@ void RenderWidgetHostViewAndroid::DestroyDelegatedContent() {
DCHECK(!delegated_frame_host_ ||
delegated_frame_host_->HasDelegatedContent() ==
frame_evictor_->HasFrame());
- DCHECK_EQ(locks_on_frame_count_, 0u);
if (!delegated_frame_host_)
return;
@@ -1161,27 +1112,6 @@ void RenderWidgetHostViewAndroid::ClearCompositorFrame() {
DestroyDelegatedContent();
}
-void RenderWidgetHostViewAndroid::RetainFrame(uint32_t compositor_frame_sink_id,
- cc::CompositorFrame frame) {
- DCHECK(locks_on_frame_count_);
-
- // Store the incoming frame so that it can be swapped when all the locks have
- // been released. If there is already a stored frame, then replace and skip
- // the previous one but make sure we still eventually send the ACK. Holding
- // the ACK also blocks the renderer when its max_frames_pending is reached.
- if (last_frame_info_) {
- base::Closure ack_callback = base::Bind(
- &RenderWidgetHostViewAndroid::SendReclaimCompositorResources,
- weak_ptr_factory_.GetWeakPtr(),
- last_frame_info_->compositor_frame_sink_id, true /* is_swap_ack */);
-
- ack_callbacks_.push(ack_callback);
- }
-
- last_frame_info_.reset(
- new LastFrameInfo(compositor_frame_sink_id, std::move(frame)));
-}
-
void RenderWidgetHostViewAndroid::SynchronousFrameMetadata(
cc::CompositorFrameMetadata frame_metadata) {
if (!content_view_core_)
@@ -1409,9 +1339,7 @@ void RenderWidgetHostViewAndroid::HideInternal() {
bool stop_observing_root_window = !is_showing_ && hide_frontbuffer;
if (hide_frontbuffer) {
- if (locks_on_frame_count_ == 0)
- view_.GetLayer()->SetHideLayerAndSubtree(true);
-
+ view_.GetLayer()->SetHideLayerAndSubtree(true);
frame_evictor_->SetVisible(false);
}
@@ -1785,7 +1713,7 @@ void RenderWidgetHostViewAndroid::SetContentViewCore(
bool resize = false;
if (content_view_core != content_view_core_) {
selection_controller_.reset();
- ReleaseLocksOnSurface();
+ RunAckCallbacks();
// TODO(yusufo) : Get rid of the below conditions and have a better handling
// for resizing after crbug.com/628302 is handled.
bool is_size_initialized = !content_view_core
@@ -1978,7 +1906,6 @@ void RenderWidgetHostViewAndroid::OnActivityStarted() {
}
void RenderWidgetHostViewAndroid::OnLostResources() {
- ReleaseLocksOnSurface();
Khushal 2017/02/02 01:46:35 So at the other place where we were calling this,
DestroyDelegatedContent();
DCHECK(ack_callbacks_.empty());
}

Powered by Google App Engine
This is Rietveld 408576698