| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 450 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 451 cc::SurfaceManager* manager = | 451 cc::SurfaceManager* manager = |
| 452 factory->GetContextFactoryPrivate()->GetSurfaceManager(); | 452 factory->GetContextFactoryPrivate()->GetSurfaceManager(); |
| 453 bool allocated_new_local_surface_id = false; | 453 bool allocated_new_local_surface_id = false; |
| 454 if (!local_surface_id_.is_valid() || frame_size != current_surface_size_ || | 454 if (!local_surface_id_.is_valid() || frame_size != current_surface_size_ || |
| 455 frame_size_in_dip != current_frame_size_in_dip_) { | 455 frame_size_in_dip != current_frame_size_in_dip_) { |
| 456 local_surface_id_ = id_allocator_->GenerateId(); | 456 local_surface_id_ = id_allocator_->GenerateId(); |
| 457 allocated_new_local_surface_id = true; | 457 allocated_new_local_surface_id = true; |
| 458 } | 458 } |
| 459 | 459 |
| 460 gfx::Size desired_size = client_->DelegatedFrameHostDesiredSizeInDIP(); | 460 frame.metadata.latency_info.insert(frame.metadata.latency_info.end(), |
| 461 if (desired_size != frame_size_in_dip && !desired_size.IsEmpty()) { | 461 skipped_latency_info_list_.begin(), |
| 462 skipped_latency_info_list_.insert(skipped_latency_info_list_.end(), | 462 skipped_latency_info_list_.end()); |
| 463 frame.metadata.latency_info.begin(), | 463 skipped_latency_info_list_.clear(); |
| 464 frame.metadata.latency_info.end()); | |
| 465 frame.metadata.latency_info.clear(); | |
| 466 } else { | |
| 467 frame.metadata.latency_info.insert(frame.metadata.latency_info.end(), | |
| 468 skipped_latency_info_list_.begin(), | |
| 469 skipped_latency_info_list_.end()); | |
| 470 skipped_latency_info_list_.clear(); | |
| 471 } | |
| 472 | 464 |
| 473 support_->SubmitCompositorFrame(local_surface_id_, std::move(frame)); | 465 support_->SubmitCompositorFrame(local_surface_id_, std::move(frame)); |
| 474 | 466 |
| 475 if (allocated_new_local_surface_id) { | 467 if (allocated_new_local_surface_id) { |
| 476 // manager must outlive compositors using it. | 468 // manager must outlive compositors using it. |
| 477 cc::SurfaceId surface_id(frame_sink_id_, local_surface_id_); | 469 cc::SurfaceId surface_id(frame_sink_id_, local_surface_id_); |
| 478 cc::SurfaceInfo surface_info(surface_id, frame_device_scale_factor, | 470 cc::SurfaceInfo surface_info(surface_id, frame_device_scale_factor, |
| 479 frame_size); | 471 frame_size); |
| 480 client_->DelegatedFrameHostGetLayer()->SetShowPrimarySurface( | 472 client_->DelegatedFrameHostGetLayer()->SetShowPrimarySurface( |
| 481 surface_info, manager->reference_factory()); | 473 surface_info, manager->reference_factory()); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 | 850 |
| 859 void DelegatedFrameHost::ResetCompositorFrameSinkSupport() { | 851 void DelegatedFrameHost::ResetCompositorFrameSinkSupport() { |
| 860 if (!support_) | 852 if (!support_) |
| 861 return; | 853 return; |
| 862 if (compositor_) | 854 if (compositor_) |
| 863 compositor_->RemoveFrameSink(frame_sink_id_); | 855 compositor_->RemoveFrameSink(frame_sink_id_); |
| 864 support_.reset(); | 856 support_.reset(); |
| 865 } | 857 } |
| 866 | 858 |
| 867 } // namespace content | 859 } // namespace content |
| OLD | NEW |