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, | 141 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters); |
142 OnUpdateVSyncParametersFromBrowser); | |
143 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck); | 142 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck); |
144 IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources, OnReclaimResources); | 143 IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources, OnReclaimResources); |
145 #if defined(OS_ANDROID) | 144 #if defined(OS_ANDROID) |
146 IPC_MESSAGE_HANDLER(ViewMsg_BeginFrame, OnBeginImplFrame); | 145 IPC_MESSAGE_HANDLER(ViewMsg_BeginFrame, OnBeginImplFrame); |
147 #endif | 146 #endif |
148 IPC_END_MESSAGE_MAP() | 147 IPC_END_MESSAGE_MAP() |
149 } | 148 } |
150 | 149 |
151 void CompositorOutputSurface::OnUpdateVSyncParametersFromBrowser( | 150 void CompositorOutputSurface::OnUpdateVSyncParameters( |
152 base::TimeTicks timebase, | 151 base::TimeTicks timebase, base::TimeDelta interval) { |
153 base::TimeDelta interval) { | |
154 DCHECK(CalledOnValidThread()); | 152 DCHECK(CalledOnValidThread()); |
155 CommitVSyncParameters(timebase, interval); | 153 OnVSyncParametersChanged(timebase, interval); |
156 } | 154 } |
157 | 155 |
158 #if defined(OS_ANDROID) | 156 #if defined(OS_ANDROID) |
159 void CompositorOutputSurface::SetNeedsBeginImplFrame(bool enable) { | 157 void CompositorOutputSurface::SetNeedsBeginImplFrame(bool enable) { |
160 DCHECK(CalledOnValidThread()); | 158 DCHECK(CalledOnValidThread()); |
161 if (needs_begin_impl_frame_ != enable) | 159 if (needs_begin_impl_frame_ != enable) |
162 Send(new ViewHostMsg_SetNeedsBeginFrame(routing_id_, enable)); | 160 Send(new ViewHostMsg_SetNeedsBeginFrame(routing_id_, enable)); |
163 OutputSurface::SetNeedsBeginImplFrame(enable); | 161 OutputSurface::SetNeedsBeginImplFrame(enable); |
164 } | 162 } |
165 | 163 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // If this is the last surface to stop preferring smoothness, | 226 // If this is the last surface to stop preferring smoothness, |
229 // Reset the main thread's priority to the default. | 227 // Reset the main thread's priority to the default. |
230 if (prefers_smoothness_ == true && | 228 if (prefers_smoothness_ == true && |
231 --g_prefer_smoothness_count == 0) { | 229 --g_prefer_smoothness_count == 0) { |
232 SetThreadPriorityToDefault(main_thread_handle_); | 230 SetThreadPriorityToDefault(main_thread_handle_); |
233 } | 231 } |
234 prefers_smoothness_ = prefers_smoothness; | 232 prefers_smoothness_ = prefers_smoothness; |
235 } | 233 } |
236 | 234 |
237 } // namespace content | 235 } // namespace content |
OLD | NEW |