| 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/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1472 int32 surface_id, | 1472 int32 surface_id, |
| 1473 uint64 surface_handle, | 1473 uint64 surface_handle, |
| 1474 int32 route_id, | 1474 int32 route_id, |
| 1475 const gfx::Size& size, | 1475 const gfx::Size& size, |
| 1476 int32 gpu_process_host_id) { | 1476 int32 gpu_process_host_id) { |
| 1477 TRACE_EVENT0("renderer_host", | 1477 TRACE_EVENT0("renderer_host", |
| 1478 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped"); | 1478 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped"); |
| 1479 if (!view_) { | 1479 if (!view_) { |
| 1480 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1480 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
| 1481 gpu_process_host_id, | 1481 gpu_process_host_id, |
| 1482 false, | 1482 surface_handle, |
| 1483 0); | 1483 0); |
| 1484 return; | 1484 return; |
| 1485 } | 1485 } |
| 1486 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params; | 1486 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params; |
| 1487 gpu_params.surface_id = surface_id; | 1487 gpu_params.surface_id = surface_id; |
| 1488 gpu_params.surface_handle = surface_handle; | 1488 gpu_params.surface_handle = surface_handle; |
| 1489 gpu_params.route_id = route_id; | 1489 gpu_params.route_id = route_id; |
| 1490 gpu_params.size = size; | 1490 gpu_params.size = size; |
| 1491 #if defined(OS_MACOSX) | 1491 #if defined(OS_MACOSX) |
| 1492 // Compositor window is always gfx::kNullPluginWindow. | 1492 // Compositor window is always gfx::kNullPluginWindow. |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2250 return false; | 2250 return false; |
| 2251 } else { | 2251 } else { |
| 2252 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); | 2252 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); |
| 2253 return true; | 2253 return true; |
| 2254 } | 2254 } |
| 2255 } | 2255 } |
| 2256 } | 2256 } |
| 2257 | 2257 |
| 2258 // static | 2258 // static |
| 2259 void RenderWidgetHostImpl::AcknowledgeBufferPresent( | 2259 void RenderWidgetHostImpl::AcknowledgeBufferPresent( |
| 2260 int32 route_id, int gpu_host_id, bool presented, uint32 sync_point) { | 2260 int32 route_id, int gpu_host_id, uint64 surface_handle, uint32 sync_point) { |
| 2261 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 2261 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
| 2262 if (ui_shim) | 2262 if (ui_shim) |
| 2263 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, | 2263 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, |
| 2264 presented, | 2264 surface_handle, |
| 2265 sync_point)); | 2265 sync_point)); |
| 2266 } | 2266 } |
| 2267 | 2267 |
| 2268 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { | 2268 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { |
| 2269 if (!is_threaded_compositing_enabled_) | 2269 if (!is_threaded_compositing_enabled_) |
| 2270 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); | 2270 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); |
| 2271 } | 2271 } |
| 2272 | 2272 |
| 2273 #if defined(USE_AURA) | 2273 #if defined(USE_AURA) |
| 2274 | 2274 |
| 2275 void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { | 2275 void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { |
| 2276 #if defined(OS_WIN) | 2276 #if defined(OS_WIN) |
| 2277 HWND hwnd = reinterpret_cast<HWND>(new_parent); | 2277 HWND hwnd = reinterpret_cast<HWND>(new_parent); |
| 2278 if (!hwnd) | 2278 if (!hwnd) |
| 2279 hwnd = WebPluginDelegateImpl::GetDefaultWindowParent(); | 2279 hwnd = WebPluginDelegateImpl::GetDefaultWindowParent(); |
| 2280 for (std::list<HWND>::iterator i = dummy_windows_for_activation_.begin(); | 2280 for (std::list<HWND>::iterator i = dummy_windows_for_activation_.begin(); |
| 2281 i != dummy_windows_for_activation_.end(); ++i) { | 2281 i != dummy_windows_for_activation_.end(); ++i) { |
| 2282 SetParent(*i, hwnd); | 2282 SetParent(*i, hwnd); |
| 2283 } | 2283 } |
| 2284 #endif | 2284 #endif |
| 2285 } | 2285 } |
| 2286 | 2286 |
| 2287 // static | |
| 2288 void RenderWidgetHostImpl::SendFrontSurfaceIsProtected( | |
| 2289 bool is_protected, | |
| 2290 uint32 protection_state_id, | |
| 2291 int32 route_id, | |
| 2292 int gpu_host_id) { | |
| 2293 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | |
| 2294 if (ui_shim) { | |
| 2295 ui_shim->Send(new AcceleratedSurfaceMsg_SetFrontSurfaceIsProtected( | |
| 2296 route_id, is_protected, protection_state_id)); | |
| 2297 } | |
| 2298 } | |
| 2299 #endif | 2287 #endif |
| 2300 | 2288 |
| 2301 void RenderWidgetHostImpl::DelayedAutoResized() { | 2289 void RenderWidgetHostImpl::DelayedAutoResized() { |
| 2302 gfx::Size new_size = new_auto_size_; | 2290 gfx::Size new_size = new_auto_size_; |
| 2303 // Clear the new_auto_size_ since the empty value is used as a flag to | 2291 // Clear the new_auto_size_ since the empty value is used as a flag to |
| 2304 // indicate that no callback is in progress (i.e. without this line | 2292 // indicate that no callback is in progress (i.e. without this line |
| 2305 // DelayedAutoResized will not get called again). | 2293 // DelayedAutoResized will not get called again). |
| 2306 new_auto_size_.SetSize(0, 0); | 2294 new_auto_size_.SetSize(0, 0); |
| 2307 if (!should_auto_resize_) | 2295 if (!should_auto_resize_) |
| 2308 return; | 2296 return; |
| 2309 | 2297 |
| 2310 OnRenderAutoResized(new_size); | 2298 OnRenderAutoResized(new_size); |
| 2311 } | 2299 } |
| 2312 | 2300 |
| 2313 void RenderWidgetHostImpl::DetachDelegate() { | 2301 void RenderWidgetHostImpl::DetachDelegate() { |
| 2314 delegate_ = NULL; | 2302 delegate_ = NULL; |
| 2315 } | 2303 } |
| 2316 | 2304 |
| 2317 } // namespace content | 2305 } // namespace content |
| OLD | NEW |