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

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

Issue 1652983005: Remove Enumeration Histograms from the Blink Platform API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_blink_histograms_5a
Patch Set: Rebase two new histograms were added today 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 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2012-2013 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012-2013 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 16 matching lines...) Expand all
27 27
28 #include "core/dom/ViewportDescription.h" 28 #include "core/dom/ViewportDescription.h"
29 29
30 #include "core/dom/Document.h" 30 #include "core/dom/Document.h"
31 #include "core/frame/FrameHost.h" 31 #include "core/frame/FrameHost.h"
32 #include "core/frame/FrameView.h" 32 #include "core/frame/FrameView.h"
33 #include "core/frame/LocalFrame.h" 33 #include "core/frame/LocalFrame.h"
34 #include "core/frame/Settings.h" 34 #include "core/frame/Settings.h"
35 #include "platform/Histogram.h" 35 #include "platform/Histogram.h"
36 #include "platform/weborigin/KURL.h" 36 #include "platform/weborigin/KURL.h"
37 #include "public/platform/Platform.h"
38 37
39 namespace blink { 38 namespace blink {
40 39
41 static const float& compareIgnoringAuto(const float& value1, const float& value2 , const float& (*compare) (const float&, const float&)) 40 static const float& compareIgnoringAuto(const float& value1, const float& value2 , const float& (*compare) (const float&, const float&))
42 { 41 {
43 if (value1 == ViewportDescription::ValueAuto) 42 if (value1 == ViewportDescription::ValueAuto)
44 return value2; 43 return value2;
45 44
46 if (value2 == ViewportDescription::ValueAuto) 45 if (value2 == ViewportDescription::ValueAuto)
47 return value1; 46 return value1;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 TypeCount 213 TypeCount
215 }; 214 };
216 215
217 if (!mainFrame || !mainFrame->host() || !mainFrame->view() || !mainFrame->do cument()) 216 if (!mainFrame || !mainFrame->host() || !mainFrame->view() || !mainFrame->do cument())
218 return; 217 return;
219 218
220 // Avoid chrome:// pages like the new-tab page (on Android new tab is non-ht tp). 219 // Avoid chrome:// pages like the new-tab page (on Android new tab is non-ht tp).
221 if (!mainFrame->document()->url().protocolIsInHTTPFamily()) 220 if (!mainFrame->document()->url().protocolIsInHTTPFamily())
222 return; 221 return;
223 222
223 DEFINE_STATIC_LOCAL(EnumerationHistogram, metaTagTypeHistogram, ("Viewport.M etaTagType", TypeCount));
224 if (!isSpecifiedByAuthor()) { 224 if (!isSpecifiedByAuthor()) {
225 if (mainFrame->document()->isMobileDocument()) 225 metaTagTypeHistogram.count(mainFrame->document()->isMobileDocument() ? X htmlMobileProfile : NoViewportTag);
226 Platform::current()->histogramEnumeration("Viewport.MetaTagType", Xh tmlMobileProfile, TypeCount);
227 else
228 Platform::current()->histogramEnumeration("Viewport.MetaTagType", No ViewportTag, TypeCount);
229
230 return; 226 return;
231 } 227 }
232 228
233 if (isMetaViewportType()) { 229 if (isMetaViewportType()) {
234 if (maxWidth.type() == blink::Fixed) { 230 if (maxWidth.type() == blink::Fixed) {
235 Platform::current()->histogramEnumeration("Viewport.MetaTagType", Co nstantWidth, TypeCount); 231 metaTagTypeHistogram.count(ConstantWidth);
236 232
237 if (mainFrame->view()) { 233 if (mainFrame->view()) {
238 // To get an idea of how "far" the viewport is from the device's ideal width, we 234 // To get an idea of how "far" the viewport is from the device's ideal width, we
239 // report the zoom level that we'd need to be at for the entire page to be visible. 235 // report the zoom level that we'd need to be at for the entire page to be visible.
240 int viewportWidth = maxWidth.intValue(); 236 int viewportWidth = maxWidth.intValue();
241 int windowWidth = mainFrame->host()->visualViewport().size().wid th(); 237 int windowWidth = mainFrame->host()->visualViewport().size().wid th();
242 int overviewZoomPercent = 100 * windowWidth / static_cast<float> (viewportWidth); 238 int overviewZoomPercent = 100 * windowWidth / static_cast<float> (viewportWidth);
243 DEFINE_STATIC_LOCAL(SparseHistogram, overviewZoomHistogram, ("Vi ewport.OverviewZoom")); 239 DEFINE_STATIC_LOCAL(SparseHistogram, overviewZoomHistogram, ("Vi ewport.OverviewZoom"));
244 overviewZoomHistogram.sample(overviewZoomPercent); 240 overviewZoomHistogram.sample(overviewZoomPercent);
245 } 241 }
246 242
247 } else if (maxWidth.type() == blink::DeviceWidth || maxWidth.type() == b link::ExtendToZoom) { 243 } else if (maxWidth.type() == blink::DeviceWidth || maxWidth.type() == b link::ExtendToZoom) {
248 Platform::current()->histogramEnumeration("Viewport.MetaTagType", De viceWidth, TypeCount); 244 metaTagTypeHistogram.count(DeviceWidth);
249 } else { 245 } else {
250 // Overflow bucket for cases we may be unaware of. 246 // Overflow bucket for cases we may be unaware of.
251 Platform::current()->histogramEnumeration("Viewport.MetaTagType", Me taWidthOther, TypeCount); 247 metaTagTypeHistogram.count(MetaWidthOther);
252 } 248 }
253 } else if (type == ViewportDescription::HandheldFriendlyMeta) { 249 } else if (type == ViewportDescription::HandheldFriendlyMeta) {
254 Platform::current()->histogramEnumeration("Viewport.MetaTagType", MetaHa ndheldFriendly, TypeCount); 250 metaTagTypeHistogram.count(MetaHandheldFriendly);
255 } else if (type == ViewportDescription::MobileOptimizedMeta) { 251 } else if (type == ViewportDescription::MobileOptimizedMeta) {
256 Platform::current()->histogramEnumeration("Viewport.MetaTagType", Mobile OptimizedMeta, TypeCount); 252 metaTagTypeHistogram.count(MobileOptimizedMeta);
257 } 253 }
258 #endif 254 #endif
259 } 255 }
260 256
261 bool ViewportDescription::matchesHeuristicsForGpuRasterization() const 257 bool ViewportDescription::matchesHeuristicsForGpuRasterization() const
262 { 258 {
263 return maxWidth == Length(DeviceWidth) 259 return maxWidth == Length(DeviceWidth)
264 && minZoom == 1.0 260 && minZoom == 1.0
265 && minZoomIsExplicit; 261 && minZoomIsExplicit;
266 } 262 }
267 263
268 } // namespace blink 264 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698