Changeset 268421 in webkit
- Timestamp:
- Oct 13, 2020 2:38:21 PM (3 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r268420 r268421 1 2020-10-13 Per Arne Vollan <pvollan@apple.com> 2 3 [iOS 14] Hang in -[WKUserDefaults _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:] 4 https://bugs.webkit.org/show_bug.cgi?id=217183 5 <rdar://problem/69916673> 6 7 Reviewed by Geoffrey Garen. 8 9 Dispatch this work on a non-main thread, in order to avoid blocking the main thread. 10 11 * UIProcess/Cocoa/PreferenceObserver.mm: 12 (-[WKUserDefaults _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:]): 13 1 14 2020-10-13 Keith Rollin <krollin@apple.com> 2 15 -
trunk/Source/WebKit/UIProcess/Cocoa/PreferenceObserver.mm
r265740 r268421 36 36 WKPreferenceObserver *m_observer; 37 37 } 38 - (void)findPreferenceChangesAndNotifyForKeys:(NSDictionary<NSString *, id> *)oldValues toValuesForKeys:(NSDictionary<NSString *, id> *)newValues; 38 39 @end 39 40 … … 46 47 @implementation WKUserDefaults 47 48 48 - (void) _notifyObserversOfChangeFromValuesForKeys:(NSDictionary<NSString *, id> *)oldValues toValuesForKeys:(NSDictionary<NSString *, id> *)newValues49 - (void)findPreferenceChangesAndNotifyForKeys:(NSDictionary<NSString *, id> *)oldValues toValuesForKeys:(NSDictionary<NSString *, id> *)newValues 49 50 { 50 [super _notifyObserversOfChangeFromValuesForKeys:oldValues toValuesForKeys:newValues];51 52 51 if (!m_observer) 53 52 return; … … 85 84 [m_observer preferenceDidChange:m_suiteName key:key encodedValue:encodedString]; 86 85 } 86 } 87 88 - (void)_notifyObserversOfChangeFromValuesForKeys:(NSDictionary<NSString *, id> *)oldValues toValuesForKeys:(NSDictionary<NSString *, id> *)newValues 89 { 90 [super _notifyObserversOfChangeFromValuesForKeys:oldValues toValuesForKeys:newValues]; 91 92 if (!isMainThread()) { 93 [self findPreferenceChangesAndNotifyForKeys:oldValues toValuesForKeys:newValues]; 94 return; 95 } 96 97 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), [self, protectedSelf = retainPtr(self), oldValues = retainPtr(oldValues), newValues = retainPtr(newValues)] { 98 [self findPreferenceChangesAndNotifyForKeys:oldValues.get() toValuesForKeys:newValues.get()]; 99 }); 87 100 } 88 101
Note: See TracChangeset
for help on using the changeset viewer.