Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: content/browser/compositor/delegated_frame_host.cc

Issue 1016033006: Enable BeginFrame scheduling on aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mac build Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 can_lock_compositor_ = NO_PENDING_RENDERER_FRAME; 898 can_lock_compositor_ = NO_PENDING_RENDERER_FRAME;
899 } 899 }
900 } 900 }
901 901
902 void DelegatedFrameHost::OnCompositingShuttingDown(ui::Compositor* compositor) { 902 void DelegatedFrameHost::OnCompositingShuttingDown(ui::Compositor* compositor) {
903 DCHECK_EQ(compositor, compositor_); 903 DCHECK_EQ(compositor, compositor_);
904 ResetCompositor(); 904 ResetCompositor();
905 DCHECK(!compositor_); 905 DCHECK(!compositor_);
906 } 906 }
907 907
908 void DelegatedFrameHost::OnUpdateVSyncParameters( 908 void DelegatedFrameHost::UpdateVSyncParameters(
danakj 2015/03/25 17:40:38 s/Update/Set/ ?
simonhong 2015/03/25 18:05:22 Done.
909 base::TimeTicks timebase, 909 base::TimeTicks timebase,
910 base::TimeDelta interval) { 910 base::TimeDelta interval) {
911 vsync_timebase_ = timebase; 911 vsync_timebase_ = timebase;
912 vsync_interval_ = interval; 912 vsync_interval_ = interval;
913 if (client_->DelegatedFrameHostIsVisible())
914 client_->DelegatedFrameHostUpdateVSyncParameters(timebase, interval);
915 } 913 }
916 914
917 //////////////////////////////////////////////////////////////////////////////// 915 ////////////////////////////////////////////////////////////////////////////////
918 // DelegatedFrameHost, ImageTransportFactoryObserver implementation: 916 // DelegatedFrameHost, ImageTransportFactoryObserver implementation:
919 917
920 void DelegatedFrameHost::OnLostResources() { 918 void DelegatedFrameHost::OnLostResources() {
921 if (frame_provider_.get() || !surface_id_.is_null()) 919 if (frame_provider_.get() || !surface_id_.is_null())
922 EvictDelegatedFrame(); 920 EvictDelegatedFrame();
923 idle_frame_subscriber_textures_.clear(); 921 idle_frame_subscriber_textures_.clear();
924 yuv_readback_pipeline_.reset(); 922 yuv_readback_pipeline_.reset();
(...skipping 10 matching lines...) Expand all
935 frame_subscriber_callbacks_.pop_front(); 933 frame_subscriber_callbacks_.pop_front();
936 } 934 }
937 935
938 DCHECK(!compositor_); 936 DCHECK(!compositor_);
939 ImageTransportFactory::GetInstance()->RemoveObserver(this); 937 ImageTransportFactory::GetInstance()->RemoveObserver(this);
940 938
941 if (!surface_id_.is_null()) 939 if (!surface_id_.is_null())
942 surface_factory_->Destroy(surface_id_); 940 surface_factory_->Destroy(surface_id_);
943 if (resource_collection_.get()) 941 if (resource_collection_.get())
944 resource_collection_->SetClient(NULL); 942 resource_collection_->SetClient(NULL);
945
946 DCHECK(!vsync_manager_.get());
947 } 943 }
948 944
949 void DelegatedFrameHost::RunOnCommitCallbacks() { 945 void DelegatedFrameHost::RunOnCommitCallbacks() {
950 for (std::vector<base::Closure>::const_iterator 946 for (std::vector<base::Closure>::const_iterator
951 it = on_compositing_did_commit_callbacks_.begin(); 947 it = on_compositing_did_commit_callbacks_.begin();
952 it != on_compositing_did_commit_callbacks_.end(); ++it) { 948 it != on_compositing_did_commit_callbacks_.end(); ++it) {
953 it->Run(); 949 it->Run();
954 } 950 }
955 on_compositing_did_commit_callbacks_.clear(); 951 on_compositing_did_commit_callbacks_.clear();
956 } 952 }
957 953
958 void DelegatedFrameHost::AddOnCommitCallbackAndDisableLocks( 954 void DelegatedFrameHost::AddOnCommitCallbackAndDisableLocks(
959 const base::Closure& callback) { 955 const base::Closure& callback) {
960 DCHECK(compositor_); 956 DCHECK(compositor_);
961 957
962 can_lock_compositor_ = NO_PENDING_COMMIT; 958 can_lock_compositor_ = NO_PENDING_COMMIT;
963 if (!callback.is_null()) 959 if (!callback.is_null())
964 on_compositing_did_commit_callbacks_.push_back(callback); 960 on_compositing_did_commit_callbacks_.push_back(callback);
965 } 961 }
966 962
967 void DelegatedFrameHost::SetCompositor(ui::Compositor* compositor) { 963 void DelegatedFrameHost::SetCompositor(ui::Compositor* compositor) {
968 DCHECK(!compositor_); 964 DCHECK(!compositor_);
969 if (!compositor) 965 if (!compositor)
970 return; 966 return;
971 compositor_ = compositor; 967 compositor_ = compositor;
972 compositor_->AddObserver(this); 968 compositor_->AddObserver(this);
973 DCHECK(!vsync_manager_.get());
974 vsync_manager_ = compositor_->vsync_manager();
975 vsync_manager_->AddObserver(this);
976 } 969 }
977 970
978 void DelegatedFrameHost::ResetCompositor() { 971 void DelegatedFrameHost::ResetCompositor() {
979 if (!compositor_) 972 if (!compositor_)
980 return; 973 return;
981 RunOnCommitCallbacks(); 974 RunOnCommitCallbacks();
982 if (resize_lock_) { 975 if (resize_lock_) {
983 resize_lock_.reset(); 976 resize_lock_.reset();
984 client_->DelegatedFrameHostResizeLockWasReleased(); 977 client_->DelegatedFrameHostResizeLockWasReleased();
985 } 978 }
986 if (compositor_->HasObserver(this)) 979 if (compositor_->HasObserver(this))
987 compositor_->RemoveObserver(this); 980 compositor_->RemoveObserver(this);
988 if (vsync_manager_.get()) {
989 vsync_manager_->RemoveObserver(this);
990 vsync_manager_ = NULL;
991 }
992 compositor_ = nullptr; 981 compositor_ = nullptr;
993 } 982 }
994 983
995 void DelegatedFrameHost::LockResources() { 984 void DelegatedFrameHost::LockResources() {
996 DCHECK(frame_provider_.get() || !surface_id_.is_null()); 985 DCHECK(frame_provider_.get() || !surface_id_.is_null());
997 delegated_frame_evictor_->LockFrame(); 986 delegated_frame_evictor_->LockFrame();
998 } 987 }
999 988
1000 void DelegatedFrameHost::RequestCopyOfOutput( 989 void DelegatedFrameHost::RequestCopyOfOutput(
1001 scoped_ptr<cc::CopyOutputRequest> request) { 990 scoped_ptr<cc::CopyOutputRequest> request) {
(...skipping 25 matching lines...) Expand all
1027 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 1016 cc::SurfaceManager* manager = factory->GetSurfaceManager();
1028 new_layer->SetShowSurface( 1017 new_layer->SetShowSurface(
1029 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), 1018 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)),
1030 base::Bind(&RequireCallback, base::Unretained(manager)), 1019 base::Bind(&RequireCallback, base::Unretained(manager)),
1031 current_surface_size_, current_scale_factor_, 1020 current_surface_size_, current_scale_factor_,
1032 current_frame_size_in_dip_); 1021 current_frame_size_in_dip_);
1033 } 1022 }
1034 } 1023 }
1035 1024
1036 } // namespace content 1025 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698