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

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: cleanup 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/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 OnAcceleratedSurfacePostSubBuffer) 192 OnAcceleratedSurfacePostSubBuffer)
193 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSuspend, 193 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSuspend,
194 OnAcceleratedSurfaceSuspend) 194 OnAcceleratedSurfaceSuspend)
195 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected, 195 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected,
196 OnGraphicsInfoCollected) 196 OnGraphicsInfoCollected)
197 197
198 #if defined(TOOLKIT_USES_GTK) || defined(OS_WIN) 198 #if defined(TOOLKIT_USES_GTK) || defined(OS_WIN)
199 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView) 199 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView)
200 #endif 200 #endif
201 201
202 #if defined(OS_MACOSX) || defined(USE_AURA) 202 #if defined(USE_AURA)
203 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew, 203 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew,
204 OnAcceleratedSurfaceNew) 204 OnAcceleratedSurfaceNew)
205 #endif 205 #endif
206 206
207 #if defined(USE_AURA) 207 #if defined(USE_AURA)
208 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease, 208 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease,
209 OnAcceleratedSurfaceRelease) 209 OnAcceleratedSurfaceRelease)
210 #endif 210 #endif
211 211
212 IPC_MESSAGE_UNHANDLED_ERROR() 212 IPC_MESSAGE_UNHANDLED_ERROR()
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 0, 0, 273 0, 0,
274 std::max(1, size.width()), 274 std::max(1, size.width()),
275 std::max(1, size.height()), 275 std::max(1, size.height()),
276 SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER | 276 SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER |
277 SWP_NOACTIVATE | SWP_DEFERERASE); 277 SWP_NOACTIVATE | SWP_DEFERERASE);
278 #endif 278 #endif
279 } 279 }
280 280
281 #endif 281 #endif
282 282
283 #if defined(OS_MACOSX) || defined(USE_AURA) 283 #if defined(USE_AURA)
284 284
285 void GpuProcessHostUIShim::OnAcceleratedSurfaceNew( 285 void GpuProcessHostUIShim::OnAcceleratedSurfaceNew(
286 const GpuHostMsg_AcceleratedSurfaceNew_Params& params) { 286 const GpuHostMsg_AcceleratedSurfaceNew_Params& params) {
287 ScopedSendOnIOThread delayed_send( 287 ScopedSendOnIOThread delayed_send(
288 host_id_, 288 host_id_,
289 new AcceleratedSurfaceMsg_NewACK( 289 new AcceleratedSurfaceMsg_NewACK(
290 params.route_id, 290 params.route_id,
291 params.surface_handle, 291 params.surface_handle,
292 TransportDIB::DefaultHandleValue())); 292 TransportDIB::DefaultHandleValue()));
293 293
294 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( 294 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID(
295 params.surface_id); 295 params.surface_id);
296 if (!view) 296 if (!view)
297 return; 297 return;
298 298
299 uint64 surface_handle = params.surface_handle; 299 uint64 surface_handle = params.surface_handle;
300 TransportDIB::Handle shm_handle = TransportDIB::DefaultHandleValue(); 300 TransportDIB::Handle shm_handle = TransportDIB::DefaultHandleValue();
301 301
302 #if defined(OS_MACOSX)
303 if (params.create_transport_dib) {
304 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory());
305 if (shared_memory->CreateAnonymous(params.width * params.height * 4)) {
306 // Create a local handle for RWHVMac to map the SHM.
307 TransportDIB::Handle local_handle;
308 if (!shared_memory->ShareToProcess(0 /* pid, not needed */,
309 &local_handle)) {
310 return;
311 } else {
312 view->AcceleratedSurfaceSetTransportDIB(params.window,
313 params.width,
314 params.height,
315 local_handle);
316 // Create a remote handle for the GPU process to map the SHM.
317 if (!shared_memory->ShareToProcess(0 /* pid, not needed */,
318 &shm_handle)) {
319 return;
320 }
321 }
322 }
323 } else {
324 view->AcceleratedSurfaceSetIOSurface(params.window,
325 params.width,
326 params.height,
327 surface_handle);
328 }
329 #else // defined(USE_AURA)
330 view->AcceleratedSurfaceNew( 302 view->AcceleratedSurfaceNew(
331 params.width, params.height, &surface_handle, &shm_handle); 303 params.width, params.height, &surface_handle, &shm_handle);
332 #endif
333 delayed_send.Cancel(); 304 delayed_send.Cancel();
334 Send(new AcceleratedSurfaceMsg_NewACK( 305 Send(new AcceleratedSurfaceMsg_NewACK(
335 params.route_id, surface_handle, shm_handle)); 306 params.route_id, surface_handle, shm_handle));
336 } 307 }
337 308
338 #endif 309 #endif
339 310
340 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( 311 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped(
341 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { 312 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
342 TRACE_EVENT0("renderer", 313 TRACE_EVENT0("renderer",
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease( 365 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease(
395 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) { 366 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) {
396 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( 367 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID(
397 params.surface_id); 368 params.surface_id);
398 if (!view) 369 if (!view)
399 return; 370 return;
400 view->AcceleratedSurfaceRelease(params.identifier); 371 view->AcceleratedSurfaceRelease(params.identifier);
401 } 372 }
402 373
403 #endif 374 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698