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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 | 891 |
892 void DelegatedFrameHost::OnCompositingShuttingDown(ui::Compositor* compositor) { | 892 void DelegatedFrameHost::OnCompositingShuttingDown(ui::Compositor* compositor) { |
893 DCHECK_EQ(compositor, compositor_); | 893 DCHECK_EQ(compositor, compositor_); |
894 ResetCompositor(); | 894 ResetCompositor(); |
895 DCHECK(!compositor_); | 895 DCHECK(!compositor_); |
896 } | 896 } |
897 | 897 |
898 void DelegatedFrameHost::OnUpdateVSyncParameters( | 898 void DelegatedFrameHost::OnUpdateVSyncParameters( |
899 base::TimeTicks timebase, | 899 base::TimeTicks timebase, |
900 base::TimeDelta interval) { | 900 base::TimeDelta interval) { |
901 vsync_timebase_ = timebase; | 901 SetVSyncParameters(timebase, interval); |
902 vsync_interval_ = interval; | |
903 if (client_->DelegatedFrameHostIsVisible()) | 902 if (client_->DelegatedFrameHostIsVisible()) |
904 client_->DelegatedFrameHostUpdateVSyncParameters(timebase, interval); | 903 client_->DelegatedFrameHostUpdateVSyncParameters(timebase, interval); |
905 } | 904 } |
906 | 905 |
907 //////////////////////////////////////////////////////////////////////////////// | 906 //////////////////////////////////////////////////////////////////////////////// |
908 // DelegatedFrameHost, ImageTransportFactoryObserver implementation: | 907 // DelegatedFrameHost, ImageTransportFactoryObserver implementation: |
909 | 908 |
910 void DelegatedFrameHost::OnLostResources() { | 909 void DelegatedFrameHost::OnLostResources() { |
911 if (frame_provider_.get() || !surface_id_.is_null()) | 910 if (frame_provider_.get() || !surface_id_.is_null()) |
912 EvictDelegatedFrame(); | 911 EvictDelegatedFrame(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 } | 969 } |
971 if (compositor_->HasObserver(this)) | 970 if (compositor_->HasObserver(this)) |
972 compositor_->RemoveObserver(this); | 971 compositor_->RemoveObserver(this); |
973 if (vsync_manager_.get()) { | 972 if (vsync_manager_.get()) { |
974 vsync_manager_->RemoveObserver(this); | 973 vsync_manager_->RemoveObserver(this); |
975 vsync_manager_ = NULL; | 974 vsync_manager_ = NULL; |
976 } | 975 } |
977 compositor_ = nullptr; | 976 compositor_ = nullptr; |
978 } | 977 } |
979 | 978 |
| 979 void DelegatedFrameHost::SetVSyncParameters(const base::TimeTicks& timebase, |
| 980 const base::TimeDelta& interval) { |
| 981 vsync_timebase_ = timebase; |
| 982 vsync_interval_ = interval; |
| 983 } |
| 984 |
980 void DelegatedFrameHost::LockResources() { | 985 void DelegatedFrameHost::LockResources() { |
981 DCHECK(frame_provider_.get() || !surface_id_.is_null()); | 986 DCHECK(frame_provider_.get() || !surface_id_.is_null()); |
982 delegated_frame_evictor_->LockFrame(); | 987 delegated_frame_evictor_->LockFrame(); |
983 } | 988 } |
984 | 989 |
985 void DelegatedFrameHost::RequestCopyOfOutput( | 990 void DelegatedFrameHost::RequestCopyOfOutput( |
986 scoped_ptr<cc::CopyOutputRequest> request) { | 991 scoped_ptr<cc::CopyOutputRequest> request) { |
987 if (!request_copy_of_output_callback_for_testing_.is_null()) | 992 if (!request_copy_of_output_callback_for_testing_.is_null()) |
988 request_copy_of_output_callback_for_testing_.Run(request.Pass()); | 993 request_copy_of_output_callback_for_testing_.Run(request.Pass()); |
989 else | 994 else |
(...skipping 22 matching lines...) Expand all Loading... |
1012 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 1017 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
1013 new_layer->SetShowSurface( | 1018 new_layer->SetShowSurface( |
1014 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 1019 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
1015 base::Bind(&RequireCallback, base::Unretained(manager)), | 1020 base::Bind(&RequireCallback, base::Unretained(manager)), |
1016 current_surface_size_, current_scale_factor_, | 1021 current_surface_size_, current_scale_factor_, |
1017 current_frame_size_in_dip_); | 1022 current_frame_size_in_dip_); |
1018 } | 1023 } |
1019 } | 1024 } |
1020 | 1025 |
1021 } // namespace content | 1026 } // namespace content |
OLD | NEW |