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

Unified Diff: content/browser/frame_host/render_widget_host_view_child_frame.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_child_frame.cc
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.cc b/content/browser/frame_host/render_widget_host_view_child_frame.cc
index 45141bcea5ab6a6522f0cb5d592678cd277543eb..4091687f8be48d0e6457f2d4f55ba8d1cd1cbc54 100644
--- a/content/browser/frame_host/render_widget_host_view_child_frame.cc
+++ b/content/browser/frame_host/render_widget_host_view_child_frame.cc
@@ -69,9 +69,7 @@ RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame(
}
RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() {
- if (local_frame_id_.is_valid())
- surface_factory_->Destroy(local_frame_id_);
-
+ surface_factory_.reset();
if (GetSurfaceManager())
GetSurfaceManager()->InvalidateFrameSinkId(frame_sink_id_);
}
@@ -400,10 +398,22 @@ void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame(
current_surface_scale_factor_ = scale_factor;
}
+ bool was_null = false;
Fady Samuel 2016/11/10 23:33:37 rename to allocated_new_local_frame_id
Saman Sami 2016/11/11 17:49:59 Done.
if (!local_frame_id_.is_valid()) {
local_frame_id_ = id_allocator_->GenerateId();
- surface_factory_->Create(local_frame_id_);
+ was_null = true;
+ }
+
+ cc::SurfaceFactory::DrawCallback ack_callback =
+ base::Bind(&RenderWidgetHostViewChildFrame::SurfaceDrawn, AsWeakPtr(),
+ compositor_frame_sink_id);
+ ack_pending_count_++;
+ // If this value grows very large, something is going wrong.
+ DCHECK_LT(ack_pending_count_, 1000U);
+ surface_factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame),
+ ack_callback);
+ if (was_null) {
cc::SurfaceSequence sequence =
cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++);
// The renderer process will satisfy this dependency when it creates a
@@ -415,16 +425,6 @@ void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame(
cc::SurfaceId(frame_sink_id_, local_frame_id_), frame_size,
scale_factor, sequence);
}
-
- cc::SurfaceFactory::DrawCallback ack_callback =
- base::Bind(&RenderWidgetHostViewChildFrame::SurfaceDrawn, AsWeakPtr(),
- compositor_frame_sink_id);
- ack_pending_count_++;
- // If this value grows very large, something is going wrong.
- DCHECK_LT(ack_pending_count_, 1000U);
- surface_factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame),
- ack_callback);
-
ProcessFrameSwappedCallbacks();
}
@@ -726,8 +726,6 @@ RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager(
}
void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() {
- if (local_frame_id_.is_valid())
- surface_factory_->Destroy(local_frame_id_);
local_frame_id_ = cc::LocalFrameId();
}

Powered by Google App Engine
This is Rietveld 408576698