| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "DocumentStatisticsCollector.h" | 5 #include "DocumentStatisticsCollector.h" |
| 6 | 6 |
| 7 #include "core/HTMLNames.h" | 7 #include "core/HTMLNames.h" |
| 8 #include "core/InputTypeNames.h" | 8 #include "core/InputTypeNames.h" |
| 9 #include "core/dom/ElementTraversal.h" | 9 #include "core/dom/ElementTraversal.h" |
| 10 #include "core/dom/NodeComputedStyle.h" | 10 #include "core/dom/NodeComputedStyle.h" |
| 11 #include "core/dom/Text.h" | 11 #include "core/dom/Text.h" |
| 12 #include "core/frame/FrameHost.h" | |
| 13 #include "core/frame/LocalFrame.h" | 12 #include "core/frame/LocalFrame.h" |
| 14 #include "core/frame/VisualViewport.h" | 13 #include "core/frame/VisualViewport.h" |
| 15 #include "core/html/HTMLHeadElement.h" | 14 #include "core/html/HTMLHeadElement.h" |
| 16 #include "core/html/HTMLInputElement.h" | 15 #include "core/html/HTMLInputElement.h" |
| 17 #include "core/html/HTMLMetaElement.h" | 16 #include "core/html/HTMLMetaElement.h" |
| 17 #include "core/page/Page.h" |
| 18 #include "platform/Histogram.h" | 18 #include "platform/Histogram.h" |
| 19 #include "public/platform/Platform.h" | 19 #include "public/platform/Platform.h" |
| 20 #include "public/platform/WebDistillability.h" | 20 #include "public/platform/WebDistillability.h" |
| 21 | 21 |
| 22 namespace blink { | 22 namespace blink { |
| 23 | 23 |
| 24 using namespace HTMLNames; | 24 using namespace HTMLNames; |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 if (meta.name() == ogType || meta.getAttribute(propertyAttr) == ogType) { | 174 if (meta.name() == ogType || meta.getAttribute(propertyAttr) == ogType) { |
| 175 if (equalIgnoringCase(meta.content(), "article")) { | 175 if (equalIgnoringCase(meta.content(), "article")) { |
| 176 return true; | 176 return true; |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 return false; | 180 return false; |
| 181 } | 181 } |
| 182 | 182 |
| 183 bool isMobileFriendly(Document& document) { | 183 bool isMobileFriendly(Document& document) { |
| 184 if (FrameHost* frameHost = document.frameHost()) | 184 if (Page* page = document.page()) |
| 185 return frameHost->visualViewport().shouldDisableDesktopWorkarounds(); | 185 return page->visualViewport().shouldDisableDesktopWorkarounds(); |
| 186 return false; | 186 return false; |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace | 189 } // namespace |
| 190 | 190 |
| 191 WebDistillabilityFeatures DocumentStatisticsCollector::collectStatistics( | 191 WebDistillabilityFeatures DocumentStatisticsCollector::collectStatistics( |
| 192 Document& document) { | 192 Document& document) { |
| 193 TRACE_EVENT0("blink", "DocumentStatisticsCollector::collectStatistics"); | 193 TRACE_EVENT0("blink", "DocumentStatisticsCollector::collectStatistics"); |
| 194 | 194 |
| 195 WebDistillabilityFeatures features = WebDistillabilityFeatures(); | 195 WebDistillabilityFeatures features = WebDistillabilityFeatures(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 220 double elapsedTime = monotonicallyIncreasingTime() - startTime; | 220 double elapsedTime = monotonicallyIncreasingTime() - startTime; |
| 221 | 221 |
| 222 DEFINE_STATIC_LOCAL(CustomCountHistogram, distillabilityHistogram, | 222 DEFINE_STATIC_LOCAL(CustomCountHistogram, distillabilityHistogram, |
| 223 ("WebCore.DistillabilityUs", 1, 1000000, 50)); | 223 ("WebCore.DistillabilityUs", 1, 1000000, 50)); |
| 224 distillabilityHistogram.count(static_cast<int>(1e6 * elapsedTime)); | 224 distillabilityHistogram.count(static_cast<int>(1e6 * elapsedTime)); |
| 225 | 225 |
| 226 return features; | 226 return features; |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace blink | 229 } // namespace blink |
| OLD | NEW |