| 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_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
| 6 | 6 |
| 7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
| 8 #include <QuartzCore/QuartzCore.h> | 8 #include <QuartzCore/QuartzCore.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 | 1316 |
| 1317 void RenderWidgetHostViewMac::PluginImeCompositionCompleted( | 1317 void RenderWidgetHostViewMac::PluginImeCompositionCompleted( |
| 1318 const base::string16& text, int plugin_id) { | 1318 const base::string16& text, int plugin_id) { |
| 1319 if (render_widget_host_) { | 1319 if (render_widget_host_) { |
| 1320 render_widget_host_->Send(new ViewMsg_PluginImeCompositionCompleted( | 1320 render_widget_host_->Send(new ViewMsg_PluginImeCompositionCompleted( |
| 1321 render_widget_host_->GetRoutingID(), text, plugin_id)); | 1321 render_widget_host_->GetRoutingID(), text, plugin_id)); |
| 1322 } | 1322 } |
| 1323 } | 1323 } |
| 1324 | 1324 |
| 1325 void RenderWidgetHostViewMac::CompositorSwapBuffers( | 1325 void RenderWidgetHostViewMac::CompositorSwapBuffers( |
| 1326 uint64 surface_handle, | 1326 IOSurfaceID surface_handle, |
| 1327 const gfx::Size& size, | 1327 const gfx::Size& size, |
| 1328 float surface_scale_factor, | 1328 float surface_scale_factor, |
| 1329 const std::vector<ui::LatencyInfo>& latency_info) { | 1329 const std::vector<ui::LatencyInfo>& latency_info) { |
| 1330 // Ensure that the frame be acked unless it is explicitly passed to a | 1330 // Ensure that the frame be acked unless it is explicitly passed to a |
| 1331 // display function. | 1331 // display function. |
| 1332 base::ScopedClosureRunner scoped_ack( | 1332 base::ScopedClosureRunner scoped_ack( |
| 1333 base::Bind(&RenderWidgetHostViewMac::SendPendingSwapAck, | 1333 base::Bind(&RenderWidgetHostViewMac::SendPendingSwapAck, |
| 1334 weak_factory_.GetWeakPtr())); | 1334 weak_factory_.GetWeakPtr())); |
| 1335 | 1335 |
| 1336 if (render_widget_host_->is_hidden()) | 1336 if (render_widget_host_->is_hidden()) |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1654 return true; | 1654 return true; |
| 1655 } | 1655 } |
| 1656 | 1656 |
| 1657 void RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped( | 1657 void RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped( |
| 1658 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 1658 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| 1659 int gpu_host_id) { | 1659 int gpu_host_id) { |
| 1660 TRACE_EVENT0("browser", | 1660 TRACE_EVENT0("browser", |
| 1661 "RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped"); | 1661 "RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped"); |
| 1662 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1662 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1663 | 1663 |
| 1664 IOSurfaceID io_surface_handle = |
| 1665 static_cast<IOSurfaceID>(params.surface_handle); |
| 1664 AddPendingSwapAck(params.route_id, | 1666 AddPendingSwapAck(params.route_id, |
| 1665 gpu_host_id, | 1667 gpu_host_id, |
| 1666 compositing_iosurface_ ? | 1668 compositing_iosurface_ ? |
| 1667 compositing_iosurface_->GetRendererID() : 0); | 1669 compositing_iosurface_->GetRendererID() : 0); |
| 1668 CompositorSwapBuffers(params.surface_handle, | 1670 CompositorSwapBuffers(io_surface_handle, |
| 1669 params.size, | 1671 params.size, |
| 1670 params.scale_factor, | 1672 params.scale_factor, |
| 1671 params.latency_info); | 1673 params.latency_info); |
| 1672 } | 1674 } |
| 1673 | 1675 |
| 1674 void RenderWidgetHostViewMac::AcceleratedSurfacePostSubBuffer( | 1676 void RenderWidgetHostViewMac::AcceleratedSurfacePostSubBuffer( |
| 1675 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, | 1677 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, |
| 1676 int gpu_host_id) { | 1678 int gpu_host_id) { |
| 1677 TRACE_EVENT0("browser", | 1679 TRACE_EVENT0("browser", |
| 1678 "RenderWidgetHostViewMac::AcceleratedSurfacePostSubBuffer"); | 1680 "RenderWidgetHostViewMac::AcceleratedSurfacePostSubBuffer"); |
| 1679 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1681 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1680 | 1682 |
| 1683 IOSurfaceID io_surface_handle = |
| 1684 static_cast<IOSurfaceID>(params.surface_handle); |
| 1681 AddPendingSwapAck(params.route_id, | 1685 AddPendingSwapAck(params.route_id, |
| 1682 gpu_host_id, | 1686 gpu_host_id, |
| 1683 compositing_iosurface_ ? | 1687 compositing_iosurface_ ? |
| 1684 compositing_iosurface_->GetRendererID() : 0); | 1688 compositing_iosurface_->GetRendererID() : 0); |
| 1685 CompositorSwapBuffers(params.surface_handle, | 1689 CompositorSwapBuffers(io_surface_handle, |
| 1686 params.surface_size, | 1690 params.surface_size, |
| 1687 params.surface_scale_factor, | 1691 params.surface_scale_factor, |
| 1688 params.latency_info); | 1692 params.latency_info); |
| 1689 } | 1693 } |
| 1690 | 1694 |
| 1691 void RenderWidgetHostViewMac::AcceleratedSurfaceSuspend() { | 1695 void RenderWidgetHostViewMac::AcceleratedSurfaceSuspend() { |
| 1692 if (compositing_iosurface_) | 1696 if (compositing_iosurface_) |
| 1693 compositing_iosurface_->UnrefIOSurface(); | 1697 compositing_iosurface_->UnrefIOSurface(); |
| 1694 } | 1698 } |
| 1695 | 1699 |
| (...skipping 2228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3924 | 3928 |
| 3925 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3929 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3926 // regions that are not draggable. (See ControlRegionView in | 3930 // regions that are not draggable. (See ControlRegionView in |
| 3927 // native_app_window_cocoa.mm). This requires the render host view to be | 3931 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3928 // draggable by default. | 3932 // draggable by default. |
| 3929 - (BOOL)mouseDownCanMoveWindow { | 3933 - (BOOL)mouseDownCanMoveWindow { |
| 3930 return YES; | 3934 return YES; |
| 3931 } | 3935 } |
| 3932 | 3936 |
| 3933 @end | 3937 @end |
| OLD | NEW |