Bug 178072 - Make HashMap::keys() and HashMap::values() work with WTF::map/WTF::copyToVector
Summary: Make HashMap::keys() and HashMap::values() work with WTF::map/WTF::copyToVector
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-10-08 21:08 PDT by Sam Weinig
Modified: 2017-10-10 08:09 PDT (History)
9 users (show)

See Also:


Attachments
Patch (5.97 KB, patch)
2017-10-08 21:16 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (9.80 KB, patch)
2017-10-09 07:45 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (9.98 KB, patch)
2017-10-09 08:34 PDT, Sam Weinig
darin: review+
Details | Formatted Diff | Diff
Patch (12.32 KB, patch)
2017-10-09 11:56 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2017-10-08 21:08:14 PDT
Make HashMap::keys() and HashMap::values() work with WTF::map/WTF::copyToVector
Comment 1 Sam Weinig 2017-10-08 21:16:50 PDT
Created attachment 323157 [details]
Patch
Comment 2 Sam Weinig 2017-10-08 21:17:55 PDT
I'm not sure about the name SizedIteratorRange. Maybe IteratorRangeWithSize? Maybe something more abstract, like Container?
Comment 3 Sam Weinig 2017-10-09 06:30:18 PDT
Maybe SizedContainerProxy?
Comment 4 Sam Weinig 2017-10-09 07:45:57 PDT
Created attachment 323174 [details]
Patch
Comment 5 Sam Weinig 2017-10-09 08:34:29 PDT
Created attachment 323177 [details]
Patch
Comment 6 Darin Adler 2017-10-09 10:50:44 PDT
Comment on attachment 323177 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=323177&action=review

> Source/WebCore/platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h:80
> +    WTF::SizedIteratorRange<OptionContainer, OptionContainer::iterator::Values> options() { return m_options.values(); }

I’d like the type here to be OptionContainer::ValuesIteratorRange. Can we add some "using" to HashMap.h so we can do it that way instead of having to write out the type like this?

> Source/WebKit/Shared/AsyncRequest.h:141
> +    WTF::SizedIteratorRange<RequestMap, RequestMap::iterator::Values> values()

Ditto.

> Source/WebKit/UIProcess/WebProcessProxy.h:101
> +    WTF::SizedIteratorRange<WebPageProxyMap, WebPageProxyMap::const_iterator::Values> pages() const { return m_pageMap.values(); }

And again.
Comment 7 Darin Adler 2017-10-09 10:51:48 PDT
Comment on attachment 323177 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=323177&action=review

>> Source/WebCore/platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h:80
>> +    WTF::SizedIteratorRange<OptionContainer, OptionContainer::iterator::Values> options() { return m_options.values(); }
> 
> I’d like the type here to be OptionContainer::ValuesIteratorRange. Can we add some "using" to HashMap.h so we can do it that way instead of having to write out the type like this?

Or is there some way to use std::result_of?
Comment 8 Sam Weinig 2017-10-09 11:56:57 PDT
Created attachment 323196 [details]
Patch
Comment 9 Sam Weinig 2017-10-09 11:58:31 PDT
(In reply to Darin Adler from comment #7)
> Comment on attachment 323177 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=323177&action=review
> 
> >> Source/WebCore/platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h:80
> >> +    WTF::SizedIteratorRange<OptionContainer, OptionContainer::iterator::Values> options() { return m_options.values(); }
> > 
> > I’d like the type here to be OptionContainer::ValuesIteratorRange. Can we add some "using" to HashMap.h so we can do it that way instead of having to write out the type like this?
> 
> Or is there some way to use std::result_of?

I went with the type aliases. No need to make the caller user do something weird.
Comment 10 WebKit Commit Bot 2017-10-09 13:01:18 PDT
Comment on attachment 323196 [details]
Patch

Clearing flags on attachment: 323196

Committed r223061: <http://trac.webkit.org/changeset/223061>
Comment 11 Radar WebKit Bug Importer 2017-10-10 08:09:19 PDT
<rdar://problem/34910705>