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

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

Issue 2494243003: Set WebFont priority to very low if the network is detected to be slow (Closed)
Patch Set: Addressed toyoshim comments Created 4 years, 1 month 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) 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 bool isCORSFailed() const { return m_corsFailed; } 60 bool isCORSFailed() const { return m_corsFailed; }
61 String otsParsingMessage() const { return m_otsParsingMessage; } 61 String otsParsingMessage() const { return m_otsParsingMessage; }
62 62
63 bool ensureCustomFontData(); 63 bool ensureCustomFontData();
64 FontPlatformData platformDataFromCustomData( 64 FontPlatformData platformDataFromCustomData(
65 float size, 65 float size,
66 bool bold, 66 bool bold,
67 bool italic, 67 bool italic,
68 FontOrientation = FontOrientation::Horizontal); 68 FontOrientation = FontOrientation::Horizontal);
69 69
70 // Returns true if the loading priority of the remote font resource can be
71 // lowered. The loading priority of the font can be lowered only if the
72 // font is not needed for painting the text.
73 bool isLowPriorityLoadingAllowedForRemoteFont() const;
74
70 private: 75 private:
71 class FontResourceFactory : public ResourceFactory { 76 class FontResourceFactory : public ResourceFactory {
72 public: 77 public:
73 FontResourceFactory() : ResourceFactory(Resource::Font) {} 78 FontResourceFactory() : ResourceFactory(Resource::Font) {}
74 79
75 Resource* create(const ResourceRequest& request, 80 Resource* create(const ResourceRequest& request,
76 const ResourceLoaderOptions& options, 81 const ResourceLoaderOptions& options,
77 const String& charset) const override { 82 const String& charset) const override {
78 return new FontResource(request, options); 83 return new FontResource(request, options);
79 } 84 }
(...skipping 25 matching lines...) Expand all
105 110
106 class FontResourceClient : public ResourceClient { 111 class FontResourceClient : public ResourceClient {
107 public: 112 public:
108 ~FontResourceClient() override {} 113 ~FontResourceClient() override {}
109 static bool isExpectedType(ResourceClient* client) { 114 static bool isExpectedType(ResourceClient* client) {
110 return client->getResourceClientType() == FontType; 115 return client->getResourceClientType() == FontType;
111 } 116 }
112 ResourceClientType getResourceClientType() const final { return FontType; } 117 ResourceClientType getResourceClientType() const final { return FontType; }
113 virtual void fontLoadShortLimitExceeded(FontResource*) {} 118 virtual void fontLoadShortLimitExceeded(FontResource*) {}
114 virtual void fontLoadLongLimitExceeded(FontResource*) {} 119 virtual void fontLoadLongLimitExceeded(FontResource*) {}
120
121 // Returns true if loading priority of remote font resources can be lowered.
122 virtual bool isLowPriorityLoadingAllowedForRemoteFont() const { return true; }
kinuko 2016/11/15 05:43:47 It probably doesn't change anything but is the def
tbansal1 2016/11/15 08:17:04 Yes it is intentional. I have added more comments
Kunihiko Sakamoto 2016/11/15 09:34:53 A supplementary explanation: All subclasses of Res
115 }; 123 };
116 124
117 } // namespace blink 125 } // namespace blink
118 126
119 #endif 127 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698