Chromium Code Reviews| Index: cc/input/main_thread_scrolling_reason.h |
| diff --git a/cc/input/main_thread_scrolling_reason.h b/cc/input/main_thread_scrolling_reason.h |
| index 9746d9425740d96ff63e52707b498f08b4878d80..2de0041991d1f1a8b05b849a49cbda46de2974e4 100644 |
| --- a/cc/input/main_thread_scrolling_reason.h |
| +++ b/cc/input/main_thread_scrolling_reason.h |
| @@ -43,6 +43,12 @@ struct MainThreadScrollingReason { |
| kHasBorderRadius = 1 << 19, |
| kHasClipRelatedProperty = 1 << 20, |
| kHasBoxShadowFromNonRootLayer = 1 << 21, |
| + // Scrolling a composited element which is on top of a non-composited |
|
bokan
2017/03/31 16:55:52
Nit: newline above
|
| + // one will end up with main thread scrolling because we are scrolling a non |
| + // fast scrollable region. If all scrollers from the composited element's |
| + // containing block chain are composited, it must be because of an element |
| + // not in the chain in which case the following reason is added. |
| + kUnknownNonCompositedRegion = 1 << 22, |
| // Transient scrolling reasons. These are computed for each scroll begin. |
| kNonFastScrollableRegion = 1 << 5, |
| @@ -57,7 +63,7 @@ struct MainThreadScrollingReason { |
| // New flags should increment this number but it should never be decremented |
| // because the values are used in UMA histograms. It should also be noted |
| // that it excludes the kNotScrollingOnMain value. |
| - kMainThreadScrollingReasonCount = 22, |
| + kMainThreadScrollingReasonCount = 23, |
| }; |
| // Returns true if the given MainThreadScrollingReason can be set by the main |
| @@ -67,10 +73,7 @@ struct MainThreadScrollingReason { |
| kNotScrollingOnMain | kHasBackgroundAttachmentFixedObjects | |
| kHasNonLayerViewportConstrainedObjects | kThreadedScrollingDisabled | |
| kScrollbarScrolling | kPageOverlay | kHandlingScrollFromMainThread | |
| - kCustomScrollbarScrolling | kHasOpacityAndLCDText | |
| - kHasTransformAndLCDText | kBackgroundNotOpaqueInRectAndLCDText | |
| - kHasBorderRadius | kHasClipRelatedProperty | |
| - kHasBoxShadowFromNonRootLayer; |
| + kCustomScrollbarScrolling; |
| return (reasons & reasons_set_by_main_thread) == reasons; |
| } |
| @@ -84,6 +87,17 @@ struct MainThreadScrollingReason { |
| return (reasons & reasons_set_by_compositor) == reasons; |
| } |
| + // Usually a scroller won't be composited with the following reasons |
|
bokan
2017/03/31 16:55:52
If we force promotion though, we remove these reas
yigu
2017/03/31 19:18:55
Actually we don't remove these reasons for PLSA. I
bokan
2017/04/04 18:14:26
We won't *record* the reasons, but will they still
yigu
2017/04/05 20:18:02
When composited, the reasons won't be set on PLSA.
|
| + // unless we force the promotion. e.g. Apply will-change:transform. |
| + static bool NonCompositedScrollReasons(uint32_t reasons) { |
| + uint32_t non_composited_reasons = |
| + kHasOpacityAndLCDText | kHasTransformAndLCDText | |
| + kBackgroundNotOpaqueInRectAndLCDText | kHasBorderRadius | |
| + kHasClipRelatedProperty | kHasBoxShadowFromNonRootLayer | |
| + kUnknownNonCompositedRegion; |
| + return reasons && (reasons & non_composited_reasons); |
| + } |
| + |
| static std::string mainThreadScrollingReasonsAsText(uint32_t reasons) { |
| base::trace_event::TracedValue tracedValue; |
| mainThreadScrollingReasonsAsTracedValue(reasons, &tracedValue); |
| @@ -130,6 +144,8 @@ struct MainThreadScrollingReason { |
| tracedValue->AppendString("Has clip related property"); |
| if (reasons & MainThreadScrollingReason::kHasBoxShadowFromNonRootLayer) |
| tracedValue->AppendString("Has box shadow from non-root layer"); |
| + if (reasons & MainThreadScrollingReason::kUnknownNonCompositedRegion) |
|
bokan
2017/03/31 16:55:52
I think this should never actually be stored/set o
|
| + tracedValue->AppendString("Unknown non composited region"); |
| // Transient scrolling reasons. |
| if (reasons & MainThreadScrollingReason::kNonFastScrollableRegion) |
| @@ -148,20 +164,6 @@ struct MainThreadScrollingReason { |
| tracedValue->AppendString("Page-based scrolling"); |
| tracedValue->EndArray(); |
| } |
| - |
| - // For a given reason, return its index in enum |
| - static int getReasonIndex(uint32_t reason) { |
| - // Multiple reasons provided |
| - if (reason & (reason - 1)) |
| - return -1; |
| - |
| - int index = -1; |
| - while (reason > 0) { |
| - reason = reason >> 1; |
| - ++index; |
| - } |
| - return index; |
| - } |
| }; |
| } // namespace cc |