[Webkit-unassigned] [Bug 184012] Unable to use HashMap<WebCore::SecurityOriginData, Ref<WebSWServerToContextConnection>> type in StorageProcess.h

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 26 10:35:40 PDT 2018


--- Comment #3 from Chris Dumez <cdumez at apple.com> ---
(In reply to Chris Dumez from comment #2)
> Using HashMap<RefPtr<WebCore::SecurityOrigin>,
> Ref<WebSWServerToContextConnection>> works. I believe the different is that
> emptyValueIsZero for both the Key and the Value.
> emptyValueIsZero is false when the key is a SecurityOriginData. So
> KeyValuePairHashTraits::emptyValueIsZero goes from true to false and it
> causes failures.

As a result, it ends up using a different template specialization for HashTableBucketInitializer:
    template<bool emptyValueIsZero> struct HashTableBucketInitializer;

    template<> struct HashTableBucketInitializer<false> {
        template<typename Traits, typename Value> static void initialize(Value& bucket)
            new (NotNull, std::addressof(bucket)) Value(Traits::emptyValue());

    template<> struct HashTableBucketInitializer<true> {
        template<typename Traits, typename Value> static void initialize(Value& bucket)
            // This initializes the bucket without copying the empty value.
            // That makes it possible to use this with types that don't support copying.
            // The memset to 0 looks like a slow operation but is optimized by the compilers.
            memset(std::addressof(bucket), 0, sizeof(bucket));

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180326/16bdac42/attachment.html>

More information about the webkit-unassigned mailing list