Diff
Modified: trunk/Source/WTF/ChangeLog (225691 => 225692)
--- trunk/Source/WTF/ChangeLog 2017-12-08 20:07:30 UTC (rev 225691)
+++ trunk/Source/WTF/ChangeLog 2017-12-08 20:16:54 UTC (rev 225692)
@@ -1,5 +1,17 @@
2017-12-08 Yusuke Suzuki <utatane....@gmail.com>
+ Remove pthread_once in favor of dispatch_once
+ https://bugs.webkit.org/show_bug.cgi?id=180591
+
+ Reviewed by Saam Barati.
+
+ Fix the comment.
+
+ * wtf/Threading.h:
+ (WTF::Thread::current):
+
+2017-12-08 Yusuke Suzuki <utatane....@gmail.com>
+
[WTF][Linux][GTK] Fix a minor bug in generic/WorkQueue when WorkQueue is immediately destroyed
https://bugs.webkit.org/show_bug.cgi?id=180586
Modified: trunk/Source/WTF/wtf/Threading.h (225691 => 225692)
--- trunk/Source/WTF/wtf/Threading.h 2017-12-08 20:07:30 UTC (rev 225691)
+++ trunk/Source/WTF/wtf/Threading.h 2017-12-08 20:16:54 UTC (rev 225692)
@@ -315,7 +315,7 @@
// on secondary ones, so there is no need for synchronization here.
// WRT _javascript_Core:
// Thread::initializeTLSKey() is initially called from initializeThreading(), ensuring
- // this is initially called in a pthread_once locked context.
+ // this is initially called in a std::call_once locked context.
#if !HAVE(FAST_TLS)
if (UNLIKELY(Thread::s_key == InvalidThreadSpecificKey))
WTF::initializeThreading();
Modified: trunk/Source/WebCore/ChangeLog (225691 => 225692)
--- trunk/Source/WebCore/ChangeLog 2017-12-08 20:07:30 UTC (rev 225691)
+++ trunk/Source/WebCore/ChangeLog 2017-12-08 20:16:54 UTC (rev 225692)
@@ -1,3 +1,16 @@
+2017-12-08 Yusuke Suzuki <utatane....@gmail.com>
+
+ Remove pthread_once in favor of dispatch_once
+ https://bugs.webkit.org/show_bug.cgi?id=180591
+
+ Reviewed by Saam Barati.
+
+ No behavior change.
+
+ * platform/mac/WebCoreNSURLExtras.mm:
+ (WebCore::allCharactersInIDNScriptWhiteList):
+ (WebCore::readIDNScriptWhiteList): Deleted.
+
2017-12-08 Chris Dumez <cdu...@apple.com>
Improve error handling in RegistrationDatabase
Modified: trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm (225691 => 225692)
--- trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm 2017-12-08 20:07:30 UTC (rev 225691)
+++ trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm 2017-12-08 20:16:54 UTC (rev 225692)
@@ -45,7 +45,6 @@
typedef void (* StringRangeApplierFunction)(NSString *string, NSRange range, void *context);
-static pthread_once_t IDNScriptWhiteListFileRead = PTHREAD_ONCE_INIT;
static uint32_t IDNScriptWhiteList[(USCRIPT_CODE_LIMIT + 31) / 32];
@@ -277,26 +276,24 @@
return YES;
}
-static void readIDNScriptWhiteList(void)
+static BOOL allCharactersInIDNScriptWhiteList(const UChar *buffer, int32_t length)
{
- // Read white list from library.
- NSArray *dirs = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSAllDomainsMask, YES);
- int numDirs = [dirs count];
- for (int i = 0; i < numDirs; i++) {
- if (readIDNScriptWhiteListFile([[dirs objectAtIndex:i] stringByAppendingPathComponent:@"IDNScriptWhiteList.txt"]))
- return;
- }
-
- // Fall back on white list inside bundle.
- NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebCore"];
-
- if (!readIDNScriptWhiteListFile([bundle pathForResource:@"IDNScriptWhiteList" ofType:@"txt"]))
- CRASH();
-}
+ static dispatch_once_t flag;
+ dispatch_once(&flag, ^{
+ // Read white list from library.
+ NSArray *dirs = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSAllDomainsMask, YES);
+ int numDirs = [dirs count];
+ for (int i = 0; i < numDirs; i++) {
+ if (readIDNScriptWhiteListFile([[dirs objectAtIndex:i] stringByAppendingPathComponent:@"IDNScriptWhiteList.txt"]))
+ return;
+ }
-static BOOL allCharactersInIDNScriptWhiteList(const UChar *buffer, int32_t length)
-{
- pthread_once(&IDNScriptWhiteListFileRead, readIDNScriptWhiteList);
+ // Fall back on white list inside bundle.
+ NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebCore"];
+
+ if (!readIDNScriptWhiteListFile([bundle pathForResource:@"IDNScriptWhiteList" ofType:@"txt"]))
+ CRASH();
+ });
int32_t i = 0;
std::optional<UChar32> previousCodePoint;
Modified: trunk/Source/WebKit/ChangeLog (225691 => 225692)
--- trunk/Source/WebKit/ChangeLog 2017-12-08 20:07:30 UTC (rev 225691)
+++ trunk/Source/WebKit/ChangeLog 2017-12-08 20:16:54 UTC (rev 225692)
@@ -1,3 +1,14 @@
+2017-12-08 Yusuke Suzuki <utatane....@gmail.com>
+
+ Remove pthread_once in favor of dispatch_once
+ https://bugs.webkit.org/show_bug.cgi?id=180591
+
+ Reviewed by Saam Barati.
+
+ * PluginProcess/mac/PluginProcessMac.mm:
+ (WebKit::shouldCallRealDebugger):
+ (WebKit::initShouldCallRealDebugger): Deleted.
+
2017-12-08 Chris Dumez <cdu...@apple.com>
ProcessPoolConfiguration::copy() fails to copy the service worker path
Modified: trunk/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm (225691 => 225692)
--- trunk/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm 2017-12-08 20:07:30 UTC (rev 225691)
+++ trunk/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm 2017-12-08 20:16:54 UTC (rev 225692)
@@ -162,20 +162,16 @@
#if defined(__i386__)
-static pthread_once_t shouldCallRealDebuggerOnce = PTHREAD_ONCE_INIT;
-static bool isUserbreakSet = false;
-
-static void initShouldCallRealDebugger()
+static bool shouldCallRealDebugger()
{
- char* var = getenv("USERBREAK");
-
- if (var)
- isUserbreakSet = atoi(var);
-}
+ static bool isUserbreakSet = false;
+ static dispatch_once_t flag;
+ dispatch_once(&flag, ^{
+ char* var = getenv("USERBREAK");
-static bool shouldCallRealDebugger()
-{
- pthread_once(&shouldCallRealDebuggerOnce, initShouldCallRealDebugger);
+ if (var)
+ isUserbreakSet = atoi(var);
+ });
return isUserbreakSet;
}
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (225691 => 225692)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2017-12-08 20:07:30 UTC (rev 225691)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2017-12-08 20:16:54 UTC (rev 225692)
@@ -1,3 +1,17 @@
+2017-12-08 Yusuke Suzuki <utatane....@gmail.com>
+
+ Remove pthread_once in favor of dispatch_once
+ https://bugs.webkit.org/show_bug.cgi?id=180591
+
+ Reviewed by Saam Barati.
+
+ * Misc/WebKitErrors.m:
+ (+[NSError _registerWebKitErrors]):
+ (registerErrors): Deleted.
+ * Storage/WebStorageManager.mm:
+ (+[WebStorageManager _storageDirectoryPath]):
+ (initializeLocalStoragePath): Deleted.
+
2017-12-07 Darin Adler <da...@apple.com>
Remove some unused code from WebKitLegacy
Modified: trunk/Source/WebKitLegacy/mac/Misc/WebKitErrors.m (225691 => 225692)
--- trunk/Source/WebKitLegacy/mac/Misc/WebKitErrors.m 2017-12-08 20:07:30 UTC (rev 225691)
+++ trunk/Source/WebKitLegacy/mac/Misc/WebKitErrors.m 2017-12-08 20:16:54 UTC (rev 225692)
@@ -32,7 +32,7 @@
#import <WebKitLegacy/WebKitErrorsPrivate.h>
#import <WebKitLegacy/WebNSURLExtras.h>
-#import <pthread.h>
+#import <dispatch/dispatch.h>
NSString *WebKitErrorDomain = @"WebKitErrorDomain";
@@ -58,9 +58,6 @@
#define WebKitErrorDescriptionGeolocationLocationUnknown UI_STRING_INTERNAL("The current location cannot be found.", "WebKitErrorGeolocationLocationUnknown description")
-static pthread_once_t registerErrorsControl = PTHREAD_ONCE_INIT;
-static void registerErrors(void);
-
@implementation NSError (WebKitExtras)
static NSMutableDictionary *descriptions = nil;
@@ -67,7 +64,33 @@
+ (void)_registerWebKitErrors
{
- pthread_once(®isterErrorsControl, registerErrors);
+ static dispatch_once_t flag;
+ dispatch_once(&flag, ^{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
+ // Policy errors
+ WebKitErrorDescriptionCannotShowMIMEType, [NSNumber numberWithInt: WebKitErrorCannotShowMIMEType],
+ WebKitErrorDescriptionCannotShowURL, [NSNumber numberWithInt: WebKitErrorCannotShowURL],
+ WebKitErrorDescriptionFrameLoadInterruptedByPolicyChange, [NSNumber numberWithInt: WebKitErrorFrameLoadInterruptedByPolicyChange],
+ WebKitErrorDescriptionCannotUseRestrictedPort, [NSNumber numberWithInt: WebKitErrorCannotUseRestrictedPort],
+ WebKitErrorDescriptionFrameLoadBlockedByContentFilter, [NSNumber numberWithInt: WebKitErrorFrameLoadBlockedByContentFilter],
+
+ // Plug-in and java errors
+ WebKitErrorDescriptionCannotFindPlugin, [NSNumber numberWithInt: WebKitErrorCannotFindPlugIn],
+ WebKitErrorDescriptionCannotLoadPlugin, [NSNumber numberWithInt: WebKitErrorCannotLoadPlugIn],
+ WebKitErrorDescriptionJavaUnavailable, [NSNumber numberWithInt: WebKitErrorJavaUnavailable],
+ WebKitErrorDescriptionPlugInCancelledConnection, [NSNumber numberWithInt: WebKitErrorPlugInCancelledConnection],
+ WebKitErrorDescriptionPlugInWillHandleLoad, [NSNumber numberWithInt: WebKitErrorPlugInWillHandleLoad],
+
+ // Geolocation errors
+ WebKitErrorDescriptionGeolocationLocationUnknown, [NSNumber numberWithInt: WebKitErrorGeolocationLocationUnknown],
+ nil];
+
+ [NSError _webkit_addErrorsWithCodesAndDescriptions:dict inDomain:WebKitErrorDomain];
+
+ [pool drain];
+ });
}
-(id)_webkit_initWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL
@@ -145,32 +168,4 @@
[descriptions setObject:dictionary forKey:domain];
}
-static void registerErrors()
-{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
- // Policy errors
- WebKitErrorDescriptionCannotShowMIMEType, [NSNumber numberWithInt: WebKitErrorCannotShowMIMEType],
- WebKitErrorDescriptionCannotShowURL, [NSNumber numberWithInt: WebKitErrorCannotShowURL],
- WebKitErrorDescriptionFrameLoadInterruptedByPolicyChange, [NSNumber numberWithInt: WebKitErrorFrameLoadInterruptedByPolicyChange],
- WebKitErrorDescriptionCannotUseRestrictedPort, [NSNumber numberWithInt: WebKitErrorCannotUseRestrictedPort],
- WebKitErrorDescriptionFrameLoadBlockedByContentFilter, [NSNumber numberWithInt: WebKitErrorFrameLoadBlockedByContentFilter],
-
- // Plug-in and java errors
- WebKitErrorDescriptionCannotFindPlugin, [NSNumber numberWithInt: WebKitErrorCannotFindPlugIn],
- WebKitErrorDescriptionCannotLoadPlugin, [NSNumber numberWithInt: WebKitErrorCannotLoadPlugIn],
- WebKitErrorDescriptionJavaUnavailable, [NSNumber numberWithInt: WebKitErrorJavaUnavailable],
- WebKitErrorDescriptionPlugInCancelledConnection, [NSNumber numberWithInt: WebKitErrorPlugInCancelledConnection],
- WebKitErrorDescriptionPlugInWillHandleLoad, [NSNumber numberWithInt: WebKitErrorPlugInWillHandleLoad],
-
- // Geolocation errors
- WebKitErrorDescriptionGeolocationLocationUnknown, [NSNumber numberWithInt: WebKitErrorGeolocationLocationUnknown],
- nil];
-
- [NSError _webkit_addErrorsWithCodesAndDescriptions:dict inDomain:WebKitErrorDomain];
-
- [pool drain];
-}
-
@end
Modified: trunk/Source/WebKitLegacy/mac/Storage/WebStorageManager.mm (225691 => 225692)
--- trunk/Source/WebKitLegacy/mac/Storage/WebStorageManager.mm 2017-12-08 20:07:30 UTC (rev 225691)
+++ trunk/Source/WebKitLegacy/mac/Storage/WebStorageManager.mm 2017-12-08 20:16:54 UTC (rev 225692)
@@ -33,7 +33,6 @@
#import <WebCore/PageGroup.h>
#import <WebCore/SecurityOrigin.h>
#import <WebCore/SecurityOriginData.h>
-#import <pthread.h>
using namespace WebCore;
@@ -40,10 +39,6 @@
NSString * const WebStorageDirectoryDefaultsKey = @"WebKitLocalStorageDatabasePathPreferenceKey";
NSString * const WebStorageDidModifyOriginNotification = @"WebStorageDidModifyOriginNotification";
-static NSString *sLocalStoragePath;
-static void initializeLocalStoragePath();
-static pthread_once_t registerLocalStoragePath = PTHREAD_ONCE_INIT;
-
@implementation WebStorageManager
+ (WebStorageManager *)sharedWebStorageManager
@@ -109,7 +104,18 @@
+ (NSString *)_storageDirectoryPath
{
- pthread_once(®isterLocalStoragePath, initializeLocalStoragePath);
+ static NSString *sLocalStoragePath;
+ static dispatch_once_t flag;
+ dispatch_once(&flag, ^{
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ sLocalStoragePath = [defaults objectForKey:WebStorageDirectoryDefaultsKey];
+ if (!sLocalStoragePath || ![sLocalStoragePath isKindOfClass:[NSString class]]) {
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
+ NSString *libraryDirectory = [paths objectAtIndex:0];
+ sLocalStoragePath = [libraryDirectory stringByAppendingPathComponent:@"WebKit/LocalStorage"];
+ }
+ sLocalStoragePath = [[sLocalStoragePath stringByStandardizingPath] retain];
+ });
return sLocalStoragePath;
}
@@ -123,18 +129,6 @@
WebKit::WebStorageNamespaceProvider::closeIdleLocalStorageDatabases();
}
-static void initializeLocalStoragePath()
-{
- NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
- sLocalStoragePath = [defaults objectForKey:WebStorageDirectoryDefaultsKey];
- if (!sLocalStoragePath || ![sLocalStoragePath isKindOfClass:[NSString class]]) {
- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
- NSString *libraryDirectory = [paths objectAtIndex:0];
- sLocalStoragePath = [libraryDirectory stringByAppendingPathComponent:@"WebKit/LocalStorage"];
- }
- sLocalStoragePath = [[sLocalStoragePath stringByStandardizingPath] retain];
-}
-
void WebKitInitializeStorageIfNecessary()
{
static BOOL initialized = NO;