| 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 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1432 int32 surface_id, | 1432 int32 surface_id, |
| 1433 uint64 surface_handle, | 1433 uint64 surface_handle, |
| 1434 int32 route_id, | 1434 int32 route_id, |
| 1435 const gfx::Size& size, | 1435 const gfx::Size& size, |
| 1436 int32 gpu_process_host_id) { | 1436 int32 gpu_process_host_id) { |
| 1437 TRACE_EVENT0("renderer_host", | 1437 TRACE_EVENT0("renderer_host", |
| 1438 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped"); | 1438 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped"); |
| 1439 if (!view_) { | 1439 if (!view_) { |
| 1440 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1440 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
| 1441 gpu_process_host_id, | 1441 gpu_process_host_id, |
| 1442 false, | 1442 surface_handle, |
| 1443 0); | 1443 0); |
| 1444 return; | 1444 return; |
| 1445 } | 1445 } |
| 1446 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params; | 1446 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params; |
| 1447 gpu_params.surface_id = surface_id; | 1447 gpu_params.surface_id = surface_id; |
| 1448 gpu_params.surface_handle = surface_handle; | 1448 gpu_params.surface_handle = surface_handle; |
| 1449 gpu_params.route_id = route_id; | 1449 gpu_params.route_id = route_id; |
| 1450 gpu_params.size = size; | 1450 gpu_params.size = size; |
| 1451 #if defined(OS_MACOSX) | 1451 #if defined(OS_MACOSX) |
| 1452 // Compositor window is always gfx::kNullPluginWindow. | 1452 // Compositor window is always gfx::kNullPluginWindow. |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2197 return false; | 2197 return false; |
| 2198 } else { | 2198 } else { |
| 2199 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); | 2199 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); |
| 2200 return true; | 2200 return true; |
| 2201 } | 2201 } |
| 2202 } | 2202 } |
| 2203 } | 2203 } |
| 2204 | 2204 |
| 2205 // static | 2205 // static |
| 2206 void RenderWidgetHostImpl::AcknowledgeBufferPresent( | 2206 void RenderWidgetHostImpl::AcknowledgeBufferPresent( |
| 2207 int32 route_id, int gpu_host_id, bool presented, uint32 sync_point) { | 2207 int32 route_id, int gpu_host_id, uint64 surface_handle, uint32 sync_point) { |
| 2208 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 2208 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
| 2209 if (ui_shim) | 2209 if (ui_shim) |
| 2210 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, | 2210 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, |
| 2211 presented, | 2211 surface_handle, |
| 2212 sync_point)); | 2212 sync_point)); |
| 2213 } | 2213 } |
| 2214 | 2214 |
| 2215 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { | 2215 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { |
| 2216 if (!is_threaded_compositing_enabled_) | 2216 if (!is_threaded_compositing_enabled_) |
| 2217 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); | 2217 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); |
| 2218 } | 2218 } |
| 2219 | 2219 |
| 2220 #if defined(USE_AURA) | 2220 #if defined(USE_AURA) |
| 2221 | 2221 |
| 2222 void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { | 2222 void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { |
| 2223 #if defined(OS_WIN) | 2223 #if defined(OS_WIN) |
| 2224 HWND hwnd = reinterpret_cast<HWND>(new_parent); | 2224 HWND hwnd = reinterpret_cast<HWND>(new_parent); |
| 2225 if (!hwnd) | 2225 if (!hwnd) |
| 2226 hwnd = WebPluginDelegateImpl::GetDefaultWindowParent(); | 2226 hwnd = WebPluginDelegateImpl::GetDefaultWindowParent(); |
| 2227 for (std::list<HWND>::iterator i = dummy_windows_for_activation_.begin(); | 2227 for (std::list<HWND>::iterator i = dummy_windows_for_activation_.begin(); |
| 2228 i != dummy_windows_for_activation_.end(); ++i) { | 2228 i != dummy_windows_for_activation_.end(); ++i) { |
| 2229 SetParent(*i, hwnd); | 2229 SetParent(*i, hwnd); |
| 2230 } | 2230 } |
| 2231 #endif | 2231 #endif |
| 2232 } | 2232 } |
| 2233 | 2233 |
| 2234 // static | |
| 2235 void RenderWidgetHostImpl::SendFrontSurfaceIsProtected( | |
| 2236 bool is_protected, | |
| 2237 uint32 protection_state_id, | |
| 2238 int32 route_id, | |
| 2239 int gpu_host_id) { | |
| 2240 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | |
| 2241 if (ui_shim) { | |
| 2242 ui_shim->Send(new AcceleratedSurfaceMsg_SetFrontSurfaceIsProtected( | |
| 2243 route_id, is_protected, protection_state_id)); | |
| 2244 } | |
| 2245 } | |
| 2246 #endif | 2234 #endif |
| 2247 | 2235 |
| 2248 void RenderWidgetHostImpl::DelayedAutoResized() { | 2236 void RenderWidgetHostImpl::DelayedAutoResized() { |
| 2249 gfx::Size new_size = new_auto_size_; | 2237 gfx::Size new_size = new_auto_size_; |
| 2250 // Clear the new_auto_size_ since the empty value is used as a flag to | 2238 // Clear the new_auto_size_ since the empty value is used as a flag to |
| 2251 // indicate that no callback is in progress (i.e. without this line | 2239 // indicate that no callback is in progress (i.e. without this line |
| 2252 // DelayedAutoResized will not get called again). | 2240 // DelayedAutoResized will not get called again). |
| 2253 new_auto_size_.SetSize(0, 0); | 2241 new_auto_size_.SetSize(0, 0); |
| 2254 if (!should_auto_resize_) | 2242 if (!should_auto_resize_) |
| 2255 return; | 2243 return; |
| 2256 | 2244 |
| 2257 OnRenderAutoResized(new_size); | 2245 OnRenderAutoResized(new_size); |
| 2258 } | 2246 } |
| 2259 | 2247 |
| 2260 void RenderWidgetHostImpl::DetachDelegate() { | 2248 void RenderWidgetHostImpl::DetachDelegate() { |
| 2261 delegate_ = NULL; | 2249 delegate_ = NULL; |
| 2262 } | 2250 } |
| 2263 | 2251 |
| 2264 } // namespace content | 2252 } // namespace content |
| OLD | NEW |