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

Side by Side Diff: Source/core/fetch/FontResource.h

Issue 23720005: Move webfont usage metrics reporting to FontResource (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSFontFaceSource.cpp ('k') | Source/core/fetch/FontResource.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 class FontResource : public Resource { 43 class FontResource : public Resource {
44 public: 44 public:
45 FontResource(const ResourceRequest&); 45 FontResource(const ResourceRequest&);
46 virtual ~FontResource(); 46 virtual ~FontResource();
47 47
48 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&); 48 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&);
49 49
50 virtual void didAddClient(ResourceClient*); 50 virtual void didAddClient(ResourceClient*);
51 51
52 virtual void allClientsRemoved(); 52 virtual void allClientsRemoved();
53 void willUseFontData();
53 void beginLoadIfNeeded(ResourceFetcher* dl); 54 void beginLoadIfNeeded(ResourceFetcher* dl);
54 bool stillNeedsLoad() const { return !m_loadInitiated; } 55 bool stillNeedsLoad() const { return !m_loadInitiated; }
55 56
56 bool ensureCustomFontData(); 57 bool ensureCustomFontData();
57 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital ic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth); 58 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital ic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
58 59
59 #if ENABLE(SVG_FONTS) 60 #if ENABLE(SVG_FONTS)
60 bool ensureSVGFontData(); 61 bool ensureSVGFontData();
61 SVGFontElement* getSVGFontById(const String&) const; 62 SVGFontElement* getSVGFontById(const String&) const;
62 #endif 63 #endif
63 64
64 private: 65 private:
65 virtual void checkNotify(); 66 virtual void checkNotify();
66 OwnPtr<FontCustomPlatformData> m_fontData; 67 OwnPtr<FontCustomPlatformData> m_fontData;
67 bool m_loadInitiated; 68 bool m_loadInitiated;
68 69
69 #if ENABLE(SVG_FONTS) 70 #if ENABLE(SVG_FONTS)
70 RefPtr<WebCore::SVGDocument> m_externalSVGDocument; 71 RefPtr<WebCore::SVGDocument> m_externalSVGDocument;
71 #endif 72 #endif
73 class FontResourceHistograms {
74 public:
75 enum UsageType {
76 StyledAndUsed,
77 StyledButNotUsed,
78 NotStyledButUsed,
79 UsageTypeMax
80 };
81 FontResourceHistograms() : m_styledTime(0) { }
82 ~FontResourceHistograms();
83 void willUseFontData();
84 void loadStarted();
85 private:
86 double m_styledTime;
87 };
88 FontResourceHistograms m_histograms;
72 89
73 friend class MemoryCache; 90 friend class MemoryCache;
74 }; 91 };
75 92
76 class FontResourceClient : public ResourceClient { 93 class FontResourceClient : public ResourceClient {
77 public: 94 public:
78 virtual ~FontResourceClient() { } 95 virtual ~FontResourceClient() { }
79 static ResourceClientType expectedType() { return FontType; } 96 static ResourceClientType expectedType() { return FontType; }
80 virtual ResourceClientType resourceClientType() const { return expectedType( ); } 97 virtual ResourceClientType resourceClientType() const { return expectedType( ); }
81 virtual void fontLoaded(FontResource*) { } 98 virtual void fontLoaded(FontResource*) { }
82 virtual void didStartFontLoad(FontResource*) { } 99 virtual void didStartFontLoad(FontResource*) { }
83 }; 100 };
84 101
85 } 102 }
86 103
87 #endif 104 #endif
OLDNEW
« no previous file with comments | « Source/core/css/CSSFontFaceSource.cpp ('k') | Source/core/fetch/FontResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698