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

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

Issue 619843002: cc: Make separate interface for BeginFrame ipc from OutputSurface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 19 matching lines...) Expand all
30 30
31 namespace content { 31 namespace content {
32 32
33 //------------------------------------------------------------------------------ 33 //------------------------------------------------------------------------------
34 34
35 // static 35 // static
36 IPC::ForwardingMessageFilter* CompositorOutputSurface::CreateFilter( 36 IPC::ForwardingMessageFilter* CompositorOutputSurface::CreateFilter(
37 base::TaskRunner* target_task_runner) 37 base::TaskRunner* target_task_runner)
38 { 38 {
39 uint32 messages_to_filter[] = { 39 uint32 messages_to_filter[] = {
40 ViewMsg_UpdateVSyncParameters::ID, 40 ViewMsg_UpdateVSyncParameters::ID,
Sami 2014/10/10 13:32:33 Do we still need this message in this new world?
mithro-old 2014/10/13 02:56:20 /Eventually/ we can remove this UpdateVSyncParamet
simonhong 2014/10/15 01:04:22 Yes, we should maintain this message in a short te
41 ViewMsg_SwapCompositorFrameAck::ID, 41 ViewMsg_SwapCompositorFrameAck::ID,
42 ViewMsg_ReclaimCompositorResources::ID, 42 ViewMsg_ReclaimCompositorResources::ID
43 #if defined(OS_ANDROID)
44 ViewMsg_BeginFrame::ID
45 #endif
46 }; 43 };
47 44
48 return new IPC::ForwardingMessageFilter( 45 return new IPC::ForwardingMessageFilter(
49 messages_to_filter, arraysize(messages_to_filter), 46 messages_to_filter, arraysize(messages_to_filter),
50 target_task_runner); 47 target_task_runner);
51 } 48 }
52 49
53 CompositorOutputSurface::CompositorOutputSurface( 50 CompositorOutputSurface::CompositorOutputSurface(
54 int32 routing_id, 51 int32 routing_id,
55 uint32 output_surface_id, 52 uint32 output_surface_id,
(...skipping 21 matching lines...) Expand all
77 DCHECK(frame_swap_message_queue_.get()); 74 DCHECK(frame_swap_message_queue_.get());
78 DetachFromThread(); 75 DetachFromThread();
79 message_sender_ = RenderThreadImpl::current()->sync_message_filter(); 76 message_sender_ = RenderThreadImpl::current()->sync_message_filter();
80 DCHECK(message_sender_.get()); 77 DCHECK(message_sender_.get());
81 if (OutputSurface::software_device()) 78 if (OutputSurface::software_device())
82 capabilities_.max_frames_pending = 1; 79 capabilities_.max_frames_pending = 1;
83 } 80 }
84 81
85 CompositorOutputSurface::~CompositorOutputSurface() { 82 CompositorOutputSurface::~CompositorOutputSurface() {
86 DCHECK(CalledOnValidThread()); 83 DCHECK(CalledOnValidThread());
87 SetNeedsBeginFrame(false);
88 if (!HasClient()) 84 if (!HasClient())
89 return; 85 return;
90 UpdateSmoothnessTakesPriority(false); 86 UpdateSmoothnessTakesPriority(false);
91 if (output_surface_proxy_.get()) 87 if (output_surface_proxy_.get())
92 output_surface_proxy_->ClearOutputSurface(); 88 output_surface_proxy_->ClearOutputSurface();
93 output_surface_filter_->RemoveRoute(routing_id_); 89 output_surface_filter_->RemoveRoute(routing_id_);
94 } 90 }
95 91
96 bool CompositorOutputSurface::BindToClient( 92 bool CompositorOutputSurface::BindToClient(
97 cc::OutputSurfaceClient* client) { 93 cc::OutputSurfaceClient* client) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 182
187 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { 183 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) {
188 DCHECK(CalledOnValidThread()); 184 DCHECK(CalledOnValidThread());
189 if (!HasClient()) 185 if (!HasClient())
190 return; 186 return;
191 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) 187 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message)
192 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, 188 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters,
193 OnUpdateVSyncParametersFromBrowser); 189 OnUpdateVSyncParametersFromBrowser);
194 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck); 190 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck);
195 IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources, OnReclaimResources); 191 IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources, OnReclaimResources);
196 #if defined(OS_ANDROID)
197 IPC_MESSAGE_HANDLER(ViewMsg_BeginFrame, OnBeginFrame);
198 #endif
199 IPC_END_MESSAGE_MAP() 192 IPC_END_MESSAGE_MAP()
200 } 193 }
201 194
202 void CompositorOutputSurface::OnUpdateVSyncParametersFromBrowser( 195 void CompositorOutputSurface::OnUpdateVSyncParametersFromBrowser(
203 base::TimeTicks timebase, 196 base::TimeTicks timebase,
204 base::TimeDelta interval) { 197 base::TimeDelta interval) {
205 DCHECK(CalledOnValidThread()); 198 DCHECK(CalledOnValidThread());
206 CommitVSyncParameters(timebase, interval); 199 CommitVSyncParameters(timebase, interval);
207 } 200 }
208 201
209 #if defined(OS_ANDROID)
210 void CompositorOutputSurface::SetNeedsBeginFrame(bool enable) {
211 DCHECK(CalledOnValidThread());
212 Send(new ViewHostMsg_SetNeedsBeginFrame(routing_id_, enable));
213 }
214
215 void CompositorOutputSurface::OnBeginFrame(const cc::BeginFrameArgs& args) {
216 DCHECK(CalledOnValidThread());
217 client_->BeginFrame(args);
218 }
219 #endif // defined(OS_ANDROID)
220
221 void CompositorOutputSurface::OnSwapAck(uint32 output_surface_id, 202 void CompositorOutputSurface::OnSwapAck(uint32 output_surface_id,
222 const cc::CompositorFrameAck& ack) { 203 const cc::CompositorFrameAck& ack) {
223 // Ignore message if it's a stale one coming from a different output surface 204 // Ignore message if it's a stale one coming from a different output surface
224 // (e.g. after a lost context). 205 // (e.g. after a lost context).
225 if (output_surface_id != output_surface_id_) 206 if (output_surface_id != output_surface_id_)
226 return; 207 return;
227 ReclaimResources(&ack); 208 ReclaimResources(&ack);
228 client_->DidSwapBuffersComplete(); 209 client_->DidSwapBuffersComplete();
229 } 210 }
230 211
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // If this is the last surface to stop preferring smoothness, 258 // If this is the last surface to stop preferring smoothness,
278 // Reset the main thread's priority to the default. 259 // Reset the main thread's priority to the default.
279 if (prefers_smoothness_ == true && 260 if (prefers_smoothness_ == true &&
280 --g_prefer_smoothness_count == 0) { 261 --g_prefer_smoothness_count == 0) {
281 SetThreadPriorityToDefault(main_thread_handle_); 262 SetThreadPriorityToDefault(main_thread_handle_);
282 } 263 }
283 prefers_smoothness_ = prefers_smoothness; 264 prefers_smoothness_ = prefers_smoothness;
284 } 265 }
285 266
286 } // namespace content 267 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698