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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutView.cpp

Issue 1647883004: Support caching histograms so that a lookup isn't done in each iteration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add explicit to protected ctor as well Created 4 years, 10 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 25 matching lines...) Expand all
36 #include "core/layout/LayoutMedia.h" 36 #include "core/layout/LayoutMedia.h"
37 #include "core/layout/LayoutPart.h" 37 #include "core/layout/LayoutPart.h"
38 #include "core/layout/LayoutQuote.h" 38 #include "core/layout/LayoutQuote.h"
39 #include "core/layout/LayoutScrollbarPart.h" 39 #include "core/layout/LayoutScrollbarPart.h"
40 #include "core/layout/ViewFragmentationContext.h" 40 #include "core/layout/ViewFragmentationContext.h"
41 #include "core/layout/compositing/PaintLayerCompositor.h" 41 #include "core/layout/compositing/PaintLayerCompositor.h"
42 #include "core/page/Page.h" 42 #include "core/page/Page.h"
43 #include "core/paint/PaintLayer.h" 43 #include "core/paint/PaintLayer.h"
44 #include "core/paint/ViewPainter.h" 44 #include "core/paint/ViewPainter.h"
45 #include "core/svg/SVGDocumentExtensions.h" 45 #include "core/svg/SVGDocumentExtensions.h"
46 #include "platform/Histogram.h"
46 #include "platform/TraceEvent.h" 47 #include "platform/TraceEvent.h"
47 #include "platform/TracedValue.h" 48 #include "platform/TracedValue.h"
48 #include "platform/geometry/FloatQuad.h" 49 #include "platform/geometry/FloatQuad.h"
49 #include "platform/geometry/TransformState.h" 50 #include "platform/geometry/TransformState.h"
50 #include "platform/graphics/paint/PaintController.h" 51 #include "platform/graphics/paint/PaintController.h"
51 #include "public/platform/Platform.h" 52 #include "public/platform/Platform.h"
52 #include <inttypes.h> 53 #include <inttypes.h>
53 54
54 namespace blink { 55 namespace blink {
55 56
56 namespace { 57 namespace {
57 58
58 class HitTestLatencyRecorder { 59 class HitTestLatencyRecorder {
59 public: 60 public:
60 HitTestLatencyRecorder(bool allowsChildFrameContent) 61 HitTestLatencyRecorder(bool allowsChildFrameContent)
61 : m_start(WTF::monotonicallyIncreasingTime()) 62 : m_start(WTF::monotonicallyIncreasingTime())
62 , m_allowsChildFrameContent(allowsChildFrameContent) 63 , m_allowsChildFrameContent(allowsChildFrameContent)
63 { 64 {
64 } 65 }
65 66
66 ~HitTestLatencyRecorder() 67 ~HitTestLatencyRecorder()
67 { 68 {
68 int duration = static_cast<int>((WTF::monotonicallyIncreasingTime() - m_ start) * 1000000); 69 int duration = static_cast<int>((WTF::monotonicallyIncreasingTime() - m_ start) * 1000000);
69 Platform::current()->histogramCustomCounts(m_allowsChildFrameContent ? " Event.Latency.HitTestRecursive" : "Event.Latency.HitTest", duration, 0, 10000000 , 100); 70
71 if (m_allowsChildFrameContent) {
72 DEFINE_STATIC_LOCAL(CustomCountHistogram, recursiveLatencyHistogram, ("Event.Latency.HitTestRecursive", 0, 10000000, 100));
73 recursiveLatencyHistogram.count(duration);
74 } else {
75 DEFINE_STATIC_LOCAL(CustomCountHistogram, latencyHistogram, ("Event. Latency.HitTest", 0, 10000000, 100));
76 latencyHistogram.count(duration);
77 }
70 } 78 }
71 79
72 private: 80 private:
73 double m_start; 81 double m_start;
74 bool m_allowsChildFrameContent; 82 bool m_allowsChildFrameContent;
75 }; 83 };
76 84
77 } // namespace 85 } // namespace
78 86
79 LayoutView::LayoutView(Document* document) 87 LayoutView::LayoutView(Document* document)
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 } 997 }
990 998
991 void LayoutView::sendMediaPositionChangeNotifications(const IntRect& visibleRect ) 999 void LayoutView::sendMediaPositionChangeNotifications(const IntRect& visibleRect )
992 { 1000 {
993 for (auto& media : m_mediaForPositionNotification) { 1001 for (auto& media : m_mediaForPositionNotification) {
994 media->notifyPositionMayHaveChanged(visibleRect); 1002 media->notifyPositionMayHaveChanged(visibleRect);
995 } 1003 }
996 } 1004 }
997 1005
998 } // namespace blink 1006 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698