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

Side by Side Diff: third_party/WebKit/Source/core/inspector/InspectorStyleSheet.h

Issue 2060433002: Move SourceRange and CSSPropertySourceData classes off-heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix untidy ref-ptr handling Created 4 years, 6 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) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 class Document; 46 class Document;
47 class Element; 47 class Element;
48 class ExceptionState; 48 class ExceptionState;
49 class InspectorNetworkAgent; 49 class InspectorNetworkAgent;
50 class InspectorResourceContainer; 50 class InspectorResourceContainer;
51 class InspectorStyleSheetBase; 51 class InspectorStyleSheetBase;
52 52
53 typedef HeapVector<Member<CSSRule>> CSSRuleVector; 53 typedef HeapVector<Member<CSSRule>> CSSRuleVector;
54 typedef Vector<unsigned> LineEndings; 54 typedef Vector<unsigned> LineEndings;
55 55
56 class InspectorStyle final : public GarbageCollected<InspectorStyle> { 56 class InspectorStyle final : public GarbageCollectedFinalized<InspectorStyle> {
57 public: 57 public:
58 static InspectorStyle* create(CSSStyleDeclaration*, CSSRuleSourceData*, Insp ectorStyleSheetBase* parentStyleSheet); 58 static InspectorStyle* create(CSSStyleDeclaration*, PassRefPtr<CSSRuleSource Data>, InspectorStyleSheetBase* parentStyleSheet);
59 ~InspectorStyle();
59 60
60 CSSStyleDeclaration* cssStyle() { return m_style.get(); } 61 CSSStyleDeclaration* cssStyle() { return m_style.get(); }
61 std::unique_ptr<protocol::CSS::CSSStyle> buildObjectForStyle(); 62 std::unique_ptr<protocol::CSS::CSSStyle> buildObjectForStyle();
62 std::unique_ptr<protocol::Array<protocol::CSS::CSSComputedStyleProperty>> bu ildArrayForComputedStyle(); 63 std::unique_ptr<protocol::Array<protocol::CSS::CSSComputedStyleProperty>> bu ildArrayForComputedStyle();
63 bool styleText(String* result); 64 bool styleText(String* result);
64 bool textForRange(const SourceRange&, String* result); 65 bool textForRange(const SourceRange&, String* result);
65 66
66 DECLARE_TRACE(); 67 DECLARE_TRACE();
67 68
68 private: 69 private:
69 InspectorStyle(CSSStyleDeclaration*, CSSRuleSourceData*, InspectorStyleSheet Base* parentStyleSheet); 70 InspectorStyle(CSSStyleDeclaration*, PassRefPtr<CSSRuleSourceData>, Inspecto rStyleSheetBase* parentStyleSheet);
70 71
71 void populateAllProperties(HeapVector<CSSPropertySourceData>& result); 72 void populateAllProperties(Vector<CSSPropertySourceData>& result);
72 std::unique_ptr<protocol::CSS::CSSStyle> styleWithProperties(); 73 std::unique_ptr<protocol::CSS::CSSStyle> styleWithProperties();
73 String shorthandValue(const String& shorthandProperty); 74 String shorthandValue(const String& shorthandProperty);
74 75
75 Member<CSSStyleDeclaration> m_style; 76 Member<CSSStyleDeclaration> m_style;
76 Member<CSSRuleSourceData> m_sourceData; 77 RefPtr<CSSRuleSourceData> m_sourceData;
77 Member<InspectorStyleSheetBase> m_parentStyleSheet; 78 Member<InspectorStyleSheetBase> m_parentStyleSheet;
78 }; 79 };
79 80
80 class InspectorStyleSheetBase : public GarbageCollectedFinalized<InspectorStyleS heetBase> { 81 class InspectorStyleSheetBase : public GarbageCollectedFinalized<InspectorStyleS heetBase> {
81 public: 82 public:
82 class CORE_EXPORT Listener { 83 class CORE_EXPORT Listener {
83 public: 84 public:
84 Listener() { } 85 Listener() { }
85 virtual ~Listener() { } 86 virtual ~Listener() { }
86 virtual void styleSheetChanged(InspectorStyleSheetBase*) = 0; 87 virtual void styleSheetChanged(InspectorStyleSheetBase*) = 0;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 175
175 void replaceText(const SourceRange&, const String& text, SourceRange* newRan ge, String* oldText); 176 void replaceText(const SourceRange&, const String& text, SourceRange* newRan ge, String* oldText);
176 void innerSetText(const String& newText, bool markAsLocallyModified); 177 void innerSetText(const String& newText, bool markAsLocallyModified);
177 Element* ownerStyleElement(); 178 Element* ownerStyleElement();
178 179
179 Member<InspectorResourceContainer> m_resourceContainer; 180 Member<InspectorResourceContainer> m_resourceContainer;
180 Member<InspectorNetworkAgent> m_networkAgent; 181 Member<InspectorNetworkAgent> m_networkAgent;
181 Member<CSSStyleSheet> m_pageStyleSheet; 182 Member<CSSStyleSheet> m_pageStyleSheet;
182 String m_origin; 183 String m_origin;
183 String m_documentURL; 184 String m_documentURL;
184 Member<RuleSourceDataList> m_sourceData; 185 std::unique_ptr<RuleSourceDataList> m_sourceData;
185 String m_text; 186 String m_text;
186 CSSRuleVector m_cssomFlatRules; 187 CSSRuleVector m_cssomFlatRules;
187 CSSRuleVector m_parsedFlatRules; 188 CSSRuleVector m_parsedFlatRules;
188 typedef HashMap<unsigned, unsigned, WTF::IntHash<unsigned>, WTF::UnsignedWit hZeroKeyHashTraits<unsigned>> IndexMap; 189 typedef HashMap<unsigned, unsigned, WTF::IntHash<unsigned>, WTF::UnsignedWit hZeroKeyHashTraits<unsigned>> IndexMap;
189 IndexMap m_ruleToSourceData; 190 IndexMap m_ruleToSourceData;
190 IndexMap m_sourceDataToRule; 191 IndexMap m_sourceDataToRule;
191 String m_sourceURL; 192 String m_sourceURL;
192 }; 193 };
193 194
194 class InspectorStyleSheetForInlineStyle final : public InspectorStyleSheetBase { 195 class InspectorStyleSheetForInlineStyle final : public InspectorStyleSheetBase {
195 public: 196 public:
196 static InspectorStyleSheetForInlineStyle* create(Element*, Listener*); 197 static InspectorStyleSheetForInlineStyle* create(Element*, Listener*);
197 198
198 void didModifyElementAttribute(); 199 void didModifyElementAttribute();
199 bool setText(const String&, ExceptionState&) override; 200 bool setText(const String&, ExceptionState&) override;
200 bool getText(String* result) override; 201 bool getText(String* result) override;
201 CSSStyleDeclaration* inlineStyle(); 202 CSSStyleDeclaration* inlineStyle();
202 CSSRuleSourceData* ruleSourceData(); 203 PassRefPtr<CSSRuleSourceData> ruleSourceData();
203 204
204 DECLARE_VIRTUAL_TRACE(); 205 DECLARE_VIRTUAL_TRACE();
205 206
206 protected: 207 protected:
207 InspectorStyle* inspectorStyle(CSSStyleDeclaration*) override; 208 InspectorStyle* inspectorStyle(CSSStyleDeclaration*) override;
208 209
209 // Also accessed by friend class InspectorStyle. 210 // Also accessed by friend class InspectorStyle.
210 bool isInlineStyle() override { return true; } 211 bool isInlineStyle() override { return true; }
211 212
212 private: 213 private:
213 InspectorStyleSheetForInlineStyle(Element*, Listener*); 214 InspectorStyleSheetForInlineStyle(Element*, Listener*);
214 const String& elementStyleText(); 215 const String& elementStyleText();
215 216
216 Member<Element> m_element; 217 Member<Element> m_element;
217 Member<InspectorStyle> m_inspectorStyle; 218 Member<InspectorStyle> m_inspectorStyle;
218 }; 219 };
219 220
220 } // namespace blink 221 } // namespace blink
221 222
222 #endif // !defined(InspectorStyleSheet_h) 223 #endif // !defined(InspectorStyleSheet_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698