Changeset 176471 in webkit
- Timestamp:
- Nov 21, 2014, 1:22:47 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
platform/audio/ios/MediaSessionManagerIOS.mm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r176470 r176471 1 2014-11-21 Eric Carlson <eric.carlson@apple.com> 2 3 [iOS] allocate volume view on the main thread 4 https://bugs.webkit.org/show_bug.cgi?id=138971 5 rdar://problem/18016958 6 7 Reviewed by Jer Noble. 8 9 * platform/audio/ios/MediaSessionManagerIOS.mm: 10 (-[WebMediaSessionHelper allocateVolumeView]): New, dispatch to the main thread if necessary before allocating 11 the volume view. 12 (-[WebMediaSessionHelper initWithCallback:]): Call allocateVolumeView. 13 1 14 2014-11-21 Zalan Bujtas <zalan@apple.com> 2 15 -
trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm
r176448 r176471 96 96 97 97 - (id)initWithCallback:(MediaSessionManageriOS*)callback; 98 - (void)allocateVolumeView; 98 99 - (void)clearCallback; 99 100 - (void)interruption:(NSNotification *)notification; … … 229 230 @implementation WebMediaSessionHelper 230 231 232 - (void)allocateVolumeView 233 { 234 if (!isMainThread()) { 235 // Call synchronously to the main thread so that _volumeView will be completely setup before the constructor completes 236 // because hasWirelessTargetsAvailable is synchronous and can be called on the WebThread. 237 RetainPtr<WebMediaSessionHelper> strongSelf = self; 238 dispatch_sync(dispatch_get_main_queue(), [strongSelf]() { 239 [strongSelf allocateVolumeView]; 240 return; 241 }); 242 } 243 244 _volumeView = adoptNS([[getMPVolumeViewClass() alloc] init]); 245 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(wirelessRoutesAvailableDidChange:) name:MPVolumeViewWirelessRoutesAvailableDidChangeNotification object:_volumeView.get()]; 246 247 } 248 231 249 - (id)initWithCallback:(MediaSessionManageriOS*)callback 232 250 { … … 237 255 238 256 _callback = callback; 239 _volumeView = adoptNS([[getMPVolumeViewClass() alloc] init]);240 257 241 258 NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; … … 248 265 [center addObserver:self selector:@selector(applicationWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil]; 249 266 [center addObserver:self selector:@selector(applicationWillResignActive:) name:WebUIApplicationWillResignActiveNotification object:nil]; 250 [center addObserver:self selector:@selector(wirelessRoutesAvailableDidChange:) name:MPVolumeViewWirelessRoutesAvailableDidChangeNotification object:_volumeView.get()]; 267 268 [self allocateVolumeView]; 251 269 252 270 // Now playing won't work unless we turn on the delivery of remote control events.
Note:
See TracChangeset
for help on using the changeset viewer.