Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(645)

Side by Side Diff: content/renderer/render_widget.cc

Issue 9307043: Revert 120111 - Defer render_widget draw until host window is available (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 168 }
169 169
170 // This is used to complete pending inits and non-pending inits. For non- 170 // This is used to complete pending inits and non-pending inits. For non-
171 // pending cases, the parent will be the same as the current parent. This 171 // pending cases, the parent will be the same as the current parent. This
172 // indicates we do not need to reparent or anything. 172 // indicates we do not need to reparent or anything.
173 void RenderWidget::CompleteInit(gfx::NativeViewId parent_hwnd) { 173 void RenderWidget::CompleteInit(gfx::NativeViewId parent_hwnd) {
174 DCHECK(routing_id_ != MSG_ROUTING_NONE); 174 DCHECK(routing_id_ != MSG_ROUTING_NONE);
175 175
176 host_window_ = parent_hwnd; 176 host_window_ = parent_hwnd;
177 177
178 DoDeferredUpdate();
179
180 Send(new ViewHostMsg_RenderViewReady(routing_id_)); 178 Send(new ViewHostMsg_RenderViewReady(routing_id_));
181 } 179 }
182 180
183 void RenderWidget::SetSwappedOut(bool is_swapped_out) { 181 void RenderWidget::SetSwappedOut(bool is_swapped_out) {
184 // We should only toggle between states. 182 // We should only toggle between states.
185 DCHECK(is_swapped_out_ != is_swapped_out); 183 DCHECK(is_swapped_out_ != is_swapped_out);
186 is_swapped_out_ = is_swapped_out; 184 is_swapped_out_ = is_swapped_out;
187 185
188 // If we are swapping out, we will call ReleaseProcess, allowing the process 186 // If we are swapping out, we will call ReleaseProcess, allowing the process
189 // to exit if all of its RenderViews are swapped out. We wait until the 187 // to exit if all of its RenderViews are swapped out. We wait until the
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 730
733 if (pending_input_event_ack_.get()) 731 if (pending_input_event_ack_.get())
734 Send(pending_input_event_ack_.release()); 732 Send(pending_input_event_ack_.release());
735 } 733 }
736 734
737 void RenderWidget::DoDeferredUpdate() { 735 void RenderWidget::DoDeferredUpdate() {
738 TRACE_EVENT0("renderer", "RenderWidget::DoDeferredUpdate"); 736 TRACE_EVENT0("renderer", "RenderWidget::DoDeferredUpdate");
739 737
740 if (!webwidget_) 738 if (!webwidget_)
741 return; 739 return;
742
743 if (!host_window_) {
744 TRACE_EVENT0("renderer", "EarlyOut_NoHostWindow");
745 return;
746 }
747 if (update_reply_pending_) { 740 if (update_reply_pending_) {
748 TRACE_EVENT0("renderer", "EarlyOut_UpdateReplyPending"); 741 TRACE_EVENT0("renderer", "EarlyOut_UpdateReplyPending");
749 return; 742 return;
750 } 743 }
751 if (is_accelerated_compositing_active_ && 744 if (is_accelerated_compositing_active_ &&
752 num_swapbuffers_complete_pending_ >= kMaxSwapBuffersPending) { 745 num_swapbuffers_complete_pending_ >= kMaxSwapBuffersPending) {
753 TRACE_EVENT0("renderer", "EarlyOut_MaxSwapBuffersPending"); 746 TRACE_EVENT0("renderer", "EarlyOut_MaxSwapBuffersPending");
754 return; 747 return;
755 } 748 }
756 749
757 // Suppress updating when we are hidden. 750 // Suppress updating when we are hidden.
758 if (is_hidden_ || size_.IsEmpty()) { 751 if (is_hidden_ || size_.IsEmpty()) {
759 paint_aggregator_.ClearPendingUpdate(); 752 paint_aggregator_.ClearPendingUpdate();
760 needs_repainting_on_restore_ = true; 753 needs_repainting_on_restore_ = true;
761 TRACE_EVENT0("renderer", "EarlyOut_NotVisible"); 754 TRACE_EVENT0("renderer", "EarlyOut_NotVisible");
762 return; 755 return;
763 } 756 }
764 757
765 if (is_accelerated_compositing_active_)
766 using_asynchronous_swapbuffers_ = SupportsAsynchronousSwapBuffers();
767
768 // Tracking of frame rate jitter 758 // Tracking of frame rate jitter
769 base::TimeTicks frame_begin_ticks = base::TimeTicks::Now(); 759 base::TimeTicks frame_begin_ticks = base::TimeTicks::Now();
770 AnimateIfNeeded(); 760 AnimateIfNeeded();
771 761
772 // Layout may generate more invalidation. It may also enable the 762 // Layout may generate more invalidation. It may also enable the
773 // GPU acceleration, so make sure to run layout before we send the 763 // GPU acceleration, so make sure to run layout before we send the
774 // GpuRenderingActivated message. 764 // GpuRenderingActivated message.
775 webwidget_->layout(); 765 webwidget_->layout();
776 766
777 // Suppress painting if nothing is dirty. This has to be done after updating 767 // Suppress painting if nothing is dirty. This has to be done after updating
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 // round-trips to the browser's UI thread before finishing the frame, 1003 // round-trips to the browser's UI thread before finishing the frame,
1014 // causing deadlocks if we delay the UpdateRect until we receive the 1004 // causing deadlocks if we delay the UpdateRect until we receive the
1015 // OnSwapBuffersComplete. So send a dummy message that will unblock the 1005 // OnSwapBuffersComplete. So send a dummy message that will unblock the
1016 // browser's UI thread. 1006 // browser's UI thread.
1017 Send(new ViewHostMsg_UpdateIsDelayed(routing_id_)); 1007 Send(new ViewHostMsg_UpdateIsDelayed(routing_id_));
1018 } 1008 }
1019 1009
1020 is_accelerated_compositing_active_ = true; 1010 is_accelerated_compositing_active_ = true;
1021 Send(new ViewHostMsg_DidActivateAcceleratedCompositing( 1011 Send(new ViewHostMsg_DidActivateAcceleratedCompositing(
1022 routing_id_, is_accelerated_compositing_active_)); 1012 routing_id_, is_accelerated_compositing_active_));
1013
1014 // Note: asynchronous swapbuffer support currently only matters if
1015 // compositing scheduling happens on the RenderWidget.
1016 using_asynchronous_swapbuffers_ = SupportsAsynchronousSwapBuffers();
1023 } 1017 }
1024 1018
1025 void RenderWidget::didDeactivateCompositor() { 1019 void RenderWidget::didDeactivateCompositor() {
1026 TRACE_EVENT0("gpu", "RenderWidget::didDeactivateCompositor"); 1020 TRACE_EVENT0("gpu", "RenderWidget::didDeactivateCompositor");
1027 1021
1028 is_accelerated_compositing_active_ = false; 1022 is_accelerated_compositing_active_ = false;
1029 Send(new ViewHostMsg_DidActivateAcceleratedCompositing( 1023 Send(new ViewHostMsg_DidActivateAcceleratedCompositing(
1030 routing_id_, is_accelerated_compositing_active_)); 1024 routing_id_, is_accelerated_compositing_active_));
1031 1025
1032 if (using_asynchronous_swapbuffers_) 1026 if (using_asynchronous_swapbuffers_)
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 } 1569 }
1576 } 1570 }
1577 1571
1578 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { 1572 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) {
1579 return false; 1573 return false;
1580 } 1574 }
1581 1575
1582 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { 1576 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const {
1583 return false; 1577 return false;
1584 } 1578 }
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698