Bug 236441 - Make MIMETypeRegistry::mimeTypeForPath take a StringView
Summary: Make MIMETypeRegistry::mimeTypeForPath take a StringView
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: EasyFix, GoodFirstBug, InRadar
Depends on:
Blocks:
 
Reported: 2022-02-10 07:01 PST by Tim Nguyen (:ntim)
Modified: 2022-03-16 05:55 PDT (History)
9 users (show)

See Also:


Attachments
Patch (3.66 KB, patch)
2022-03-14 04:09 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (16.27 KB, patch)
2022-03-15 01:36 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (16.21 KB, patch)
2022-03-16 03:26 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Nguyen (:ntim) 2022-02-10 07:01:33 PST
So we don't need an expensive call to toString()
Comment 1 Radar WebKit Bug Importer 2022-02-17 07:02:16 PST
<rdar://problem/89084526>
Comment 2 youenn fablet 2022-03-14 04:09:34 PDT
Created attachment 454576 [details]
Patch
Comment 3 Chris Dumez 2022-03-14 07:11:15 PDT
Comment on attachment 454576 [details]
Patch

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

> Source/WebCore/platform/MIMETypeRegistry.cpp:402
> +        auto result = mimeTypeForExtension(path.substring(position + 1).toString());

Seems we could go one step further and make mimeTypeForExtension() take a StringView too?
Comment 4 youenn fablet 2022-03-15 01:26:47 PDT
Comment on attachment 454576 [details]
Patch

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

>> Source/WebCore/platform/MIMETypeRegistry.cpp:402
>> +        auto result = mimeTypeForExtension(path.substring(position + 1).toString());
> 
> Seems we could go one step further and make mimeTypeForExtension() take a StringView too?

I thought about it and did not do it as it is a bigger/cross-platform change.
I'll give it a try.
Comment 5 youenn fablet 2022-03-15 01:36:44 PDT
Created attachment 454679 [details]
Patch
Comment 6 Chris Dumez 2022-03-15 07:14:12 PDT
Comment on attachment 454679 [details]
Patch

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

r=me with fix.

> Source/WebCore/platform/MIMETypeRegistry.cpp:402
> +        auto result = mimeTypeForExtension(path.substring(position + 1).toString());

There should be no .toString() here.
Comment 7 youenn fablet 2022-03-16 03:26:45 PDT
Created attachment 454817 [details]
Patch for landing
Comment 8 EWS 2022-03-16 05:55:16 PDT
Committed r291341 (248480@main): <https://commits.webkit.org/248480@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 454817 [details].