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

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

Issue 2151933003: Change WTF::TemporaryChange to be an alias for AutoReset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TemporaryChange -> AutoReset Created 4 years, 5 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 /* 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 #include "platform/graphics/paint/PaintController.h" 108 #include "platform/graphics/paint/PaintController.h"
109 #include "platform/scheduler/CancellableTaskFactory.h" 109 #include "platform/scheduler/CancellableTaskFactory.h"
110 #include "platform/scroll/ScrollAnimatorBase.h" 110 #include "platform/scroll/ScrollAnimatorBase.h"
111 #include "platform/scroll/ScrollbarTheme.h" 111 #include "platform/scroll/ScrollbarTheme.h"
112 #include "platform/text/TextStream.h" 112 #include "platform/text/TextStream.h"
113 #include "public/platform/WebDisplayItemList.h" 113 #include "public/platform/WebDisplayItemList.h"
114 #include "public/platform/WebFrameScheduler.h" 114 #include "public/platform/WebFrameScheduler.h"
115 #include "wtf/CurrentTime.h" 115 #include "wtf/CurrentTime.h"
116 #include "wtf/PtrUtil.h" 116 #include "wtf/PtrUtil.h"
117 #include "wtf/StdLibExtras.h" 117 #include "wtf/StdLibExtras.h"
118 #include "wtf/TemporaryChange.h"
119 #include <memory> 118 #include <memory>
120 119
121 namespace blink { 120 namespace blink {
122 121
123 using namespace HTMLNames; 122 using namespace HTMLNames;
124 123
125 // The maximum number of updateWidgets iterations that should be done before ret urning. 124 // The maximum number of updateWidgets iterations that should be done before ret urning.
126 static const unsigned maxUpdateWidgetsIterations = 2; 125 static const unsigned maxUpdateWidgetsIterations = 2;
127 static const double resourcePriorityUpdateDelayAfterScroll = 0.250; 126 static const double resourcePriorityUpdateDelayAfterScroll = 0.250;
128 127
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 updateScrollbars(); 552 updateScrollbars();
554 } 553 }
555 554
556 setContentsSize(size); 555 setContentsSize(size);
557 } 556 }
558 557
559 void FrameView::adjustViewSizeAndLayout() 558 void FrameView::adjustViewSizeAndLayout()
560 { 559 {
561 adjustViewSize(); 560 adjustViewSize();
562 if (needsLayout()) { 561 if (needsLayout()) {
563 TemporaryChange<bool> suppressAdjustViewSize(m_suppressAdjustViewSize, t rue); 562 AutoReset<bool> suppressAdjustViewSize(&m_suppressAdjustViewSize, true);
564 layout(); 563 layout();
565 } 564 }
566 } 565 }
567 566
568 void FrameView::calculateScrollbarModesFromOverflowStyle(const ComputedStyle* st yle, ScrollbarMode& hMode, ScrollbarMode& vMode) 567 void FrameView::calculateScrollbarModesFromOverflowStyle(const ComputedStyle* st yle, ScrollbarMode& hMode, ScrollbarMode& vMode)
569 { 568 {
570 hMode = vMode = ScrollbarAuto; 569 hMode = vMode = ScrollbarAuto;
571 570
572 EOverflow overflowX = style->overflowX(); 571 EOverflow overflowX = style->overflowX();
573 EOverflow overflowY = style->overflowY(); 572 EOverflow overflowY = style->overflowY();
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 ASSERT(frameView); 780 ASSERT(frameView);
782 frameView->layout(); 781 frameView->layout();
783 } 782 }
784 783
785 void FrameView::performPreLayoutTasks() 784 void FrameView::performPreLayoutTasks()
786 { 785 {
787 TRACE_EVENT0("blink,benchmark", "FrameView::performPreLayoutTasks"); 786 TRACE_EVENT0("blink,benchmark", "FrameView::performPreLayoutTasks");
788 lifecycle().advanceTo(DocumentLifecycle::InPreLayout); 787 lifecycle().advanceTo(DocumentLifecycle::InPreLayout);
789 788
790 // Don't schedule more layouts, we're in one. 789 // Don't schedule more layouts, we're in one.
791 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, fal se); 790 AutoReset<bool> changeSchedulingEnabled(&m_layoutSchedulingEnabled, false);
792 791
793 if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_postLayoutTasksT imer.isActive()) { 792 if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_postLayoutTasksT imer.isActive()) {
794 // This is a new top-level layout. If there are any remaining tasks from the previous layout, finish them now. 793 // This is a new top-level layout. If there are any remaining tasks from the previous layout, finish them now.
795 m_inSynchronousPostLayout = true; 794 m_inSynchronousPostLayout = true;
796 performPostLayoutTasks(); 795 performPostLayoutTasks();
797 m_inSynchronousPostLayout = false; 796 m_inSynchronousPostLayout = false;
798 } 797 }
799 798
800 bool wasResized = wasViewportResized(); 799 bool wasResized = wasViewportResized();
801 Document* document = m_frame->document(); 800 Document* document = m_frame->document();
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 958
960 performPreLayoutTasks(); 959 performPreLayoutTasks();
961 960
962 Document* document = m_frame->document(); 961 Document* document = m_frame->document();
963 962
964 // TODO(crbug.com/460956): The notion of a single root for layout is no long er applicable. Remove or update this code. 963 // TODO(crbug.com/460956): The notion of a single root for layout is no long er applicable. Remove or update this code.
965 LayoutObject* rootForThisLayout = layoutView(); 964 LayoutObject* rootForThisLayout = layoutView();
966 965
967 FontCachePurgePreventer fontCachePurgePreventer; 966 FontCachePurgePreventer fontCachePurgePreventer;
968 { 967 {
969 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false); 968 AutoReset<bool> changeSchedulingEnabled(&m_layoutSchedulingEnabled, fals e);
970 m_nestedLayoutCount++; 969 m_nestedLayoutCount++;
971 970
972 updateCounters(); 971 updateCounters();
973 972
974 // If the layout view was marked as needing layout after we added items in the subtree roots we need 973 // If the layout view was marked as needing layout after we added items in the subtree roots we need
975 // to clear the roots and do the layout from the layoutView. 974 // to clear the roots and do the layout from the layoutView.
976 if (layoutViewItem().needsLayout()) 975 if (layoutViewItem().needsLayout())
977 clearLayoutSubtreeRootsAndMarkContainingBlocks(); 976 clearLayoutSubtreeRootsAndMarkContainingBlocks();
978 layoutViewItem().clearHitTestCache(); 977 layoutViewItem().clearHitTestCache();
979 978
(...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 2514
2516 // Only the following target states are supported. 2515 // Only the following target states are supported.
2517 DCHECK(targetState == DocumentLifecycle::LayoutClean 2516 DCHECK(targetState == DocumentLifecycle::LayoutClean
2518 || targetState == DocumentLifecycle::CompositingClean 2517 || targetState == DocumentLifecycle::CompositingClean
2519 || targetState == DocumentLifecycle::PrePaintClean 2518 || targetState == DocumentLifecycle::PrePaintClean
2520 || targetState == DocumentLifecycle::PaintClean); 2519 || targetState == DocumentLifecycle::PaintClean);
2521 2520
2522 if (!m_frame->document()->isActive()) 2521 if (!m_frame->document()->isActive())
2523 return; 2522 return;
2524 2523
2525 TemporaryChange<DocumentLifecycle::LifecycleState> targetStateScope(m_curren tUpdateLifecyclePhasesTargetState, targetState); 2524 AutoReset<DocumentLifecycle::LifecycleState> targetStateScope(&m_currentUpda teLifecyclePhasesTargetState, targetState);
2526 2525
2527 if (shouldThrottleRendering()) { 2526 if (shouldThrottleRendering()) {
2528 updateViewportIntersectionsForSubtree(std::min(targetState, DocumentLife cycle::CompositingClean)); 2527 updateViewportIntersectionsForSubtree(std::min(targetState, DocumentLife cycle::CompositingClean));
2529 return; 2528 return;
2530 } 2529 }
2531 2530
2532 updateStyleAndLayoutIfNeededRecursive(); 2531 updateStyleAndLayoutIfNeededRecursive();
2533 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean); 2532 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean);
2534 2533
2535 if (targetState == DocumentLifecycle::LayoutClean) { 2534 if (targetState == DocumentLifecycle::LayoutClean) {
(...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after
4281 } 4280 }
4282 4281
4283 bool FrameView::canThrottleRendering() const 4282 bool FrameView::canThrottleRendering() const
4284 { 4283 {
4285 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4284 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4286 return false; 4285 return false;
4287 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); 4286 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling);
4288 } 4287 }
4289 4288
4290 } // namespace blink 4289 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/frame/FrameViewAutoSizeInfo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698