Changeset 158980 in webkit
- Timestamp:
- Nov 8, 2013 5:16:26 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r158979 r158980 1 2013-11-08 Anders Carlsson <andersca@apple.com> 2 3 Implement more KeyedEncoder functionality 4 https://bugs.webkit.org/show_bug.cgi?id=124089 5 6 Reviewed by Beth Dakin. 7 8 * bindings/js/SerializedScriptValue.h: 9 * history/HistoryItem.cpp: 10 (WebCore::HistoryItem::encodeBackForwardTreeNode): 11 * platform/KeyedCoding.h: 12 (WebCore::KeyedEncoder::encodeConditionalObject): 13 1 14 2013-11-08 Eric Carlson <eric.carlson@apple.com> 2 15 -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.h
r155736 r158980 96 96 #endif 97 97 98 const Vector<uint8_t>& data() { return m_data; }98 const Vector<uint8_t>& data() const { return m_data; } 99 99 const Vector<String>& blobURLs() const { return m_blobURLs; } 100 100 -
trunk/Source/WebCore/history/HistoryItem.cpp
r158978 r158980 740 740 // FIXME: Implement. 741 741 742 encoder.encodeString("formContentType", m_formContentType); 743 744 encoder.encodeConditionalObject("formData", m_formData.get(), [](KeyedEncoder&, const FormData&) { 745 // FIXME: Implement. 746 }); 747 748 encoder.encodeString("referrer", m_referrer); 749 750 encoder.encodeObject("scrollPoint", m_scrollPoint, [](KeyedEncoder& encoder, const IntPoint& scrollPoint) { 751 encoder.encodeInt32("x", scrollPoint.x()); 752 encoder.encodeInt32("y", scrollPoint.y()); 753 }); 754 755 encoder.encodeFloat("pageScaleFactor", m_pageScaleFactor); 756 757 encoder.encodeConditionalObject("stateObject", m_stateObject.get(), [](KeyedEncoder& encoder, const SerializedScriptValue& stateObject) { 758 encoder.encodeBytes("data", stateObject.data().data(), stateObject.data().size()); 759 }); 760 742 761 encoder.encodeString("target", m_target); 743 762 } -
trunk/Source/WebCore/platform/KeyedCoding.h
r158978 r158980 36 36 37 37 public: 38 virtual void encodeBytes(const String& key, const uint8_t*, size_t) = 0; 38 39 virtual void encodeUInt32(const String& key, uint32_t) = 0; 39 40 virtual void encodeInt32(const String& key, int32_t) = 0; 41 virtual void encodeFloat(const String& key, float) = 0; 40 42 virtual void encodeString(const String& key, const String&) = 0; 41 43 … … 48 50 } 49 51 52 template<typename T, typename F> 53 void encodeConditionalObject(const String& key, const T* object, F&& function) 54 { 55 if (!object) 56 return; 57 58 encodeObject(key, *object, std::forward<F>(function)); 59 } 60 50 61 private: 51 62 virtual void beginObject(const String& key) = 0; -
trunk/Source/WebKit2/ChangeLog
r158978 r158980 1 2013-11-08 Anders Carlsson <andersca@apple.com> 2 3 Implement more KeyedEncoder functionality 4 https://bugs.webkit.org/show_bug.cgi?id=124089 5 6 Reviewed by Beth Dakin. 7 8 * Shared/cf/KeyedEncoder.cpp: 9 (WebKit::KeyedEncoder::encodeBytes): 10 (WebKit::KeyedEncoder::encodeInt32): 11 (WebKit::KeyedEncoder::encodeFloat): 12 * Shared/cf/KeyedEncoder.h: 13 1 14 2013-11-08 Anders Carlsson <andersca@apple.com> 2 15 -
trunk/Source/WebKit2/Shared/cf/KeyedEncoder.cpp
r158978 r158980 49 49 } 50 50 51 void KeyedEncoder::encodeBytes(const String& key, const uint8_t* bytes, size_t size) 52 { 53 RetainPtr<CFDataRef> data = adoptCF(CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, bytes, size, kCFAllocatorNull)); 54 CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), data.get()); 55 } 56 51 57 void KeyedEncoder::encodeUInt32(const String& key, uint32_t value) 52 58 { 53 59 RetainPtr<CFNumberRef> number = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value)); 60 CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), number.get()); 61 } 62 63 void KeyedEncoder::encodeInt32(const String& key, int32_t value) 64 { 65 RetainPtr<CFNumberRef> number = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value)); 66 CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), number.get()); 67 } 68 69 void KeyedEncoder::encodeFloat(const String& key, float value) 70 { 71 RetainPtr<CFNumberRef> number = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &value)); 54 72 CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), number.get()); 55 73 } -
trunk/Source/WebKit2/Shared/cf/KeyedEncoder.h
r158978 r158980 39 39 40 40 private: 41 virtual void encodeBytes(const String& key, const uint8_t*, size_t) OVERRIDE; 42 41 43 virtual void encodeUInt32(const String& key, uint32_t) OVERRIDE; 44 virtual void encodeInt32(const String& key, int32_t) OVERRIDE; 45 virtual void encodeFloat(const String& key, float) OVERRIDE; 42 46 virtual void encodeString(const String& key, const String&) OVERRIDE; 43 47
Note: See TracChangeset
for help on using the changeset viewer.