Title: [142384] trunk/Source/WebKit2
- Revision
- 142384
- Author
- [email protected]
- Date
- 2013-02-09 19:48:27 -0800 (Sat, 09 Feb 2013)
Log Message
Unreviewed, rolling out r137328.
http://trac.webkit.org/changeset/137328
https://bugs.webkit.org/show_bug.cgi?id=109367
causes memory usage to balloon if connection queue is filling
faster than sending (Requested by kling on #webkit).
Patch by Sheriff Bot <[email protected]> on 2013-02-09
* Platform/CoreIPC/ArgumentEncoder.cpp:
(CoreIPC::ArgumentEncoder::ArgumentEncoder):
(CoreIPC::ArgumentEncoder::grow):
* Platform/CoreIPC/ArgumentEncoder.h:
(CoreIPC::ArgumentEncoder::buffer):
(ArgumentEncoder):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (142383 => 142384)
--- trunk/Source/WebKit2/ChangeLog 2013-02-10 00:50:59 UTC (rev 142383)
+++ trunk/Source/WebKit2/ChangeLog 2013-02-10 03:48:27 UTC (rev 142384)
@@ -1,3 +1,19 @@
+2013-02-09 Sheriff Bot <[email protected]>
+
+ Unreviewed, rolling out r137328.
+ http://trac.webkit.org/changeset/137328
+ https://bugs.webkit.org/show_bug.cgi?id=109367
+
+ causes memory usage to balloon if connection queue is filling
+ faster than sending (Requested by kling on #webkit).
+
+ * Platform/CoreIPC/ArgumentEncoder.cpp:
+ (CoreIPC::ArgumentEncoder::ArgumentEncoder):
+ (CoreIPC::ArgumentEncoder::grow):
+ * Platform/CoreIPC/ArgumentEncoder.h:
+ (CoreIPC::ArgumentEncoder::buffer):
+ (ArgumentEncoder):
+
2013-02-08 Sam Weinig <[email protected]>
Fix ASSERT when the Web Content Process crashes
Modified: trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp (142383 => 142384)
--- trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp 2013-02-10 00:50:59 UTC (rev 142383)
+++ trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp 2013-02-10 03:48:27 UTC (rev 142384)
@@ -39,8 +39,9 @@
ArgumentEncoder::ArgumentEncoder()
: m_buffer(0)
+ , m_bufferPointer(0)
, m_bufferSize(0)
- , m_bufferCapacity(inlineBufferSize)
+ , m_bufferCapacity(0)
{
}
@@ -67,31 +68,27 @@
if (alignedSize + size > m_bufferCapacity) {
size_t newCapacity = std::max(alignedSize + size, std::max(static_cast<size_t>(32), m_bufferCapacity + m_bufferCapacity / 4 + 1));
+ // Use system malloc / realloc instead of fastMalloc due to
+ // fastMalloc using MADV_FREE_REUSABLE which doesn't work with
+ // mach messages with OOL message and MACH_MSG_VIRTUAL_COPY.
+ // System malloc also calls madvise(MADV_FREE_REUSABLE) but after first
+ // checking via madvise(CAN_REUSE) that it will succeed. Should this
+ // behavior change we'll need to revisit this.
+ if (!m_buffer)
+ m_buffer = static_cast<uint8_t*>(malloc(newCapacity));
+ else
+ m_buffer = static_cast<uint8_t*>(realloc(m_buffer, newCapacity));
- if (newCapacity > inlineBufferSize) {
- // Use system malloc / realloc instead of fastMalloc due to
- // fastMalloc using MADV_FREE_REUSABLE which doesn't work with
- // mach messages with OOL message and MACH_MSG_VIRTUAL_COPY.
- // System malloc also calls madvise(MADV_FREE_REUSABLE) but after first
- // checking via madvise(CAN_REUSE) that it will succeed. Should this
- // behavior change we'll need to revisit this.
- if (!m_buffer)
- m_buffer = static_cast<uint8_t*>(malloc(newCapacity));
- else
- m_buffer = static_cast<uint8_t*>(realloc(m_buffer, newCapacity));
+ if (!m_buffer)
+ CRASH();
- if (!m_buffer)
- CRASH();
-
- if (usesInlineBuffer())
- memcpy(m_buffer, m_inlineBuffer, m_bufferCapacity);
- }
-
m_bufferCapacity = newCapacity;
}
m_bufferSize = alignedSize + size;
- return buffer() + alignedSize;
+ m_bufferPointer = m_buffer + alignedSize + size;
+
+ return m_buffer + alignedSize;
}
void ArgumentEncoder::encodeFixedLengthData(const uint8_t* data, size_t size, unsigned alignment)
Modified: trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h (142383 => 142384)
--- trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h 2013-02-10 00:50:59 UTC (rev 142383)
+++ trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h 2013-02-10 03:48:27 UTC (rev 142384)
@@ -73,7 +73,7 @@
return *this;
}
- uint8_t* buffer() { return usesInlineBuffer() ? m_inlineBuffer : m_buffer; }
+ uint8_t* buffer() const { return m_buffer; }
size_t bufferSize() const { return m_bufferSize; }
void addAttachment(const Attachment&);
@@ -83,18 +83,15 @@
ArgumentEncoder();
private:
- static const size_t inlineBufferSize = 4096;
- bool usesInlineBuffer() const { return m_bufferCapacity <= inlineBufferSize; }
uint8_t* grow(unsigned alignment, size_t size);
uint8_t* m_buffer;
+ uint8_t* m_bufferPointer;
size_t m_bufferSize;
size_t m_bufferCapacity;
Vector<Attachment> m_attachments;
-
- uint8_t m_inlineBuffer[inlineBufferSize];
};
} // namespace CoreIPC
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes