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

Side by Side Diff: third_party/WebKit/Source/core/css/StyleSheetContents.h

Issue 2205843003: Use weak members to cache StyleSheetContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Might be in cache without being used before garbage collection Created 4 years, 4 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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 bool isLoading() const; 76 bool isLoading() const;
77 77
78 void checkLoaded(); 78 void checkLoaded();
79 void startLoadingDynamicSheet(); 79 void startLoadingDynamicSheet();
80 80
81 StyleSheetContents* rootStyleSheet() const; 81 StyleSheetContents* rootStyleSheet() const;
82 bool hasSingleOwnerNode() const; 82 bool hasSingleOwnerNode() const;
83 Node* singleOwnerNode() const; 83 Node* singleOwnerNode() const;
84 Document* singleOwnerDocument() const; 84 Document* singleOwnerDocument() const;
85 bool hasSingleOwnerDocument() const { return m_hasSingleOwnerDocument; }
85 86
86 const String& charset() const { return m_parserContext.charset(); } 87 const String& charset() const { return m_parserContext.charset(); }
87 88
88 bool loadCompleted() const; 89 bool loadCompleted() const;
89 bool hasFailedOrCanceledSubresources() const; 90 bool hasFailedOrCanceledSubresources() const;
90 91
91 void setHasSyntacticallyValidCSSHeader(bool isValidCss); 92 void setHasSyntacticallyValidCSSHeader(bool isValidCss);
92 bool hasSyntacticallyValidCSSHeader() const { return m_hasSyntacticallyValid CSSHeader; } 93 bool hasSyntacticallyValidCSSHeader() const { return m_hasSyntacticallyValid CSSHeader; }
93 94
94 void setHasFontFaceRule() { m_hasFontFaceRule = true; } 95 void setHasFontFaceRule() { m_hasFontFaceRule = true; }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 void registerClient(CSSStyleSheet*); 134 void registerClient(CSSStyleSheet*);
134 void unregisterClient(CSSStyleSheet*); 135 void unregisterClient(CSSStyleSheet*);
135 size_t clientSize() const { return m_loadingClients.size() + m_completedClie nts.size(); } 136 size_t clientSize() const { return m_loadingClients.size() + m_completedClie nts.size(); }
136 bool hasOneClient() { return clientSize() == 1; } 137 bool hasOneClient() { return clientSize() == 1; }
137 void clientLoadCompleted(CSSStyleSheet*); 138 void clientLoadCompleted(CSSStyleSheet*);
138 void clientLoadStarted(CSSStyleSheet*); 139 void clientLoadStarted(CSSStyleSheet*);
139 140
140 bool isMutable() const { return m_isMutable; } 141 bool isMutable() const { return m_isMutable; }
141 void setMutable() { m_isMutable = true; } 142 void setMutable() { m_isMutable = true; }
142 143
143 void removeSheetFromCache(Document*); 144 bool isUsedFromTextCache() const { return m_isUsedFromTextCache; }
145 void setIsUsedFromTextCache() { m_isUsedFromTextCache = true; }
144 146
145 bool isReferencedFromResource() const { return m_referencedFromResource; } 147 bool isReferencedFromResource() const { return m_referencedFromResource; }
146 void setReferencedFromResource(CSSStyleSheetResource*); 148 void setReferencedFromResource(CSSStyleSheetResource*);
147 void clearReferencedFromResource(); 149 void clearReferencedFromResource();
148 150
149 void setHasMediaQueries(); 151 void setHasMediaQueries();
150 bool hasMediaQueries() const { return m_hasMediaQueries; } 152 bool hasMediaQueries() const { return m_hasMediaQueries; }
151 153
152 bool didLoadErrorOccur() const { return m_didLoadErrorOccur; } 154 bool didLoadErrorOccur() const { return m_didLoadErrorOccur; }
153 155
(...skipping 25 matching lines...) Expand all
179 PrefixNamespaceURIMap m_namespaces; 181 PrefixNamespaceURIMap m_namespaces;
180 AtomicString m_defaultNamespace; 182 AtomicString m_defaultNamespace;
181 WeakMember<CSSStyleSheetResource> m_referencedFromResource; 183 WeakMember<CSSStyleSheetResource> m_referencedFromResource;
182 184
183 bool m_hasSyntacticallyValidCSSHeader : 1; 185 bool m_hasSyntacticallyValidCSSHeader : 1;
184 bool m_didLoadErrorOccur : 1; 186 bool m_didLoadErrorOccur : 1;
185 bool m_isMutable : 1; 187 bool m_isMutable : 1;
186 bool m_hasFontFaceRule : 1; 188 bool m_hasFontFaceRule : 1;
187 bool m_hasMediaQueries : 1; 189 bool m_hasMediaQueries : 1;
188 bool m_hasSingleOwnerDocument : 1; 190 bool m_hasSingleOwnerDocument : 1;
191 bool m_isUsedFromTextCache : 1;
189 192
190 CSSParserContext m_parserContext; 193 CSSParserContext m_parserContext;
191 194
192 HeapHashSet<WeakMember<CSSStyleSheet>> m_loadingClients; 195 HeapHashSet<WeakMember<CSSStyleSheet>> m_loadingClients;
193 HeapHashSet<WeakMember<CSSStyleSheet>> m_completedClients; 196 HeapHashSet<WeakMember<CSSStyleSheet>> m_completedClients;
194 197
195 Member<RuleSet> m_ruleSet; 198 Member<RuleSet> m_ruleSet;
196 String m_sourceMapURL; 199 String m_sourceMapURL;
197 }; 200 };
198 201
199 } // namespace blink 202 } // namespace blink
200 203
201 #endif 204 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698