WebKit Bugzilla
Attachment 372721 Details for
Bug 199140
: Platform font class gets needlessly initialized in the Networking process
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Use NSClassFromString to avoid unnecessary initialization
file_199140.txt (text/plain), 4.16 KB, created by
mitz
on 2019-06-23 17:33:06 PDT
(
hide
)
Description:
Use NSClassFromString to avoid unnecessary initialization
Filename:
MIME Type:
Creator:
mitz
Created:
2019-06-23 17:33:06 PDT
Size:
4.16 KB
patch
obsolete
>Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 246724) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,20 @@ >+2019-06-23 Dan Bernstein <mitz@apple.com> >+ >+ Platform font class gets needlessly initialized in the Networking process >+ https://bugs.webkit.org/show_bug.cgi?id=199140 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * 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. >+ > 2019-06-23 Simon Fraser <simon.fraser@apple.com> > > Add OverflowScrollProxyNodes to the scrolling tree >Index: Source/WebKit/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in >=================================================================== >--- Source/WebKit/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in (revision 246724) >+++ Source/WebKit/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in (working copy) >@@ -95,7 +95,6 @@ > > (allow file-read* > ;; Basic system paths >- (subpath "/Library/Fonts") ;; Needed to serialize font data types <rdar://problem/50164879> > (subpath "/Library/Frameworks") > (subpath "/Library/Managed Preferences") > >Index: Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb >=================================================================== >--- Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb (revision 246724) >+++ Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb (working copy) >@@ -72,12 +72,6 @@ > (literal "/usr/local/lib/log") ; <rdar://problem/36629495> > ) > >-;; Read-only preferences and data >-(allow file-read* >- ;; Basic system paths >- (subpath "/Library/Fonts") ;; Needed to serialize font data types <rdar://problem/50164879> >-) >- > ;; Security framework > (allow mach-lookup > (global-name "com.apple.ocspd") >Index: Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm >=================================================================== >--- Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm (revision 246724) >+++ Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm (working copy) >@@ -77,6 +77,34 @@ enum class NSType { > > #pragma mark - Helpers > >+static Class platformColorClass() >+{ >+ static Class colorClass; >+ static std::once_flag flag; >+ std::call_once(flag, [] { >+#if USE(APPKIT) >+ colorClass = NSClassFromString(@"NSColor"); >+#else >+ colorClass = NSClassFromString(@"UIColor"); >+#endif >+ }); >+ return colorClass; >+} >+ >+static Class platformFontClass() >+{ >+ static Class fontClass; >+ static std::once_flag flag; >+ std::call_once(flag, [] { >+#if USE(APPKIT) >+ fontClass = NSClassFromString(@"NSFont"); >+#else >+ fontClass = NSClassFromString(@"UIFont"); >+#endif >+ }); >+ return fontClass; >+} >+ > static NSType typeFromObject(id object) > { > ASSERT(object); >@@ -84,7 +112,7 @@ static NSType typeFromObject(id object) > // Specific classes handled. > if ([object isKindOfClass:[NSArray class]]) > return NSType::Array; >- if ([object isKindOfClass:[PlatformColor class]]) >+ if ([object isKindOfClass:platformColorClass()]) > return NSType::Color; > if ([object isKindOfClass:[NSData class]]) > return NSType::Data; >@@ -92,7 +120,7 @@ static NSType typeFromObject(id object) > return NSType::Date; > if ([object isKindOfClass:[NSDictionary class]]) > return NSType::Dictionary; >- if ([object isKindOfClass:[PlatformFont class]]) >+ if ([object isKindOfClass:platformFontClass()]) > return NSType::Font; > if ([object isKindOfClass:[NSNumber class]]) > return NSType::Number;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199140
: 372721