Changeset 88853 in webkit
- Timestamp:
- Jun 14, 2011 2:39:32 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r88846 r88853 1 2011-06-14 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Darin Adler. 4 5 Add functions for encoding/decoding data with a known size and alignment 6 https://bugs.webkit.org/show_bug.cgi?id=62663 7 8 * Platform/CoreIPC/ArgumentDecoder.cpp: 9 (CoreIPC::ArgumentDecoder::decodeFixedLengthData): 10 * Platform/CoreIPC/ArgumentDecoder.h: 11 * Platform/CoreIPC/ArgumentEncoder.cpp: 12 (CoreIPC::ArgumentEncoder::encodeFixedLengthData): 13 (CoreIPC::ArgumentEncoder::encodeVariableLengthData): 14 * Platform/CoreIPC/ArgumentEncoder.h: 15 1 16 2011-06-14 Anders Carlsson <andersca@apple.com> 2 17 -
trunk/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp
r86945 r88853 103 103 } 104 104 105 bool ArgumentDecoder::decodeFixedLengthData(uint8_t* data, size_t size, unsigned alignment) 106 { 107 if (!alignBufferPosition(size, alignment)) 108 return false; 109 110 memcpy(data, m_bufferPos, size); 111 m_bufferPos += size; 112 113 return true; 114 } 115 105 116 bool ArgumentDecoder::decodeBytes(Vector<uint8_t>& buffer) 106 117 { -
trunk/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h
r85755 r88853 47 47 bool isInvalid() const { return m_bufferPos > m_bufferEnd; } 48 48 void markInvalid() { m_bufferPos = m_bufferEnd + 1; } 49 50 bool decodeFixedLengthData(uint8_t*, size_t, unsigned alignment); 49 51 50 52 bool decodeBytes(Vector<uint8_t>&); -
trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp
r86574 r88853 86 86 } 87 87 88 void ArgumentEncoder::encodeFixedLengthData(const uint8_t* data, size_t size, unsigned alignment) 89 { 90 uint8_t* buffer = grow(alignment, size); 91 memcpy(buffer, data, size); 92 } 93 94 void ArgumentEncoder::encodeVariableLengthData(const uint8_t* data, size_t size, unsigned alignment) 95 { 96 // Encode the size. 97 encodeUInt64(static_cast<uint64_t>(size)); 98 99 // Encode the data. 100 encodeFixedLengthData(data, size, alignment); 101 } 102 88 103 void ArgumentEncoder::encodeBytes(const uint8_t* bytes, size_t size) 89 104 { -
trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h
r73662 r88853 41 41 static PassOwnPtr<ArgumentEncoder> create(uint64_t destinationID); 42 42 ~ArgumentEncoder(); 43 44 void encodeFixedLengthData(const uint8_t*, size_t, unsigned alignment); 45 void encodeVariableLengthData(const uint8_t*, size_t, unsigned alignment); 43 46 44 47 void encodeBytes(const uint8_t*, size_t);
Note: See TracChangeset
for help on using the changeset viewer.