Bug 180471 - Implement {DOMMimeTypeArray, DOMPluginArray}::supportedPropertyNames().
Summary: Implement {DOMMimeTypeArray, DOMPluginArray}::supportedPropertyNames().
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ms2ger (he/him; ⌚ UTC+1/+2)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-12-06 07:05 PST by Ms2ger (he/him; ⌚ UTC+1/+2)
Modified: 2017-12-12 06:30 PST (History)
4 users (show)

See Also:


Attachments
Patch (6.78 KB, patch)
2017-12-06 07:22 PST, Ms2ger (he/him; ⌚ UTC+1/+2)
no flags Details | Formatted Diff | Diff
Patch (6.61 KB, patch)
2017-12-12 03:15 PST, Ms2ger (he/him; ⌚ UTC+1/+2)
no flags Details | Formatted Diff | Diff
Patch (6.62 KB, patch)
2017-12-12 04:58 PST, Ms2ger (he/him; ⌚ UTC+1/+2)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ms2ger (he/him; ⌚ UTC+1/+2) 2017-12-06 07:05:17 PST
.
Comment 1 Ms2ger (he/him; ⌚ UTC+1/+2) 2017-12-06 07:22:24 PST
Created attachment 328565 [details]
Patch
Comment 2 Darin Adler 2017-12-11 21:36:49 PST
Comment on attachment 328565 [details]
Patch

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

> Source/WebCore/plugins/DOMMimeTypeArray.cpp:97
> +    unsigned size = mimes.size();
> +
> +    Vector<AtomicString> result;
> +    result.reserveInitialCapacity(size);
> +
> +    for (unsigned i = 0; i < size; ++i)
> +        result.uncheckedAppend(AtomicString(mimes[i].type));

Writing it like this gets rid of an unnecessary local variable, uses a modern for loop, gets rid of unnecessary explicit conversion to AtomicString, and saves a little bit of reference count churn by using WTFMove.

    Vector<AtomicString> result;
    result.reserveInitialCapacity(mimes.size());
    for (auto& info : mimes)
        result.uncheckedAppend(WTFMove(info.type));

> Source/WebCore/plugins/DOMPluginArray.cpp:85
> +    const Vector<PluginInfo>& plugins = data->publiclyVisiblePlugins();
> +    unsigned size = plugins.size();
> +
> +    Vector<AtomicString> result;
> +    result.reserveInitialCapacity(size);
> +
> +    for (unsigned i = 0; i < size; ++i)
> +        result.uncheckedAppend(AtomicString(plugins[i].name));

Writing it like this gets rid of an unnecessary written-out type, an unnecessary local variable, uses a modern for loop, and gets rid of unnecessary explicit conversion to AtomicString.

    auto& plugins = data->publiclyVisiblePlugins();

    Vector<AtomicString> result;
    result.reserveInitialCapacity(plugins.size());
    for (auto& plugin : plugins)
        result.uncheckedAppend(plugin.name);
Comment 3 Ms2ger (he/him; ⌚ UTC+1/+2) 2017-12-12 03:15:23 PST
Created attachment 329101 [details]
Patch
Comment 4 Ms2ger (he/him; ⌚ UTC+1/+2) 2017-12-12 04:58:39 PST
Created attachment 329108 [details]
Patch
Comment 5 WebKit Commit Bot 2017-12-12 06:29:05 PST
Comment on attachment 329108 [details]
Patch

Clearing flags on attachment: 329108

Committed r225779: <https://trac.webkit.org/changeset/225779>
Comment 6 WebKit Commit Bot 2017-12-12 06:29:07 PST
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2017-12-12 06:30:36 PST
<rdar://problem/35993095>