| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 LayerTreeHostImpl* layer_tree_host_impl) | 46 LayerTreeHostImpl* layer_tree_host_impl) |
| 47 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl), | 47 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl), |
| 48 latency_(latency) { | 48 latency_(latency) { |
| 49 } | 49 } |
| 50 | 50 |
| 51 LatencyInfoSwapPromiseMonitor::~LatencyInfoSwapPromiseMonitor() { | 51 LatencyInfoSwapPromiseMonitor::~LatencyInfoSwapPromiseMonitor() { |
| 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 scoped_ptr<SwapPromise> swap_promise(new LatencyInfoSwapPromise(*latency_)); | 56 std::unique_ptr<SwapPromise> swap_promise( |
| 57 new LatencyInfoSwapPromise(*latency_)); |
| 57 layer_tree_host_->QueueSwapPromise(std::move(swap_promise)); | 58 layer_tree_host_->QueueSwapPromise(std::move(swap_promise)); |
| 58 } | 59 } |
| 59 } | 60 } |
| 60 | 61 |
| 61 void LatencyInfoSwapPromiseMonitor::OnSetNeedsRedrawOnImpl() { | 62 void LatencyInfoSwapPromiseMonitor::OnSetNeedsRedrawOnImpl() { |
| 62 if (AddRenderingScheduledComponent(latency_, false /* on_main */)) { | 63 if (AddRenderingScheduledComponent(latency_, false /* on_main */)) { |
| 63 scoped_ptr<SwapPromise> swap_promise(new LatencyInfoSwapPromise(*latency_)); | 64 std::unique_ptr<SwapPromise> swap_promise( |
| 65 new LatencyInfoSwapPromise(*latency_)); |
| 64 // Queue a pinned swap promise on the active tree. This will allow | 66 // Queue a pinned swap promise on the active tree. This will allow |
| 65 // measurement of the time to the next SwapBuffers(). The swap | 67 // measurement of the time to the next SwapBuffers(). The swap |
| 66 // promise is pinned so that it is not interrupted by new incoming | 68 // promise is pinned so that it is not interrupted by new incoming |
| 67 // activations (which would otherwise break the swap promise). | 69 // activations (which would otherwise break the swap promise). |
| 68 layer_tree_host_impl_->active_tree()->QueuePinnedSwapPromise( | 70 layer_tree_host_impl_->active_tree()->QueuePinnedSwapPromise( |
| 69 std::move(swap_promise)); | 71 std::move(swap_promise)); |
| 70 } | 72 } |
| 71 } | 73 } |
| 72 | 74 |
| 73 void LatencyInfoSwapPromiseMonitor::OnForwardScrollUpdateToMainThreadOnImpl() { | 75 void LatencyInfoSwapPromiseMonitor::OnForwardScrollUpdateToMainThreadOnImpl() { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 88 } | 90 } |
| 89 if (!new_sequence_number) | 91 if (!new_sequence_number) |
| 90 return; | 92 return; |
| 91 ui::LatencyInfo new_latency; | 93 ui::LatencyInfo new_latency; |
| 92 new_latency.AddLatencyNumberWithTraceName( | 94 new_latency.AddLatencyNumberWithTraceName( |
| 93 ui::LATENCY_BEGIN_SCROLL_LISTENER_UPDATE_MAIN_COMPONENT, 0, | 95 ui::LATENCY_BEGIN_SCROLL_LISTENER_UPDATE_MAIN_COMPONENT, 0, |
| 94 new_sequence_number, "ScrollUpdate"); | 96 new_sequence_number, "ScrollUpdate"); |
| 95 new_latency.CopyLatencyFrom( | 97 new_latency.CopyLatencyFrom( |
| 96 *latency_, | 98 *latency_, |
| 97 ui::INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT); | 99 ui::INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT); |
| 98 scoped_ptr<SwapPromise> swap_promise( | 100 std::unique_ptr<SwapPromise> swap_promise( |
| 99 new LatencyInfoSwapPromise(new_latency)); | 101 new LatencyInfoSwapPromise(new_latency)); |
| 100 layer_tree_host_impl_->QueueSwapPromiseForMainThreadScrollUpdate( | 102 layer_tree_host_impl_->QueueSwapPromiseForMainThreadScrollUpdate( |
| 101 std::move(swap_promise)); | 103 std::move(swap_promise)); |
| 102 } | 104 } |
| 103 } | 105 } |
| 104 | 106 |
| 105 } // namespace cc | 107 } // namespace cc |
| OLD | NEW |