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

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

Issue 1829403002: Clean up font loading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Resource_status
Patch Set: Another rebase! Created 4 years, 8 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) 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 29 matching lines...) Expand all
40 class FontCustomPlatformData; 40 class FontCustomPlatformData;
41 class FontResourceClient; 41 class FontResourceClient;
42 42
43 class FontResource final : public Resource { 43 class FontResource final : public Resource {
44 public: 44 public:
45 using ClientType = FontResourceClient; 45 using ClientType = FontResourceClient;
46 46
47 static FontResource* fetch(FetchRequest&, ResourceFetcher*); 47 static FontResource* fetch(FetchRequest&, ResourceFetcher*);
48 ~FontResource() override; 48 ~FontResource() override;
49 49
50 void load(ResourceFetcher*) override;
51
52 void didAddClient(ResourceClient*) override; 50 void didAddClient(ResourceClient*) override;
53 51
54 void allClientsAndObserversRemoved() override; 52 void allClientsAndObserversRemoved() override;
55 void beginLoadIfNeeded(ResourceFetcher* dl); 53 void startLoadLimitTimersIfNeeded();
56
57 bool loadScheduled() const { return getStatus() == LoadStartScheduled; }
58 void didScheduleLoad();
59 void didUnscheduleLoad();
60 54
61 void setCORSFailed() override { m_corsFailed = true; } 55 void setCORSFailed() override { m_corsFailed = true; }
62 bool isCORSFailed() const { return m_corsFailed; } 56 bool isCORSFailed() const { return m_corsFailed; }
63 String otsParsingMessage() const { return m_otsParsingMessage; } 57 String otsParsingMessage() const { return m_otsParsingMessage; }
64 58
65 bool ensureCustomFontData(); 59 bool ensureCustomFontData();
66 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital ic, FontOrientation = FontOrientation::Horizontal); 60 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital ic, FontOrientation = FontOrientation::Horizontal);
67 61
68 protected: 62 protected:
69 bool isSafeToUnlock() const override; 63 bool isSafeToUnlock() const override;
(...skipping 28 matching lines...) Expand all
98 }; 92 };
99 93
100 DEFINE_RESOURCE_TYPE_CASTS(Font); 94 DEFINE_RESOURCE_TYPE_CASTS(Font);
101 95
102 class FontResourceClient : public ResourceClient { 96 class FontResourceClient : public ResourceClient {
103 public: 97 public:
104 ~FontResourceClient() override {} 98 ~FontResourceClient() override {}
105 static bool isExpectedType(ResourceClient* client) { return client->getResou rceClientType() == FontType; } 99 static bool isExpectedType(ResourceClient* client) { return client->getResou rceClientType() == FontType; }
106 ResourceClientType getResourceClientType() const final { return FontType; } 100 ResourceClientType getResourceClientType() const final { return FontType; }
107 virtual void fontLoaded(FontResource*) {} 101 virtual void fontLoaded(FontResource*) {}
108 virtual void didStartFontLoad(FontResource*) {}
109 virtual void fontLoadShortLimitExceeded(FontResource*) {} 102 virtual void fontLoadShortLimitExceeded(FontResource*) {}
110 virtual void fontLoadLongLimitExceeded(FontResource*) {} 103 virtual void fontLoadLongLimitExceeded(FontResource*) {}
111 }; 104 };
112 105
113 } // namespace blink 106 } // namespace blink
114 107
115 #endif 108 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp ('k') | third_party/WebKit/Source/core/fetch/FontResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698