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 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1505 int32 surface_id, | 1505 int32 surface_id, |
1506 uint64 surface_handle, | 1506 uint64 surface_handle, |
1507 int32 route_id, | 1507 int32 route_id, |
1508 const gfx::Size& size, | 1508 const gfx::Size& size, |
1509 int32 gpu_process_host_id) { | 1509 int32 gpu_process_host_id) { |
1510 TRACE_EVENT0("renderer_host", | 1510 TRACE_EVENT0("renderer_host", |
1511 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped"); | 1511 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped"); |
1512 if (!view_) { | 1512 if (!view_) { |
1513 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1513 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
1514 gpu_process_host_id, | 1514 gpu_process_host_id, |
1515 false, | 1515 surface_handle, |
1516 0); | 1516 0); |
1517 return; | 1517 return; |
1518 } | 1518 } |
1519 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params; | 1519 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params; |
1520 gpu_params.surface_id = surface_id; | 1520 gpu_params.surface_id = surface_id; |
1521 gpu_params.surface_handle = surface_handle; | 1521 gpu_params.surface_handle = surface_handle; |
1522 gpu_params.route_id = route_id; | 1522 gpu_params.route_id = route_id; |
1523 gpu_params.size = size; | 1523 gpu_params.size = size; |
1524 #if defined(OS_MACOSX) | 1524 #if defined(OS_MACOSX) |
1525 // Compositor window is always gfx::kNullPluginWindow. | 1525 // Compositor window is always gfx::kNullPluginWindow. |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2285 return false; | 2285 return false; |
2286 } else { | 2286 } else { |
2287 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); | 2287 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); |
2288 return true; | 2288 return true; |
2289 } | 2289 } |
2290 } | 2290 } |
2291 } | 2291 } |
2292 | 2292 |
2293 // static | 2293 // static |
2294 void RenderWidgetHostImpl::AcknowledgeBufferPresent( | 2294 void RenderWidgetHostImpl::AcknowledgeBufferPresent( |
2295 int32 route_id, int gpu_host_id, bool presented, uint32 sync_point) { | 2295 int32 route_id, int gpu_host_id, uint64 surface_handle, uint32 sync_point) { |
2296 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 2296 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
2297 if (ui_shim) | 2297 if (ui_shim) |
2298 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, | 2298 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, |
2299 presented, | 2299 surface_handle, |
2300 sync_point)); | 2300 sync_point)); |
2301 } | 2301 } |
2302 | 2302 |
2303 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { | 2303 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { |
2304 if (!is_threaded_compositing_enabled_) | 2304 if (!is_threaded_compositing_enabled_) |
2305 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); | 2305 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); |
2306 } | 2306 } |
2307 | 2307 |
2308 #if defined(USE_AURA) | 2308 #if defined(USE_AURA) |
2309 | 2309 |
2310 void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { | 2310 void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { |
2311 #if defined(OS_WIN) | 2311 #if defined(OS_WIN) |
2312 HWND hwnd = reinterpret_cast<HWND>(new_parent); | 2312 HWND hwnd = reinterpret_cast<HWND>(new_parent); |
2313 if (!hwnd) | 2313 if (!hwnd) |
2314 hwnd = WebPluginDelegateImpl::GetDefaultWindowParent(); | 2314 hwnd = WebPluginDelegateImpl::GetDefaultWindowParent(); |
2315 for (std::list<HWND>::iterator i = dummy_windows_for_activation_.begin(); | 2315 for (std::list<HWND>::iterator i = dummy_windows_for_activation_.begin(); |
2316 i != dummy_windows_for_activation_.end(); ++i) { | 2316 i != dummy_windows_for_activation_.end(); ++i) { |
2317 SetParent(*i, hwnd); | 2317 SetParent(*i, hwnd); |
2318 } | 2318 } |
2319 #endif | 2319 #endif |
2320 } | 2320 } |
2321 | 2321 |
2322 // static | |
2323 void RenderWidgetHostImpl::SendFrontSurfaceIsProtected( | |
2324 bool is_protected, | |
2325 uint32 protection_state_id, | |
2326 int32 route_id, | |
2327 int gpu_host_id) { | |
2328 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | |
2329 if (ui_shim) { | |
2330 ui_shim->Send(new AcceleratedSurfaceMsg_SetFrontSurfaceIsProtected( | |
2331 route_id, is_protected, protection_state_id)); | |
2332 } | |
2333 } | |
2334 #endif | 2322 #endif |
2335 | 2323 |
2336 void RenderWidgetHostImpl::DelayedAutoResized() { | 2324 void RenderWidgetHostImpl::DelayedAutoResized() { |
2337 gfx::Size new_size = new_auto_size_; | 2325 gfx::Size new_size = new_auto_size_; |
2338 // Clear the new_auto_size_ since the empty value is used as a flag to | 2326 // Clear the new_auto_size_ since the empty value is used as a flag to |
2339 // indicate that no callback is in progress (i.e. without this line | 2327 // indicate that no callback is in progress (i.e. without this line |
2340 // DelayedAutoResized will not get called again). | 2328 // DelayedAutoResized will not get called again). |
2341 new_auto_size_.SetSize(0, 0); | 2329 new_auto_size_.SetSize(0, 0); |
2342 if (!should_auto_resize_) | 2330 if (!should_auto_resize_) |
2343 return; | 2331 return; |
2344 | 2332 |
2345 OnRenderAutoResized(new_size); | 2333 OnRenderAutoResized(new_size); |
2346 } | 2334 } |
2347 | 2335 |
2348 void RenderWidgetHostImpl::DetachDelegate() { | 2336 void RenderWidgetHostImpl::DetachDelegate() { |
2349 delegate_ = NULL; | 2337 delegate_ = NULL; |
2350 } | 2338 } |
2351 | 2339 |
2352 } // namespace content | 2340 } // namespace content |
OLD | NEW |