Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Side by Side Diff: cc/input/main_thread_scrolling_reason.h

Issue 2638013002: Record box shadow as main thread scrolling reasons (Closed)
Patch Set: Add flag related test && bug fix Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/trace_event/trace_event_argument.h" 10 #include "base/trace_event/trace_event_argument.h"
(...skipping 23 matching lines...) Expand all
34 34
35 // Style-related scrolling on main reasons. 35 // Style-related scrolling on main reasons.
36 // These *AndLCDText reasons are due to subpixel text rendering which can 36 // These *AndLCDText reasons are due to subpixel text rendering which can
37 // only be applied by blending glyphs with the background at a specific 37 // only be applied by blending glyphs with the background at a specific
38 // screen position; transparency and transforms break this. 38 // screen position; transparency and transforms break this.
39 kHasOpacityAndLCDText = 1 << 16, 39 kHasOpacityAndLCDText = 1 << 16,
40 kHasTransformAndLCDText = 1 << 17, 40 kHasTransformAndLCDText = 1 << 17,
41 kBackgroundNotOpaqueInRectAndLCDText = 1 << 18, 41 kBackgroundNotOpaqueInRectAndLCDText = 1 << 18,
42 kHasBorderRadius = 1 << 19, 42 kHasBorderRadius = 1 << 19,
43 kHasClipRelatedProperty = 1 << 20, 43 kHasClipRelatedProperty = 1 << 20,
44 kHasBoxShadowAndLCDText = 1 << 21,
45 kHasTranslucentBorderAndLCDText = 1 << 22,
44 46
45 // Transient scrolling reasons. These are computed for each scroll begin. 47 // Transient scrolling reasons. These are computed for each scroll begin.
46 kNonFastScrollableRegion = 1 << 5, 48 kNonFastScrollableRegion = 1 << 5,
47 kFailedHitTest = 1 << 7, 49 kFailedHitTest = 1 << 7,
48 kNoScrollingLayer = 1 << 8, 50 kNoScrollingLayer = 1 << 8,
49 kNotScrollable = 1 << 9, 51 kNotScrollable = 1 << 9,
50 kContinuingMainThreadScroll = 1 << 10, 52 kContinuingMainThreadScroll = 1 << 10,
51 kNonInvertibleTransform = 1 << 11, 53 kNonInvertibleTransform = 1 << 11,
52 kPageBasedScrolling = 1 << 12, 54 kPageBasedScrolling = 1 << 12,
53 55
54 // The maximum number of flags in this struct (excluding itself). 56 // The maximum number of flags in this struct (excluding itself).
55 // New flags should increment this number but it should never be decremented 57 // New flags should increment this number but it should never be decremented
56 // because the values are used in UMA histograms. It should also be noted 58 // because the values are used in UMA histograms. It should also be noted
57 // that it excludes the kNotScrollingOnMain value. 59 // that it excludes the kNotScrollingOnMain value.
58 kMainThreadScrollingReasonCount = 21, 60 kMainThreadScrollingReasonCount = 23,
59 }; 61 };
60 62
61 // Returns true if the given MainThreadScrollingReason can be set by the main 63 // Returns true if the given MainThreadScrollingReason can be set by the main
62 // thread. 64 // thread.
63 static bool MainThreadCanSetScrollReasons(uint32_t reasons) { 65 static bool MainThreadCanSetScrollReasons(uint32_t reasons) {
64 uint32_t reasons_set_by_main_thread = 66 uint32_t reasons_set_by_main_thread =
65 kNotScrollingOnMain | kHasBackgroundAttachmentFixedObjects | 67 kNotScrollingOnMain | kHasBackgroundAttachmentFixedObjects |
66 kHasNonLayerViewportConstrainedObjects | kThreadedScrollingDisabled | 68 kHasNonLayerViewportConstrainedObjects | kThreadedScrollingDisabled |
67 kScrollbarScrolling | kPageOverlay | kHandlingScrollFromMainThread | 69 kScrollbarScrolling | kPageOverlay | kHandlingScrollFromMainThread |
68 kCustomScrollbarScrolling | kHasOpacityAndLCDText | 70 kCustomScrollbarScrolling | kHasOpacityAndLCDText |
69 kHasTransformAndLCDText | kBackgroundNotOpaqueInRectAndLCDText | 71 kHasTransformAndLCDText | kBackgroundNotOpaqueInRectAndLCDText |
70 kHasBorderRadius | kHasClipRelatedProperty; 72 kHasBorderRadius | kHasClipRelatedProperty | kHasBoxShadowAndLCDText |
73 kHasTranslucentBorderAndLCDText;
71 return (reasons & reasons_set_by_main_thread) == reasons; 74 return (reasons & reasons_set_by_main_thread) == reasons;
72 } 75 }
73 76
74 // Returns true if the given MainThreadScrollingReason can be set by the 77 // Returns true if the given MainThreadScrollingReason can be set by the
75 // compositor. 78 // compositor.
76 static bool CompositorCanSetScrollReasons(uint32_t reasons) { 79 static bool CompositorCanSetScrollReasons(uint32_t reasons) {
77 uint32_t reasons_set_by_compositor = 80 uint32_t reasons_set_by_compositor =
78 kNonFastScrollableRegion | kFailedHitTest | kNoScrollingLayer | 81 kNonFastScrollableRegion | kFailedHitTest | kNoScrollingLayer |
79 kNotScrollable | kContinuingMainThreadScroll | kNonInvertibleTransform | 82 kNotScrollable | kContinuingMainThreadScroll | kNonInvertibleTransform |
80 kPageBasedScrolling; 83 kPageBasedScrolling;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 tracedValue->AppendString("Has transform and LCD text"); 121 tracedValue->AppendString("Has transform and LCD text");
119 if (reasons & 122 if (reasons &
120 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText) { 123 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText) {
121 tracedValue->AppendString( 124 tracedValue->AppendString(
122 "Background is not opaque in rect and LCD text"); 125 "Background is not opaque in rect and LCD text");
123 } 126 }
124 if (reasons & MainThreadScrollingReason::kHasBorderRadius) 127 if (reasons & MainThreadScrollingReason::kHasBorderRadius)
125 tracedValue->AppendString("Has border radius"); 128 tracedValue->AppendString("Has border radius");
126 if (reasons & MainThreadScrollingReason::kHasClipRelatedProperty) 129 if (reasons & MainThreadScrollingReason::kHasClipRelatedProperty)
127 tracedValue->AppendString("Has clip related property"); 130 tracedValue->AppendString("Has clip related property");
131 if (reasons & MainThreadScrollingReason::kHasBoxShadowAndLCDText)
132 tracedValue->AppendString("Has box shadow and LCD text");
133 if (reasons & MainThreadScrollingReason::kHasTranslucentBorderAndLCDText)
134 tracedValue->AppendString("Has translucent border and LCD text");
128 135
129 // Transient scrolling reasons. 136 // Transient scrolling reasons.
130 if (reasons & MainThreadScrollingReason::kNonFastScrollableRegion) 137 if (reasons & MainThreadScrollingReason::kNonFastScrollableRegion)
131 tracedValue->AppendString("Non fast scrollable region"); 138 tracedValue->AppendString("Non fast scrollable region");
132 if (reasons & MainThreadScrollingReason::kFailedHitTest) 139 if (reasons & MainThreadScrollingReason::kFailedHitTest)
133 tracedValue->AppendString("Failed hit test"); 140 tracedValue->AppendString("Failed hit test");
134 if (reasons & MainThreadScrollingReason::kNoScrollingLayer) 141 if (reasons & MainThreadScrollingReason::kNoScrollingLayer)
135 tracedValue->AppendString("No scrolling layer"); 142 tracedValue->AppendString("No scrolling layer");
136 if (reasons & MainThreadScrollingReason::kNotScrollable) 143 if (reasons & MainThreadScrollingReason::kNotScrollable)
137 tracedValue->AppendString("Not scrollable"); 144 tracedValue->AppendString("Not scrollable");
(...skipping 17 matching lines...) Expand all
155 reason = reason >> 1; 162 reason = reason >> 1;
156 ++index; 163 ++index;
157 } 164 }
158 return index; 165 return index;
159 } 166 }
160 }; 167 };
161 168
162 } // namespace cc 169 } // namespace cc
163 170
164 #endif // CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_ 171 #endif // CC_INPUT_MAIN_THREAD_SCROLLING_REASON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698