Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 // The layer trees must be destroyed before the layer tree host. We've | 295 // The layer trees must be destroyed before the layer tree host. We've |
| 296 // made a contract with our animation controllers that the animation_host | 296 // made a contract with our animation controllers that the animation_host |
| 297 // will outlive them, and we must make good. | 297 // will outlive them, and we must make good. |
| 298 if (recycle_tree_) | 298 if (recycle_tree_) |
| 299 recycle_tree_->Shutdown(); | 299 recycle_tree_->Shutdown(); |
| 300 if (pending_tree_) | 300 if (pending_tree_) |
| 301 pending_tree_->Shutdown(); | 301 pending_tree_->Shutdown(); |
| 302 active_tree_->Shutdown(); | 302 active_tree_->Shutdown(); |
| 303 recycle_tree_ = nullptr; | 303 recycle_tree_ = nullptr; |
| 304 pending_tree_ = nullptr; | 304 pending_tree_ = nullptr; |
| 305 active_tree_ = nullptr; | 305 active_tree_ = nullptr; |
|
piman
2016/07/28 20:54:09
You need to break the forced_redraw_swap_promises_
| |
| 306 | 306 |
| 307 animation_host_->ClearTimelines(); | 307 animation_host_->ClearTimelines(); |
| 308 animation_host_->SetMutatorHostClient(nullptr); | 308 animation_host_->SetMutatorHostClient(nullptr); |
| 309 } | 309 } |
| 310 | 310 |
| 311 void LayerTreeHostImpl::BeginMainFrameAborted(CommitEarlyOutReason reason) { | 311 void LayerTreeHostImpl::BeginMainFrameAborted(CommitEarlyOutReason reason) { |
| 312 // If the begin frame data was handled, then scroll and scale set was applied | 312 // If the begin frame data was handled, then scroll and scale set was applied |
| 313 // by the main thread, so the active tree needs to be updated as if these sent | 313 // by the main thread, so the active tree needs to be updated as if these sent |
| 314 // values were applied and committed. | 314 // values were applied and committed. |
| 315 if (CommitEarlyOutHandledCommit(reason)) | 315 if (CommitEarlyOutHandledCommit(reason)) |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 621 } | 621 } |
| 622 return scroll_elasticity_helper_.get(); | 622 return scroll_elasticity_helper_.get(); |
| 623 } | 623 } |
| 624 | 624 |
| 625 void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate( | 625 void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate( |
| 626 std::unique_ptr<SwapPromise> swap_promise) { | 626 std::unique_ptr<SwapPromise> swap_promise) { |
| 627 swap_promises_for_main_thread_scroll_update_.push_back( | 627 swap_promises_for_main_thread_scroll_update_.push_back( |
| 628 std::move(swap_promise)); | 628 std::move(swap_promise)); |
| 629 } | 629 } |
| 630 | 630 |
| 631 void LayerTreeHostImpl::QueueForcedRedrawSwapPromise( | |
| 632 std::unique_ptr<SwapPromise> swap_promise) { | |
| 633 forced_redraw_swap_promises_.push_back(std::move(swap_promise)); | |
|
piman
2016/07/28 20:54:09
This would bypass the activation, meaning, you may
| |
| 634 } | |
| 635 | |
| 631 void LayerTreeHostImpl::TrackDamageForAllSurfaces( | 636 void LayerTreeHostImpl::TrackDamageForAllSurfaces( |
| 632 const LayerImplList& render_surface_layer_list) { | 637 const LayerImplList& render_surface_layer_list) { |
| 633 // For now, we use damage tracking to compute a global scissor. To do this, we | 638 // For now, we use damage tracking to compute a global scissor. To do this, we |
| 634 // must compute all damage tracking before drawing anything, so that we know | 639 // must compute all damage tracking before drawing anything, so that we know |
| 635 // the root damage rect. The root damage rect is then used to scissor each | 640 // the root damage rect. The root damage rect is then used to scissor each |
| 636 // surface. | 641 // surface. |
| 637 size_t render_surface_layer_list_size = render_surface_layer_list.size(); | 642 size_t render_surface_layer_list_size = render_surface_layer_list.size(); |
| 638 for (size_t i = 0; i < render_surface_layer_list_size; ++i) { | 643 for (size_t i = 0; i < render_surface_layer_list_size; ++i) { |
| 639 size_t surface_index = render_surface_layer_list_size - 1 - i; | 644 size_t surface_index = render_surface_layer_list_size - 1 - i; |
| 640 LayerImpl* render_surface_layer = render_surface_layer_list[surface_index]; | 645 LayerImpl* render_surface_layer = render_surface_layer_list[surface_index]; |
| (...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1832 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, | 1837 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, |
| 1833 "step", "SwapBuffers"); | 1838 "step", "SwapBuffers"); |
| 1834 // Only add the latency component once for renderer swap, not the browser | 1839 // Only add the latency component once for renderer swap, not the browser |
| 1835 // swap. | 1840 // swap. |
| 1836 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, | 1841 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, |
| 1837 0, nullptr)) { | 1842 0, nullptr)) { |
| 1838 latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, | 1843 latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, |
| 1839 0, 0); | 1844 0, 0); |
| 1840 } | 1845 } |
| 1841 } | 1846 } |
| 1847 | |
| 1848 for (const auto& promise : forced_redraw_swap_promises_) { | |
| 1849 promise->DidSwap(&metadata); | |
| 1850 } | |
| 1851 forced_redraw_swap_promises_.clear(); | |
| 1852 | |
| 1842 renderer_->SwapBuffers(std::move(metadata)); | 1853 renderer_->SwapBuffers(std::move(metadata)); |
| 1843 return true; | 1854 return true; |
| 1844 } | 1855 } |
| 1845 | 1856 |
| 1846 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { | 1857 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { |
| 1847 current_begin_frame_tracker_.Start(args); | 1858 current_begin_frame_tracker_.Start(args); |
| 1848 | 1859 |
| 1849 if (is_likely_to_require_a_draw_) { | 1860 if (is_likely_to_require_a_draw_) { |
| 1850 // Optimistically schedule a draw. This will let us expect the tile manager | 1861 // Optimistically schedule a draw. This will let us expect the tile manager |
| 1851 // to complete its work so that we can draw new tiles within the impl frame | 1862 // to complete its work so that we can draw new tiles within the impl frame |
| (...skipping 2199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4051 return task_runner_provider_->HasImplThread(); | 4062 return task_runner_provider_->HasImplThread(); |
| 4052 } | 4063 } |
| 4053 | 4064 |
| 4054 bool LayerTreeHostImpl::CommitToActiveTree() const { | 4065 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 4055 // In single threaded mode we skip the pending tree and commit directly to the | 4066 // In single threaded mode we skip the pending tree and commit directly to the |
| 4056 // active tree. | 4067 // active tree. |
| 4057 return !task_runner_provider_->HasImplThread(); | 4068 return !task_runner_provider_->HasImplThread(); |
| 4058 } | 4069 } |
| 4059 | 4070 |
| 4060 } // namespace cc | 4071 } // namespace cc |
| OLD | NEW |