OLD | NEW |
---|---|
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 } | 131 } |
132 | 132 |
133 OutputSurface::SwapBuffers(frame); | 133 OutputSurface::SwapBuffers(frame); |
134 } | 134 } |
135 | 135 |
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, OnUpdateVSyncParameters); | 141 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, |
142 OnUpdateVSyncParametersFromView); | |
piman
2014/02/04 04:51:01
nit: gratuitous rename? Not sure which "FromView"
sheu
2014/02/04 22:01:45
A little bit convoluted. See comment in BrowserCo
piman
2014/02/04 22:52:54
Note: BrowserCompositorOutputSurface doesn't deriv
| |
142 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck); | 143 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck); |
143 IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources, OnReclaimResources); | 144 IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources, OnReclaimResources); |
144 #if defined(OS_ANDROID) | 145 #if defined(OS_ANDROID) |
145 IPC_MESSAGE_HANDLER(ViewMsg_BeginFrame, OnBeginImplFrame); | 146 IPC_MESSAGE_HANDLER(ViewMsg_BeginFrame, OnBeginImplFrame); |
146 #endif | 147 #endif |
147 IPC_END_MESSAGE_MAP() | 148 IPC_END_MESSAGE_MAP() |
148 } | 149 } |
149 | 150 |
150 void CompositorOutputSurface::OnUpdateVSyncParameters( | 151 void CompositorOutputSurface::OnUpdateVSyncParametersFromView( |
151 base::TimeTicks timebase, base::TimeDelta interval) { | 152 base::TimeTicks timebase, base::TimeDelta interval) { |
152 DCHECK(CalledOnValidThread()); | 153 DCHECK(CalledOnValidThread()); |
153 OnVSyncParametersChanged(timebase, interval); | 154 CommitVSyncParameters(timebase, interval); |
154 } | 155 } |
155 | 156 |
156 #if defined(OS_ANDROID) | 157 #if defined(OS_ANDROID) |
157 void CompositorOutputSurface::SetNeedsBeginImplFrame(bool enable) { | 158 void CompositorOutputSurface::SetNeedsBeginImplFrame(bool enable) { |
158 DCHECK(CalledOnValidThread()); | 159 DCHECK(CalledOnValidThread()); |
159 if (needs_begin_impl_frame_ != enable) | 160 if (needs_begin_impl_frame_ != enable) |
160 Send(new ViewHostMsg_SetNeedsBeginFrame(routing_id_, enable)); | 161 Send(new ViewHostMsg_SetNeedsBeginFrame(routing_id_, enable)); |
161 OutputSurface::SetNeedsBeginImplFrame(enable); | 162 OutputSurface::SetNeedsBeginImplFrame(enable); |
162 } | 163 } |
163 | 164 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 // If this is the last surface to stop preferring smoothness, | 227 // If this is the last surface to stop preferring smoothness, |
227 // Reset the main thread's priority to the default. | 228 // Reset the main thread's priority to the default. |
228 if (prefers_smoothness_ == true && | 229 if (prefers_smoothness_ == true && |
229 --g_prefer_smoothness_count == 0) { | 230 --g_prefer_smoothness_count == 0) { |
230 SetThreadPriorityToDefault(main_thread_handle_); | 231 SetThreadPriorityToDefault(main_thread_handle_); |
231 } | 232 } |
232 prefers_smoothness_ = prefers_smoothness; | 233 prefers_smoothness_ = prefers_smoothness; |
233 } | 234 } |
234 | 235 |
235 } // namespace content | 236 } // namespace content |
OLD | NEW |