Changeset 144544 in webkit
- Timestamp:
- Mar 2, 2013 1:06:57 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r144543 r144544 1 2013-03-02 Eric Seidel <eric@webkit.org> 2 3 Remove two unnecessary mallocs from the main-thread-parser code path 4 https://bugs.webkit.org/show_bug.cgi?id=111249 5 6 Reviewed by Adam Barth. 7 8 I noticed these while fixing up our Vector -> String conversions 9 but never went back to fix the FIXME. 10 11 AtomicString(Vector<UChar, capacity>) is smart enough to avoid mallocing 12 if the represented string is already in the AtomicString table. It 13 also handles 8bit vs. 16bit and empty() just like nameString() does. 14 15 I also removed a 3rd caller to nameString() in the XSSAuditor which 16 was causing an unnecessary malloc in both the main and background 17 thread parser paths. 18 19 * html/parser/AtomicHTMLToken.h: 20 (WebCore::AtomicHTMLToken::AtomicHTMLToken): 21 * html/parser/HTMLToken.h: 22 * html/parser/XSSAuditor.cpp: 23 (WebCore): 24 (WebCore::threadSafeMatch): 25 (WebCore::hasName): 26 1 27 2013-03-02 Eric Seidel <eric@webkit.org> 2 28 -
trunk/Source/WebCore/html/parser/AtomicHTMLToken.h
r143673 r144544 154 154 break; 155 155 case HTMLToken::DOCTYPE: 156 m_name = AtomicString(token.name String()); // FIXME: Should be AtomicString(token.name()) to avoid mallocing every time.156 m_name = AtomicString(token.name()); 157 157 m_doctypeData = token.releaseDoctypeData(); 158 158 break; … … 162 162 case HTMLToken::EndTag: { 163 163 m_selfClosing = token.selfClosing(); 164 m_name = AtomicString(token.name String()); // FIXME: Should be AtomicString(token.name()) to avoid mallocing every time.164 m_name = AtomicString(token.name()); 165 165 initializeAttributes(token.attributes()); 166 166 break; -
trunk/Source/WebCore/html/parser/HTMLToken.h
r143415 r144544 152 152 } 153 153 154 // FIXME: Rename this to copyNameAsString().155 String nameString() const156 {157 if (!m_data.size())158 return emptyString();159 if (isAll8BitData())160 return String::make8BitFrom16BitSource(m_data.data(), m_data.size());161 return String(m_data);162 }163 164 154 /* DOCTYPE Tokens */ 165 155 -
trunk/Source/WebCore/html/parser/XSSAuditor.cpp
r144530 r144544 114 114 } 115 115 116 // If other files need this, we should move this to HTMLParserIdioms.h 117 template<size_t inlineCapacity> 118 bool threadSafeMatch(const Vector<UChar, inlineCapacity>& vector, const QualifiedName& qname) 119 { 120 return equalIgnoringNullity(vector, qname.localName().impl()); 121 } 122 116 123 static bool hasName(const HTMLToken& token, const QualifiedName& name) 117 124 { 118 return threadSafeMatch(token.name String(), name);125 return threadSafeMatch(token.name(), name); 119 126 } 120 127
Note: See TracChangeset
for help on using the changeset viewer.