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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "content/common/swapped_out_messages.h" | 17 #include "content/common/swapped_out_messages.h" |
18 #include "content/common/view_messages.h" | 18 #include "content/common/view_messages.h" |
19 #include "content/public/common/content_switches.h" | 19 #include "content/public/common/content_switches.h" |
20 #include "content/renderer/render_process.h" | 20 #include "content/renderer/render_process.h" |
21 #include "content/renderer/render_thread_impl.h" | 21 #include "content/renderer/render_thread_impl.h" |
22 #include "content/renderer/renderer_webkitplatformsupport_impl.h" | 22 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
23 #include "ipc/ipc_sync_message.h" | 23 #include "ipc/ipc_sync_message.h" |
24 #include "skia/ext/platform_canvas.h" | 24 #include "skia/ext/platform_canvas.h" |
25 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h " | |
25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHelperPlugin.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHelperPlugin.h" |
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPagePopup.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPagePopup.h" |
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h" |
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenuInfo.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenuInfo.h" |
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" |
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" | 33 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" |
33 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" | 34 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" |
34 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" | 35 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 is_swapped_out_(swapped_out), | 101 is_swapped_out_(swapped_out), |
101 input_method_is_active_(false), | 102 input_method_is_active_(false), |
102 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 103 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
103 can_compose_inline_(true), | 104 can_compose_inline_(true), |
104 popup_type_(popup_type), | 105 popup_type_(popup_type), |
105 pending_window_rect_count_(0), | 106 pending_window_rect_count_(0), |
106 suppress_next_char_events_(false), | 107 suppress_next_char_events_(false), |
107 is_accelerated_compositing_active_(false), | 108 is_accelerated_compositing_active_(false), |
108 animation_update_pending_(false), | 109 animation_update_pending_(false), |
109 invalidation_task_posted_(false), | 110 invalidation_task_posted_(false), |
111 deferred_update_count_(0), | |
110 screen_info_(screen_info), | 112 screen_info_(screen_info), |
111 device_scale_factor_(1) { | 113 device_scale_factor_(1) { |
112 if (!swapped_out) | 114 if (!swapped_out) |
113 RenderProcess::current()->AddRefProcess(); | 115 RenderProcess::current()->AddRefProcess(); |
114 DCHECK(RenderThread::Get()); | 116 DCHECK(RenderThread::Get()); |
115 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( | 117 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( |
116 switches::kDisableGpuVsync); | 118 switches::kDisableGpuVsync); |
117 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) | 119 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) |
118 device_scale_factor_ = screen_info.verticalDPI / kStandardDPI; | 120 device_scale_factor_ = screen_info.verticalDPI / kStandardDPI; |
119 // Unless an explicit scale factor was provided for testing, ensure the scale | 121 // Unless an explicit scale factor was provided for testing, ensure the scale |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
882 60); | 884 60); |
883 } | 885 } |
884 | 886 |
885 // Calculate filtered time per frame: | 887 // Calculate filtered time per frame: |
886 float frame_time_elapsed = static_cast<float>(delay.InSecondsF()); | 888 float frame_time_elapsed = static_cast<float>(delay.InSecondsF()); |
887 filtered_time_per_frame_ = | 889 filtered_time_per_frame_ = |
888 0.9f * filtered_time_per_frame_ + 0.1f * frame_time_elapsed; | 890 0.9f * filtered_time_per_frame_ + 0.1f * frame_time_elapsed; |
889 } | 891 } |
890 last_do_deferred_update_time_ = frame_begin_ticks; | 892 last_do_deferred_update_time_ = frame_begin_ticks; |
891 | 893 |
894 if (!is_accelerated_compositing_active_) | |
895 deferred_update_count_++; | |
piman
2012/07/27 03:39:44
I'm not exactly sure what you're trying to count,
dtu
2012/07/31 01:35:00
Removed this.
| |
896 | |
892 // OK, save the pending update to a local since painting may cause more | 897 // OK, save the pending update to a local since painting may cause more |
893 // invalidation. Some WebCore rendering objects only layout when painted. | 898 // invalidation. Some WebCore rendering objects only layout when painted. |
894 PaintAggregator::PendingUpdate update; | 899 PaintAggregator::PendingUpdate update; |
895 paint_aggregator_.PopPendingUpdate(&update); | 900 paint_aggregator_.PopPendingUpdate(&update); |
896 | 901 |
897 gfx::Rect scroll_damage = update.GetScrollDamage(); | 902 gfx::Rect scroll_damage = update.GetScrollDamage(); |
898 gfx::Rect bounds = update.GetPaintBounds().Union(scroll_damage); | 903 gfx::Rect bounds = update.GetPaintBounds().Union(scroll_damage); |
899 | 904 |
900 // Notify derived classes that we're about to initiate a paint. | 905 // Notify derived classes that we're about to initiate a paint. |
901 WillInitiatePaint(); | 906 WillInitiatePaint(); |
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1762 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { | 1767 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { |
1763 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); | 1768 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); |
1764 i != plugin_window_moves_.end(); ++i) { | 1769 i != plugin_window_moves_.end(); ++i) { |
1765 if (i->window == window) { | 1770 if (i->window == window) { |
1766 plugin_window_moves_.erase(i); | 1771 plugin_window_moves_.erase(i); |
1767 break; | 1772 break; |
1768 } | 1773 } |
1769 } | 1774 } |
1770 } | 1775 } |
1771 | 1776 |
1777 void RenderWidget::GetRenderingStats(WebKit::WebRenderingStats& stats) const { | |
1778 webwidget()->renderingStats(stats); | |
1779 stats.numAnimationFrames += deferred_update_count_; | |
1780 stats.numFramesSentToScreen += deferred_update_count_; | |
1781 } | |
1782 | |
1772 void RenderWidget::BeginSmoothScroll(bool down, bool scroll_far) { | 1783 void RenderWidget::BeginSmoothScroll(bool down, bool scroll_far) { |
1773 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, down, scroll_far)); | 1784 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, down, scroll_far)); |
1774 } | 1785 } |
1775 | 1786 |
1776 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 1787 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
1777 return false; | 1788 return false; |
1778 } | 1789 } |
1779 | 1790 |
1780 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 1791 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
1781 return false; | 1792 return false; |
1782 } | 1793 } |
OLD | NEW |