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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 } | 918 } |
919 | 919 |
920 // Calculate filtered time per frame: | 920 // Calculate filtered time per frame: |
921 float frame_time_elapsed = static_cast<float>(delay.InSecondsF()); | 921 float frame_time_elapsed = static_cast<float>(delay.InSecondsF()); |
922 filtered_time_per_frame_ = | 922 filtered_time_per_frame_ = |
923 0.9f * filtered_time_per_frame_ + 0.1f * frame_time_elapsed; | 923 0.9f * filtered_time_per_frame_ + 0.1f * frame_time_elapsed; |
924 } | 924 } |
925 last_do_deferred_update_time_ = frame_begin_ticks; | 925 last_do_deferred_update_time_ = frame_begin_ticks; |
926 | 926 |
927 if (!is_accelerated_compositing_active_) { | 927 if (!is_accelerated_compositing_active_) { |
928 software_stats_.numAnimationFrames++; | 928 software_stats_.mainAnimationFrameCount++; |
929 software_stats_.numFramesSentToScreen++; | 929 software_stats_.compositorFrameCount++; |
930 } | 930 } |
931 | 931 |
932 // OK, save the pending update to a local since painting may cause more | 932 // OK, save the pending update to a local since painting may cause more |
933 // invalidation. Some WebCore rendering objects only layout when painted. | 933 // invalidation. Some WebCore rendering objects only layout when painted. |
934 PaintAggregator::PendingUpdate update; | 934 PaintAggregator::PendingUpdate update; |
935 paint_aggregator_.PopPendingUpdate(&update); | 935 paint_aggregator_.PopPendingUpdate(&update); |
936 | 936 |
937 gfx::Rect scroll_damage = update.GetScrollDamage(); | 937 gfx::Rect scroll_damage = update.GetScrollDamage(); |
938 gfx::Rect bounds = update.GetPaintBounds().Union(scroll_damage); | 938 gfx::Rect bounds = update.GetPaintBounds().Union(scroll_damage); |
939 | 939 |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1853 i != plugin_window_moves_.end(); ++i) { | 1853 i != plugin_window_moves_.end(); ++i) { |
1854 if (i->window == window) { | 1854 if (i->window == window) { |
1855 plugin_window_moves_.erase(i); | 1855 plugin_window_moves_.erase(i); |
1856 break; | 1856 break; |
1857 } | 1857 } |
1858 } | 1858 } |
1859 } | 1859 } |
1860 | 1860 |
1861 void RenderWidget::GetRenderingStats(WebKit::WebRenderingStats& stats) const { | 1861 void RenderWidget::GetRenderingStats(WebKit::WebRenderingStats& stats) const { |
1862 webwidget()->renderingStats(stats); | 1862 webwidget()->renderingStats(stats); |
1863 stats.numAnimationFrames += software_stats_.numAnimationFrames; | 1863 stats.mainAnimationFrameCount += software_stats_.mainAnimationFrameCount; |
1864 stats.numFramesSentToScreen += software_stats_.numFramesSentToScreen; | 1864 stats.compositorFrameCount += software_stats_.compositorFrameCount; |
1865 stats.totalPaintTimeInSeconds += software_stats_.totalPaintTimeInSeconds; | 1865 stats.totalPaintTimeInSeconds += software_stats_.totalPaintTimeInSeconds; |
1866 } | 1866 } |
1867 | 1867 |
1868 bool RenderWidget::GetGpuRenderingStats( | 1868 bool RenderWidget::GetGpuRenderingStats( |
1869 content::GpuRenderingStats* stats) const { | 1869 content::GpuRenderingStats* stats) const { |
1870 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); | 1870 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); |
1871 if (!gpu_channel) | 1871 if (!gpu_channel) |
1872 return false; | 1872 return false; |
1873 | 1873 |
1874 return gpu_channel->CollectRenderingStatsForSurface(surface_id(), stats); | 1874 return gpu_channel->CollectRenderingStatsForSurface(surface_id(), stats); |
1875 } | 1875 } |
1876 | 1876 |
1877 void RenderWidget::BeginSmoothScroll( | 1877 void RenderWidget::BeginSmoothScroll( |
1878 bool down, | 1878 bool down, |
1879 bool scroll_far, | 1879 bool scroll_far, |
1880 const SmoothScrollCompletionCallback& callback) { | 1880 const SmoothScrollCompletionCallback& callback) { |
1881 DCHECK(!callback.is_null()); | 1881 DCHECK(!callback.is_null()); |
1882 int id = next_smooth_scroll_gesture_id_++; | 1882 int id = next_smooth_scroll_gesture_id_++; |
1883 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, id, down, scroll_far)); | 1883 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, id, down, scroll_far)); |
1884 pending_smooth_scroll_gestures_.insert(std::make_pair(id, callback)); | 1884 pending_smooth_scroll_gestures_.insert(std::make_pair(id, callback)); |
1885 } | 1885 } |
1886 | 1886 |
1887 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 1887 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
1888 return false; | 1888 return false; |
1889 } | 1889 } |
1890 | 1890 |
1891 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 1891 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
1892 return false; | 1892 return false; |
1893 } | 1893 } |
OLD | NEW |