| 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 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 int32 surface_id, | 1483 int32 surface_id, |
| 1484 uint64 surface_handle, | 1484 uint64 surface_handle, |
| 1485 int32 route_id, | 1485 int32 route_id, |
| 1486 const gfx::Size& size, | 1486 const gfx::Size& size, |
| 1487 int32 gpu_process_host_id) { | 1487 int32 gpu_process_host_id) { |
| 1488 TRACE_EVENT0("renderer_host", | 1488 TRACE_EVENT0("renderer_host", |
| 1489 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped"); | 1489 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped"); |
| 1490 if (!view_) { | 1490 if (!view_) { |
| 1491 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1491 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
| 1492 gpu_process_host_id, | 1492 gpu_process_host_id, |
| 1493 false, | 1493 surface_handle, |
| 1494 0); | 1494 0); |
| 1495 return; | 1495 return; |
| 1496 } | 1496 } |
| 1497 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params; | 1497 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params; |
| 1498 gpu_params.surface_id = surface_id; | 1498 gpu_params.surface_id = surface_id; |
| 1499 gpu_params.surface_handle = surface_handle; | 1499 gpu_params.surface_handle = surface_handle; |
| 1500 gpu_params.route_id = route_id; | 1500 gpu_params.route_id = route_id; |
| 1501 gpu_params.size = size; | 1501 gpu_params.size = size; |
| 1502 #if defined(OS_MACOSX) | 1502 #if defined(OS_MACOSX) |
| 1503 // Compositor window is always gfx::kNullPluginWindow. | 1503 // Compositor window is always gfx::kNullPluginWindow. |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2263 return false; | 2263 return false; |
| 2264 } else { | 2264 } else { |
| 2265 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); | 2265 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); |
| 2266 return true; | 2266 return true; |
| 2267 } | 2267 } |
| 2268 } | 2268 } |
| 2269 } | 2269 } |
| 2270 | 2270 |
| 2271 // static | 2271 // static |
| 2272 void RenderWidgetHostImpl::AcknowledgeBufferPresent( | 2272 void RenderWidgetHostImpl::AcknowledgeBufferPresent( |
| 2273 int32 route_id, int gpu_host_id, bool presented, uint32 sync_point) { | 2273 int32 route_id, int gpu_host_id, uint64 surface_handle, uint32 sync_point) { |
| 2274 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 2274 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
| 2275 if (ui_shim) | 2275 if (ui_shim) |
| 2276 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, | 2276 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, |
| 2277 presented, | 2277 surface_handle, |
| 2278 sync_point)); | 2278 sync_point)); |
| 2279 } | 2279 } |
| 2280 | 2280 |
| 2281 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { | 2281 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { |
| 2282 if (!is_threaded_compositing_enabled_) | 2282 if (!is_threaded_compositing_enabled_) |
| 2283 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); | 2283 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); |
| 2284 } | 2284 } |
| 2285 | 2285 |
| 2286 #if defined(USE_AURA) | 2286 #if defined(USE_AURA) |
| 2287 | 2287 |
| 2288 void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { | 2288 void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { |
| 2289 #if defined(OS_WIN) | 2289 #if defined(OS_WIN) |
| 2290 HWND hwnd = reinterpret_cast<HWND>(new_parent); | 2290 HWND hwnd = reinterpret_cast<HWND>(new_parent); |
| 2291 if (!hwnd) | 2291 if (!hwnd) |
| 2292 hwnd = WebPluginDelegateImpl::GetDefaultWindowParent(); | 2292 hwnd = WebPluginDelegateImpl::GetDefaultWindowParent(); |
| 2293 for (std::list<HWND>::iterator i = dummy_windows_for_activation_.begin(); | 2293 for (std::list<HWND>::iterator i = dummy_windows_for_activation_.begin(); |
| 2294 i != dummy_windows_for_activation_.end(); ++i) { | 2294 i != dummy_windows_for_activation_.end(); ++i) { |
| 2295 SetParent(*i, hwnd); | 2295 SetParent(*i, hwnd); |
| 2296 } | 2296 } |
| 2297 #endif | 2297 #endif |
| 2298 } | 2298 } |
| 2299 | 2299 |
| 2300 // static | |
| 2301 void RenderWidgetHostImpl::SendFrontSurfaceIsProtected( | |
| 2302 bool is_protected, | |
| 2303 uint32 protection_state_id, | |
| 2304 int32 route_id, | |
| 2305 int gpu_host_id) { | |
| 2306 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | |
| 2307 if (ui_shim) { | |
| 2308 ui_shim->Send(new AcceleratedSurfaceMsg_SetFrontSurfaceIsProtected( | |
| 2309 route_id, is_protected, protection_state_id)); | |
| 2310 } | |
| 2311 } | |
| 2312 #endif | 2300 #endif |
| 2313 | 2301 |
| 2314 void RenderWidgetHostImpl::DelayedAutoResized() { | 2302 void RenderWidgetHostImpl::DelayedAutoResized() { |
| 2315 gfx::Size new_size = new_auto_size_; | 2303 gfx::Size new_size = new_auto_size_; |
| 2316 // Clear the new_auto_size_ since the empty value is used as a flag to | 2304 // Clear the new_auto_size_ since the empty value is used as a flag to |
| 2317 // indicate that no callback is in progress (i.e. without this line | 2305 // indicate that no callback is in progress (i.e. without this line |
| 2318 // DelayedAutoResized will not get called again). | 2306 // DelayedAutoResized will not get called again). |
| 2319 new_auto_size_.SetSize(0, 0); | 2307 new_auto_size_.SetSize(0, 0); |
| 2320 if (!should_auto_resize_) | 2308 if (!should_auto_resize_) |
| 2321 return; | 2309 return; |
| 2322 | 2310 |
| 2323 OnRenderAutoResized(new_size); | 2311 OnRenderAutoResized(new_size); |
| 2324 } | 2312 } |
| 2325 | 2313 |
| 2326 void RenderWidgetHostImpl::DetachDelegate() { | 2314 void RenderWidgetHostImpl::DetachDelegate() { |
| 2327 delegate_ = NULL; | 2315 delegate_ = NULL; |
| 2328 } | 2316 } |
| 2329 | 2317 |
| 2330 } // namespace content | 2318 } // namespace content |
| OLD | NEW |