| 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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 if (!surface_factory_) { | 455 if (!surface_factory_) { |
| 456 surface_factory_ = | 456 surface_factory_ = |
| 457 base::WrapUnique(new cc::SurfaceFactory(manager, this)); | 457 base::WrapUnique(new cc::SurfaceFactory(manager, this)); |
| 458 } | 458 } |
| 459 if (surface_id_.is_null() || frame_size != current_surface_size_ || | 459 if (surface_id_.is_null() || frame_size != current_surface_size_ || |
| 460 frame_size_in_dip != current_frame_size_in_dip_) { | 460 frame_size_in_dip != current_frame_size_in_dip_) { |
| 461 if (!surface_id_.is_null()) | 461 if (!surface_id_.is_null()) |
| 462 surface_factory_->Destroy(surface_id_); | 462 surface_factory_->Destroy(surface_id_); |
| 463 surface_id_ = id_allocator_->GenerateId(); | 463 surface_id_ = id_allocator_->GenerateId(); |
| 464 surface_factory_->Create(surface_id_); | 464 surface_factory_->Create(surface_id_); |
| 465 surface_factory_->SetSurfaceGpuMemoryBufferClientId( |
| 466 surface_id_, client_->DelegatedFrameHostGetGpuMemoryBufferClientId()); |
| 465 // manager must outlive compositors using it. | 467 // manager must outlive compositors using it. |
| 466 client_->DelegatedFrameHostGetLayer()->SetShowSurface( | 468 client_->DelegatedFrameHostGetLayer()->SetShowSurface( |
| 467 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 469 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
| 468 base::Bind(&RequireCallback, base::Unretained(manager)), frame_size, | 470 base::Bind(&RequireCallback, base::Unretained(manager)), frame_size, |
| 469 frame_device_scale_factor, frame_size_in_dip); | 471 frame_device_scale_factor, frame_size_in_dip); |
| 470 current_surface_size_ = frame_size; | 472 current_surface_size_ = frame_size; |
| 471 current_scale_factor_ = frame_device_scale_factor; | 473 current_scale_factor_ = frame_device_scale_factor; |
| 472 } | 474 } |
| 473 | 475 |
| 474 frame->metadata.latency_info.insert(frame->metadata.latency_info.end(), | 476 frame->metadata.latency_info.insert(frame->metadata.latency_info.end(), |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 896 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
| 895 new_layer->SetShowSurface( | 897 new_layer->SetShowSurface( |
| 896 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 898 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
| 897 base::Bind(&RequireCallback, base::Unretained(manager)), | 899 base::Bind(&RequireCallback, base::Unretained(manager)), |
| 898 current_surface_size_, current_scale_factor_, | 900 current_surface_size_, current_scale_factor_, |
| 899 current_frame_size_in_dip_); | 901 current_frame_size_in_dip_); |
| 900 } | 902 } |
| 901 } | 903 } |
| 902 | 904 |
| 903 } // namespace content | 905 } // namespace content |
| OLD | NEW |