OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/compositor/delegated_frame_host.h" | 5 #include "content/browser/compositor/delegated_frame_host.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
10 #include "cc/output/compositor_frame_ack.h" | 10 #include "cc/output/compositor_frame_ack.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
365 ui::Compositor* compositor = client_->GetCompositor(); | 365 ui::Compositor* compositor = client_->GetCompositor(); |
366 if (frame_size.IsEmpty()) { | 366 if (frame_size.IsEmpty()) { |
367 DCHECK(frame_data->resource_list.empty()); | 367 DCHECK(frame_data->resource_list.empty()); |
368 EvictDelegatedFrame(); | 368 EvictDelegatedFrame(); |
369 modified_layers = true; | 369 modified_layers = true; |
370 } else { | 370 } else { |
371 if (use_surfaces_) { | 371 if (use_surfaces_) { |
372 if (!surface_factory_) { | 372 if (!surface_factory_) { |
373 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 373 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
374 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 374 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
375 id_allocator_ = factory->CreateSurfaceIdAllocator(); | 375 id_allocator_ = |
danakj
2014/10/07 20:33:19
You said "Also move ownership of the SurfaceIdAllo
| |
376 factory->GetContextFactory()->CreateSurfaceIdAllocator(); | |
376 surface_factory_ = | 377 surface_factory_ = |
377 make_scoped_ptr(new cc::SurfaceFactory(manager, this)); | 378 make_scoped_ptr(new cc::SurfaceFactory(manager, this)); |
378 } | 379 } |
379 if (surface_id_.is_null() || frame_size != current_surface_size_ || | 380 if (surface_id_.is_null() || frame_size != current_surface_size_ || |
380 frame_size_in_dip != current_frame_size_in_dip_) { | 381 frame_size_in_dip != current_frame_size_in_dip_) { |
381 // TODO(jbauman): Wait to destroy this surface until the parent has | 382 if (!surface_id_.is_null()) { |
382 // finished using it. | 383 if (compositor) { |
383 if (!surface_id_.is_null()) | 384 std::set<cc::SurfaceSequence> seq; |
384 surface_factory_->Destroy(surface_id_); | 385 seq.insert(compositor->CreateSurfaceSequence()); |
danakj
2014/10/07 20:08:25
What step (in that 1-10 steps) in your design docu
danakj
2014/10/07 20:33:19
What if the layer moves to another compositor afte
danakj
2014/10/08 21:51:21
Comment here please explaining that we want the co
| |
386 surface_factory_->DestroyOnSequence(surface_id_, seq); | |
danakj
2014/10/02 01:53:45
Can you help me understand what's going on here?
| |
387 } else { | |
388 surface_factory_->Destroy(surface_id_); | |
389 } | |
390 } | |
385 surface_id_ = id_allocator_->GenerateId(); | 391 surface_id_ = id_allocator_->GenerateId(); |
386 surface_factory_->Create(surface_id_, frame_size); | 392 surface_factory_->Create(surface_id_, frame_size); |
387 client_->GetLayer()->SetShowSurface(surface_id_, frame_size_in_dip); | 393 client_->GetLayer()->SetShowSurface(surface_id_, frame_size_in_dip); |
388 current_surface_size_ = frame_size; | 394 current_surface_size_ = frame_size; |
389 modified_layers = true; | 395 modified_layers = true; |
390 } | 396 } |
391 scoped_ptr<cc::CompositorFrame> compositor_frame = | 397 scoped_ptr<cc::CompositorFrame> compositor_frame = |
392 make_scoped_ptr(new cc::CompositorFrame()); | 398 make_scoped_ptr(new cc::CompositorFrame()); |
393 compositor_frame->delegated_frame_data = frame_data.Pass(); | 399 compositor_frame->delegated_frame_data = frame_data.Pass(); |
394 | 400 |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
986 if (frame_provider_.get()) { | 992 if (frame_provider_.get()) { |
987 new_layer->SetShowDelegatedContent(frame_provider_.get(), | 993 new_layer->SetShowDelegatedContent(frame_provider_.get(), |
988 current_frame_size_in_dip_); | 994 current_frame_size_in_dip_); |
989 } | 995 } |
990 if (!surface_id_.is_null()) { | 996 if (!surface_id_.is_null()) { |
991 new_layer->SetShowSurface(surface_id_, current_frame_size_in_dip_); | 997 new_layer->SetShowSurface(surface_id_, current_frame_size_in_dip_); |
992 } | 998 } |
993 } | 999 } |
994 | 1000 |
995 } // namespace content | 1001 } // namespace content |
OLD | NEW |