Update FeatureObserver on top level navigation in addition to page destruction.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Feb 2013 19:19:02 +0000 (19:19 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Feb 2013 19:19:02 +0000 (19:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=109874

Patch by Kassy Coan <kassycoan@chromium.org> on 2013-02-19
Reviewed by Adam Barth.

No new tests. Only effect is to histogram more frequently.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::dispatchDidCommitLoad):
* page/FeatureObserver.cpp:
(WebCore::FeatureObserver::~FeatureObserver):
(WebCore):
(WebCore::FeatureObserver::updateMeasurements):
(WebCore::FeatureObserver::didCommitLoad):
* page/FeatureObserver.h:
(FeatureObserver):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143363 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/page/FeatureObserver.cpp
Source/WebCore/page/FeatureObserver.h

index 3ba2007403f59df9f169bac6cecc8d68f1dfdb83..1894b9e3a7b7041fb71a4cb0be4c2700c7980210 100644 (file)
@@ -1,3 +1,22 @@
+2013-02-19  Kassy Coan  <kassycoan@chromium.org>
+
+        Update FeatureObserver on top level navigation in addition to page destruction.
+        https://bugs.webkit.org/show_bug.cgi?id=109874
+
+        Reviewed by Adam Barth.
+
+        No new tests. Only effect is to histogram more frequently.
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::dispatchDidCommitLoad):
+        * page/FeatureObserver.cpp:
+        (WebCore::FeatureObserver::~FeatureObserver):
+        (WebCore):
+        (WebCore::FeatureObserver::updateMeasurements):
+        (WebCore::FeatureObserver::didCommitLoad):
+        * page/FeatureObserver.h:
+        (FeatureObserver):
+
 2013-02-19  Morten Stenshorne  <mstensho@opera.com>
 
         Remove unnecessary (and problematic) copy-constructor from LayoutUnit
index 0d0e8f1dd76dad3e132aedf8a8caab60030a1399..c6dd12e6c6071502d3508136947eaee0a9b7f205 100644 (file)
@@ -3264,6 +3264,10 @@ void FrameLoader::dispatchDidCommitLoad()
     }
 
     InspectorInstrumentation::didCommitLoad(m_frame, m_documentLoader.get());
+
+    if (m_frame->page()->mainFrame() == m_frame)
+        m_frame->page()->featureObserver()->didCommitLoad();
+
 }
 
 void FrameLoader::tellClientAboutPastMemoryCacheLoads()
index 7e2165acc64b05a29ab622eef46a61918e97bc6d..483a79b7cbfa41c2919388a61cc9b5ffc30b2db4 100644 (file)
@@ -42,6 +42,12 @@ FeatureObserver::~FeatureObserver()
     // We always log PageDestruction so that we have a scale for the rest of the features.
     HistogramSupport::histogramEnumeration("WebCore.FeatureObserver", PageDestruction, NumberOfFeatures);
 
+    updateMeasurements();
+}
+
+void FeatureObserver::updateMeasurements()
+{
+    HistogramSupport::histogramEnumeration("WebCore.FeatureObserver", PageVisits, NumberOfFeatures);
     if (!m_featureBits)
         return;
 
@@ -49,6 +55,13 @@ FeatureObserver::~FeatureObserver()
         if (m_featureBits->quickGet(i))
             HistogramSupport::histogramEnumeration("WebCore.FeatureObserver", i, NumberOfFeatures);
     }
+
+    m_featureBits->clearAll();
+}
+
+void FeatureObserver::didCommitLoad()
+{
+    updateMeasurements();
 }
 
 void FeatureObserver::observe(Document* document, Feature feature)
index 78f99ed8692d37e6c85fc56f13d8c58e0973a00b..71f7a8a5d7c22a23faa45c35b0b6c86cd148d43f 100644 (file)
@@ -95,12 +95,14 @@ public:
         RequiredAttribute,
         ResultsAttribute,
         StepAttribute,
+        PageVisits,
         // Add new features above this line. Don't change assigned numbers of each items.
         NumberOfFeatures, // This enum value must be last.
     };
 
     static void observe(Document*, Feature);
     static void observe(DOMWindow*, Feature);
+    void didCommitLoad();
 
 private:
     void didObserve(Feature feature)
@@ -114,6 +116,8 @@ private:
         m_featureBits->quickSet(feature);
     }
 
+    void updateMeasurements();
+
     OwnPtr<BitVector> m_featureBits;
 };