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 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 } else { // Accelerated compositing path | 1077 } else { // Accelerated compositing path |
1078 // Begin painting. | 1078 // Begin painting. |
1079 // If painting is done via the gpu process then we don't set any damage | 1079 // If painting is done via the gpu process then we don't set any damage |
1080 // rects to save the browser process from doing unecessary work. | 1080 // rects to save the browser process from doing unecessary work. |
1081 pending_update_params_->bitmap_rect = bounds; | 1081 pending_update_params_->bitmap_rect = bounds; |
1082 pending_update_params_->scroll_rect = gfx::Rect(); | 1082 pending_update_params_->scroll_rect = gfx::Rect(); |
1083 // We don't need an ack, because we're not sharing a DIB with the browser. | 1083 // We don't need an ack, because we're not sharing a DIB with the browser. |
1084 // If it needs to (e.g. composited UI), the GPU process does its own ACK | 1084 // If it needs to (e.g. composited UI), the GPU process does its own ACK |
1085 // with the browser for the GPU surface. | 1085 // with the browser for the GPU surface. |
1086 pending_update_params_->needs_ack = false; | 1086 pending_update_params_->needs_ack = false; |
1087 webwidget_->composite(false); | 1087 Composite(); |
1088 } | 1088 } |
1089 | 1089 |
1090 // If we're holding a pending input event ACK, send the ACK before sending the | 1090 // If we're holding a pending input event ACK, send the ACK before sending the |
1091 // UpdateReply message so we can receive another input event before the | 1091 // UpdateReply message so we can receive another input event before the |
1092 // UpdateRect_ACK on platforms where the UpdateRect_ACK is sent from within | 1092 // UpdateRect_ACK on platforms where the UpdateRect_ACK is sent from within |
1093 // the UpdateRect IPC message handler. | 1093 // the UpdateRect IPC message handler. |
1094 if (pending_input_event_ack_.get()) | 1094 if (pending_input_event_ack_.get()) |
1095 Send(pending_input_event_ack_.release()); | 1095 Send(pending_input_event_ack_.release()); |
1096 | 1096 |
1097 // If composite() called SwapBuffers, pending_update_params_ will be reset (in | 1097 // If Composite() called SwapBuffers, pending_update_params_ will be reset (in |
1098 // OnSwapBuffersPosted), meaning a message has been added to the | 1098 // OnSwapBuffersPosted), meaning a message has been added to the |
1099 // updates_pending_swap_ queue, that will be sent later. Otherwise, we send | 1099 // updates_pending_swap_ queue, that will be sent later. Otherwise, we send |
1100 // the message now. | 1100 // the message now. |
1101 if (pending_update_params_.get()) { | 1101 if (pending_update_params_.get()) { |
1102 // sending an ack to browser process that the paint is complete... | 1102 // sending an ack to browser process that the paint is complete... |
1103 update_reply_pending_ = pending_update_params_->needs_ack; | 1103 update_reply_pending_ = pending_update_params_->needs_ack; |
1104 Send(new ViewHostMsg_UpdateRect(routing_id_, *pending_update_params_)); | 1104 Send(new ViewHostMsg_UpdateRect(routing_id_, *pending_update_params_)); |
1105 pending_update_params_.reset(); | 1105 pending_update_params_.reset(); |
1106 } | 1106 } |
1107 | 1107 |
1108 // If we're software rendering then we're done initiating the paint. | 1108 // If we're software rendering then we're done initiating the paint. |
1109 if (!is_accelerated_compositing_active_) | 1109 if (!is_accelerated_compositing_active_) |
1110 DidInitiatePaint(); | 1110 DidInitiatePaint(); |
1111 } | 1111 } |
1112 | 1112 |
| 1113 void RenderWidget::Composite() { |
| 1114 DCHECK(is_accelerated_compositing_active_); |
| 1115 DCHECK(web_layer_tree_view_); |
| 1116 web_layer_tree_view_->composite(); |
| 1117 } |
| 1118 |
1113 /////////////////////////////////////////////////////////////////////////////// | 1119 /////////////////////////////////////////////////////////////////////////////// |
1114 // WebWidgetClient | 1120 // WebWidgetClient |
1115 | 1121 |
1116 void RenderWidget::didInvalidateRect(const WebRect& rect) { | 1122 void RenderWidget::didInvalidateRect(const WebRect& rect) { |
1117 TRACE_EVENT2("renderer", "RenderWidget::didInvalidateRect", | 1123 TRACE_EVENT2("renderer", "RenderWidget::didInvalidateRect", |
1118 "width", rect.width, "height", rect.height); | 1124 "width", rect.width, "height", rect.height); |
1119 // The invalidated rect might be outside the bounds of the view. | 1125 // The invalidated rect might be outside the bounds of the view. |
1120 gfx::Rect view_rect(size_); | 1126 gfx::Rect view_rect(size_); |
1121 gfx::Rect damaged_rect = gfx::IntersectRects(view_rect, rect); | 1127 gfx::Rect damaged_rect = gfx::IntersectRects(view_rect, rect); |
1122 if (damaged_rect.IsEmpty()) | 1128 if (damaged_rect.IsEmpty()) |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2027 | 2033 |
2028 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 2034 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
2029 return false; | 2035 return false; |
2030 } | 2036 } |
2031 | 2037 |
2032 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { | 2038 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { |
2033 return true; | 2039 return true; |
2034 } | 2040 } |
2035 | 2041 |
2036 } // namespace content | 2042 } // namespace content |
OLD | NEW |