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

Unified Diff: cc/surfaces/surface_factory.cc

Issue 553213003: Avoid destroying surface before the parent surface stops referencing it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
Index: cc/surfaces/surface_factory.cc
diff --git a/cc/surfaces/surface_factory.cc b/cc/surfaces/surface_factory.cc
index ab7186a39b42181cc9f72174a281d19e565853a7..dcf1130c942b4dcefbbb0b34e39d85e4a9e869c5 100644
--- a/cc/surfaces/surface_factory.cc
+++ b/cc/surfaces/surface_factory.cc
@@ -29,17 +29,26 @@ void SurfaceFactory::Create(SurfaceId surface_id, const gfx::Size& size) {
void SurfaceFactory::Destroy(SurfaceId surface_id) {
OwningSurfaceMap::iterator it = surface_map_.find(surface_id);
DCHECK(it != surface_map_.end());
- DCHECK(it->second->factory() == this);
+ DCHECK(it->second->factory().get() == this);
manager_->DeregisterSurface(surface_id);
surface_map_.erase(it);
}
+void SurfaceFactory::DestroyOnSequence(
+ SurfaceId surface_id,
+ const std::set<SurfaceSequence>& dependency_set) {
+ OwningSurfaceMap::iterator it = surface_map_.find(surface_id);
+ DCHECK(it != surface_map_.end());
+ DCHECK(it->second->factory().get() == this);
+ manager_->DestroyOnSequence(surface_map_.take_and_erase(it), dependency_set);
+}
+
void SurfaceFactory::SubmitFrame(SurfaceId surface_id,
scoped_ptr<CompositorFrame> frame,
const base::Closure& callback) {
OwningSurfaceMap::iterator it = surface_map_.find(surface_id);
DCHECK(it != surface_map_.end());
- DCHECK(it->second->factory() == this);
+ DCHECK(it->second->factory().get() == this);
it->second->QueueFrame(frame.Pass(), callback);
manager_->SurfaceModified(surface_id);
}
@@ -52,7 +61,7 @@ void SurfaceFactory::RequestCopyOfSurface(
copy_request->SendEmptyResult();
return;
}
- DCHECK(it->second->factory() == this);
+ DCHECK(it->second->factory().get() == this);
it->second->RequestCopyOfOutput(copy_request.Pass());
manager_->SurfaceModified(surface_id);
}

Powered by Google App Engine
This is Rietveld 408576698