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

Side by Side Diff: third_party/WebKit/Source/core/fetch/FontResource.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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Torch Mobile, Inc. 3 * Copyright (C) 2009 Torch Mobile, Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 11 matching lines...) Expand all
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #include "core/fetch/FontResource.h" 27 #include "core/fetch/FontResource.h"
28 28
29 #include "core/fetch/FetchRequest.h" 29 #include "core/fetch/FetchRequest.h"
30 #include "core/fetch/ResourceClientWalker.h" 30 #include "core/fetch/ResourceClientWalker.h"
31 #include "core/fetch/ResourceFetcher.h" 31 #include "core/fetch/ResourceFetcher.h"
32 #include "platform/Histogram.h"
32 #include "platform/SharedBuffer.h" 33 #include "platform/SharedBuffer.h"
33 #include "platform/fonts/FontCustomPlatformData.h" 34 #include "platform/fonts/FontCustomPlatformData.h"
34 #include "platform/fonts/FontPlatformData.h" 35 #include "platform/fonts/FontPlatformData.h"
35 #include "public/platform/Platform.h"
36 #include "wtf/CurrentTime.h" 36 #include "wtf/CurrentTime.h"
37 37
38 namespace blink { 38 namespace blink {
39 39
40 // Durations of font-display periods. 40 // Durations of font-display periods.
41 // https://tabatkins.github.io/specs/css-font-display/#font-display-desc 41 // https://tabatkins.github.io/specs/css-font-display/#font-display-desc
42 static const double fontLoadWaitShortLimitSec = 0.1; 42 static const double fontLoadWaitShortLimitSec = 0.1;
43 static const double fontLoadWaitLongLimitSec = 3.0; 43 static const double fontLoadWaitLongLimitSec = 3.0;
44 44
45 enum FontPackageFormat { 45 enum FontPackageFormat {
(...skipping 13 matching lines...) Expand all
59 const char* data = buffer->data(); 59 const char* data = buffer->data();
60 if (data[0] == 'w' && data[1] == 'O' && data[2] == 'F' && data[3] == 'F') 60 if (data[0] == 'w' && data[1] == 'O' && data[2] == 'F' && data[3] == 'F')
61 return PackageFormatWOFF; 61 return PackageFormatWOFF;
62 if (data[0] == 'w' && data[1] == 'O' && data[2] == 'F' && data[3] == '2') 62 if (data[0] == 'w' && data[1] == 'O' && data[2] == 'F' && data[3] == '2')
63 return PackageFormatWOFF2; 63 return PackageFormatWOFF2;
64 return PackageFormatSFNT; 64 return PackageFormatSFNT;
65 } 65 }
66 66
67 static void recordPackageFormatHistogram(FontPackageFormat format) 67 static void recordPackageFormatHistogram(FontPackageFormat format)
68 { 68 {
69 Platform::current()->histogramEnumeration("WebFont.PackageFormat", format, P ackageFormatEnumMax); 69 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, packageFormatHistogram , new EnumerationHistogram("WebFont.PackageFormat", PackageFormatEnumMax));
70 packageFormatHistogram.count(format);
70 } 71 }
71 72
72 ResourcePtr<FontResource> FontResource::fetch(FetchRequest& request, ResourceFet cher* fetcher) 73 ResourcePtr<FontResource> FontResource::fetch(FetchRequest& request, ResourceFet cher* fetcher)
73 { 74 {
74 ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone ); 75 ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone );
75 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon textFont); 76 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon textFont);
76 return toFontResource(fetcher->requestResource(request, FontResourceFactory( ))); 77 return toFontResource(fetcher->requestResource(request, FontResourceFactory( )));
77 } 78 }
78 79
79 FontResource::FontResource(const ResourceRequest& resourceRequest) 80 FontResource::FontResource(const ResourceRequest& resourceRequest)
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 void FontResource::checkNotify() 195 void FontResource::checkNotify()
195 { 196 {
196 m_fontLoadShortLimitTimer.stop(); 197 m_fontLoadShortLimitTimer.stop();
197 m_fontLoadLongLimitTimer.stop(); 198 m_fontLoadLongLimitTimer.stop();
198 ResourceClientWalker<FontResourceClient> w(m_clients); 199 ResourceClientWalker<FontResourceClient> w(m_clients);
199 while (FontResourceClient* c = w.next()) 200 while (FontResourceClient* c = w.next())
200 c->fontLoaded(this); 201 c->fontLoaded(this);
201 } 202 }
202 203
203 } // namespace blink 204 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698