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

Unified Diff: content/browser/compositor/delegated_frame_host.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, 3 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/compositor/delegated_frame_host.cc
diff --git a/content/browser/compositor/delegated_frame_host.cc b/content/browser/compositor/delegated_frame_host.cc
index 28d586b3d694ed0ce9d0c38470776721b4172560..21fdb831d97bcaaee1769d100305e70b05f566c2 100644
--- a/content/browser/compositor/delegated_frame_host.cc
+++ b/content/browser/compositor/delegated_frame_host.cc
@@ -372,16 +372,22 @@ void DelegatedFrameHost::SwapDelegatedFrame(
if (!surface_factory_) {
ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
cc::SurfaceManager* manager = factory->GetSurfaceManager();
- id_allocator_ = factory->CreateSurfaceIdAllocator();
+ id_allocator_ =
+ factory->GetContextFactory()->CreateSurfaceIdAllocator();
surface_factory_ =
make_scoped_ptr(new cc::SurfaceFactory(manager, this));
}
if (surface_id_.is_null() || frame_size != current_surface_size_ ||
frame_size_in_dip != current_frame_size_in_dip_) {
- // TODO(jbauman): Wait to destroy this surface until the parent has
- // finished using it.
- if (!surface_id_.is_null())
- surface_factory_->Destroy(surface_id_);
+ if (!surface_id_.is_null()) {
+ if (compositor) {
+ std::set<cc::SurfaceSequence> seq;
+ seq.insert(compositor->CreateSurfaceSequence());
+ surface_factory_->DestroyOnSequence(surface_id_, seq);
+ } else {
+ surface_factory_->Destroy(surface_id_);
+ }
+ }
surface_id_ = id_allocator_->GenerateId();
surface_factory_->Create(surface_id_, frame_size);
client_->GetLayer()->SetShowSurface(surface_id_, frame_size_in_dip);

Powered by Google App Engine
This is Rietveld 408576698