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

Side by Side Diff: content/renderer/gpu/compositor_output_surface.cc

Issue 218633010: cc: Handle retroactive BeginFrames in the Scheduler. (Closed) Base URL: http://git.chromium.org/chromium/src.git@compositorVsyncDisable
Patch Set: rebase on pending patches Created 6 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/gpu/compositor_output_surface.h" 5 #include "content/renderer/gpu/compositor_output_surface.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 DCHECK(output_surface_filter_.get()); 71 DCHECK(output_surface_filter_.get());
72 DetachFromThread(); 72 DetachFromThread();
73 message_sender_ = RenderThreadImpl::current()->sync_message_filter(); 73 message_sender_ = RenderThreadImpl::current()->sync_message_filter();
74 DCHECK(message_sender_.get()); 74 DCHECK(message_sender_.get());
75 if (OutputSurface::software_device()) 75 if (OutputSurface::software_device())
76 capabilities_.max_frames_pending = 1; 76 capabilities_.max_frames_pending = 1;
77 } 77 }
78 78
79 CompositorOutputSurface::~CompositorOutputSurface() { 79 CompositorOutputSurface::~CompositorOutputSurface() {
80 DCHECK(CalledOnValidThread()); 80 DCHECK(CalledOnValidThread());
81 SetNeedsBeginImplFrame(false); 81 SetNeedsBeginFrame(false);
82 if (!HasClient()) 82 if (!HasClient())
83 return; 83 return;
84 UpdateSmoothnessTakesPriority(false); 84 UpdateSmoothnessTakesPriority(false);
85 if (output_surface_proxy_.get()) 85 if (output_surface_proxy_.get())
86 output_surface_proxy_->ClearOutputSurface(); 86 output_surface_proxy_->ClearOutputSurface();
87 output_surface_filter_->RemoveRoute(routing_id_); 87 output_surface_filter_->RemoveRoute(routing_id_);
88 } 88 }
89 89
90 bool CompositorOutputSurface::BindToClient( 90 bool CompositorOutputSurface::BindToClient(
91 cc::OutputSurfaceClient* client) { 91 cc::OutputSurfaceClient* client) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { 136 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) {
137 DCHECK(CalledOnValidThread()); 137 DCHECK(CalledOnValidThread());
138 if (!HasClient()) 138 if (!HasClient())
139 return; 139 return;
140 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) 140 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message)
141 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, 141 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters,
142 OnUpdateVSyncParametersFromBrowser); 142 OnUpdateVSyncParametersFromBrowser);
143 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck); 143 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck);
144 IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources, OnReclaimResources); 144 IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources, OnReclaimResources);
145 #if defined(OS_ANDROID) 145 #if defined(OS_ANDROID)
146 IPC_MESSAGE_HANDLER(ViewMsg_BeginFrame, OnBeginImplFrame); 146 IPC_MESSAGE_HANDLER(ViewMsg_BeginFrame, OnBeginFrame);
147 #endif 147 #endif
148 IPC_END_MESSAGE_MAP() 148 IPC_END_MESSAGE_MAP()
149 } 149 }
150 150
151 void CompositorOutputSurface::OnUpdateVSyncParametersFromBrowser( 151 void CompositorOutputSurface::OnUpdateVSyncParametersFromBrowser(
152 base::TimeTicks timebase, 152 base::TimeTicks timebase,
153 base::TimeDelta interval) { 153 base::TimeDelta interval) {
154 DCHECK(CalledOnValidThread()); 154 DCHECK(CalledOnValidThread());
155 CommitVSyncParameters(timebase, interval); 155 CommitVSyncParameters(timebase, interval);
156 } 156 }
157 157
158 #if defined(OS_ANDROID) 158 #if defined(OS_ANDROID)
159 void CompositorOutputSurface::SetNeedsBeginImplFrame(bool enable) { 159 void CompositorOutputSurface::SetNeedsBeginFrame(bool enable) {
160 DCHECK(CalledOnValidThread()); 160 DCHECK(CalledOnValidThread());
161 if (needs_begin_impl_frame_ != enable) 161 if (needs_begin_frame_ != enable)
162 Send(new ViewHostMsg_SetNeedsBeginFrame(routing_id_, enable)); 162 Send(new ViewHostMsg_SetNeedsBeginFrame(routing_id_, enable));
163 OutputSurface::SetNeedsBeginImplFrame(enable); 163 OutputSurface::SetNeedsBeginFrame(enable);
164 } 164 }
165 165
166 void CompositorOutputSurface::OnBeginImplFrame(const cc::BeginFrameArgs& args) { 166 void CompositorOutputSurface::OnBeginFrame(const cc::BeginFrameArgs& args) {
167 DCHECK(CalledOnValidThread()); 167 DCHECK(CalledOnValidThread());
168 BeginImplFrame(args); 168 BeginFrame(args);
169 } 169 }
170 #endif // defined(OS_ANDROID) 170 #endif // defined(OS_ANDROID)
171 171
172 void CompositorOutputSurface::OnSwapAck(uint32 output_surface_id, 172 void CompositorOutputSurface::OnSwapAck(uint32 output_surface_id,
173 const cc::CompositorFrameAck& ack) { 173 const cc::CompositorFrameAck& ack) {
174 // Ignore message if it's a stale one coming from a different output surface 174 // Ignore message if it's a stale one coming from a different output surface
175 // (e.g. after a lost context). 175 // (e.g. after a lost context).
176 if (output_surface_id != output_surface_id_) 176 if (output_surface_id != output_surface_id_)
177 return; 177 return;
178 ReclaimResources(&ack); 178 ReclaimResources(&ack);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 // If this is the last surface to stop preferring smoothness, 228 // If this is the last surface to stop preferring smoothness,
229 // Reset the main thread's priority to the default. 229 // Reset the main thread's priority to the default.
230 if (prefers_smoothness_ == true && 230 if (prefers_smoothness_ == true &&
231 --g_prefer_smoothness_count == 0) { 231 --g_prefer_smoothness_count == 0) {
232 SetThreadPriorityToDefault(main_thread_handle_); 232 SetThreadPriorityToDefault(main_thread_handle_);
233 } 233 }
234 prefers_smoothness_ = prefers_smoothness; 234 prefers_smoothness_ = prefers_smoothness;
235 } 235 }
236 236
237 } // namespace content 237 } // namespace content
OLDNEW
« cc/trees/layer_tree_host_impl.cc ('K') | « content/renderer/gpu/compositor_output_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698