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