Changeset 173080 in webkit
- Timestamp:
- Aug 28, 2014 2:08:26 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r173079 r173080 1 2014-08-28 Pratik Solanki <psolanki@apple.com> 2 3 WebContent hangs under SharedBuffer::duplicateDataBufferIfNecessary() while browsing some websites 4 https://bugs.webkit.org/show_bug.cgi?id=136347 5 <rdar://problem/18073745> 6 7 Reviewed by Andreas Kling. 8 9 When passing data to ImageIO, we create a copy if we have to reallocate the buffer. We would 10 set the size of the new buffer to be the size of the SharedBuffer data. This causes memory 11 churn since we would create a new buffer for every data chunk we get. Fix this by at least 12 doubling the capacity of the buffer when we duplicate it. 13 14 * platform/SharedBuffer.cpp: 15 (WebCore::SharedBuffer::duplicateDataBufferIfNecessary): 16 1 17 2014-08-28 Dan Bernstein <mitz@apple.com> 2 18 -
trunk/Source/WebCore/platform/SharedBuffer.cpp
r172790 r173080 28 28 #include "SharedBuffer.h" 29 29 30 #include <algorithm> 30 31 #include <wtf/PassOwnPtr.h> 31 32 #include <wtf/unicode/UTF8.h> … … 352 353 void SharedBuffer::duplicateDataBufferIfNecessary() const 353 354 { 354 if (m_buffer->hasOneRef() || m_size <= m_buffer->data.capacity()) 355 size_t currentCapacity = m_buffer->data.capacity(); 356 if (m_buffer->hasOneRef() || m_size <= currentCapacity) 355 357 return; 356 358 359 size_t newCapacity = std::max(static_cast<size_t>(m_size), currentCapacity * 2); 357 360 RefPtr<DataBuffer> newBuffer = adoptRef(new DataBuffer); 358 newBuffer->data.reserveInitialCapacity( m_size);361 newBuffer->data.reserveInitialCapacity(newCapacity); 359 362 newBuffer->data = m_buffer->data; 360 363 m_buffer = newBuffer.release();
Note: See TracChangeset
for help on using the changeset viewer.