Changeset 223963 in webkit
- Timestamp:
- Oct 25, 2017 11:21:41 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r223962 r223963 1 2017-10-25 Simon Fraser <simon.fraser@apple.com> 2 3 MediaSessionManager* needs to catch Obj-C exceptions 4 https://bugs.webkit.org/show_bug.cgi?id=178813 5 6 Reviewed by Tim Horton. 7 8 Wrap all calls out to Objective-C with BEGIN_BLOCK_OBJC_EXCEPTIONS/END_BLOCK_OBJC_EXCEPTIONS. 9 10 * platform/audio/ios/MediaSessionManagerIOS.mm: 11 (WebCore::MediaSessionManageriOS::MediaSessionManageriOS): 12 (WebCore::MediaSessionManageriOS::~MediaSessionManageriOS): 13 (WebCore::MediaSessionManageriOS::hasWirelessTargetsAvailable): 14 (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring): 15 (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): 16 (WebCore::MediaSessionManageriOS::externalOutputDeviceAvailableDidChange): 17 (-[WebMediaSessionHelper allocateVolumeView]): 18 (-[WebMediaSessionHelper initWithCallback:]): 19 * platform/audio/mac/MediaSessionManagerMac.mm: 20 (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): 21 1 22 2017-10-25 Andy Estes <aestes@apple.com> 2 23 -
trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm
r220809 r223963 41 41 #import <objc/runtime.h> 42 42 #import <pal/spi/ios/MediaPlayerSPI.h> 43 #import <wtf/BlockObjCExceptions.h> 43 44 #import <wtf/MainThread.h> 44 45 #import <wtf/RAMSize.h> … … 131 132 MediaSessionManageriOS::MediaSessionManageriOS() 132 133 : PlatformMediaSessionManager() 133 , m_objcObserver(adoptNS([[WebMediaSessionHelper alloc] initWithCallback:this])) 134 { 134 { 135 BEGIN_BLOCK_OBJC_EXCEPTIONS 136 m_objcObserver = adoptNS([[WebMediaSessionHelper alloc] initWithCallback:this]); 137 END_BLOCK_OBJC_EXCEPTIONS 135 138 resetRestrictions(); 136 139 } … … 138 141 MediaSessionManageriOS::~MediaSessionManageriOS() 139 142 { 143 BEGIN_BLOCK_OBJC_EXCEPTIONS 140 144 [m_objcObserver clearCallback]; 145 m_objcObserver = nil; 146 END_BLOCK_OBJC_EXCEPTIONS 141 147 } 142 148 … … 160 166 bool MediaSessionManageriOS::hasWirelessTargetsAvailable() 161 167 { 168 BEGIN_BLOCK_OBJC_EXCEPTIONS 162 169 return [m_objcObserver hasWirelessTargetsAvailable]; 170 END_BLOCK_OBJC_EXCEPTIONS 163 171 } 164 172 … … 170 178 171 179 LOG(Media, "MediaSessionManageriOS::configureWireLessTargetMonitoring - requiresMonitoring = %s", requiresMonitoring ? "true" : "false"); 180 181 BEGIN_BLOCK_OBJC_EXCEPTIONS 172 182 173 183 if (requiresMonitoring) … … 175 185 else 176 186 [m_objcObserver stopMonitoringAirPlayRoutes]; 187 188 END_BLOCK_OBJC_EXCEPTIONS 177 189 } 178 190 … … 223 235 void MediaSessionManageriOS::updateNowPlayingInfo() 224 236 { 237 BEGIN_BLOCK_OBJC_EXCEPTIONS 225 238 MPNowPlayingInfoCenter *nowPlaying = (MPNowPlayingInfoCenter *)[getMPNowPlayingInfoCenterClass() defaultCenter]; 226 239 const PlatformMediaSession* currentSession = this->nowPlayingEligibleSession(); … … 267 280 m_nowPlayingActive = true; 268 281 [nowPlaying setNowPlayingInfo:info.get()]; 282 END_BLOCK_OBJC_EXCEPTIONS 269 283 } 270 284 … … 279 293 void MediaSessionManageriOS::externalOutputDeviceAvailableDidChange() 280 294 { 295 BEGIN_BLOCK_OBJC_EXCEPTIONS 281 296 forEachSession([haveTargets = [m_objcObserver hasWirelessTargetsAvailable]] (PlatformMediaSession& session, size_t) { 282 297 session.externalOutputDeviceAvailableDidChange(haveTargets); 283 298 }); 299 END_BLOCK_OBJC_EXCEPTIONS 284 300 } 285 301 … … 297 313 RetainPtr<WebMediaSessionHelper> strongSelf = self; 298 314 dispatch_async(dispatch_get_main_queue(), [strongSelf]() { 315 BEGIN_BLOCK_OBJC_EXCEPTIONS 299 316 RetainPtr<MPVolumeView> volumeView = adoptNS([allocMPVolumeViewInstance() init]); 300 317 callOnWebThreadOrDispatchAsyncOnMainThread([strongSelf, volumeView]() { 318 BEGIN_BLOCK_OBJC_EXCEPTIONS 301 319 [strongSelf setVolumeView:volumeView]; 320 END_BLOCK_OBJC_EXCEPTIONS 302 321 }); 322 END_BLOCK_OBJC_EXCEPTIONS 303 323 }); 304 324 } … … 340 360 // Now playing won't work unless we turn on the delivery of remote control events. 341 361 dispatch_async(dispatch_get_main_queue(), ^ { 362 BEGIN_BLOCK_OBJC_EXCEPTIONS 342 363 [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; 364 END_BLOCK_OBJC_EXCEPTIONS 343 365 }); 344 366 -
trunk/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm
r217858 r223963 33 33 #import "MediaPlayer.h" 34 34 #import "PlatformMediaSession.h" 35 #import <wtf/BlockObjCExceptions.h> 35 36 36 37 #import "MediaRemoteSoftLink.h" … … 124 125 if (!isMediaRemoteFrameworkAvailable()) 125 126 return; 127 128 BEGIN_BLOCK_OBJC_EXCEPTIONS 126 129 127 130 const PlatformMediaSession* currentSession = this->nowPlayingEligibleSession(); … … 203 206 MRMediaRemoteSetNowPlayingVisibility(MRMediaRemoteGetLocalOrigin(), visibility); 204 207 } 205 #endif 208 END_BLOCK_OBJC_EXCEPTIONS 209 #endif // USE(MEDIAREMOTE) 206 210 } 207 211
Note: See TracChangeset
for help on using the changeset viewer.