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 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 int32 surface_id, | 1523 int32 surface_id, |
1524 uint64 surface_handle, | 1524 uint64 surface_handle, |
1525 int32 route_id, | 1525 int32 route_id, |
1526 const gfx::Size& size, | 1526 const gfx::Size& size, |
1527 int32 gpu_process_host_id) { | 1527 int32 gpu_process_host_id) { |
1528 TRACE_EVENT0("renderer_host", | 1528 TRACE_EVENT0("renderer_host", |
1529 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped"); | 1529 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped"); |
1530 if (!view_) { | 1530 if (!view_) { |
1531 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1531 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
1532 gpu_process_host_id, | 1532 gpu_process_host_id, |
1533 surface_handle, | 1533 false, |
1534 0); | 1534 0); |
1535 return; | 1535 return; |
1536 } | 1536 } |
1537 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params; | 1537 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params; |
1538 gpu_params.surface_id = surface_id; | 1538 gpu_params.surface_id = surface_id; |
1539 gpu_params.surface_handle = surface_handle; | 1539 gpu_params.surface_handle = surface_handle; |
1540 gpu_params.route_id = route_id; | 1540 gpu_params.route_id = route_id; |
1541 gpu_params.size = size; | 1541 gpu_params.size = size; |
1542 #if defined(OS_MACOSX) | 1542 #if defined(OS_MACOSX) |
1543 // Compositor window is always gfx::kNullPluginWindow. | 1543 // Compositor window is always gfx::kNullPluginWindow. |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2303 return false; | 2303 return false; |
2304 } else { | 2304 } else { |
2305 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); | 2305 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); |
2306 return true; | 2306 return true; |
2307 } | 2307 } |
2308 } | 2308 } |
2309 } | 2309 } |
2310 | 2310 |
2311 // static | 2311 // static |
2312 void RenderWidgetHostImpl::AcknowledgeBufferPresent( | 2312 void RenderWidgetHostImpl::AcknowledgeBufferPresent( |
2313 int32 route_id, int gpu_host_id, uint64 surface_handle, uint32 sync_point) { | 2313 int32 route_id, int gpu_host_id, bool presented, uint32 sync_point) { |
2314 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 2314 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
2315 if (ui_shim) | 2315 if (ui_shim) |
2316 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, | 2316 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, |
2317 surface_handle, | 2317 presented, |
2318 sync_point)); | 2318 sync_point)); |
2319 } | 2319 } |
2320 | 2320 |
2321 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { | 2321 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { |
2322 if (!is_threaded_compositing_enabled_) | 2322 if (!is_threaded_compositing_enabled_) |
2323 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); | 2323 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); |
2324 } | 2324 } |
2325 | 2325 |
2326 #if defined(USE_AURA) | 2326 #if defined(USE_AURA) |
2327 | 2327 |
2328 void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { | 2328 void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { |
2329 #if defined(OS_WIN) | 2329 #if defined(OS_WIN) |
2330 HWND hwnd = reinterpret_cast<HWND>(new_parent); | 2330 HWND hwnd = reinterpret_cast<HWND>(new_parent); |
2331 if (!hwnd) | 2331 if (!hwnd) |
2332 hwnd = WebPluginDelegateImpl::GetDefaultWindowParent(); | 2332 hwnd = WebPluginDelegateImpl::GetDefaultWindowParent(); |
2333 for (std::list<HWND>::iterator i = dummy_windows_for_activation_.begin(); | 2333 for (std::list<HWND>::iterator i = dummy_windows_for_activation_.begin(); |
2334 i != dummy_windows_for_activation_.end(); ++i) { | 2334 i != dummy_windows_for_activation_.end(); ++i) { |
2335 SetParent(*i, hwnd); | 2335 SetParent(*i, hwnd); |
2336 } | 2336 } |
2337 #endif | 2337 #endif |
2338 } | 2338 } |
2339 | 2339 |
| 2340 // static |
| 2341 void RenderWidgetHostImpl::SendFrontSurfaceIsProtected( |
| 2342 bool is_protected, |
| 2343 uint32 protection_state_id, |
| 2344 int32 route_id, |
| 2345 int gpu_host_id) { |
| 2346 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
| 2347 if (ui_shim) { |
| 2348 ui_shim->Send(new AcceleratedSurfaceMsg_SetFrontSurfaceIsProtected( |
| 2349 route_id, is_protected, protection_state_id)); |
| 2350 } |
| 2351 } |
2340 #endif | 2352 #endif |
2341 | 2353 |
2342 void RenderWidgetHostImpl::DelayedAutoResized() { | 2354 void RenderWidgetHostImpl::DelayedAutoResized() { |
2343 gfx::Size new_size = new_auto_size_; | 2355 gfx::Size new_size = new_auto_size_; |
2344 // Clear the new_auto_size_ since the empty value is used as a flag to | 2356 // Clear the new_auto_size_ since the empty value is used as a flag to |
2345 // indicate that no callback is in progress (i.e. without this line | 2357 // indicate that no callback is in progress (i.e. without this line |
2346 // DelayedAutoResized will not get called again). | 2358 // DelayedAutoResized will not get called again). |
2347 new_auto_size_.SetSize(0, 0); | 2359 new_auto_size_.SetSize(0, 0); |
2348 if (!should_auto_resize_) | 2360 if (!should_auto_resize_) |
2349 return; | 2361 return; |
2350 | 2362 |
2351 OnRenderAutoResized(new_size); | 2363 OnRenderAutoResized(new_size); |
2352 } | 2364 } |
2353 | 2365 |
2354 void RenderWidgetHostImpl::DetachDelegate() { | 2366 void RenderWidgetHostImpl::DetachDelegate() { |
2355 delegate_ = NULL; | 2367 delegate_ = NULL; |
2356 } | 2368 } |
2357 | 2369 |
2358 } // namespace content | 2370 } // namespace content |
OLD | NEW |