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