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

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

Issue 9958100: Unobfuscate RWHVMac accelerated compositing code path by separating it from plugin code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: public APIs of CompositingIOSurface set context current Created 8 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
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/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/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 OnAcceleratedSurfacePostSubBuffer) 195 OnAcceleratedSurfacePostSubBuffer)
196 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSuspend, 196 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSuspend,
197 OnAcceleratedSurfaceSuspend) 197 OnAcceleratedSurfaceSuspend)
198 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected, 198 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected,
199 OnGraphicsInfoCollected) 199 OnGraphicsInfoCollected)
200 200
201 #if defined(TOOLKIT_USES_GTK) || defined(OS_WIN) 201 #if defined(TOOLKIT_USES_GTK) || defined(OS_WIN)
202 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView) 202 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView)
203 #endif 203 #endif
204 204
205 #if defined(OS_MACOSX) || defined(USE_AURA) 205 #if defined(USE_AURA)
206 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew, 206 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew,
207 OnAcceleratedSurfaceNew) 207 OnAcceleratedSurfaceNew)
208 #endif 208 #endif
209 209
210 #if defined(USE_AURA) 210 #if defined(USE_AURA)
211 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease, 211 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease,
212 OnAcceleratedSurfaceRelease) 212 OnAcceleratedSurfaceRelease)
213 #endif 213 #endif
214 214
215 IPC_MESSAGE_UNHANDLED_ERROR() 215 IPC_MESSAGE_UNHANDLED_ERROR()
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 0, 0, 276 0, 0,
277 std::max(1, size.width()), 277 std::max(1, size.width()),
278 std::max(1, size.height()), 278 std::max(1, size.height()),
279 SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER | 279 SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER |
280 SWP_NOACTIVATE | SWP_DEFERERASE); 280 SWP_NOACTIVATE | SWP_DEFERERASE);
281 #endif 281 #endif
282 } 282 }
283 283
284 #endif 284 #endif
285 285
286 #if defined(OS_MACOSX) || defined(USE_AURA) 286 #if defined(USE_AURA)
287 287
288 void GpuProcessHostUIShim::OnAcceleratedSurfaceNew( 288 void GpuProcessHostUIShim::OnAcceleratedSurfaceNew(
289 const GpuHostMsg_AcceleratedSurfaceNew_Params& params) { 289 const GpuHostMsg_AcceleratedSurfaceNew_Params& params) {
290 ScopedSendOnIOThread delayed_send( 290 ScopedSendOnIOThread delayed_send(
291 host_id_, 291 host_id_,
292 new AcceleratedSurfaceMsg_NewACK( 292 new AcceleratedSurfaceMsg_NewACK(
293 params.route_id, 293 params.route_id,
294 params.surface_handle, 294 params.surface_handle,
295 TransportDIB::DefaultHandleValue())); 295 TransportDIB::DefaultHandleValue()));
296 296
297 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( 297 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID(
298 params.surface_id); 298 params.surface_id);
299 if (!view) 299 if (!view)
300 return; 300 return;
301 301
302 uint64 surface_handle = params.surface_handle; 302 uint64 surface_handle = params.surface_handle;
303 TransportDIB::Handle shm_handle = TransportDIB::DefaultHandleValue(); 303 TransportDIB::Handle shm_handle = TransportDIB::DefaultHandleValue();
304 304
305 #if defined(OS_MACOSX)
306 if (params.create_transport_dib) {
307 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory());
308 if (shared_memory->CreateAnonymous(params.width * params.height * 4)) {
309 // Create a local handle for RWHVMac to map the SHM.
310 TransportDIB::Handle local_handle;
311 if (!shared_memory->ShareToProcess(0 /* pid, not needed */,
312 &local_handle)) {
313 return;
314 } else {
315 view->AcceleratedSurfaceSetTransportDIB(params.window,
316 params.width,
317 params.height,
318 local_handle);
319 // Create a remote handle for the GPU process to map the SHM.
320 if (!shared_memory->ShareToProcess(0 /* pid, not needed */,
321 &shm_handle)) {
322 return;
323 }
324 }
325 }
326 } else {
327 view->AcceleratedSurfaceSetIOSurface(params.window,
328 params.width,
329 params.height,
330 surface_handle);
331 }
332 #else // defined(USE_AURA)
333 view->AcceleratedSurfaceNew( 305 view->AcceleratedSurfaceNew(
334 params.width, params.height, &surface_handle, &shm_handle); 306 params.width, params.height, &surface_handle, &shm_handle);
335 #endif
336 delayed_send.Cancel(); 307 delayed_send.Cancel();
337 Send(new AcceleratedSurfaceMsg_NewACK( 308 Send(new AcceleratedSurfaceMsg_NewACK(
338 params.route_id, surface_handle, shm_handle)); 309 params.route_id, surface_handle, shm_handle));
339 } 310 }
340 311
341 #endif 312 #endif
342 313
343 static base::TimeDelta GetSwapDelay() { 314 static base::TimeDelta GetSwapDelay() {
344 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 315 CommandLine* cmd_line = CommandLine::ForCurrentProcess();
345 int delay = 0; 316 int delay = 0;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease( 382 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease(
412 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) { 383 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) {
413 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( 384 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID(
414 params.surface_id); 385 params.surface_id);
415 if (!view) 386 if (!view)
416 return; 387 return;
417 view->AcceleratedSurfaceRelease(params.identifier); 388 view->AcceleratedSurfaceRelease(params.identifier);
418 } 389 }
419 390
420 #endif 391 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698