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