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 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1154 params.view_size = size_; | 1154 params.view_size = size_; |
1155 params.plugin_window_moves.swap(plugin_window_moves_); | 1155 params.plugin_window_moves.swap(plugin_window_moves_); |
1156 params.flags = next_paint_flags_; | 1156 params.flags = next_paint_flags_; |
1157 params.scroll_offset = GetScrollOffset(); | 1157 params.scroll_offset = GetScrollOffset(); |
1158 params.needs_ack = false; | 1158 params.needs_ack = false; |
1159 | 1159 |
1160 Send(new ViewHostMsg_UpdateRect(routing_id_, params)); | 1160 Send(new ViewHostMsg_UpdateRect(routing_id_, params)); |
1161 next_paint_flags_ = 0; | 1161 next_paint_flags_ = 0; |
1162 } | 1162 } |
1163 | 1163 |
1164 #if defined(WEBWIDGETCLIENT_SCHEDULECOMPOSITE_RETURNS_BOOL) | |
1165 bool RenderWidget::scheduleComposite() { | |
nduca
2012/05/02 06:53:00
Can you fix this with less code duplication? E.g.
| |
1166 if (WebWidgetHandlesCompositorScheduling()) { | |
1167 webwidget_->composite(false); | |
1168 return true; | |
1169 } | |
1170 | |
1171 // TODO(nduca): replace with something a little less hacky. The reason this | |
1172 // hack is still used is because the Invalidate-DoDeferredUpdate loop | |
1173 // contains a lot of host-renderer synchronization logic that is still | |
1174 // important for the accelerated compositing case. The option of simply | |
1175 // duplicating all that code is less desirable than "faking out" the | |
1176 // invalidation path using a magical damage rect. | |
1177 didInvalidateRect(WebRect(0, 0, 1, 1)); | |
1178 return !is_hidden_; | |
nduca
2012/05/02 06:53:00
This feels fragile to me. You're assuming things h
| |
1179 } | |
1180 #else | |
1164 void RenderWidget::scheduleComposite() { | 1181 void RenderWidget::scheduleComposite() { |
1165 if (WebWidgetHandlesCompositorScheduling()) { | 1182 if (WebWidgetHandlesCompositorScheduling()) { |
1166 webwidget_->composite(false); | 1183 webwidget_->composite(false); |
1167 } else { | 1184 } else { |
1168 // TODO(nduca): replace with something a little less hacky. The reason this | 1185 // TODO(nduca): replace with something a little less hacky. The reason this |
1169 // hack is still used is because the Invalidate-DoDeferredUpdate loop | 1186 // hack is still used is because the Invalidate-DoDeferredUpdate loop |
1170 // contains a lot of host-renderer synchronization logic that is still | 1187 // contains a lot of host-renderer synchronization logic that is still |
1171 // important for the accelerated compositing case. The option of simply | 1188 // important for the accelerated compositing case. The option of simply |
1172 // duplicating all that code is less desirable than "faking out" the | 1189 // duplicating all that code is less desirable than "faking out" the |
1173 // invalidation path using a magical damage rect. | 1190 // invalidation path using a magical damage rect. |
1174 didInvalidateRect(WebRect(0, 0, 1, 1)); | 1191 didInvalidateRect(WebRect(0, 0, 1, 1)); |
1175 } | 1192 } |
1176 } | 1193 } |
1194 #endif | |
1177 | 1195 |
1178 void RenderWidget::scheduleAnimation() { | 1196 void RenderWidget::scheduleAnimation() { |
1179 if (animation_update_pending_) | 1197 if (animation_update_pending_) |
1180 return; | 1198 return; |
1181 | 1199 |
1182 TRACE_EVENT0("gpu", "RenderWidget::scheduleAnimation"); | 1200 TRACE_EVENT0("gpu", "RenderWidget::scheduleAnimation"); |
1183 animation_update_pending_ = true; | 1201 animation_update_pending_ = true; |
1184 if (!animation_timer_.IsRunning()) { | 1202 if (!animation_timer_.IsRunning()) { |
1185 animation_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(0), this, | 1203 animation_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(0), this, |
1186 &RenderWidget::AnimationCallback); | 1204 &RenderWidget::AnimationCallback); |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1696 } | 1714 } |
1697 } | 1715 } |
1698 | 1716 |
1699 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 1717 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
1700 return false; | 1718 return false; |
1701 } | 1719 } |
1702 | 1720 |
1703 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 1721 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
1704 return false; | 1722 return false; |
1705 } | 1723 } |
OLD | NEW |