Changeset 223963 in webkit


Ignore:
Timestamp:
Oct 25, 2017 11:21:41 AM (6 years ago)
Author:
Simon Fraser
Message:

MediaSessionManager* needs to catch Obj-C exceptions
https://bugs.webkit.org/show_bug.cgi?id=178813

Reviewed by Tim Horton.

Wrap all calls out to Objective-C with BEGIN_BLOCK_OBJC_EXCEPTIONS/END_BLOCK_OBJC_EXCEPTIONS.

  • platform/audio/ios/MediaSessionManagerIOS.mm:

(WebCore::MediaSessionManageriOS::MediaSessionManageriOS):
(WebCore::MediaSessionManageriOS::~MediaSessionManageriOS):
(WebCore::MediaSessionManageriOS::hasWirelessTargetsAvailable):
(WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring):
(WebCore::MediaSessionManageriOS::updateNowPlayingInfo):
(WebCore::MediaSessionManageriOS::externalOutputDeviceAvailableDidChange):
(-[WebMediaSessionHelper allocateVolumeView]):
(-[WebMediaSessionHelper initWithCallback:]):

  • platform/audio/mac/MediaSessionManagerMac.mm:

(WebCore::MediaSessionManagerMac::updateNowPlayingInfo):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r223962 r223963  
     12017-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
    1222017-10-25  Andy Estes  <aestes@apple.com>
    223
  • trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm

    r220809 r223963  
    4141#import <objc/runtime.h>
    4242#import <pal/spi/ios/MediaPlayerSPI.h>
     43#import <wtf/BlockObjCExceptions.h>
    4344#import <wtf/MainThread.h>
    4445#import <wtf/RAMSize.h>
     
    131132MediaSessionManageriOS::MediaSessionManageriOS()
    132133    : 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
    135138    resetRestrictions();
    136139}
     
    138141MediaSessionManageriOS::~MediaSessionManageriOS()
    139142{
     143    BEGIN_BLOCK_OBJC_EXCEPTIONS
    140144    [m_objcObserver clearCallback];
     145    m_objcObserver = nil;
     146    END_BLOCK_OBJC_EXCEPTIONS
    141147}
    142148
     
    160166bool MediaSessionManageriOS::hasWirelessTargetsAvailable()
    161167{
     168    BEGIN_BLOCK_OBJC_EXCEPTIONS
    162169    return [m_objcObserver hasWirelessTargetsAvailable];
     170    END_BLOCK_OBJC_EXCEPTIONS
    163171}
    164172
     
    170178
    171179    LOG(Media, "MediaSessionManageriOS::configureWireLessTargetMonitoring - requiresMonitoring = %s", requiresMonitoring ? "true" : "false");
     180
     181    BEGIN_BLOCK_OBJC_EXCEPTIONS
    172182
    173183    if (requiresMonitoring)
     
    175185    else
    176186        [m_objcObserver stopMonitoringAirPlayRoutes];
     187
     188    END_BLOCK_OBJC_EXCEPTIONS
    177189}
    178190
     
    223235void MediaSessionManageriOS::updateNowPlayingInfo()
    224236{
     237    BEGIN_BLOCK_OBJC_EXCEPTIONS
    225238    MPNowPlayingInfoCenter *nowPlaying = (MPNowPlayingInfoCenter *)[getMPNowPlayingInfoCenterClass() defaultCenter];
    226239    const PlatformMediaSession* currentSession = this->nowPlayingEligibleSession();
     
    267280    m_nowPlayingActive = true;
    268281    [nowPlaying setNowPlayingInfo:info.get()];
     282    END_BLOCK_OBJC_EXCEPTIONS
    269283}
    270284
     
    279293void MediaSessionManageriOS::externalOutputDeviceAvailableDidChange()
    280294{
     295    BEGIN_BLOCK_OBJC_EXCEPTIONS
    281296    forEachSession([haveTargets = [m_objcObserver hasWirelessTargetsAvailable]] (PlatformMediaSession& session, size_t) {
    282297        session.externalOutputDeviceAvailableDidChange(haveTargets);
    283298    });
     299    END_BLOCK_OBJC_EXCEPTIONS
    284300}
    285301
     
    297313    RetainPtr<WebMediaSessionHelper> strongSelf = self;
    298314    dispatch_async(dispatch_get_main_queue(), [strongSelf]() {
     315        BEGIN_BLOCK_OBJC_EXCEPTIONS
    299316        RetainPtr<MPVolumeView> volumeView = adoptNS([allocMPVolumeViewInstance() init]);
    300317        callOnWebThreadOrDispatchAsyncOnMainThread([strongSelf, volumeView]() {
     318            BEGIN_BLOCK_OBJC_EXCEPTIONS
    301319            [strongSelf setVolumeView:volumeView];
     320            END_BLOCK_OBJC_EXCEPTIONS
    302321        });
     322        END_BLOCK_OBJC_EXCEPTIONS
    303323    });
    304324}
     
    340360    // Now playing won't work unless we turn on the delivery of remote control events.
    341361    dispatch_async(dispatch_get_main_queue(), ^ {
     362        BEGIN_BLOCK_OBJC_EXCEPTIONS
    342363        [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
     364        END_BLOCK_OBJC_EXCEPTIONS
    343365    });
    344366
  • trunk/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm

    r217858 r223963  
    3333#import "MediaPlayer.h"
    3434#import "PlatformMediaSession.h"
     35#import <wtf/BlockObjCExceptions.h>
    3536
    3637#import "MediaRemoteSoftLink.h"
     
    124125    if (!isMediaRemoteFrameworkAvailable())
    125126        return;
     127
     128    BEGIN_BLOCK_OBJC_EXCEPTIONS
    126129
    127130    const PlatformMediaSession* currentSession = this->nowPlayingEligibleSession();
     
    203206        MRMediaRemoteSetNowPlayingVisibility(MRMediaRemoteGetLocalOrigin(), visibility);
    204207    }
    205 #endif
     208    END_BLOCK_OBJC_EXCEPTIONS
     209#endif // USE(MEDIAREMOTE)
    206210}
    207211
Note: See TracChangeset for help on using the changeset viewer.