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

Unified Diff: content/browser/frame_host/render_widget_host_view_guest.cc

Issue 2485473003: Remove SurfaceFactory::Create and SurfaceFactory::Destroy (Closed)
Patch Set: up Created 4 years, 1 month 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/frame_host/render_widget_host_view_guest.cc
diff --git a/content/browser/frame_host/render_widget_host_view_guest.cc b/content/browser/frame_host/render_widget_host_view_guest.cc
index 57890b189ebd483be7309817d8bb62d6c0fcec7f..b14a741cd2243b1cdd955777019c5b69c83d04f8 100644
--- a/content/browser/frame_host/render_widget_host_view_guest.cc
+++ b/content/browser/frame_host/render_widget_host_view_guest.cc
@@ -306,10 +306,22 @@ void RenderWidgetHostViewGuest::OnSwapCompositorFrame(
current_surface_scale_factor_ = scale_factor;
}
+ bool allocated_new_local_frame_id = false;
if (!local_frame_id_.is_valid()) {
local_frame_id_ = id_allocator_->GenerateId();
- surface_factory_->Create(local_frame_id_);
+ allocated_new_local_frame_id = true;
+ }
+
+ cc::SurfaceFactory::DrawCallback ack_callback = base::Bind(
+ &RenderWidgetHostViewChildFrame::SurfaceDrawn,
+ RenderWidgetHostViewChildFrame::AsWeakPtr(), compositor_frame_sink_id);
+ ack_pending_count_++;
+ // If this value grows very large, something is going wrong.
+ DCHECK(ack_pending_count_ < 1000);
+ surface_factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame),
+ ack_callback);
+ if (allocated_new_local_frame_id) {
cc::SurfaceSequence sequence =
cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++);
// The renderer process will satisfy this dependency when it creates a
@@ -326,16 +338,6 @@ void RenderWidgetHostViewGuest::OnSwapCompositorFrame(
sequence);
}
}
-
- cc::SurfaceFactory::DrawCallback ack_callback = base::Bind(
- &RenderWidgetHostViewChildFrame::SurfaceDrawn,
- RenderWidgetHostViewChildFrame::AsWeakPtr(), compositor_frame_sink_id);
- ack_pending_count_++;
- // If this value grows very large, something is going wrong.
- DCHECK(ack_pending_count_ < 1000);
- surface_factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame),
- ack_callback);
-
ProcessFrameSwappedCallbacks();
// If after detaching we are sent a frame, we should finish processing it, and

Powered by Google App Engine
This is Rietveld 408576698