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

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

Issue 13068002: Send vsync notification from browser to renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move ifdef'd messages to the end. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/gpu/compositor_output_surface.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 24 matching lines...) Expand all
35 namespace content { 35 namespace content {
36 36
37 //------------------------------------------------------------------------------ 37 //------------------------------------------------------------------------------
38 38
39 // static 39 // static
40 IPC::ForwardingMessageFilter* CompositorOutputSurface::CreateFilter( 40 IPC::ForwardingMessageFilter* CompositorOutputSurface::CreateFilter(
41 base::TaskRunner* target_task_runner) 41 base::TaskRunner* target_task_runner)
42 { 42 {
43 uint32 messages_to_filter[] = { 43 uint32 messages_to_filter[] = {
44 ViewMsg_UpdateVSyncParameters::ID, 44 ViewMsg_UpdateVSyncParameters::ID,
45 ViewMsg_SwapCompositorFrameAck::ID 45 ViewMsg_SwapCompositorFrameAck::ID,
46 #if defined(OS_ANDROID)
47 ViewMsg_DidVSync::ID
48 #endif
46 }; 49 };
47 50
48 return new IPC::ForwardingMessageFilter( 51 return new IPC::ForwardingMessageFilter(
49 messages_to_filter, arraysize(messages_to_filter), 52 messages_to_filter, arraysize(messages_to_filter),
50 target_task_runner); 53 target_task_runner);
51 } 54 }
52 55
53 CompositorOutputSurface::CompositorOutputSurface( 56 CompositorOutputSurface::CompositorOutputSurface(
54 int32 routing_id, 57 int32 routing_id,
55 WebGraphicsContext3DCommandBufferImpl* context3D, 58 WebGraphicsContext3DCommandBufferImpl* context3D,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 OutputSurface::PostSubBuffer(rect, latency_info); 127 OutputSurface::PostSubBuffer(rect, latency_info);
125 } 128 }
126 129
127 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { 130 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) {
128 DCHECK(CalledOnValidThread()); 131 DCHECK(CalledOnValidThread());
129 if (!client_) 132 if (!client_)
130 return; 133 return;
131 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) 134 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message)
132 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters); 135 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters);
133 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck); 136 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck);
137 #if defined(OS_ANDROID)
138 IPC_MESSAGE_HANDLER(ViewMsg_DidVSync, OnDidVSync);
139 #endif
134 IPC_END_MESSAGE_MAP() 140 IPC_END_MESSAGE_MAP()
135 } 141 }
136 142
137 void CompositorOutputSurface::OnUpdateVSyncParameters( 143 void CompositorOutputSurface::OnUpdateVSyncParameters(
138 base::TimeTicks timebase, base::TimeDelta interval) { 144 base::TimeTicks timebase, base::TimeDelta interval) {
139 DCHECK(CalledOnValidThread()); 145 DCHECK(CalledOnValidThread());
140 DCHECK(client_);
141 client_->OnVSyncParametersChanged(timebase, interval); 146 client_->OnVSyncParametersChanged(timebase, interval);
142 } 147 }
143 148
149 #if defined(OS_ANDROID)
150 void CompositorOutputSurface::EnableVSyncNotification(bool enable) {
151 DCHECK(CalledOnValidThread());
152 Send(new ViewHostMsg_SetVSyncNotificationEnabled(routing_id_, enable));
153 }
154
155 void CompositorOutputSurface::OnDidVSync(base::TimeTicks frame_time) {
156 DCHECK(CalledOnValidThread());
157 client_->DidVSync(frame_time);
158 }
159 #endif // defined(OS_ANDROID)
160
144 void CompositorOutputSurface::OnSwapAck(const cc::CompositorFrameAck& ack) { 161 void CompositorOutputSurface::OnSwapAck(const cc::CompositorFrameAck& ack) {
145 client_->OnSendFrameToParentCompositorAck(ack); 162 client_->OnSendFrameToParentCompositorAck(ack);
146 } 163 }
147 164
148 bool CompositorOutputSurface::Send(IPC::Message* message) { 165 bool CompositorOutputSurface::Send(IPC::Message* message) {
149 return ChildThread::current()->sync_message_filter()->Send(message); 166 return ChildThread::current()->sync_message_filter()->Send(message);
150 } 167 }
151 168
152 namespace { 169 namespace {
153 #if defined(OS_ANDROID) 170 #if defined(OS_ANDROID)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // If this is the last surface to stop preferring smoothness, 202 // If this is the last surface to stop preferring smoothness,
186 // Reset the main thread's priority to the default. 203 // Reset the main thread's priority to the default.
187 if (prefers_smoothness_ == true && 204 if (prefers_smoothness_ == true &&
188 --g_prefer_smoothness_count == 0) { 205 --g_prefer_smoothness_count == 0) {
189 SetThreadsPriorityToDefault(main_thread_id_); 206 SetThreadsPriorityToDefault(main_thread_id_);
190 } 207 }
191 prefers_smoothness_ = prefers_smoothness; 208 prefers_smoothness_ = prefers_smoothness;
192 } 209 }
193 210
194 } // namespace content 211 } // namespace content
OLDNEW
« no previous file with comments | « 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