| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/latency_info_swap_promise_monitor.h" | 5 #include "cc/trees/latency_info_swap_promise_monitor.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
| 10 #include "cc/output/latency_info_swap_promise.h" | 10 #include "cc/output/latency_info_swap_promise.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 | 53 |
| 54 void LatencyInfoSwapPromiseMonitor::OnSetNeedsCommitOnMain() { | 54 void LatencyInfoSwapPromiseMonitor::OnSetNeedsCommitOnMain() { |
| 55 if (AddRenderingScheduledComponent(latency_, true /* on_main */)) { | 55 if (AddRenderingScheduledComponent(latency_, true /* on_main */)) { |
| 56 std::unique_ptr<SwapPromise> swap_promise( | 56 std::unique_ptr<SwapPromise> swap_promise( |
| 57 new LatencyInfoSwapPromise(*latency_)); | 57 new LatencyInfoSwapPromise(*latency_)); |
| 58 layer_tree_host_->QueueSwapPromise(std::move(swap_promise)); | 58 layer_tree_host_->QueueSwapPromise(std::move(swap_promise)); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 void LatencyInfoSwapPromiseMonitor::OnSetNeedsForcedRedrawOnMain() { |
| 63 std::unique_ptr<SwapPromise> swap_promise( |
| 64 new LatencyInfoSwapPromise(*latency_)); |
| 65 layer_tree_host_->QueueForcedRedrawSwapPromise(std::move(swap_promise)); |
| 66 } |
| 67 |
| 62 void LatencyInfoSwapPromiseMonitor::OnSetNeedsRedrawOnImpl() { | 68 void LatencyInfoSwapPromiseMonitor::OnSetNeedsRedrawOnImpl() { |
| 63 if (AddRenderingScheduledComponent(latency_, false /* on_main */)) { | 69 if (AddRenderingScheduledComponent(latency_, false /* on_main */)) { |
| 64 std::unique_ptr<SwapPromise> swap_promise( | 70 std::unique_ptr<SwapPromise> swap_promise( |
| 65 new LatencyInfoSwapPromise(*latency_)); | 71 new LatencyInfoSwapPromise(*latency_)); |
| 66 // Queue a pinned swap promise on the active tree. This will allow | 72 // Queue a pinned swap promise on the active tree. This will allow |
| 67 // measurement of the time to the next SwapBuffers(). The swap | 73 // measurement of the time to the next SwapBuffers(). The swap |
| 68 // promise is pinned so that it is not interrupted by new incoming | 74 // promise is pinned so that it is not interrupted by new incoming |
| 69 // activations (which would otherwise break the swap promise). | 75 // activations (which would otherwise break the swap promise). |
| 70 layer_tree_host_impl_->active_tree()->QueuePinnedSwapPromise( | 76 layer_tree_host_impl_->active_tree()->QueuePinnedSwapPromise( |
| 71 std::move(swap_promise)); | 77 std::move(swap_promise)); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 98 *latency_, | 104 *latency_, |
| 99 ui::INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT); | 105 ui::INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT); |
| 100 std::unique_ptr<SwapPromise> swap_promise( | 106 std::unique_ptr<SwapPromise> swap_promise( |
| 101 new LatencyInfoSwapPromise(new_latency)); | 107 new LatencyInfoSwapPromise(new_latency)); |
| 102 layer_tree_host_impl_->QueueSwapPromiseForMainThreadScrollUpdate( | 108 layer_tree_host_impl_->QueueSwapPromiseForMainThreadScrollUpdate( |
| 103 std::move(swap_promise)); | 109 std::move(swap_promise)); |
| 104 } | 110 } |
| 105 } | 111 } |
| 106 | 112 |
| 107 } // namespace cc | 113 } // namespace cc |
| OLD | NEW |