OLD | NEW |
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 #include "platform/TraceEvent.h" | 80 #include "platform/TraceEvent.h" |
81 #include "platform/fonts/FontCache.h" | 81 #include "platform/fonts/FontCache.h" |
82 #include "platform/geometry/FloatRect.h" | 82 #include "platform/geometry/FloatRect.h" |
83 #include "platform/graphics/GraphicsContext.h" | 83 #include "platform/graphics/GraphicsContext.h" |
84 #include "platform/graphics/GraphicsContextStateSaver.h" | 84 #include "platform/graphics/GraphicsContextStateSaver.h" |
85 #include "platform/graphics/GraphicsLayer.h" | 85 #include "platform/graphics/GraphicsLayer.h" |
86 #include "platform/graphics/GraphicsLayerDebugInfo.h" | 86 #include "platform/graphics/GraphicsLayerDebugInfo.h" |
87 #include "platform/graphics/paint/DisplayItemList.h" | 87 #include "platform/graphics/paint/DisplayItemList.h" |
88 #include "platform/scroll/ScrollAnimator.h" | 88 #include "platform/scroll/ScrollAnimator.h" |
89 #include "platform/text/TextStream.h" | 89 #include "platform/text/TextStream.h" |
90 #include "public/platform/Platform.h" | |
91 #include "wtf/CurrentTime.h" | 90 #include "wtf/CurrentTime.h" |
92 #include "wtf/StdLibExtras.h" | 91 #include "wtf/StdLibExtras.h" |
93 #include "wtf/TemporaryChange.h" | 92 #include "wtf/TemporaryChange.h" |
94 | 93 |
95 namespace blink { | 94 namespace blink { |
96 | 95 |
97 using namespace HTMLNames; | 96 using namespace HTMLNames; |
98 | 97 |
99 double FrameView::s_currentFrameTimeStamp = 0.0; | 98 double FrameView::s_currentFrameTimeStamp = 0.0; |
100 | 99 |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 document->styleResolverChanged(); | 835 document->styleResolverChanged(); |
837 document->mediaQueryAffectingValueChanged(); | 836 document->mediaQueryAffectingValueChanged(); |
838 } else if (wasResized) { | 837 } else if (wasResized) { |
839 document->evaluateMediaQueryList(); | 838 document->evaluateMediaQueryList(); |
840 } | 839 } |
841 | 840 |
842 document->updateRenderTreeIfNeeded(); | 841 document->updateRenderTreeIfNeeded(); |
843 lifecycle().advanceTo(DocumentLifecycle::StyleClean); | 842 lifecycle().advanceTo(DocumentLifecycle::StyleClean); |
844 } | 843 } |
845 | 844 |
846 void FrameView::lineLayoutTime(double ms) | |
847 { | |
848 m_lineLayoutMs += ms; | |
849 } | |
850 | |
851 static void gatherDebugLayoutRects(LayoutObject& layoutRoot) | 845 static void gatherDebugLayoutRects(LayoutObject& layoutRoot) |
852 { | 846 { |
853 bool isTracing; | 847 bool isTracing; |
854 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink.debug.la
yout"), &isTracing); | 848 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink.debug.la
yout"), &isTracing); |
855 if (!isTracing) | 849 if (!isTracing) |
856 return; | 850 return; |
857 if (!layoutRoot.enclosingLayer()->hasCompositedLayerMapping()) | 851 if (!layoutRoot.enclosingLayer()->hasCompositedLayerMapping()) |
858 return; | 852 return; |
859 // For access to compositedLayerMapping(). | 853 // For access to compositedLayerMapping(). |
860 DisableCompositingQueryAsserts disabler; | 854 DisableCompositingQueryAsserts disabler; |
(...skipping 17 matching lines...) Expand all Loading... |
878 { | 872 { |
879 LayoutState layoutState(root); | 873 LayoutState layoutState(root); |
880 root.layout(); | 874 root.layout(); |
881 gatherDebugLayoutRects(root); | 875 gatherDebugLayoutRects(root); |
882 } | 876 } |
883 | 877 |
884 void FrameView::performLayout(bool inSubtreeLayout) | 878 void FrameView::performLayout(bool inSubtreeLayout) |
885 { | 879 { |
886 ASSERT(inSubtreeLayout || m_layoutSubtreeRoots.isEmpty()); | 880 ASSERT(inSubtreeLayout || m_layoutSubtreeRoots.isEmpty()); |
887 | 881 |
888 m_lineLayoutMs = 0; | |
889 TRACE_EVENT0("blink,benchmark", "FrameView::performLayout"); | 882 TRACE_EVENT0("blink,benchmark", "FrameView::performLayout"); |
890 double start = WTF::currentTimeMS(); | |
891 | 883 |
892 ScriptForbiddenScope forbidScript; | 884 ScriptForbiddenScope forbidScript; |
893 | 885 |
894 ASSERT(!isInPerformLayout()); | 886 ASSERT(!isInPerformLayout()); |
895 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout); | 887 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout); |
896 | 888 |
897 TemporaryChange<bool> changeInPerformLayout(m_inPerformLayout, true); | 889 TemporaryChange<bool> changeInPerformLayout(m_inPerformLayout, true); |
898 | 890 |
899 // performLayout is the actual guts of layout(). | 891 // performLayout is the actual guts of layout(). |
900 // FIXME: The 300 other lines in layout() probably belong in other helper fu
nctions | 892 // FIXME: The 300 other lines in layout() probably belong in other helper fu
nctions |
(...skipping 14 matching lines...) Expand all Loading... |
915 if (LayoutObject* container = root.container()) | 907 if (LayoutObject* container = root.container()) |
916 container->setMayNeedPaintInvalidation(); | 908 container->setMayNeedPaintInvalidation(); |
917 } | 909 } |
918 } else { | 910 } else { |
919 layoutFromRootObject(*layoutView()); | 911 layoutFromRootObject(*layoutView()); |
920 } | 912 } |
921 | 913 |
922 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAllIma
geResourcePriorities(); | 914 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAllIma
geResourcePriorities(); |
923 | 915 |
924 lifecycle().advanceTo(DocumentLifecycle::AfterPerformLayout); | 916 lifecycle().advanceTo(DocumentLifecycle::AfterPerformLayout); |
925 int layoutMs = (WTF::currentTimeMS() - start); | |
926 Platform::current()->histogramCustomCounts("Renderer.LayoutMs", layoutMs, 0,
1000 * 60, 50); | |
927 // TODO(benjhayden): re-enable when safe | |
928 // Platform::current()->histogramCustomCounts("Renderer.LineLayoutMs", m_lin
eLayoutMs, 0, 1000 * 60, 50); | |
929 } | 917 } |
930 | 918 |
931 void FrameView::scheduleOrPerformPostLayoutTasks() | 919 void FrameView::scheduleOrPerformPostLayoutTasks() |
932 { | 920 { |
933 if (m_postLayoutTasksTimer.isActive()) | 921 if (m_postLayoutTasksTimer.isActive()) |
934 return; | 922 return; |
935 | 923 |
936 if (!m_inSynchronousPostLayout) { | 924 if (!m_inSynchronousPostLayout) { |
937 m_inSynchronousPostLayout = true; | 925 m_inSynchronousPostLayout = true; |
938 // Calls resumeScheduledEvents() | 926 // Calls resumeScheduledEvents() |
(...skipping 3160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4099 { | 4087 { |
4100 Settings* settings = frame().settings(); | 4088 Settings* settings = frame().settings(); |
4101 if (!settings || !settings->rootLayerScrolls()) | 4089 if (!settings || !settings->rootLayerScrolls()) |
4102 return this; | 4090 return this; |
4103 | 4091 |
4104 LayoutView* layoutView = this->layoutView(); | 4092 LayoutView* layoutView = this->layoutView(); |
4105 return layoutView ? layoutView->scrollableArea() : nullptr; | 4093 return layoutView ? layoutView->scrollableArea() : nullptr; |
4106 } | 4094 } |
4107 | 4095 |
4108 } // namespace blink | 4096 } // namespace blink |
OLD | NEW |