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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 surface_rect, surface_rect, params_in_pixel.mailbox_name, &ack_params)) | 882 surface_rect, surface_rect, params_in_pixel.mailbox_name, &ack_params)) |
883 return; | 883 return; |
884 | 884 |
885 previous_damage_.setRect(RectToSkIRect(surface_rect)); | 885 previous_damage_.setRect(RectToSkIRect(surface_rect)); |
886 skipped_damage_.setEmpty(); | 886 skipped_damage_.setEmpty(); |
887 | 887 |
888 ui::Compositor* compositor = GetCompositor(); | 888 ui::Compositor* compositor = GetCompositor(); |
889 if (compositor) { | 889 if (compositor) { |
890 gfx::Size surface_size = ConvertSizeToDIP(this, params_in_pixel.size); | 890 gfx::Size surface_size = ConvertSizeToDIP(this, params_in_pixel.size); |
891 window_->SchedulePaintInRect(gfx::Rect(surface_size)); | 891 window_->SchedulePaintInRect(gfx::Rect(surface_size)); |
| 892 |
| 893 FrameLatency frame_latency; |
| 894 frame_latency.latency_info = params_in_pixel.latency_info; |
| 895 frame_latency.latency_info.browserMainFrameNumber = |
| 896 compositor->SetInputNumber(frame_latency.latency_info.inputNumber); |
| 897 frame_latency.gpu_host_id = gpu_host_id; |
| 898 frame_latency.route_id = params_in_pixel.route_id; |
| 899 frame_queue_.push(frame_latency); |
892 } | 900 } |
893 | 901 |
894 SwapBuffersCompleted(ack_params); | 902 SwapBuffersCompleted(ack_params); |
895 } | 903 } |
896 | 904 |
897 void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( | 905 void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( |
898 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, | 906 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, |
899 int gpu_host_id) { | 907 int gpu_host_id) { |
900 const gfx::Rect surface_rect = | 908 const gfx::Rect surface_rect = |
901 gfx::Rect(gfx::Point(), params_in_pixel.surface_size); | 909 gfx::Rect(gfx::Point(), params_in_pixel.surface_size); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 surface_size_in_pixel.height() - params_in_pixel.y - | 951 surface_size_in_pixel.height() - params_in_pixel.y - |
944 params_in_pixel.height, | 952 params_in_pixel.height, |
945 params_in_pixel.width, | 953 params_in_pixel.width, |
946 params_in_pixel.height)); | 954 params_in_pixel.height)); |
947 | 955 |
948 // Damage may not have been DIP aligned, so inflate damage to compensate | 956 // Damage may not have been DIP aligned, so inflate damage to compensate |
949 // for any round-off error. | 957 // for any round-off error. |
950 rect_to_paint.Inset(-1, -1); | 958 rect_to_paint.Inset(-1, -1); |
951 rect_to_paint.Intersect(window_->bounds()); | 959 rect_to_paint.Intersect(window_->bounds()); |
952 | 960 |
| 961 FrameLatency frame_latency; |
| 962 frame_latency.latency_info = params_in_pixel.latency_info; |
| 963 frame_latency.latency_info.browserMainFrameNumber = |
| 964 compositor->SetInputNumber(frame_latency.latency_info.inputNumber); |
| 965 frame_latency.gpu_host_id = gpu_host_id; |
| 966 frame_latency.route_id = params_in_pixel.route_id; |
| 967 frame_queue_.push(frame_latency); |
| 968 |
953 window_->SchedulePaintInRect(rect_to_paint); | 969 window_->SchedulePaintInRect(rect_to_paint); |
954 } | 970 } |
955 | 971 |
956 SwapBuffersCompleted(ack_params); | 972 SwapBuffersCompleted(ack_params); |
957 } | 973 } |
958 | 974 |
959 void RenderWidgetHostViewAura::AcceleratedSurfaceSuspend() { | 975 void RenderWidgetHostViewAura::AcceleratedSurfaceSuspend() { |
960 } | 976 } |
961 | 977 |
962 bool RenderWidgetHostViewAura::HasAcceleratedSurface( | 978 bool RenderWidgetHostViewAura::HasAcceleratedSurface( |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 | 1764 |
1749 void RenderWidgetHostViewAura::OnCompositingLockStateChanged( | 1765 void RenderWidgetHostViewAura::OnCompositingLockStateChanged( |
1750 ui::Compositor* compositor) { | 1766 ui::Compositor* compositor) { |
1751 // A compositor lock that is part of a resize lock timed out. We | 1767 // A compositor lock that is part of a resize lock timed out. We |
1752 // should display a renderer frame. | 1768 // should display a renderer frame. |
1753 if (!compositor->IsLocked() && can_lock_compositor_ == YES_DID_LOCK) { | 1769 if (!compositor->IsLocked() && can_lock_compositor_ == YES_DID_LOCK) { |
1754 can_lock_compositor_ = NO_PENDING_RENDERER_FRAME; | 1770 can_lock_compositor_ = NO_PENDING_RENDERER_FRAME; |
1755 } | 1771 } |
1756 } | 1772 } |
1757 | 1773 |
| 1774 void RenderWidgetHostViewAura::OnReceivedLatencyInfo( |
| 1775 ui::Compositor* compositor, |
| 1776 const cc::LatencyInfo& latency_info) { |
| 1777 while (!frame_queue_.empty()) { |
| 1778 const FrameLatency& frame_latency = frame_queue_.front(); |
| 1779 if (latency_info.rendererMainFrameNumber < |
| 1780 frame_latency.latency_info.browserMainFrameNumber) |
| 1781 break; |
| 1782 |
| 1783 cc::LatencyInfo real_latency_info = frame_latency.latency_info; |
| 1784 real_latency_info.browserMainFrameNumber = |
| 1785 latency_info.rendererMainFrameNumber; |
| 1786 real_latency_info.browserImplFrameNumber = |
| 1787 latency_info.rendererImplFrameNumber; |
| 1788 real_latency_info.swapTimestamp = latency_info.swapTimestamp; |
| 1789 RenderWidgetHostImpl::NotifyFrameDisplayed(frame_latency.route_id, |
| 1790 frame_latency.gpu_host_id, |
| 1791 real_latency_info); |
| 1792 frame_queue_.pop(); |
| 1793 } |
| 1794 } |
| 1795 |
1758 //////////////////////////////////////////////////////////////////////////////// | 1796 //////////////////////////////////////////////////////////////////////////////// |
1759 // RenderWidgetHostViewAura, ImageTransportFactoryObserver implementation: | 1797 // RenderWidgetHostViewAura, ImageTransportFactoryObserver implementation: |
1760 | 1798 |
1761 void RenderWidgetHostViewAura::OnLostResources() { | 1799 void RenderWidgetHostViewAura::OnLostResources() { |
1762 current_surface_ = NULL; | 1800 current_surface_ = NULL; |
1763 UpdateExternalTexture(); | 1801 UpdateExternalTexture(); |
1764 locks_pending_commit_.clear(); | 1802 locks_pending_commit_.clear(); |
1765 | 1803 |
1766 DCHECK(!shared_surface_handle_.is_null()); | 1804 DCHECK(!shared_surface_handle_.is_null()); |
1767 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 1805 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1968 RenderWidgetHost* widget) { | 2006 RenderWidgetHost* widget) { |
1969 return new RenderWidgetHostViewAura(widget); | 2007 return new RenderWidgetHostViewAura(widget); |
1970 } | 2008 } |
1971 | 2009 |
1972 // static | 2010 // static |
1973 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 2011 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
1974 GetScreenInfoForWindow(results, NULL); | 2012 GetScreenInfoForWindow(results, NULL); |
1975 } | 2013 } |
1976 | 2014 |
1977 } // namespace content | 2015 } // namespace content |
OLD | NEW |