Changeset 246726 in webkit


Ignore:
Timestamp:
Jun 23, 2019 8:44:50 PM (5 years ago)
Author:
mitz@apple.com
Message:

Platform font class gets needlessly initialized in the Networking process
https://bugs.webkit.org/show_bug.cgi?id=199140

Reviewed by Tim Horton.

  • NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: Revert a change that was made in r246702, which is not needed anymore.
  • Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Ditto.
  • Shared/Cocoa/ArgumentCodersCocoa.mm:

(IPC::platformColorClass): Added getter that uses NSClassFromString, thereby avoiding

initializing the class.

(IPC::platformFontClass): Ditto.
(IPC::typeFromObject): Changed to use the above getters instead of +class.

Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r246725 r246726  
     12019-06-23  Dan Bernstein  <mitz@apple.com>
     2
     3        Platform font class gets needlessly initialized in the Networking process
     4        https://bugs.webkit.org/show_bug.cgi?id=199140
     5
     6        Reviewed by Tim Horton.
     7
     8        * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: Revert a change that was made in
     9          r246702, which is not needed anymore.
     10        * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Ditto.
     11
     12        * Shared/Cocoa/ArgumentCodersCocoa.mm:
     13        (IPC::platformColorClass): Added getter that uses NSClassFromString, thereby avoiding
     14          initializing the class.
     15        (IPC::platformFontClass): Ditto.
     16        (IPC::typeFromObject): Changed to use the above getters instead of +class.
     17
    1182019-06-23  Simon Fraser  <simon.fraser@apple.com>
    219
  • trunk/Source/WebKit/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in

    r246702 r246726  
    9696(allow file-read*
    9797    ;; Basic system paths
    98     (subpath "/Library/Fonts") ;; Needed to serialize font data types <rdar://problem/50164879>
    9998    (subpath "/Library/Frameworks")
    10099    (subpath "/Library/Managed Preferences")
  • trunk/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb

    r246702 r246726  
    7373)
    7474
    75 ;; Read-only preferences and data
    76 (allow file-read*
    77     ;; Basic system paths
    78     (subpath "/Library/Fonts") ;; Needed to serialize font data types <rdar://problem/50164879>
    79 )
    80 
    8175;; Security framework
    8276(allow mach-lookup
  • trunk/Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm

    r243116 r246726  
    7878#pragma mark - Helpers
    7979
     80static Class platformColorClass()
     81{
     82    static Class colorClass;
     83    static std::once_flag flag;
     84    std::call_once(flag, [] {
     85#if USE(APPKIT)
     86        colorClass = NSClassFromString(@"NSColor");
     87#else
     88        colorClass = NSClassFromString(@"UIColor");
     89#endif
     90    });
     91    return colorClass;
     92}
     93
     94static Class platformFontClass()
     95{
     96    static Class fontClass;
     97    static std::once_flag flag;
     98    std::call_once(flag, [] {
     99#if USE(APPKIT)
     100        fontClass = NSClassFromString(@"NSFont");
     101#else
     102        fontClass = NSClassFromString(@"UIFont");
     103#endif
     104    });
     105    return fontClass;
     106}
     107
    80108static NSType typeFromObject(id object)
    81109{
     
    85113    if ([object isKindOfClass:[NSArray class]])
    86114        return NSType::Array;
    87     if ([object isKindOfClass:[PlatformColor class]])
     115    if ([object isKindOfClass:platformColorClass()])
    88116        return NSType::Color;
    89117    if ([object isKindOfClass:[NSData class]])
     
    93121    if ([object isKindOfClass:[NSDictionary class]])
    94122        return NSType::Dictionary;
    95     if ([object isKindOfClass:[PlatformFont class]])
     123    if ([object isKindOfClass:platformFontClass()])
    96124        return NSType::Font;
    97125    if ([object isKindOfClass:[NSNumber class]])
Note: See TracChangeset for help on using the changeset viewer.