Changeset 176293 in webkit
- Timestamp:
- Nov 18, 2014, 4:17:27 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/wtf/Vector.h (modified) (3 diffs)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/editing/TextIterator.cpp (modified) (8 diffs)
-
WebCore/platform/SharedBuffer.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r176290 r176293 1 2014-11-18 Chris Dumez <cdumez@apple.com> 2 3 Have Vector::capacity() return an unsigned instead of a size_t 4 https://bugs.webkit.org/show_bug.cgi?id=138842 5 6 Reviewed by Andreas Kling. 7 8 Have Vector::capacity() return an unsigned instead of a size_t as 9 capacity is stored as an unsigned internally. 10 11 * wtf/Vector.h: 12 (WTF::Vector::capacity): 13 (WTF::OverflowHandler>::expandCapacity): 14 (WTF::OverflowHandler>::tryExpandCapacity): 15 1 16 2014-11-18 Geoffrey Garen <ggaren@apple.com> 2 17 -
trunk/Source/WTF/wtf/Vector.h
r176275 r176293 611 611 size_t size() const { return m_size; } 612 612 static ptrdiff_t sizeMemoryOffset() { return OBJECT_OFFSETOF(Vector, m_size); } 613 size_tcapacity() const { return Base::capacity(); }613 unsigned capacity() const { return Base::capacity(); } 614 614 bool isEmpty() const { return !size(); } 615 615 … … 876 876 void Vector<T, inlineCapacity, OverflowHandler>::expandCapacity(unsigned newMinCapacity) 877 877 { 878 reserveCapacity(std::max(newMinCapacity, std::max(16u, static_cast<unsigned>(capacity() + capacity() / 4 + 1))));878 reserveCapacity(std::max(newMinCapacity, std::max(16u, capacity() + capacity() / 4 + 1))); 879 879 } 880 880 … … 894 894 bool Vector<T, inlineCapacity, OverflowHandler>::tryExpandCapacity(unsigned newMinCapacity) 895 895 { 896 return tryReserveCapacity(std::max(newMinCapacity, std::max(16u, static_cast<unsigned>(capacity() + capacity() / 4 + 1))));896 return tryReserveCapacity(std::max(newMinCapacity, std::max(16u, capacity() + capacity() / 4 + 1))); 897 897 } 898 898 -
trunk/Source/WebCore/ChangeLog
r176290 r176293 1 2014-11-18 Chris Dumez <cdumez@apple.com> 2 3 Have Vector::capacity() return an unsigned instead of a size_t 4 https://bugs.webkit.org/show_bug.cgi?id=138842 5 6 Reviewed by Andreas Kling. 7 8 Update the code base now that Vector::capacity() returns an unsigned 9 type instead of a size_t. 10 11 No new tests, no behavior change. 12 13 * editing/TextIterator.cpp: 14 (WebCore::SearchBuffer::append): 15 (WebCore::SearchBuffer::prependContext): 16 (WebCore::SearchBuffer::search): 17 (WebCore::SearchBuffer::length): 18 * platform/SharedBuffer.cpp: 19 (WebCore::SharedBuffer::duplicateDataBufferIfNecessary): 20 1 21 2014-11-18 Geoffrey Garen <ggaren@apple.com> 2 22 -
trunk/Source/WebCore/editing/TextIterator.cpp
r174840 r176293 101 101 102 102 Vector<UChar> m_buffer; 103 size_tm_overlap;104 size_tm_prefixLength;103 unsigned m_overlap; 104 unsigned m_prefixLength; 105 105 bool m_atBreak; 106 106 bool m_needsMoreContext; … … 114 114 private: 115 115 void append(UChar, bool isCharacterStart); 116 size_tlength() const;116 unsigned length() const; 117 117 118 118 String m_target; … … 2011 2011 } else if (m_buffer.size() == m_buffer.capacity()) { 2012 2012 memcpy(m_buffer.data(), m_buffer.data() + m_buffer.size() - m_overlap, m_overlap * sizeof(UChar)); 2013 m_prefixLength -= std::min(m_prefixLength, m_buffer.size() - m_overlap);2013 m_prefixLength -= std::min(m_prefixLength, static_cast<unsigned>(m_buffer.size()) - m_overlap); 2014 2014 m_buffer.shrink(m_overlap); 2015 2015 } 2016 2016 2017 size_toldLength = m_buffer.size();2018 size_t usableLength = std::min<size_t>(m_buffer.capacity() - oldLength, text.length());2017 unsigned oldLength = m_buffer.size(); 2018 unsigned usableLength = std::min(m_buffer.capacity() - oldLength, text.length()); 2019 2019 ASSERT(usableLength); 2020 2020 m_buffer.grow(oldLength + usableLength); … … 2039 2039 m_atBreak = false; 2040 2040 2041 size_twordBoundaryContextStart = text.length();2041 unsigned wordBoundaryContextStart = text.length(); 2042 2042 if (wordBoundaryContextStart) { 2043 2043 U16_BACK_1(text, 0, wordBoundaryContextStart); … … 2045 2045 } 2046 2046 2047 size_tusableLength = std::min(m_buffer.capacity() - m_prefixLength, text.length() - wordBoundaryContextStart);2047 unsigned usableLength = std::min(m_buffer.capacity() - m_prefixLength, text.length() - wordBoundaryContextStart); 2048 2048 WTF::append(m_buffer, text.substring(text.length() - usableLength, usableLength)); 2049 2049 m_prefixLength += usableLength; … … 2191 2191 inline size_t SearchBuffer::search(size_t& start) 2192 2192 { 2193 size_tsize = m_buffer.size();2193 unsigned size = m_buffer.size(); 2194 2194 if (m_atBreak) { 2195 2195 if (!size) … … 2222 2222 // possibly including a combining character that's not yet in the buffer. 2223 2223 if (!m_atBreak && static_cast<size_t>(matchStart) >= size - m_overlap) { 2224 size_toverlap = m_overlap;2224 unsigned overlap = m_overlap; 2225 2225 if (m_options & AtWordStarts) { 2226 2226 // Ensure that there is sufficient context before matchStart the next time around for … … 2359 2359 // That's not necessarily the same length as the passed-in target string, because case folding 2360 2360 // can make two strings match even though they're not the same length. 2361 size_tSearchBuffer::length() const2362 { 2363 size_tbufferSize = m_target.length();2364 size_tlength = 0;2365 for ( size_ti = 0; i < bufferSize; ++i)2361 unsigned SearchBuffer::length() const 2362 { 2363 unsigned bufferSize = m_target.length(); 2364 unsigned length = 0; 2365 for (unsigned i = 0; i < bufferSize; ++i) 2366 2366 length += m_isCharacterStartBuffer[i]; 2367 2367 return length; -
trunk/Source/WebCore/platform/SharedBuffer.cpp
r175549 r176293 253 253 void SharedBuffer::duplicateDataBufferIfNecessary() const 254 254 { 255 size_tcurrentCapacity = m_buffer->data.capacity();255 unsigned currentCapacity = m_buffer->data.capacity(); 256 256 if (m_buffer->hasOneRef() || m_size <= currentCapacity) 257 257 return; 258 258 259 size_t newCapacity = std::max(static_cast<size_t>(m_size), currentCapacity * 2);259 unsigned newCapacity = std::max(m_size, currentCapacity * 2); 260 260 RefPtr<DataBuffer> newBuffer = adoptRef(new DataBuffer); 261 261 newBuffer->data.reserveInitialCapacity(newCapacity);
Note:
See TracChangeset
for help on using the changeset viewer.