WebKit Bugzilla
Attachment 348819 Details for
Bug 189216
: Add functionality to encode and decode a uint64_t in KeyedCoding
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189216-20180904093900.patch (text/plain), 8.89 KB, created by
Woodrow Wang
on 2018-09-04 09:39:01 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Woodrow Wang
Created:
2018-09-04 09:39:01 PDT
Size:
8.89 KB
patch
obsolete
>Subversion Revision: 235612 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 06a56fa9b049d906d3e10a8f4fa6283ee7ed6ee5..168e85bde0fbfb717c26a3a5dcab8ba829f162fd 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,30 @@ >+2018-09-04 Woodrow Wang <woodrow_wang@apple.com> >+ >+ Added functionality to encode and decode a uint64_t in KeyedCoding >+ https://bugs.webkit.org/show_bug.cgi?id=189216 >+ >+ Reviewed by Daniel Bates. >+ >+ I've added this functionality in order to be able to encode and decode the raw uint64_t >+ representation of an OptionSet for my patch here https://bugs.webkit.org/show_bug.cgi?id=187773 >+ >+ The changes in the KeyedEncoder/KeyedDecoder for Glib were made because they are derived classes >+ of KeyedCoding which contains pure virtual functions that need to be implemented. >+ >+ * platform/KeyedCoding.h: >+ * platform/cf/KeyedDecoderCF.cpp: >+ (WebCore::KeyedDecoderCF::decodeUInt64): >+ * platform/cf/KeyedDecoderCF.h: >+ * platform/cf/KeyedEncoderCF.cpp: >+ (WebCore::KeyedEncoderCF::encodeUInt64): >+ * platform/cf/KeyedEncoderCF.h: >+ * platform/glib/KeyedDecoderGlib.cpp: >+ (WebCore::KeyedDecoderGlib::decodeUInt64): >+ * platform/glib/KeyedDecoderGlib.h: >+ * platform/glib/KeyedEncoderGlib.cpp: >+ (WebCore::KeyedEncoderGlib::encodeUInt64): >+ * platform/glib/KeyedEncoderGlib.h: >+ > 2018-08-31 Woodrow Wang <woodrow_wang@apple.com> > > Added dumping function for testing resource load statistics >diff --git a/Source/WebCore/platform/KeyedCoding.h b/Source/WebCore/platform/KeyedCoding.h >index 5e9e959325f8857ca2a4caf02d63cc98ad9f0552..21d4cef795516396335a3052c76670c4761fecb8 100644 >--- a/Source/WebCore/platform/KeyedCoding.h >+++ b/Source/WebCore/platform/KeyedCoding.h >@@ -42,6 +42,7 @@ public: > virtual bool decodeBytes(const String& key, const uint8_t*&, size_t&) = 0; > virtual bool decodeBool(const String& key, bool&) = 0; > virtual bool decodeUInt32(const String& key, uint32_t&) = 0; >+ virtual bool decodeUInt64(const String& key, uint64_t&) = 0; > virtual bool decodeInt32(const String& key, int32_t&) = 0; > virtual bool decodeInt64(const String& key, int64_t&) = 0; > virtual bool decodeFloat(const String& key, float&) = 0; >@@ -150,6 +151,7 @@ public: > virtual void encodeBytes(const String& key, const uint8_t*, size_t) = 0; > virtual void encodeBool(const String& key, bool) = 0; > virtual void encodeUInt32(const String& key, uint32_t) = 0; >+ virtual void encodeUInt64(const String& key, uint64_t) = 0; > virtual void encodeInt32(const String& key, int32_t) = 0; > virtual void encodeInt64(const String& key, int64_t) = 0; > virtual void encodeFloat(const String& key, float) = 0; >diff --git a/Source/WebCore/platform/cf/KeyedDecoderCF.cpp b/Source/WebCore/platform/cf/KeyedDecoderCF.cpp >index 0569031e514f790a18a99294017e32ee08c40491..b9803bfa02324357c0dfe047313d2c3ec304cb92 100644 >--- a/Source/WebCore/platform/cf/KeyedDecoderCF.cpp >+++ b/Source/WebCore/platform/cf/KeyedDecoderCF.cpp >@@ -81,6 +81,11 @@ bool KeyedDecoderCF::decodeUInt32(const String& key, uint32_t& result) > { > return decodeInt32(key, reinterpret_cast<int32_t&>(result)); > } >+ >+bool KeyedDecoderCF::decodeUInt64(const String& key, uint64_t& result) >+{ >+ return decodeInt64(key, reinterpret_cast<int64_t&>(result)); >+} > > bool KeyedDecoderCF::decodeInt32(const String& key, int32_t& result) > { >diff --git a/Source/WebCore/platform/cf/KeyedDecoderCF.h b/Source/WebCore/platform/cf/KeyedDecoderCF.h >index 576622ebcea2d59bec89d3d7f24e9d303d1bf5a8..2fca2209fdca192474a859e88e9e42a612a483b8 100644 >--- a/Source/WebCore/platform/cf/KeyedDecoderCF.h >+++ b/Source/WebCore/platform/cf/KeyedDecoderCF.h >@@ -41,6 +41,7 @@ private: > bool decodeBytes(const String& key, const uint8_t*&, size_t&) override; > bool decodeBool(const String& key, bool&) override; > bool decodeUInt32(const String& key, uint32_t&) override; >+ bool decodeUInt64(const String& key, uint64_t&) override; > bool decodeInt32(const String& key, int32_t&) override; > bool decodeInt64(const String& key, int64_t&) override; > bool decodeFloat(const String& key, float&) override; >diff --git a/Source/WebCore/platform/cf/KeyedEncoderCF.cpp b/Source/WebCore/platform/cf/KeyedEncoderCF.cpp >index d0f0c9e24acd575dbca39511f3e3718b8f601500..1a627ea00b92cbaa6cf7c355d5e445ec4861a412 100644 >--- a/Source/WebCore/platform/cf/KeyedEncoderCF.cpp >+++ b/Source/WebCore/platform/cf/KeyedEncoderCF.cpp >@@ -71,6 +71,12 @@ void KeyedEncoderCF::encodeUInt32(const String& key, uint32_t value) > auto number = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value)); > CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), number.get()); > } >+ >+void KeyedEncoderCF::encodeUInt64(const String& key, uint64_t value) >+{ >+ auto number = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &value)); >+ CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), number.get()); >+} > > void KeyedEncoderCF::encodeInt32(const String& key, int32_t value) > { >diff --git a/Source/WebCore/platform/cf/KeyedEncoderCF.h b/Source/WebCore/platform/cf/KeyedEncoderCF.h >index 82b6b6156877e043cc61d836baa92a4b2c47125b..f586c02bb15bf39b7283fba9aa5e8a126b84fefe 100644 >--- a/Source/WebCore/platform/cf/KeyedEncoderCF.h >+++ b/Source/WebCore/platform/cf/KeyedEncoderCF.h >@@ -42,6 +42,7 @@ private: > void encodeBytes(const String& key, const uint8_t*, size_t) final; > void encodeBool(const String& key, bool) final; > void encodeUInt32(const String& key, uint32_t) final; >+ void encodeUInt64(const String& key, uint64_t) final; > void encodeInt32(const String& key, int32_t) final; > void encodeInt64(const String& key, int64_t) final; > void encodeFloat(const String& key, float) final; >diff --git a/Source/WebCore/platform/glib/KeyedDecoderGlib.cpp b/Source/WebCore/platform/glib/KeyedDecoderGlib.cpp >index 551090e02018b8f29c0729e593c5388892523743..ec817bb2cb6dbb7ba9eba28d60bc82fc38400de7 100644 >--- a/Source/WebCore/platform/glib/KeyedDecoderGlib.cpp >+++ b/Source/WebCore/platform/glib/KeyedDecoderGlib.cpp >@@ -93,6 +93,11 @@ bool KeyedDecoderGlib::decodeUInt32(const String& key, uint32_t& result) > return decodeSimpleValue(key, result, g_variant_get_uint32); > } > >+bool KeyedDecoderGlib::decodeUInt64(const String& key, uint64_t& result) >+{ >+ return decodeSimpleValue(key, result, g_variant_get_uint64); >+} >+ > bool KeyedDecoderGlib::decodeInt32(const String& key, int32_t& result) > { > return decodeSimpleValue(key, result, g_variant_get_int32); >diff --git a/Source/WebCore/platform/glib/KeyedDecoderGlib.h b/Source/WebCore/platform/glib/KeyedDecoderGlib.h >index aee3692cab7510171ca9f211369e261aea03385b..bf79c0718e9aa28ef91063e28d933ba3f768ebfa 100644 >--- a/Source/WebCore/platform/glib/KeyedDecoderGlib.h >+++ b/Source/WebCore/platform/glib/KeyedDecoderGlib.h >@@ -44,6 +44,7 @@ private: > bool decodeBytes(const String& key, const uint8_t*&, size_t&) override; > bool decodeBool(const String& key, bool&) override; > bool decodeUInt32(const String& key, uint32_t&) override; >+ bool decodeUInt64(const String& key, uint64_t&) override; > bool decodeInt32(const String& key, int32_t&) override; > bool decodeInt64(const String& key, int64_t&) override; > bool decodeFloat(const String& key, float&) override; >diff --git a/Source/WebCore/platform/glib/KeyedEncoderGlib.cpp b/Source/WebCore/platform/glib/KeyedEncoderGlib.cpp >index 81cbed53d115e44f134c1226d63462c598e44928..9d182fae917dcf247ddfd764e7d6cefddd5e385a 100644 >--- a/Source/WebCore/platform/glib/KeyedEncoderGlib.cpp >+++ b/Source/WebCore/platform/glib/KeyedEncoderGlib.cpp >@@ -65,6 +65,11 @@ void KeyedEncoderGlib::encodeUInt32(const String& key, uint32_t value) > { > g_variant_builder_add(m_variantBuilderStack.last(), "{sv}", key.utf8().data(), g_variant_new_uint32(value)); > } >+ >+void KeyedEncoderGlib::encodeUInt64(const String& key, uint64_t value) >+{ >+ g_variant_builder_add(m_variantBuilderStack.last(), "{sv}", key.utf8().data(), g_variant_new_uint64(value)); >+} > > void KeyedEncoderGlib::encodeInt32(const String& key, int32_t value) > { >diff --git a/Source/WebCore/platform/glib/KeyedEncoderGlib.h b/Source/WebCore/platform/glib/KeyedEncoderGlib.h >index f91b4ddb3315f66ec4e0c19fd270673b6c475e79..e5642bcf670ce2599fc04df729e2b4c1f8211f2e 100644 >--- a/Source/WebCore/platform/glib/KeyedEncoderGlib.h >+++ b/Source/WebCore/platform/glib/KeyedEncoderGlib.h >@@ -44,6 +44,7 @@ private: > void encodeBytes(const String& key, const uint8_t*, size_t) final; > void encodeBool(const String& key, bool) final; > void encodeUInt32(const String& key, uint32_t) final; >+ void encodeUInt64(const String& key, uint64_t) final; > void encodeInt32(const String& key, int32_t) final; > void encodeInt64(const String& key, int64_t) final; > void encodeFloat(const String& key, float) final;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189216
:
348689
|
348691
|
348819
|
348860