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

Side by Side Diff: third_party/WebKit/Source/core/dom/DocumentStatisticsCollector.cpp

Issue 1612803002: Test distillability on all pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mobile-distillable
Patch Set: address jwd's comment 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 // 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"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 return features; 221 return features;
222 222
223 ASSERT(document.hasFinishedParsing()); 223 ASSERT(document.hasFinishedParsing());
224 224
225 HTMLElement* body = document.body(); 225 HTMLElement* body = document.body();
226 HTMLElement* head = document.head(); 226 HTMLElement* head = document.head();
227 227
228 if (!body || !head) 228 if (!body || !head)
229 return features; 229 return features;
230 230
231 if (isMobileFriendly(document)) { 231 features.isMobileFriendly = isMobileFriendly(document);
232 features.isMobileFriendly = true;
233 // We only trigger Reader Mode on non-mobile-friendly pages for now.
234 return features;
235 }
236 232
237 double startTime = monotonicallyIncreasingTime(); 233 double startTime = monotonicallyIncreasingTime();
238 234
239 // This should be cheap since collectStatistics is only called right after l ayout. 235 // This should be cheap since collectStatistics is only called right after l ayout.
240 document.updateLayoutTreeIfNeeded(); 236 document.updateLayoutTreeIfNeeded();
241 237
242 // Traverse the DOM tree and collect statistics. 238 // Traverse the DOM tree and collect statistics.
243 collectFeatures(*body, features); 239 collectFeatures(*body, features);
244 features.openGraph = hasOpenGraphArticle(*head); 240 features.openGraph = hasOpenGraphArticle(*head);
245 241
246 double elapsedTime = monotonicallyIncreasingTime() - startTime; 242 double elapsedTime = monotonicallyIncreasingTime() - startTime;
247 Platform::current()->histogramCustomCounts("WebCore.DistillabilityUs", stati c_cast<int>(1e6 * elapsedTime), 1, 1000000, 50); 243 Platform::current()->histogramCustomCounts("WebCore.DistillabilityUs", stati c_cast<int>(1e6 * elapsedTime), 1, 1000000, 50);
248 244
249 return features; 245 return features;
250 } 246 }
251 247
252 } 248 }
OLDNEW
« no previous file with comments | « components/dom_distiller/content/renderer/distillability_agent.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698