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_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 if (!SwapBuffersPrepare(surface_rect, surface_rect, &ack_params)) | 890 if (!SwapBuffersPrepare(surface_rect, surface_rect, &ack_params)) |
891 return; | 891 return; |
892 | 892 |
893 previous_damage_.setRect(RectToSkIRect(surface_rect)); | 893 previous_damage_.setRect(RectToSkIRect(surface_rect)); |
894 skipped_damage_.setEmpty(); | 894 skipped_damage_.setEmpty(); |
895 | 895 |
896 ui::Compositor* compositor = GetCompositor(); | 896 ui::Compositor* compositor = GetCompositor(); |
897 if (compositor) { | 897 if (compositor) { |
898 gfx::Size surface_size = ConvertSizeToDIP(this, params_in_pixel.size); | 898 gfx::Size surface_size = ConvertSizeToDIP(this, params_in_pixel.size); |
899 window_->SchedulePaintInRect(gfx::Rect(surface_size)); | 899 window_->SchedulePaintInRect(gfx::Rect(surface_size)); |
| 900 |
| 901 FrameLatency frame_latency; |
| 902 frame_latency.latency_info = params_in_pixel.latency_info; |
| 903 frame_latency.latency_info.browserMainFrameNumber = |
| 904 compositor->SetInputNumber(frame_latency.latency_info.inputNumber); |
| 905 frame_latency.gpu_host_id = gpu_host_id; |
| 906 frame_latency.route_id = params_in_pixel.route_id; |
| 907 frame_queue_.push(frame_latency); |
900 } | 908 } |
901 | 909 |
902 SwapBuffersCompleted(ack_params); | 910 SwapBuffersCompleted(ack_params); |
903 } | 911 } |
904 | 912 |
905 void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( | 913 void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( |
906 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, | 914 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, |
907 int gpu_host_id) { | 915 int gpu_host_id) { |
908 const gfx::Rect surface_rect = | 916 const gfx::Rect surface_rect = |
909 gfx::Rect(gfx::Point(), params_in_pixel.surface_size); | 917 gfx::Rect(gfx::Point(), params_in_pixel.surface_size); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 surface_size_in_pixel.height() - params_in_pixel.y - | 959 surface_size_in_pixel.height() - params_in_pixel.y - |
952 params_in_pixel.height, | 960 params_in_pixel.height, |
953 params_in_pixel.width, | 961 params_in_pixel.width, |
954 params_in_pixel.height)); | 962 params_in_pixel.height)); |
955 | 963 |
956 // Damage may not have been DIP aligned, so inflate damage to compensate | 964 // Damage may not have been DIP aligned, so inflate damage to compensate |
957 // for any round-off error. | 965 // for any round-off error. |
958 rect_to_paint.Inset(-1, -1); | 966 rect_to_paint.Inset(-1, -1); |
959 rect_to_paint.Intersect(window_->bounds()); | 967 rect_to_paint.Intersect(window_->bounds()); |
960 | 968 |
| 969 FrameLatency frame_latency; |
| 970 frame_latency.latency_info = params_in_pixel.latency_info; |
| 971 frame_latency.latency_info.browserMainFrameNumber = |
| 972 compositor->SetInputNumber(frame_latency.latency_info.inputNumber); |
| 973 frame_latency.gpu_host_id = gpu_host_id; |
| 974 frame_latency.route_id = params_in_pixel.route_id; |
| 975 frame_queue_.push(frame_latency); |
| 976 |
961 window_->SchedulePaintInRect(rect_to_paint); | 977 window_->SchedulePaintInRect(rect_to_paint); |
962 } | 978 } |
963 | 979 |
964 SwapBuffersCompleted(ack_params); | 980 SwapBuffersCompleted(ack_params); |
965 } | 981 } |
966 | 982 |
967 void RenderWidgetHostViewAura::AcceleratedSurfaceSuspend() { | 983 void RenderWidgetHostViewAura::AcceleratedSurfaceSuspend() { |
968 } | 984 } |
969 | 985 |
970 bool RenderWidgetHostViewAura::HasAcceleratedSurface( | 986 bool RenderWidgetHostViewAura::HasAcceleratedSurface( |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1775 | 1791 |
1776 void RenderWidgetHostViewAura::OnCompositingLockStateChanged( | 1792 void RenderWidgetHostViewAura::OnCompositingLockStateChanged( |
1777 ui::Compositor* compositor) { | 1793 ui::Compositor* compositor) { |
1778 // A compositor lock that is part of a resize lock timed out. We | 1794 // A compositor lock that is part of a resize lock timed out. We |
1779 // should display a renderer frame. | 1795 // should display a renderer frame. |
1780 if (!compositor->IsLocked() && can_lock_compositor_ == YES_DID_LOCK) { | 1796 if (!compositor->IsLocked() && can_lock_compositor_ == YES_DID_LOCK) { |
1781 can_lock_compositor_ = NO_PENDING_RENDERER_FRAME; | 1797 can_lock_compositor_ = NO_PENDING_RENDERER_FRAME; |
1782 } | 1798 } |
1783 } | 1799 } |
1784 | 1800 |
| 1801 void RenderWidgetHostViewAura::OnReceivedLatencyInfo( |
| 1802 ui::Compositor* compositor, |
| 1803 const WebKit::WebLatencyInfoImpl& latency_info) { |
| 1804 while (!frame_queue_.empty()) { |
| 1805 const FrameLatency& frame_latency = frame_queue_.front(); |
| 1806 if (latency_info.rendererMainFrameNumber < |
| 1807 frame_latency.latency_info.browserMainFrameNumber) |
| 1808 break; |
| 1809 |
| 1810 WebKit::WebLatencyInfoImpl real_latency_info = frame_latency.latency_info; |
| 1811 real_latency_info.browserMainFrameNumber = |
| 1812 latency_info.rendererMainFrameNumber; |
| 1813 real_latency_info.browserImplFrameNumber = |
| 1814 latency_info.rendererImplFrameNumber; |
| 1815 real_latency_info.swapTimestamp = latency_info.swapTimestamp; |
| 1816 RenderWidgetHostImpl::NotifyFrameDisplayed(frame_latency.route_id, |
| 1817 frame_latency.gpu_host_id, |
| 1818 real_latency_info); |
| 1819 frame_queue_.pop(); |
| 1820 } |
| 1821 } |
| 1822 |
1785 //////////////////////////////////////////////////////////////////////////////// | 1823 //////////////////////////////////////////////////////////////////////////////// |
1786 // RenderWidgetHostViewAura, ImageTransportFactoryObserver implementation: | 1824 // RenderWidgetHostViewAura, ImageTransportFactoryObserver implementation: |
1787 | 1825 |
1788 void RenderWidgetHostViewAura::OnLostResources() { | 1826 void RenderWidgetHostViewAura::OnLostResources() { |
1789 image_transport_clients_.clear(); | 1827 image_transport_clients_.clear(); |
1790 current_surface_ = 0; | 1828 current_surface_ = 0; |
1791 UpdateExternalTexture(); | 1829 UpdateExternalTexture(); |
1792 locks_pending_commit_.clear(); | 1830 locks_pending_commit_.clear(); |
1793 | 1831 |
1794 DCHECK(!shared_surface_handle_.is_null()); | 1832 DCHECK(!shared_surface_handle_.is_null()); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1993 RenderWidgetHost* widget) { | 2031 RenderWidgetHost* widget) { |
1994 return new RenderWidgetHostViewAura(widget); | 2032 return new RenderWidgetHostViewAura(widget); |
1995 } | 2033 } |
1996 | 2034 |
1997 // static | 2035 // static |
1998 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 2036 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
1999 GetScreenInfoForWindow(results, NULL); | 2037 GetScreenInfoForWindow(results, NULL); |
2000 } | 2038 } |
2001 | 2039 |
2002 } // namespace content | 2040 } // namespace content |
OLD | NEW |