Chromium Code Reviews| 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 f943dd2ded246a9a5493b894aab2a602a4c15656..c2c0f19e1746c3bbc156ad696c984b3bacbbb3ae 100644 |
| --- a/content/browser/compositor/delegated_frame_host.cc |
| +++ b/content/browser/compositor/delegated_frame_host.cc |
| @@ -54,7 +54,7 @@ void DelegatedFrameHostClient::RequestCopyOfOutput( |
| DelegatedFrameHost::DelegatedFrameHost(DelegatedFrameHostClient* client) |
| : client_(client), |
| use_surfaces_(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| - switches::kUseSurfaces)), |
| + switches::kUseSurfaces)), |
| last_output_surface_id_(0), |
| pending_delegated_ack_count_(0), |
| skipped_frames_(false), |
| @@ -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> s; |
|
jamesr
2014/09/12 01:08:55
's' seems a bit too terse, maybe 'seq' ?
jbauman
2014/09/23 01:58:05
Done.
|
| + s.insert(compositor->CreateSurfaceSequence()); |
| + surface_factory_->DestroyOnSequence(surface_id_, s); |
| + } 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); |