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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2565223002: Add more specific metrics for main thread scrolling reasons (Closed)
Patch Set: Test that there should be no reason set if setPrefercompositingToCDLTextEnabled(true) Created 4 years 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 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 m_subtreeThrottled(false), 188 m_subtreeThrottled(false),
189 m_lifecycleUpdatesThrottled(false), 189 m_lifecycleUpdatesThrottled(false),
190 m_needsPaintPropertyUpdate(true), 190 m_needsPaintPropertyUpdate(true),
191 m_currentUpdateLifecyclePhasesTargetState( 191 m_currentUpdateLifecyclePhasesTargetState(
192 DocumentLifecycle::Uninitialized), 192 DocumentLifecycle::Uninitialized),
193 m_scrollAnchor(this), 193 m_scrollAnchor(this),
194 m_scrollbarManager(*this), 194 m_scrollbarManager(*this),
195 m_needsScrollbarsUpdate(false), 195 m_needsScrollbarsUpdate(false),
196 m_suppressAdjustViewSize(false), 196 m_suppressAdjustViewSize(false),
197 m_allowsLayoutInvalidationAfterLayoutClean(true), 197 m_allowsLayoutInvalidationAfterLayoutClean(true),
198 m_mainThreadScrollingReasons(0) { 198 m_mainThreadScrollingReasons(0),
199 m_mainThreadScrollingReasonsCounter(
200 MainThreadScrollingReason::kMainThreadScrollingReasonCount,
201 0) {
199 init(); 202 init();
200 } 203 }
201 204
202 FrameView* FrameView::create(LocalFrame& frame) { 205 FrameView* FrameView::create(LocalFrame& frame) {
203 FrameView* view = new FrameView(frame); 206 FrameView* view = new FrameView(frame);
204 view->show(); 207 view->show();
205 return view; 208 return view;
206 } 209 }
207 210
208 FrameView* FrameView::create(LocalFrame& frame, const IntSize& initialSize) { 211 FrameView* FrameView::create(LocalFrame& frame, const IntSize& initialSize) {
(...skipping 4569 matching lines...) Expand 10 before | Expand all | Expand 10 after
4778 MainThreadScrollingReasons FrameView::mainThreadScrollingReasonsPerFrame() 4781 MainThreadScrollingReasons FrameView::mainThreadScrollingReasonsPerFrame()
4779 const { 4782 const {
4780 MainThreadScrollingReasons reasons = 4783 MainThreadScrollingReasons reasons =
4781 static_cast<MainThreadScrollingReasons>(0); 4784 static_cast<MainThreadScrollingReasons>(0);
4782 4785
4783 if (shouldThrottleRendering()) 4786 if (shouldThrottleRendering())
4784 return reasons; 4787 return reasons;
4785 4788
4786 if (hasBackgroundAttachmentFixedObjects()) 4789 if (hasBackgroundAttachmentFixedObjects())
4787 reasons |= MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects; 4790 reasons |= MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects;
4791
4792 reasons |= getStyleRelatedMainThreadScrollingReasons();
4793
4788 ScrollingReasons scrollingReasons = getScrollingReasons(); 4794 ScrollingReasons scrollingReasons = getScrollingReasons();
4789 const bool mayBeScrolledByInput = (scrollingReasons == Scrollable); 4795 const bool mayBeScrolledByInput = (scrollingReasons == Scrollable);
4790 const bool mayBeScrolledByScript = 4796 const bool mayBeScrolledByScript =
4791 mayBeScrolledByInput || 4797 mayBeScrolledByInput ||
4792 (scrollingReasons == NotScrollableExplicitlyDisabled); 4798 (scrollingReasons == NotScrollableExplicitlyDisabled);
4793 4799
4794 // TODO(awoloszyn) Currently crbug.com/304810 will let certain 4800 // TODO(awoloszyn) Currently crbug.com/304810 will let certain
4795 // overflow:hidden elements scroll on the compositor thread, so we should 4801 // overflow:hidden elements scroll on the compositor thread, so we should
4796 // not let this move there path as an optimization, when we have 4802 // not let this move there path as an optimization, when we have
4797 // slow-repaint elements. 4803 // slow-repaint elements.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4842 .c_str()); 4848 .c_str());
4843 return result; 4849 return result;
4844 } 4850 }
4845 4851
4846 String result(MainThreadScrollingReason::mainThreadScrollingReasonsAsText( 4852 String result(MainThreadScrollingReason::mainThreadScrollingReasonsAsText(
4847 m_mainThreadScrollingReasons) 4853 m_mainThreadScrollingReasons)
4848 .c_str()); 4854 .c_str());
4849 return result; 4855 return result;
4850 } 4856 }
4851 4857
4858 void FrameView::adjustStyleRelatedMainThreadScrollingReasons(
4859 const uint32_t reason,
4860 bool increase) {
4861 int index = MainThreadScrollingReason::getReasonIndex(reason);
4862 DCHECK_GE(index, 0);
4863 m_mainThreadScrollingReasonsCounter[index] += increase ? 1 : -1;
4864 DCHECK_GE(m_mainThreadScrollingReasonsCounter[index], 0);
4865 }
4866
4867 MainThreadScrollingReasons
4868 FrameView::getStyleRelatedMainThreadScrollingReasons() const {
4869 MainThreadScrollingReasons reasons =
4870 static_cast<MainThreadScrollingReasons>(0);
4871 for (uint32_t reason = 1;
4872 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount;
4873 ++reason) {
4874 if (m_mainThreadScrollingReasonsCounter[reason] > 0) {
4875 reasons |= 1 << (reason - 1);
4876 }
4877 }
4878 return reasons;
4879 }
4880
4852 } // namespace blink 4881 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698