Bug 236441

Summary: Make MIMETypeRegistry::mimeTypeForPath take a StringView
Product: WebKit Reporter: Tim Nguyen (:ntim) <ntim>
Component: Web Template FrameworkAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, ews-watchlist, hi, japhet, joepeck, mifenton, pangle, webkit-bug-importer, youennf
Priority: P2 Keywords: EasyFix, GoodFirstBug, InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch for landing none

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].