| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_ | 5 #ifndef CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_ |
| 6 #define CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_ | 6 #define CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 if (reasons & MainThreadScrollingReason::kNotScrollable) | 141 if (reasons & MainThreadScrollingReason::kNotScrollable) |
| 142 tracedValue->AppendString("Not scrollable"); | 142 tracedValue->AppendString("Not scrollable"); |
| 143 if (reasons & MainThreadScrollingReason::kContinuingMainThreadScroll) | 143 if (reasons & MainThreadScrollingReason::kContinuingMainThreadScroll) |
| 144 tracedValue->AppendString("Continuing main thread scroll"); | 144 tracedValue->AppendString("Continuing main thread scroll"); |
| 145 if (reasons & MainThreadScrollingReason::kNonInvertibleTransform) | 145 if (reasons & MainThreadScrollingReason::kNonInvertibleTransform) |
| 146 tracedValue->AppendString("Non-invertible transform"); | 146 tracedValue->AppendString("Non-invertible transform"); |
| 147 if (reasons & MainThreadScrollingReason::kPageBasedScrolling) | 147 if (reasons & MainThreadScrollingReason::kPageBasedScrolling) |
| 148 tracedValue->AppendString("Page-based scrolling"); | 148 tracedValue->AppendString("Page-based scrolling"); |
| 149 tracedValue->EndArray(); | 149 tracedValue->EndArray(); |
| 150 } | 150 } |
| 151 | |
| 152 // For a given reason, return its index in enum | |
| 153 static int getReasonIndex(uint32_t reason) { | |
| 154 // Multiple reasons provided | |
| 155 if (reason & (reason - 1)) | |
| 156 return -1; | |
| 157 | |
| 158 int index = -1; | |
| 159 while (reason > 0) { | |
| 160 reason = reason >> 1; | |
| 161 ++index; | |
| 162 } | |
| 163 return index; | |
| 164 } | |
| 165 }; | 151 }; |
| 166 | 152 |
| 167 } // namespace cc | 153 } // namespace cc |
| 168 | 154 |
| 169 #endif // CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_ | 155 #endif // CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_ |
| OLD | NEW |