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 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 } else { // Accelerated compositing path | 1138 } else { // Accelerated compositing path |
1139 // Begin painting. | 1139 // Begin painting. |
1140 // If painting is done via the gpu process then we don't set any damage | 1140 // If painting is done via the gpu process then we don't set any damage |
1141 // rects to save the browser process from doing unecessary work. | 1141 // rects to save the browser process from doing unecessary work. |
1142 pending_update_params_->bitmap_rect = bounds; | 1142 pending_update_params_->bitmap_rect = bounds; |
1143 pending_update_params_->scroll_rect = gfx::Rect(); | 1143 pending_update_params_->scroll_rect = gfx::Rect(); |
1144 // We don't need an ack, because we're not sharing a DIB with the browser. | 1144 // We don't need an ack, because we're not sharing a DIB with the browser. |
1145 // If it needs to (e.g. composited UI), the GPU process does its own ACK | 1145 // If it needs to (e.g. composited UI), the GPU process does its own ACK |
1146 // with the browser for the GPU surface. | 1146 // with the browser for the GPU surface. |
1147 pending_update_params_->needs_ack = false; | 1147 pending_update_params_->needs_ack = false; |
1148 Composite(); | 1148 webwidget_->composite(false); |
1149 } | 1149 } |
1150 | 1150 |
1151 // If we're holding a pending input event ACK, send the ACK before sending the | 1151 // If we're holding a pending input event ACK, send the ACK before sending the |
1152 // UpdateReply message so we can receive another input event before the | 1152 // UpdateReply message so we can receive another input event before the |
1153 // UpdateRect_ACK on platforms where the UpdateRect_ACK is sent from within | 1153 // UpdateRect_ACK on platforms where the UpdateRect_ACK is sent from within |
1154 // the UpdateRect IPC message handler. | 1154 // the UpdateRect IPC message handler. |
1155 if (pending_input_event_ack_.get()) | 1155 if (pending_input_event_ack_.get()) |
1156 Send(pending_input_event_ack_.release()); | 1156 Send(pending_input_event_ack_.release()); |
1157 | 1157 |
1158 // If Composite() called SwapBuffers, pending_update_params_ will be reset (in | 1158 // If composite() called SwapBuffers, pending_update_params_ will be reset (in |
1159 // OnSwapBuffersPosted), meaning a message has been added to the | 1159 // OnSwapBuffersPosted), meaning a message has been added to the |
1160 // updates_pending_swap_ queue, that will be sent later. Otherwise, we send | 1160 // updates_pending_swap_ queue, that will be sent later. Otherwise, we send |
1161 // the message now. | 1161 // the message now. |
1162 if (pending_update_params_.get()) { | 1162 if (pending_update_params_.get()) { |
1163 // sending an ack to browser process that the paint is complete... | 1163 // sending an ack to browser process that the paint is complete... |
1164 update_reply_pending_ = pending_update_params_->needs_ack; | 1164 update_reply_pending_ = pending_update_params_->needs_ack; |
1165 Send(new ViewHostMsg_UpdateRect(routing_id_, *pending_update_params_)); | 1165 Send(new ViewHostMsg_UpdateRect(routing_id_, *pending_update_params_)); |
1166 pending_update_params_.reset(); | 1166 pending_update_params_.reset(); |
1167 } | 1167 } |
1168 | 1168 |
1169 // If we're software rendering then we're done initiating the paint. | 1169 // If we're software rendering then we're done initiating the paint. |
1170 if (!is_accelerated_compositing_active_) | 1170 if (!is_accelerated_compositing_active_) |
1171 DidInitiatePaint(); | 1171 DidInitiatePaint(); |
1172 } | 1172 } |
1173 | 1173 |
1174 void RenderWidget::Composite() { | |
1175 DCHECK(is_accelerated_compositing_active_); | |
1176 DCHECK(web_layer_tree_view_); | |
1177 web_layer_tree_view_->composite(); | |
1178 } | |
1179 | |
1180 /////////////////////////////////////////////////////////////////////////////// | 1174 /////////////////////////////////////////////////////////////////////////////// |
1181 // WebWidgetClient | 1175 // WebWidgetClient |
1182 | 1176 |
1183 void RenderWidget::didInvalidateRect(const WebRect& rect) { | 1177 void RenderWidget::didInvalidateRect(const WebRect& rect) { |
1184 TRACE_EVENT2("renderer", "RenderWidget::didInvalidateRect", | 1178 TRACE_EVENT2("renderer", "RenderWidget::didInvalidateRect", |
1185 "width", rect.width, "height", rect.height); | 1179 "width", rect.width, "height", rect.height); |
1186 // The invalidated rect might be outside the bounds of the view. | 1180 // The invalidated rect might be outside the bounds of the view. |
1187 gfx::Rect view_rect(size_); | 1181 gfx::Rect view_rect(size_); |
1188 gfx::Rect damaged_rect = gfx::IntersectRects(view_rect, rect); | 1182 gfx::Rect damaged_rect = gfx::IntersectRects(view_rect, rect); |
1189 if (damaged_rect.IsEmpty()) | 1183 if (damaged_rect.IsEmpty()) |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2110 | 2104 |
2111 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 2105 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
2112 return false; | 2106 return false; |
2113 } | 2107 } |
2114 | 2108 |
2115 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { | 2109 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { |
2116 return true; | 2110 return true; |
2117 } | 2111 } |
2118 | 2112 |
2119 } // namespace content | 2113 } // namespace content |
OLD | NEW |