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> |
| 8 |
7 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
8 #include "cc/output/latency_info_swap_promise.h" | 10 #include "cc/output/latency_info_swap_promise.h" |
9 #include "cc/trees/layer_tree_host.h" | 11 #include "cc/trees/layer_tree_host.h" |
10 #include "cc/trees/layer_tree_host_impl.h" | 12 #include "cc/trees/layer_tree_host_impl.h" |
11 #include "cc/trees/layer_tree_impl.h" | 13 #include "cc/trees/layer_tree_impl.h" |
12 | 14 |
13 namespace { | 15 namespace { |
14 | 16 |
15 bool AddRenderingScheduledComponent(ui::LatencyInfo* latency_info, | 17 bool AddRenderingScheduledComponent(ui::LatencyInfo* latency_info, |
16 bool on_main) { | 18 bool on_main) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // measurement of the time to the next SwapBuffers(). The swap | 65 // measurement of the time to the next SwapBuffers(). The swap |
64 // promise is pinned so that it is not interrupted by new incoming | 66 // promise is pinned so that it is not interrupted by new incoming |
65 // activations (which would otherwise break the swap promise). | 67 // activations (which would otherwise break the swap promise). |
66 layer_tree_host_impl_->active_tree()->QueuePinnedSwapPromise( | 68 layer_tree_host_impl_->active_tree()->QueuePinnedSwapPromise( |
67 std::move(swap_promise)); | 69 std::move(swap_promise)); |
68 } | 70 } |
69 } | 71 } |
70 | 72 |
71 void LatencyInfoSwapPromiseMonitor::OnForwardScrollUpdateToMainThreadOnImpl() { | 73 void LatencyInfoSwapPromiseMonitor::OnForwardScrollUpdateToMainThreadOnImpl() { |
72 if (AddForwardingScrollUpdateToMainComponent(latency_)) { | 74 if (AddForwardingScrollUpdateToMainComponent(latency_)) { |
73 int64 new_sequence_number = 0; | 75 int64_t new_sequence_number = 0; |
74 for (ui::LatencyInfo::LatencyMap::const_iterator it = | 76 for (ui::LatencyInfo::LatencyMap::const_iterator it = |
75 latency_->latency_components().begin(); | 77 latency_->latency_components().begin(); |
76 it != latency_->latency_components().end(); ++it) { | 78 it != latency_->latency_components().end(); ++it) { |
77 if (it->first.first == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT) { | 79 if (it->first.first == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT) { |
78 new_sequence_number = | 80 new_sequence_number = |
79 ((static_cast<int64>(base::PlatformThread::CurrentId()) << 32) ^ | 81 ((static_cast<int64_t>(base::PlatformThread::CurrentId()) << 32) ^ |
80 (reinterpret_cast<uint64>(this) << 32)) | | 82 (reinterpret_cast<uint64_t>(this) << 32)) | |
81 (it->second.sequence_number & 0xffffffff); | 83 (it->second.sequence_number & 0xffffffff); |
82 if (new_sequence_number == it->second.sequence_number) | 84 if (new_sequence_number == it->second.sequence_number) |
83 return; | 85 return; |
84 break; | 86 break; |
85 } | 87 } |
86 } | 88 } |
87 if (!new_sequence_number) | 89 if (!new_sequence_number) |
88 return; | 90 return; |
89 ui::LatencyInfo new_latency; | 91 ui::LatencyInfo new_latency; |
90 new_latency.AddLatencyNumberWithTraceName( | 92 new_latency.AddLatencyNumberWithTraceName( |
91 ui::LATENCY_BEGIN_SCROLL_LISTENER_UPDATE_MAIN_COMPONENT, 0, | 93 ui::LATENCY_BEGIN_SCROLL_LISTENER_UPDATE_MAIN_COMPONENT, 0, |
92 new_sequence_number, "ScrollUpdate"); | 94 new_sequence_number, "ScrollUpdate"); |
93 new_latency.CopyLatencyFrom( | 95 new_latency.CopyLatencyFrom( |
94 *latency_, | 96 *latency_, |
95 ui::INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT); | 97 ui::INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT); |
96 scoped_ptr<SwapPromise> swap_promise( | 98 scoped_ptr<SwapPromise> swap_promise( |
97 new LatencyInfoSwapPromise(new_latency)); | 99 new LatencyInfoSwapPromise(new_latency)); |
98 layer_tree_host_impl_->QueueSwapPromiseForMainThreadScrollUpdate( | 100 layer_tree_host_impl_->QueueSwapPromiseForMainThreadScrollUpdate( |
99 std::move(swap_promise)); | 101 std::move(swap_promise)); |
100 } | 102 } |
101 } | 103 } |
102 | 104 |
103 } // namespace cc | 105 } // namespace cc |
OLD | NEW |