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

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: 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 void DelegatedFrameHost::BeginFrameSubscription( 207 void DelegatedFrameHost::BeginFrameSubscription(
208 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) { 208 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) {
209 frame_subscriber_ = subscriber.Pass(); 209 frame_subscriber_ = subscriber.Pass();
210 } 210 }
211 211
212 void DelegatedFrameHost::EndFrameSubscription() { 212 void DelegatedFrameHost::EndFrameSubscription() {
213 idle_frame_subscriber_textures_.clear(); 213 idle_frame_subscriber_textures_.clear();
214 frame_subscriber_.reset(); 214 frame_subscriber_.reset();
215 } 215 }
216 216
217 void DelegatedFrameHost::UpdateVSyncParameters(
218 base::TimeTicks timebase,
219 base::TimeDelta interval) {
220 vsync_timebase_ = timebase;
221 vsync_interval_ = interval;
222 }
223
217 bool DelegatedFrameHost::ShouldSkipFrame(gfx::Size size_in_dip) const { 224 bool DelegatedFrameHost::ShouldSkipFrame(gfx::Size size_in_dip) const {
218 // Should skip a frame only when another frame from the renderer is guaranteed 225 // Should skip a frame only when another frame from the renderer is guaranteed
219 // to replace it. Otherwise may cause hangs when the renderer is waiting for 226 // to replace it. Otherwise may cause hangs when the renderer is waiting for
220 // the completion of latency infos (such as when taking a Snapshot.) 227 // the completion of latency infos (such as when taking a Snapshot.)
221 if (can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || 228 if (can_lock_compositor_ == NO_PENDING_RENDERER_FRAME ||
222 can_lock_compositor_ == NO_PENDING_COMMIT || 229 can_lock_compositor_ == NO_PENDING_COMMIT ||
223 !resize_lock_.get()) 230 !resize_lock_.get())
224 return false; 231 return false;
225 232
226 return size_in_dip != resize_lock_->expected_size(); 233 return size_in_dip != resize_lock_->expected_size();
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 frame_subscriber_callbacks_.pop_front(); 942 frame_subscriber_callbacks_.pop_front();
936 } 943 }
937 944
938 DCHECK(!compositor_); 945 DCHECK(!compositor_);
939 ImageTransportFactory::GetInstance()->RemoveObserver(this); 946 ImageTransportFactory::GetInstance()->RemoveObserver(this);
940 947
941 if (!surface_id_.is_null()) 948 if (!surface_id_.is_null())
942 surface_factory_->Destroy(surface_id_); 949 surface_factory_->Destroy(surface_id_);
943 if (resource_collection_.get()) 950 if (resource_collection_.get())
944 resource_collection_->SetClient(NULL); 951 resource_collection_->SetClient(NULL);
945 952 // TODO(simonhong): Remove vsync manager when BeginFrame scheduling is enabled
953 // on all platform.
954 #if 0
946 DCHECK(!vsync_manager_.get()); 955 DCHECK(!vsync_manager_.get());
956 #endif
947 } 957 }
948 958
949 void DelegatedFrameHost::RunOnCommitCallbacks() { 959 void DelegatedFrameHost::RunOnCommitCallbacks() {
950 for (std::vector<base::Closure>::const_iterator 960 for (std::vector<base::Closure>::const_iterator
951 it = on_compositing_did_commit_callbacks_.begin(); 961 it = on_compositing_did_commit_callbacks_.begin();
952 it != on_compositing_did_commit_callbacks_.end(); ++it) { 962 it != on_compositing_did_commit_callbacks_.end(); ++it) {
953 it->Run(); 963 it->Run();
954 } 964 }
955 on_compositing_did_commit_callbacks_.clear(); 965 on_compositing_did_commit_callbacks_.clear();
956 } 966 }
957 967
958 void DelegatedFrameHost::AddOnCommitCallbackAndDisableLocks( 968 void DelegatedFrameHost::AddOnCommitCallbackAndDisableLocks(
959 const base::Closure& callback) { 969 const base::Closure& callback) {
960 DCHECK(compositor_); 970 DCHECK(compositor_);
961 971
962 can_lock_compositor_ = NO_PENDING_COMMIT; 972 can_lock_compositor_ = NO_PENDING_COMMIT;
963 if (!callback.is_null()) 973 if (!callback.is_null())
964 on_compositing_did_commit_callbacks_.push_back(callback); 974 on_compositing_did_commit_callbacks_.push_back(callback);
965 } 975 }
966 976
967 void DelegatedFrameHost::SetCompositor(ui::Compositor* compositor) { 977 void DelegatedFrameHost::SetCompositor(ui::Compositor* compositor) {
968 DCHECK(!compositor_); 978 DCHECK(!compositor_);
969 if (!compositor) 979 if (!compositor)
970 return; 980 return;
971 compositor_ = compositor; 981 compositor_ = compositor;
972 compositor_->AddObserver(this); 982 compositor_->AddObserver(this);
983 #if 0
danakj 2015/03/24 17:46:24 I'm not sure what is going on in this CL sorry. Yo
973 DCHECK(!vsync_manager_.get()); 984 DCHECK(!vsync_manager_.get());
974 vsync_manager_ = compositor_->vsync_manager(); 985 vsync_manager_ = compositor_->vsync_manager();
975 vsync_manager_->AddObserver(this); 986 vsync_manager_->AddObserver(this);
987 #endif
976 } 988 }
977 989
978 void DelegatedFrameHost::ResetCompositor() { 990 void DelegatedFrameHost::ResetCompositor() {
979 if (!compositor_) 991 if (!compositor_)
980 return; 992 return;
981 RunOnCommitCallbacks(); 993 RunOnCommitCallbacks();
982 if (resize_lock_) { 994 if (resize_lock_) {
983 resize_lock_.reset(); 995 resize_lock_.reset();
984 client_->DelegatedFrameHostResizeLockWasReleased(); 996 client_->DelegatedFrameHostResizeLockWasReleased();
985 } 997 }
986 if (compositor_->HasObserver(this)) 998 if (compositor_->HasObserver(this))
987 compositor_->RemoveObserver(this); 999 compositor_->RemoveObserver(this);
1000 #if 0
988 if (vsync_manager_.get()) { 1001 if (vsync_manager_.get()) {
989 vsync_manager_->RemoveObserver(this); 1002 vsync_manager_->RemoveObserver(this);
990 vsync_manager_ = NULL; 1003 vsync_manager_ = NULL;
991 } 1004 }
1005 #endif
992 compositor_ = nullptr; 1006 compositor_ = nullptr;
993 } 1007 }
994 1008
995 void DelegatedFrameHost::LockResources() { 1009 void DelegatedFrameHost::LockResources() {
996 DCHECK(frame_provider_.get() || !surface_id_.is_null()); 1010 DCHECK(frame_provider_.get() || !surface_id_.is_null());
997 delegated_frame_evictor_->LockFrame(); 1011 delegated_frame_evictor_->LockFrame();
998 } 1012 }
999 1013
1000 void DelegatedFrameHost::RequestCopyOfOutput( 1014 void DelegatedFrameHost::RequestCopyOfOutput(
1001 scoped_ptr<cc::CopyOutputRequest> request) { 1015 scoped_ptr<cc::CopyOutputRequest> request) {
(...skipping 25 matching lines...) Expand all
1027 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 1041 cc::SurfaceManager* manager = factory->GetSurfaceManager();
1028 new_layer->SetShowSurface( 1042 new_layer->SetShowSurface(
1029 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), 1043 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)),
1030 base::Bind(&RequireCallback, base::Unretained(manager)), 1044 base::Bind(&RequireCallback, base::Unretained(manager)),
1031 current_surface_size_, current_scale_factor_, 1045 current_surface_size_, current_scale_factor_,
1032 current_frame_size_in_dip_); 1046 current_frame_size_in_dip_);
1033 } 1047 }
1034 } 1048 }
1035 1049
1036 } // namespace content 1050 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/delegated_frame_host.h ('k') | content/browser/renderer_host/render_widget_host_view_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698