Bug 186054 - Avoid unnecessary String allocation in isPublicSuffix(const String&)
Summary: Avoid unnecessary String allocation in isPublicSuffix(const String&)
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-05-29 10:15 PDT by Chris Dumez
Modified: 2018-05-29 11:33 PDT (History)
6 users (show)

See Also:


Attachments
Patch (1.62 KB, patch)
2018-05-29 10:19 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (1.96 KB, patch)
2018-05-29 10:52 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2018-05-29 10:15:02 PDT
Avoid unnecessary String allocation in isPublicSuffix(const String&):
Sample Count, Samples %, CPU %, Symbol
1, 0.0%, 0.0%, WebCore::ResourceRequestBase::partitionName(WTF::String const&) (in WebCore)
1, 0.0%, 0.0%,     WebCore::topPrivatelyControlledDomain(WTF::String const&) (in WebCore)
1, 0.0%, 0.0%,         WebCore::isPublicSuffix(WTF::String const&) (in WebCore)
1, 0.0%, 0.0%,             WTF::String::String(NSString*) (in JavaScriptCore)
1, 0.0%, 0.0%,                 DYLD-STUB$$objc_msgSend (in CoreFoundation)
Comment 1 Chris Dumez 2018-05-29 10:19:04 PDT
Created attachment 341494 [details]
Patch
Comment 2 Sam Weinig 2018-05-29 10:49:21 PDT
Comment on attachment 341494 [details]
Patch

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

> Source/WebCore/platform/mac/PublicSuffixMac.mm:39
> -    NSString *host = decodeHostName(domain);
> +    NSString *host = decodeHostName(static_cast<NSString*>(domain));

I would add a comment explaining the cast.

Also, the NSString* should be NSString * (space between NSString and *).  And I think we traditionally use C-style casts for objective-c casts.
Comment 3 Chris Dumez 2018-05-29 10:52:37 PDT
Created attachment 341499 [details]
Patch
Comment 4 WebKit Commit Bot 2018-05-29 11:32:05 PDT
Comment on attachment 341499 [details]
Patch

Clearing flags on attachment: 341499

Committed r232268: <https://trac.webkit.org/changeset/232268>
Comment 5 WebKit Commit Bot 2018-05-29 11:32:07 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2018-05-29 11:33:25 PDT
<rdar://problem/40622283>