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

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

Issue 274163004: Remove browser-side tracking of accelerated compositing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 | Annotate | Revision Log
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 28 matching lines...) Expand all
39 : client_(client), 39 : client_(client),
40 last_output_surface_id_(0), 40 last_output_surface_id_(0),
41 pending_delegated_ack_count_(0), 41 pending_delegated_ack_count_(0),
42 skipped_frames_(false), 42 skipped_frames_(false),
43 can_lock_compositor_(YES), 43 can_lock_compositor_(YES),
44 delegated_frame_evictor_(new DelegatedFrameEvictor(this)) { 44 delegated_frame_evictor_(new DelegatedFrameEvictor(this)) {
45 ImageTransportFactory::GetInstance()->AddObserver(this); 45 ImageTransportFactory::GetInstance()->AddObserver(this);
46 } 46 }
47 47
48 void DelegatedFrameHost::WasShown() { 48 void DelegatedFrameHost::WasShown() {
49 RenderWidgetHostImpl* host = client_->GetHost();
50 delegated_frame_evictor_->SetVisible(true); 49 delegated_frame_evictor_->SetVisible(true);
51 50
52 if (host->is_accelerated_compositing_active() && 51 if (!released_front_lock_.get()) {
53 !released_front_lock_.get()) {
54 ui::Compositor* compositor = client_->GetCompositor(); 52 ui::Compositor* compositor = client_->GetCompositor();
55 if (compositor) 53 if (compositor)
56 released_front_lock_ = compositor->GetCompositorLock(); 54 released_front_lock_ = compositor->GetCompositorLock();
57 } 55 }
58 } 56 }
59 57
60 void DelegatedFrameHost::WasHidden() { 58 void DelegatedFrameHost::WasHidden() {
61 delegated_frame_evictor_->SetVisible(false); 59 delegated_frame_evictor_->SetVisible(false);
62 released_front_lock_ = NULL; 60 released_front_lock_ = NULL;
63 } 61 }
(...skipping 29 matching lines...) Expand all
93 // resizing we compensate by blocking the UI thread in Compositor::Draw() by 91 // resizing we compensate by blocking the UI thread in Compositor::Draw() by
94 // issuing a FinishAllRendering() if we are resizing. 92 // issuing a FinishAllRendering() if we are resizing.
95 #if defined(OS_WIN) 93 #if defined(OS_WIN)
96 return false; 94 return false;
97 #else 95 #else
98 if (resize_lock_) 96 if (resize_lock_)
99 return false; 97 return false;
100 98
101 if (host->should_auto_resize()) 99 if (host->should_auto_resize())
102 return false; 100 return false;
103 if (!host->is_accelerated_compositing_active())
danakj 2014/05/12 17:37:58 Does this mean if you tried to resize during a slo
piman 2014/05/13 20:25:40 It is actually a desirable outcome. The resize loc
104 return false;
105 101
106 gfx::Size desired_size = client_->DesiredFrameSize(); 102 gfx::Size desired_size = client_->DesiredFrameSize();
107 if (desired_size == current_frame_size_in_dip_) 103 if (desired_size == current_frame_size_in_dip_)
108 return false; 104 return false;
109 105
110 ui::Compositor* compositor = client_->GetCompositor(); 106 ui::Compositor* compositor = client_->GetCompositor();
111 if (!compositor) 107 if (!compositor)
112 return false; 108 return false;
113 109
114 return true; 110 return true;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 198 }
203 client_->RequestCopyOfOutput(request.Pass()); 199 client_->RequestCopyOfOutput(request.Pass());
204 } 200 }
205 201
206 bool DelegatedFrameHost::CanCopyToBitmap() const { 202 bool DelegatedFrameHost::CanCopyToBitmap() const {
207 return client_->GetCompositor() && 203 return client_->GetCompositor() &&
208 client_->GetLayer()->has_external_content(); 204 client_->GetLayer()->has_external_content();
209 } 205 }
210 206
211 bool DelegatedFrameHost::CanCopyToVideoFrame() const { 207 bool DelegatedFrameHost::CanCopyToVideoFrame() const {
212 RenderWidgetHostImpl* host = client_->GetHost();
213 return client_->GetCompositor() && 208 return client_->GetCompositor() &&
214 client_->GetLayer()->has_external_content() && 209 client_->GetLayer()->has_external_content();
215 host->is_accelerated_compositing_active();
216 } 210 }
217 211
218 bool DelegatedFrameHost::CanSubscribeFrame() const { 212 bool DelegatedFrameHost::CanSubscribeFrame() const {
219 return true; 213 return true;
220 } 214 }
221 215
222 void DelegatedFrameHost::BeginFrameSubscription( 216 void DelegatedFrameHost::BeginFrameSubscription(
223 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) { 217 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) {
224 frame_subscriber_ = subscriber.Pass(); 218 frame_subscriber_ = subscriber.Pass();
225 } 219 }
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 // that should keep our frame. old_layer will be returned to the 861 // that should keep our frame. old_layer will be returned to the
868 // RecreateLayer caller, and should have a copy. 862 // RecreateLayer caller, and should have a copy.
869 if (frame_provider_.get()) { 863 if (frame_provider_.get()) {
870 new_layer->SetShowDelegatedContent(frame_provider_.get(), 864 new_layer->SetShowDelegatedContent(frame_provider_.get(),
871 current_frame_size_in_dip_); 865 current_frame_size_in_dip_);
872 } 866 }
873 } 867 }
874 868
875 } // namespace content 869 } // namespace content
876 870
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698