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

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: Add unit test && refactoring 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 m_hiddenForThrottling(false), 187 m_hiddenForThrottling(false),
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_mainThreadScrollingReasonLayoutCounter(
199 MainThreadScrollingReason::kMainThreadScrollingReasonCount,
200 0) {
198 init(); 201 init();
199 } 202 }
200 203
201 FrameView* FrameView::create(LocalFrame& frame) { 204 FrameView* FrameView::create(LocalFrame& frame) {
202 FrameView* view = new FrameView(frame); 205 FrameView* view = new FrameView(frame);
203 view->show(); 206 view->show();
204 return view; 207 return view;
205 } 208 }
206 209
207 FrameView* FrameView::create(LocalFrame& frame, const IntSize& initialSize) { 210 FrameView* FrameView::create(LocalFrame& frame, const IntSize& initialSize) {
(...skipping 4460 matching lines...) Expand 10 before | Expand all | Expand 10 after
4668 int FrameView::initialViewportWidth() const { 4671 int FrameView::initialViewportWidth() const {
4669 DCHECK(m_frame->isMainFrame()); 4672 DCHECK(m_frame->isMainFrame());
4670 return m_initialViewportSize.width(); 4673 return m_initialViewportSize.width();
4671 } 4674 }
4672 4675
4673 int FrameView::initialViewportHeight() const { 4676 int FrameView::initialViewportHeight() const {
4674 DCHECK(m_frame->isMainFrame()); 4677 DCHECK(m_frame->isMainFrame());
4675 return m_initialViewportSize.height(); 4678 return m_initialViewportSize.height();
4676 } 4679 }
4677 4680
4681 void FrameView::adjustMainThreadReasonsDueToLayoutObject(uint32_t reason,
4682 bool increase) {
4683 m_mainThreadScrollingReasonLayoutCounter[reasonIndex(reason)] +=
bokan 2016/12/13 14:38:56 This should never be negative, right? If so, pleas
yigu 2016/12/13 20:54:10 Done.
4684 increase ? 1 : -1;
4685 }
4686
4687 MainThreadScrollingReasons
4688 FrameView::checkMainThreadScrollingReasonDueToLayoutObject() {
4689 MainThreadScrollingReasons reasons =
4690 static_cast<MainThreadScrollingReasons>(0);
4691 for (uint32_t reason = 1;
4692 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount;
4693 ++reason) {
4694 if (m_mainThreadScrollingReasonLayoutCounter[reason] > 0) {
4695 reasons |= 1 << (reason - 1);
4696 }
4697 }
4698 return reasons;
4699 }
4700
4678 } // namespace blink 4701 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698