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

Side by Side Diff: content/browser/gpu/gpu_process_host_ui_shim.cc

Issue 8241012: Enable accelerated WebKit compositor for Aura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address reviewer comments. Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser/gpu/gpu_process_host_ui_shim.h" 5 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/id_map.h" 9 #include "base/id_map.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 bool GpuProcessHostUIShim::OnMessageReceived(const IPC::Message& message) { 139 bool GpuProcessHostUIShim::OnMessageReceived(const IPC::Message& message) {
140 DCHECK(CalledOnValidThread()); 140 DCHECK(CalledOnValidThread());
141 141
142 if (message.routing_id() != MSG_ROUTING_CONTROL) 142 if (message.routing_id() != MSG_ROUTING_CONTROL)
143 return false; 143 return false;
144 144
145 return OnControlMessageReceived(message); 145 return OnControlMessageReceived(message);
146 } 146 }
147 147
148 #if defined(OS_MACOSX) || defined(TOUCH_UI) 148 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
149 149
150 void GpuProcessHostUIShim::SendToGpuHost(int host_id, IPC::Message* msg) { 150 void GpuProcessHostUIShim::SendToGpuHost(int host_id, IPC::Message* msg) {
151 GpuProcessHostUIShim* ui_shim = FromID(host_id); 151 GpuProcessHostUIShim* ui_shim = FromID(host_id);
152 if (!ui_shim) { 152 if (!ui_shim) {
153 delete msg; 153 delete msg;
154 return; 154 return;
155 } 155 }
156 156
157 ui_shim->Send(msg); 157 ui_shim->Send(msg);
158 } 158 }
159 159
160 #endif 160 #endif
161 161
162 GpuProcessHostUIShim::~GpuProcessHostUIShim() { 162 GpuProcessHostUIShim::~GpuProcessHostUIShim() {
163 DCHECK(CalledOnValidThread()); 163 DCHECK(CalledOnValidThread());
164 g_hosts_by_id.Pointer()->Remove(host_id_); 164 g_hosts_by_id.Pointer()->Remove(host_id_);
165 } 165 }
166 166
167 bool GpuProcessHostUIShim::OnControlMessageReceived( 167 bool GpuProcessHostUIShim::OnControlMessageReceived(
168 const IPC::Message& message) { 168 const IPC::Message& message) {
169 DCHECK(CalledOnValidThread()); 169 DCHECK(CalledOnValidThread());
170 170
171 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message) 171 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message)
172 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage, 172 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage,
173 OnLogMessage) 173 OnLogMessage)
174 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN) 174 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN)
175 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView) 175 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView)
176 #endif 176 #endif
177 177
178 #if defined(OS_MACOSX) || defined(TOUCH_UI) 178 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
179 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, 179 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
180 OnAcceleratedSurfaceBuffersSwapped) 180 OnAcceleratedSurfaceBuffersSwapped)
181 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew, 181 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew,
182 OnAcceleratedSurfaceNew) 182 OnAcceleratedSurfaceNew)
183 #endif 183 #endif
184 184
185 #if defined(TOUCH_UI) 185 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
186 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease, 186 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease,
187 OnAcceleratedSurfaceRelease) 187 OnAcceleratedSurfaceRelease)
188 #endif 188 #endif
189 IPC_MESSAGE_UNHANDLED_ERROR() 189 IPC_MESSAGE_UNHANDLED_ERROR()
190 IPC_END_MESSAGE_MAP() 190 IPC_END_MESSAGE_MAP()
191 191
192 return true; 192 return true;
193 } 193 }
194 194
195 void GpuProcessHostUIShim::OnLogMessage( 195 void GpuProcessHostUIShim::OnLogMessage(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 0, 0, 246 0, 0,
247 std::max(1, size.width()), 247 std::max(1, size.width()),
248 std::max(1, size.height()), 248 std::max(1, size.height()),
249 SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER | 249 SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER |
250 SWP_NOACTIVATE | SWP_DEFERERASE); 250 SWP_NOACTIVATE | SWP_DEFERERASE);
251 #endif 251 #endif
252 } 252 }
253 253
254 #endif 254 #endif
255 255
256 #if defined(OS_MACOSX) || defined(TOUCH_UI) 256 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
257 257
258 void GpuProcessHostUIShim::OnAcceleratedSurfaceNew( 258 void GpuProcessHostUIShim::OnAcceleratedSurfaceNew(
259 const GpuHostMsg_AcceleratedSurfaceNew_Params& params) { 259 const GpuHostMsg_AcceleratedSurfaceNew_Params& params) {
260 ScopedSendOnIOThread delayed_send( 260 ScopedSendOnIOThread delayed_send(
261 host_id_, 261 host_id_,
262 new AcceleratedSurfaceMsg_NewACK( 262 new AcceleratedSurfaceMsg_NewACK(
263 params.route_id, 263 params.route_id,
264 params.surface_id, 264 params.surface_id,
265 TransportDIB::DefaultHandleValue())); 265 TransportDIB::DefaultHandleValue()));
266 266
(...skipping 29 matching lines...) Expand all
296 return; 296 return;
297 } 297 }
298 } 298 }
299 } 299 }
300 } else { 300 } else {
301 view->AcceleratedSurfaceSetIOSurface(params.window, 301 view->AcceleratedSurfaceSetIOSurface(params.window,
302 params.width, 302 params.width,
303 params.height, 303 params.height,
304 surface_id); 304 surface_id);
305 } 305 }
306 #elif defined(TOUCH_UI) 306 #else // defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
307 view->AcceleratedSurfaceNew( 307 view->AcceleratedSurfaceNew(
308 params.width, params.height, &surface_id, &surface_handle); 308 params.width, params.height, &surface_id, &surface_handle);
309 #endif 309 #endif
310 delayed_send.Cancel(); 310 delayed_send.Cancel();
311 Send(new AcceleratedSurfaceMsg_NewACK( 311 Send(new AcceleratedSurfaceMsg_NewACK(
312 params.route_id, surface_id, surface_handle)); 312 params.route_id, surface_id, surface_handle));
313 } 313 }
314 314
315 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( 315 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped(
316 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { 316 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
(...skipping 17 matching lines...) Expand all
334 334
335 #if defined (OS_MACOSX) 335 #if defined (OS_MACOSX)
336 view->AcceleratedSurfaceBuffersSwapped( 336 view->AcceleratedSurfaceBuffersSwapped(
337 // Parameters needed to swap the IOSurface. 337 // Parameters needed to swap the IOSurface.
338 params.window, 338 params.window,
339 params.surface_id, 339 params.surface_id,
340 // Parameters needed to formulate an acknowledgment. 340 // Parameters needed to formulate an acknowledgment.
341 params.renderer_id, 341 params.renderer_id,
342 params.route_id, 342 params.route_id,
343 host_id_); 343 host_id_);
344 #elif defined(TOUCH_UI) 344 #else // defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
345 // view must send ACK message after next composite 345 // view must send ACK message after next composite
346 view->AcceleratedSurfaceBuffersSwapped( 346 view->AcceleratedSurfaceBuffersSwapped(
347 params.surface_id, params.route_id, host_id_); 347 params.surface_id, params.route_id, host_id_);
348 #endif 348 #endif
349 } 349 }
350 350
351 #endif 351 #endif
352 352
353 #if defined(TOUCH_UI) 353 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
354 354
355 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease( 355 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease(
356 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) { 356 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) {
357 RenderViewHost* host = RenderViewHost::FromID(params.renderer_id, 357 RenderViewHost* host = RenderViewHost::FromID(params.renderer_id,
358 params.render_view_id); 358 params.render_view_id);
359 if (!host) 359 if (!host)
360 return; 360 return;
361 RenderWidgetHostView* view = host->view(); 361 RenderWidgetHostView* view = host->view();
362 if (!view) 362 if (!view)
363 return; 363 return;
364 view->AcceleratedSurfaceRelease(params.identifier); 364 view->AcceleratedSurfaceRelease(params.identifier);
365 } 365 }
366 366
367 #endif 367 #endif
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host_ui_shim.h ('k') | content/browser/renderer_host/render_widget_host_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698