| 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/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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 SWP_NOACTIVATE | SWP_DEFERERASE); | 286 SWP_NOACTIVATE | SWP_DEFERERASE); |
| 287 #endif | 287 #endif |
| 288 } | 288 } |
| 289 | 289 |
| 290 #endif | 290 #endif |
| 291 | 291 |
| 292 #if defined(USE_AURA) | 292 #if defined(USE_AURA) |
| 293 | 293 |
| 294 void GpuProcessHostUIShim::OnAcceleratedSurfaceNew( | 294 void GpuProcessHostUIShim::OnAcceleratedSurfaceNew( |
| 295 const GpuHostMsg_AcceleratedSurfaceNew_Params& params) { | 295 const GpuHostMsg_AcceleratedSurfaceNew_Params& params) { |
| 296 ScopedSendOnIOThread delayed_send( | |
| 297 host_id_, | |
| 298 new AcceleratedSurfaceMsg_NewACK( | |
| 299 params.route_id, | |
| 300 params.surface_handle, | |
| 301 TransportDIB::DefaultHandleValue())); | |
| 302 | |
| 303 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( | 296 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( |
| 304 params.surface_id); | 297 params.surface_id); |
| 305 if (!view) | 298 if (!view) |
| 306 return; | 299 return; |
| 307 | |
| 308 uint64 surface_handle = params.surface_handle; | |
| 309 TransportDIB::Handle shm_handle = TransportDIB::DefaultHandleValue(); | |
| 310 | |
| 311 view->AcceleratedSurfaceNew( | 300 view->AcceleratedSurfaceNew( |
| 312 params.width, params.height, &surface_handle, &shm_handle); | 301 params.width, params.height, params.surface_handle); |
| 313 delayed_send.Cancel(); | |
| 314 Send(new AcceleratedSurfaceMsg_NewACK( | |
| 315 params.route_id, surface_handle, shm_handle)); | |
| 316 } | 302 } |
| 317 | 303 |
| 318 #endif | 304 #endif |
| 319 | 305 |
| 320 static base::TimeDelta GetSwapDelay() { | 306 static base::TimeDelta GetSwapDelay() { |
| 321 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 307 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 322 int delay = 0; | 308 int delay = 0; |
| 323 if (cmd_line->HasSwitch(switches::kGpuSwapDelay)) { | 309 if (cmd_line->HasSwitch(switches::kGpuSwapDelay)) { |
| 324 base::StringToInt(cmd_line->GetSwitchValueNative( | 310 base::StringToInt(cmd_line->GetSwitchValueNative( |
| 325 switches::kGpuSwapDelay).c_str(), &delay); | 311 switches::kGpuSwapDelay).c_str(), &delay); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease( | 374 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease( |
| 389 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) { | 375 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) { |
| 390 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( | 376 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( |
| 391 params.surface_id); | 377 params.surface_id); |
| 392 if (!view) | 378 if (!view) |
| 393 return; | 379 return; |
| 394 view->AcceleratedSurfaceRelease(params.identifier); | 380 view->AcceleratedSurfaceRelease(params.identifier); |
| 395 } | 381 } |
| 396 | 382 |
| 397 #endif | 383 #endif |
| OLD | NEW |