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

Side by Side Diff: Source/core/css/CSSStyleSheet.h

Issue 170283019: Change various helper classes to transition types to get CSSValue entirely onto the gc heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase and revert member to persistent in StorageEvent Created 6 years, 9 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 | Annotate | Revision Log
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 CSSRule* item(unsigned index); 80 CSSRule* item(unsigned index);
81 81
82 virtual void clearOwnerNode() OVERRIDE { didMutate(EntireStyleSheetUpdate); m_ownerNode = 0; } 82 virtual void clearOwnerNode() OVERRIDE { didMutate(EntireStyleSheetUpdate); m_ownerNode = 0; }
83 virtual CSSRule* ownerRule() const OVERRIDE { return m_ownerRule; } 83 virtual CSSRule* ownerRule() const OVERRIDE { return m_ownerRule; }
84 virtual KURL baseURL() const OVERRIDE; 84 virtual KURL baseURL() const OVERRIDE;
85 virtual bool isLoading() const OVERRIDE; 85 virtual bool isLoading() const OVERRIDE;
86 86
87 void clearOwnerRule() { m_ownerRule = 0; } 87 void clearOwnerRule() { m_ownerRule = 0; }
88 Document* ownerDocument() const; 88 Document* ownerDocument() const;
89 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } 89 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); }
90 void setMediaQueries(PassRefPtr<MediaQuerySet>); 90 void setMediaQueries(PassRefPtrWillBeRawPtr<MediaQuerySet>);
91 void setTitle(const String& title) { m_title = title; } 91 void setTitle(const String& title) { m_title = title; }
92 92
93 class RuleMutationScope { 93 class RuleMutationScope {
94 WTF_MAKE_NONCOPYABLE(RuleMutationScope); 94 WTF_MAKE_NONCOPYABLE(RuleMutationScope);
95 public: 95 public:
96 RuleMutationScope(CSSStyleSheet*); 96 RuleMutationScope(CSSStyleSheet*);
97 RuleMutationScope(CSSRule*); 97 RuleMutationScope(CSSRule*);
98 ~RuleMutationScope(); 98 ~RuleMutationScope();
99 99
100 private: 100 private:
(...skipping 23 matching lines...) Expand all
124 virtual String type() const OVERRIDE { return "text/css"; } 124 virtual String type() const OVERRIDE { return "text/css"; }
125 125
126 void reattachChildRuleCSSOMWrappers(); 126 void reattachChildRuleCSSOMWrappers();
127 127
128 bool canAccessRules() const; 128 bool canAccessRules() const;
129 129
130 RefPtrWillBePersistent<StyleSheetContents> m_contents; 130 RefPtrWillBePersistent<StyleSheetContents> m_contents;
131 bool m_isInlineStylesheet; 131 bool m_isInlineStylesheet;
132 bool m_isDisabled; 132 bool m_isDisabled;
133 String m_title; 133 String m_title;
134 RefPtr<MediaQuerySet> m_mediaQueries; 134 RefPtrWillBePersistent<MediaQuerySet> m_mediaQueries;
135 135
136 Node* m_ownerNode; 136 Node* m_ownerNode;
137 // FIXME: oilpan: This is a back pointer from CSSImportRule, corresponding 137 // FIXME: oilpan: This is a back pointer from CSSImportRule, corresponding
138 // to the forward pointer on that, called m_styleSheetCSSOMWrapper. (It is 138 // to the forward pointer on that, called m_styleSheetCSSOMWrapper. (It is
139 // not related to the m_parentStyleSheet pointer which is also typed as 139 // not related to the m_parentStyleSheet pointer which is also typed as
140 // CSSStyleSheet, and which is inherited by CSSImportRule from CSSRule). 140 // CSSStyleSheet, and which is inherited by CSSImportRule from CSSRule).
141 // Since m_styleSheetCSSOMWrapper is a RefPtr we know that this object 141 // Since m_styleSheetCSSOMWrapper is a RefPtr we know that this object
142 // cannot die before the CSSImportRule is destructed, which makes it OK to 142 // cannot die before the CSSImportRule is destructed, which makes it OK to
143 // clear this from ~CSSImportRule. When this is on the GC heap we can make 143 // clear this from ~CSSImportRule. When this is on the GC heap we can make
144 // this a regular Member. 144 // this a regular Member.
145 CSSRule* m_ownerRule; 145 CSSRule* m_ownerRule;
146 146
147 TextPosition m_startPosition; 147 TextPosition m_startPosition;
148 bool m_loadCompleted; 148 bool m_loadCompleted;
149 149
150 mutable RefPtr<MediaList> m_mediaCSSOMWrapper; 150 mutable RefPtrWillBePersistent<MediaList> m_mediaCSSOMWrapper;
151 mutable WillBePersistentHeapVector<RefPtrWillBeMember<CSSRule> > m_childRule CSSOMWrappers; 151 mutable WillBePersistentHeapVector<RefPtrWillBeMember<CSSRule> > m_childRule CSSOMWrappers;
152 mutable OwnPtr<CSSRuleList> m_ruleListCSSOMWrapper; 152 mutable OwnPtr<CSSRuleList> m_ruleListCSSOMWrapper;
153 }; 153 };
154 154
155 inline CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSStyleSheet* sheet) 155 inline CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSStyleSheet* sheet)
156 : m_styleSheet(sheet) 156 : m_styleSheet(sheet)
157 { 157 {
158 if (m_styleSheet) 158 if (m_styleSheet)
159 m_styleSheet->willMutateRules(); 159 m_styleSheet->willMutateRules();
160 } 160 }
161 161
162 inline CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSRule* rule) 162 inline CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSRule* rule)
163 : m_styleSheet(rule ? rule->parentStyleSheet() : 0) 163 : m_styleSheet(rule ? rule->parentStyleSheet() : 0)
164 { 164 {
165 if (m_styleSheet) 165 if (m_styleSheet)
166 m_styleSheet->willMutateRules(); 166 m_styleSheet->willMutateRules();
167 } 167 }
168 168
169 inline CSSStyleSheet::RuleMutationScope::~RuleMutationScope() 169 inline CSSStyleSheet::RuleMutationScope::~RuleMutationScope()
170 { 170 {
171 if (m_styleSheet) 171 if (m_styleSheet)
172 m_styleSheet->didMutateRules(); 172 m_styleSheet->didMutateRules();
173 } 173 }
174 174
175 DEFINE_TYPE_CASTS(CSSStyleSheet, StyleSheet, sheet, sheet->isCSSStyleSheet(), sh eet.isCSSStyleSheet()); 175 DEFINE_TYPE_CASTS(CSSStyleSheet, StyleSheet, sheet, sheet->isCSSStyleSheet(), sh eet.isCSSStyleSheet());
176 176
177 } // namespace 177 } // namespace
178 178
179 #endif 179 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698