| OLD | NEW |
| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 LoadLimitState m_loadLimitState; | 113 LoadLimitState m_loadLimitState; |
| 114 bool m_corsFailed; | 114 bool m_corsFailed; |
| 115 Timer<FontResource> m_fontLoadShortLimitTimer; | 115 Timer<FontResource> m_fontLoadShortLimitTimer; |
| 116 Timer<FontResource> m_fontLoadLongLimitTimer; | 116 Timer<FontResource> m_fontLoadLongLimitTimer; |
| 117 | 117 |
| 118 friend class MemoryCache; | 118 friend class MemoryCache; |
| 119 FRIEND_TEST_ALL_PREFIXES(FontResourceTest, CacheAwareFontLoading); | 119 FRIEND_TEST_ALL_PREFIXES(FontResourceTest, CacheAwareFontLoading); |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 DEFINE_RESOURCE_TYPE_CASTS(Font); | 122 DEFINE_RESOURCE_TYPE_CASTS(Font); |
| 123 /* DO NOT SUBMIT - Conflict resolution helper: |
| 124 * Above we should have Font, not kFont */ |
| 123 | 125 |
| 124 class FontResourceClient : public ResourceClient { | 126 class FontResourceClient : public ResourceClient { |
| 125 public: | 127 public: |
| 126 ~FontResourceClient() override {} | 128 ~FontResourceClient() override {} |
| 127 static bool isExpectedType(ResourceClient* client) { | 129 static bool isExpectedType(ResourceClient* client) { |
| 128 return client->getResourceClientType() == FontType; | 130 return client->getResourceClientType() == FontType; |
| 129 } | 131 } |
| 130 ResourceClientType getResourceClientType() const final { return FontType; } | 132 ResourceClientType getResourceClientType() const final { return FontType; } |
| 131 | 133 |
| 132 // If cache-aware loading is activated, both callbacks will be blocked until | 134 // If cache-aware loading is activated, both callbacks will be blocked until |
| 133 // disk cache miss. Calls to addClient() and removeClient() in both callbacks | 135 // disk cache miss. Calls to addClient() and removeClient() in both callbacks |
| 134 // are prohibited to prevent race issues regarding current loading state. | 136 // are prohibited to prevent race issues regarding current loading state. |
| 135 virtual void fontLoadShortLimitExceeded(FontResource*) {} | 137 virtual void fontLoadShortLimitExceeded(FontResource*) {} |
| 136 virtual void fontLoadLongLimitExceeded(FontResource*) {} | 138 virtual void fontLoadLongLimitExceeded(FontResource*) {} |
| 137 | 139 |
| 138 // Returns true if loading priority of remote font resources can be lowered. | 140 // Returns true if loading priority of remote font resources can be lowered. |
| 139 virtual bool isLowPriorityLoadingAllowedForRemoteFont() const { | 141 virtual bool isLowPriorityLoadingAllowedForRemoteFont() const { |
| 140 // Only the RemoteFontFaceSources clients can prevent lowering of loading | 142 // Only the RemoteFontFaceSources clients can prevent lowering of loading |
| 141 // priority of the remote fonts. Set the default to true to prevent | 143 // priority of the remote fonts. Set the default to true to prevent |
| 142 // other clients from incorrectly returning false. | 144 // other clients from incorrectly returning false. |
| 143 return true; | 145 return true; |
| 144 } | 146 } |
| 145 }; | 147 }; |
| 146 | 148 |
| 147 } // namespace blink | 149 } // namespace blink |
| 148 | 150 |
| 149 #endif | 151 #endif |
| OLD | NEW |