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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 } | 1109 } |
1110 | 1110 |
1111 // Suppress updating when we are hidden. | 1111 // Suppress updating when we are hidden. |
1112 if (is_hidden_ || size_.IsEmpty() || is_swapped_out_) { | 1112 if (is_hidden_ || size_.IsEmpty() || is_swapped_out_) { |
1113 paint_aggregator_.ClearPendingUpdate(); | 1113 paint_aggregator_.ClearPendingUpdate(); |
1114 needs_repainting_on_restore_ = true; | 1114 needs_repainting_on_restore_ = true; |
1115 TRACE_EVENT0("renderer", "EarlyOut_NotVisible"); | 1115 TRACE_EVENT0("renderer", "EarlyOut_NotVisible"); |
1116 return; | 1116 return; |
1117 } | 1117 } |
1118 | 1118 |
1119 if (is_accelerated_compositing_active_) | |
1120 using_asynchronous_swapbuffers_ = SupportsAsynchronousSwapBuffers(); | |
1121 | |
1122 // Tracking of frame rate jitter | 1119 // Tracking of frame rate jitter |
1123 base::TimeTicks frame_begin_ticks = base::TimeTicks::Now(); | 1120 base::TimeTicks frame_begin_ticks = base::TimeTicks::Now(); |
1124 InstrumentWillBeginFrame(); | 1121 InstrumentWillBeginFrame(); |
1125 AnimateIfNeeded(); | 1122 AnimateIfNeeded(); |
1126 | 1123 |
1127 // Layout may generate more invalidation. It may also enable the | 1124 // Layout may generate more invalidation. It may also enable the |
1128 // GPU acceleration, so make sure to run layout before we send the | 1125 // GPU acceleration, so make sure to run layout before we send the |
1129 // GpuRenderingActivated message. | 1126 // GpuRenderingActivated message. |
1130 webwidget_->layout(); | 1127 webwidget_->layout(); |
1131 | 1128 |
| 1129 // Check for whether we need to track swap buffers. We need to do that after |
| 1130 // layout() because it may have switched us to accelerated compositing. |
| 1131 if (is_accelerated_compositing_active_) |
| 1132 using_asynchronous_swapbuffers_ = SupportsAsynchronousSwapBuffers(); |
| 1133 |
1132 // The following two can result in further layout and possibly | 1134 // The following two can result in further layout and possibly |
1133 // enable GPU acceleration so they need to be called before any painting | 1135 // enable GPU acceleration so they need to be called before any painting |
1134 // is done. | 1136 // is done. |
1135 UpdateTextInputState(DO_NOT_SHOW_IME); | 1137 UpdateTextInputState(DO_NOT_SHOW_IME); |
1136 UpdateSelectionBounds(); | 1138 UpdateSelectionBounds(); |
1137 | 1139 |
1138 // Suppress painting if nothing is dirty. This has to be done after updating | 1140 // Suppress painting if nothing is dirty. This has to be done after updating |
1139 // animations running layout as these may generate further invalidations. | 1141 // animations running layout as these may generate further invalidations. |
1140 if (!paint_aggregator_.HasPendingUpdate()) { | 1142 if (!paint_aggregator_.HasPendingUpdate()) { |
1141 TRACE_EVENT0("renderer", "EarlyOut_NoPendingUpdate"); | 1143 TRACE_EVENT0("renderer", "EarlyOut_NoPendingUpdate"); |
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2393 | 2395 |
2394 if (!context->Initialize( | 2396 if (!context->Initialize( |
2395 attributes, | 2397 attributes, |
2396 false /* bind generates resources */, | 2398 false /* bind generates resources */, |
2397 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2399 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
2398 return NULL; | 2400 return NULL; |
2399 return context.release(); | 2401 return context.release(); |
2400 } | 2402 } |
2401 | 2403 |
2402 } // namespace content | 2404 } // namespace content |
OLD | NEW |