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

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

Issue 2087383002: Fix destruction order between SurfaceManger and OffscreenCanvasSurfaceImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix SurfaceIdAllocator's destructor Created 4 years, 6 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/offscreen_canvas_surface_impl.cc
diff --git a/content/browser/renderer_host/offscreen_canvas_surface_impl.cc b/content/browser/renderer_host/offscreen_canvas_surface_impl.cc
index edbed1acad500d6efd8bbfec98f50754cfea202f..b9ada9498f928bc03d286242974c20c0c1070e7a 100644
--- a/content/browser/renderer_host/offscreen_canvas_surface_impl.cc
+++ b/content/browser/renderer_host/offscreen_canvas_surface_impl.cc
@@ -25,15 +25,22 @@ OffscreenCanvasSurfaceImpl::OffscreenCanvasSurfaceImpl(
binding_(this, std::move(request)) {}
OffscreenCanvasSurfaceImpl::~OffscreenCanvasSurfaceImpl() {
+ if (!GetSurfaceManager()) {
+ // Inform both members that SurfaceManager's no longer alive to
+ // avoid their destruction errors.
+ surface_factory_->didDestroySurfaceManager();
+ id_allocator_->didDestroySurfaceManager();
+ }
+ surface_factory_->Destroy(surface_id_);
}
void OffscreenCanvasSurfaceImpl::GetSurfaceId(
const GetSurfaceIdCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- cc::SurfaceId surface_id = id_allocator_->GenerateId();
+ surface_id_ = id_allocator_->GenerateId();
- callback.Run(surface_id);
+ callback.Run(surface_id_);
}
void OffscreenCanvasSurfaceImpl::RequestSurfaceCreation(

Powered by Google App Engine
This is Rietveld 408576698