OLD | NEW |
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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 174 |
175 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, | 175 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, |
176 OnAcceleratedSurfaceBuffersSwapped) | 176 OnAcceleratedSurfaceBuffersSwapped) |
| 177 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfacePostSubBuffer, |
| 178 OnAcceleratedSurfacePostSubBuffer) |
177 | 179 |
178 #if defined(TOOLKIT_USES_GTK) || defined(OS_WIN) | 180 #if defined(TOOLKIT_USES_GTK) || defined(OS_WIN) |
179 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView) | 181 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView) |
180 #endif | 182 #endif |
181 | 183 |
182 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 184 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
183 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew, | 185 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew, |
184 OnAcceleratedSurfaceNew) | 186 OnAcceleratedSurfaceNew) |
185 #endif | 187 #endif |
186 | 188 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 RenderWidgetHostView* view = host->view(); | 335 RenderWidgetHostView* view = host->view(); |
334 if (!view) | 336 if (!view) |
335 return; | 337 return; |
336 | 338 |
337 delayed_send.Cancel(); | 339 delayed_send.Cancel(); |
338 | 340 |
339 // View must send ACK message after next composite. | 341 // View must send ACK message after next composite. |
340 view->AcceleratedSurfaceBuffersSwapped(params, host_id_); | 342 view->AcceleratedSurfaceBuffersSwapped(params, host_id_); |
341 } | 343 } |
342 | 344 |
| 345 void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( |
| 346 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { |
| 347 TRACE_EVENT0("renderer", |
| 348 "GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer"); |
| 349 |
| 350 ScopedSendOnIOThread delayed_send( |
| 351 host_id_, |
| 352 new AcceleratedSurfaceMsg_PostSubBufferACK(params.route_id)); |
| 353 |
| 354 RenderViewHost* host = RenderViewHost::FromID(params.renderer_id, |
| 355 params.render_view_id); |
| 356 if (!host) |
| 357 return; |
| 358 |
| 359 RenderWidgetHostView* view = host->view(); |
| 360 if (!view) |
| 361 return; |
| 362 |
| 363 delayed_send.Cancel(); |
| 364 |
| 365 // View must send ACK message after next composite. |
| 366 view->AcceleratedSurfacePostSubBuffer(params, host_id_); |
| 367 } |
| 368 |
343 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 369 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
344 | 370 |
345 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease( | 371 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease( |
346 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) { | 372 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) { |
347 RenderViewHost* host = RenderViewHost::FromID(params.renderer_id, | 373 RenderViewHost* host = RenderViewHost::FromID(params.renderer_id, |
348 params.render_view_id); | 374 params.render_view_id); |
349 if (!host) | 375 if (!host) |
350 return; | 376 return; |
351 RenderWidgetHostView* view = host->view(); | 377 RenderWidgetHostView* view = host->view(); |
352 if (!view) | 378 if (!view) |
353 return; | 379 return; |
354 view->AcceleratedSurfaceRelease(params.identifier); | 380 view->AcceleratedSurfaceRelease(params.identifier); |
355 } | 381 } |
356 | 382 |
357 #endif | 383 #endif |
OLD | NEW |