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

Unified Diff: android_webview/browser/hardware_renderer.cc

Issue 2417343003: [Merge M55] aw: Fix effective frame source leak after detach (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/hardware_renderer.cc
diff --git a/android_webview/browser/hardware_renderer.cc b/android_webview/browser/hardware_renderer.cc
index 0ecf6c0625ef7bb7e473287dbc1167957bd27dee..9f4cf32646f148f55ae2a39f6e5b000027ff2338 100644
--- a/android_webview/browser/hardware_renderer.cc
+++ b/android_webview/browser/hardware_renderer.cc
@@ -156,6 +156,14 @@ void HardwareRenderer::AllocateSurface() {
void HardwareRenderer::DestroySurface() {
DCHECK(!child_id_.is_null());
DCHECK(surface_factory_);
+
+ // Submit an empty frame to force any existing resources to be returned.
+ cc::CompositorFrame empty_frame;
+ empty_frame.delegated_frame_data =
+ base::WrapUnique(new cc::DelegatedFrameData);
+ surface_factory_->SubmitCompositorFrame(child_id_, std::move(empty_frame),
+ cc::SurfaceFactory::DrawCallback());
+
surfaces_->RemoveChildId(cc::SurfaceId(frame_sink_id_, child_id_));
surface_factory_->Destroy(child_id_);
child_id_ = cc::LocalFrameId();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698