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/renderer_host/delegated_frame_host.h" | 5 #include "content/browser/renderer_host/delegated_frame_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 | 464 |
465 background_color_ = frame.metadata.root_background_color; | 465 background_color_ = frame.metadata.root_background_color; |
466 | 466 |
467 if (frame_size.IsEmpty()) { | 467 if (frame_size.IsEmpty()) { |
468 DCHECK(frame_data->resource_list.empty()); | 468 DCHECK(frame_data->resource_list.empty()); |
469 EvictDelegatedFrame(); | 469 EvictDelegatedFrame(); |
470 } else { | 470 } else { |
471 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 471 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
472 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 472 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
473 if (!surface_factory_) { | 473 if (!surface_factory_) { |
474 surface_factory_ = | 474 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>(manager, this); |
475 base::WrapUnique(new cc::SurfaceFactory(manager, this)); | |
476 } | 475 } |
477 if (surface_id_.is_null() || frame_size != current_surface_size_ || | 476 if (surface_id_.is_null() || frame_size != current_surface_size_ || |
478 frame_size_in_dip != current_frame_size_in_dip_) { | 477 frame_size_in_dip != current_frame_size_in_dip_) { |
479 if (!surface_id_.is_null()) | 478 if (!surface_id_.is_null()) |
480 surface_factory_->Destroy(surface_id_); | 479 surface_factory_->Destroy(surface_id_); |
481 surface_id_ = id_allocator_->GenerateId(); | 480 surface_id_ = id_allocator_->GenerateId(); |
482 surface_factory_->Create(surface_id_); | 481 surface_factory_->Create(surface_id_); |
483 // manager must outlive compositors using it. | 482 // manager must outlive compositors using it. |
484 client_->DelegatedFrameHostGetLayer()->SetShowSurface( | 483 client_->DelegatedFrameHostGetLayer()->SetShowSurface( |
485 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 484 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 900 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
902 new_layer->SetShowSurface( | 901 new_layer->SetShowSurface( |
903 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 902 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
904 base::Bind(&RequireCallback, base::Unretained(manager)), | 903 base::Bind(&RequireCallback, base::Unretained(manager)), |
905 current_surface_size_, current_scale_factor_, | 904 current_surface_size_, current_scale_factor_, |
906 current_frame_size_in_dip_); | 905 current_frame_size_in_dip_); |
907 } | 906 } |
908 } | 907 } |
909 | 908 |
910 } // namespace content | 909 } // namespace content |
OLD | NEW |