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_proxy.h" | 8 #include "base/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 25 matching lines...) Expand all Loading... |
36 //------------------------------------------------------------------------------ | 36 //------------------------------------------------------------------------------ |
37 | 37 |
38 // static | 38 // static |
39 IPC::ForwardingMessageFilter* CompositorOutputSurface::CreateFilter( | 39 IPC::ForwardingMessageFilter* CompositorOutputSurface::CreateFilter( |
40 base::TaskRunner* target_task_runner) | 40 base::TaskRunner* target_task_runner) |
41 { | 41 { |
42 uint32 messages_to_filter[] = { | 42 uint32 messages_to_filter[] = { |
43 ViewMsg_UpdateVSyncParameters::ID, | 43 ViewMsg_UpdateVSyncParameters::ID, |
44 ViewMsg_SwapCompositorFrameAck::ID, | 44 ViewMsg_SwapCompositorFrameAck::ID, |
45 #if defined(OS_ANDROID) | 45 #if defined(OS_ANDROID) |
46 ViewMsg_DidVSync::ID | 46 ViewMsg_BeginFrame::ID |
47 #endif | 47 #endif |
48 }; | 48 }; |
49 | 49 |
50 return new IPC::ForwardingMessageFilter( | 50 return new IPC::ForwardingMessageFilter( |
51 messages_to_filter, arraysize(messages_to_filter), | 51 messages_to_filter, arraysize(messages_to_filter), |
52 target_task_runner); | 52 target_task_runner); |
53 } | 53 } |
54 | 54 |
55 CompositorOutputSurface::CompositorOutputSurface( | 55 CompositorOutputSurface::CompositorOutputSurface( |
56 int32 routing_id, | 56 int32 routing_id, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 129 } |
130 | 130 |
131 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { | 131 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { |
132 DCHECK(CalledOnValidThread()); | 132 DCHECK(CalledOnValidThread()); |
133 if (!client_) | 133 if (!client_) |
134 return; | 134 return; |
135 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) | 135 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) |
136 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters); | 136 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters); |
137 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck); | 137 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck); |
138 #if defined(OS_ANDROID) | 138 #if defined(OS_ANDROID) |
139 IPC_MESSAGE_HANDLER(ViewMsg_DidVSync, OnDidVSync); | 139 IPC_MESSAGE_HANDLER(ViewMsg_BeginFrame, OnBeginFrame); |
140 #endif | 140 #endif |
141 IPC_END_MESSAGE_MAP() | 141 IPC_END_MESSAGE_MAP() |
142 } | 142 } |
143 | 143 |
144 void CompositorOutputSurface::OnUpdateVSyncParameters( | 144 void CompositorOutputSurface::OnUpdateVSyncParameters( |
145 base::TimeTicks timebase, base::TimeDelta interval) { | 145 base::TimeTicks timebase, base::TimeDelta interval) { |
146 DCHECK(CalledOnValidThread()); | 146 DCHECK(CalledOnValidThread()); |
147 client_->OnVSyncParametersChanged(timebase, interval); | 147 client_->OnVSyncParametersChanged(timebase, interval); |
148 } | 148 } |
149 | 149 |
150 #if defined(OS_ANDROID) | 150 #if defined(OS_ANDROID) |
151 void CompositorOutputSurface::EnableVSyncNotification(bool enable) { | 151 void CompositorOutputSurface::SetNeedsBeginFrame(bool enable) { |
152 DCHECK(CalledOnValidThread()); | 152 DCHECK(CalledOnValidThread()); |
153 Send(new ViewHostMsg_SetVSyncNotificationEnabled(routing_id_, enable)); | 153 Send(new ViewHostMsg_SetNeedsBeginFrame(routing_id_, enable)); |
154 } | 154 } |
155 | 155 |
156 void CompositorOutputSurface::OnDidVSync(base::TimeTicks frame_time) { | 156 void CompositorOutputSurface::OnBeginFrame(base::TimeTicks frame_time) { |
157 DCHECK(CalledOnValidThread()); | 157 DCHECK(CalledOnValidThread()); |
158 client_->DidVSync(frame_time); | 158 client_->BeginFrame(frame_time); |
159 } | 159 } |
160 #endif // defined(OS_ANDROID) | 160 #endif // defined(OS_ANDROID) |
161 | 161 |
162 void CompositorOutputSurface::OnSwapAck(const cc::CompositorFrameAck& ack) { | 162 void CompositorOutputSurface::OnSwapAck(const cc::CompositorFrameAck& ack) { |
163 client_->OnSendFrameToParentCompositorAck(ack); | 163 client_->OnSendFrameToParentCompositorAck(ack); |
164 } | 164 } |
165 | 165 |
166 bool CompositorOutputSurface::Send(IPC::Message* message) { | 166 bool CompositorOutputSurface::Send(IPC::Message* message) { |
167 return message_sender_->Send(message); | 167 return message_sender_->Send(message); |
168 } | 168 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // If this is the last surface to stop preferring smoothness, | 203 // If this is the last surface to stop preferring smoothness, |
204 // Reset the main thread's priority to the default. | 204 // Reset the main thread's priority to the default. |
205 if (prefers_smoothness_ == true && | 205 if (prefers_smoothness_ == true && |
206 --g_prefer_smoothness_count == 0) { | 206 --g_prefer_smoothness_count == 0) { |
207 SetThreadsPriorityToDefault(main_thread_id_); | 207 SetThreadsPriorityToDefault(main_thread_id_); |
208 } | 208 } |
209 prefers_smoothness_ = prefers_smoothness; | 209 prefers_smoothness_ = prefers_smoothness; |
210 } | 210 } |
211 | 211 |
212 } // namespace content | 212 } // namespace content |
OLD | NEW |