Changeset 196328 in webkit


Ignore:
Timestamp:
Feb 9, 2016 12:56:48 PM (8 years ago)
Author:
jer.noble@apple.com
Message:

[Mac] Adopt NSURLSession properties in AVAssetResourceLoader
https://bugs.webkit.org/show_bug.cgi?id=153873

Reviewed by Eric Carlson.

Source/WebCore:

Adopt a new AVAssetResourceLoader API allowing clients to specify a NSURLSession object to
use for media loading, and control the use of this property with a new Setting.

  • page/Settings.cpp:

(WebCore::Settings::setAVFoundationNSURLSessionEnabled):

  • page/Settings.h:

(WebCore::Settings::isAVFoundationNSURLSessionEnabled):

  • platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:

(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):

  • platform/spi/mac/AVFoundationSPI.h:

Source/WebKit/mac:

Add a WebKit preference to control the WebCore isAVFoundationNSURLSessionEnabled()
setting.

  • WebView/WebPreferenceKeysPrivate.h:
  • WebView/WebPreferences.mm:

(+[WebPreferences initialize]):
(-[WebPreferences setAVFoundationNSURLSessionEnabled:]):
(-[WebPreferences isAVFoundationNSURLSessionEnabled]):

  • WebView/WebPreferencesPrivate.h:
  • WebView/WebView.mm:

(-[WebView _preferencesChanged:]):

Source/WebKit2:

Add a WebKit2 preference to control the WebCore isAVFoundationNSURLSessionEnabled()
setting.

  • Shared/WebPreferencesDefinitions.h:
  • UIProcess/API/C/WKPreferences.cpp:

(WKPreferencesSetAVFoundationNSURLSessionEnabled):
(WKPreferencesGetAVFoundationNSURLSessionEnabled):

  • UIProcess/API/C/WKPreferencesRef.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::updatePreferences):

Location:
trunk/Source
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r196322 r196328  
     12016-02-04  Jer Noble  <jer.noble@apple.com>
     2
     3        [Mac] Adopt NSURLSession properties in AVAssetResourceLoader
     4        https://bugs.webkit.org/show_bug.cgi?id=153873
     5
     6        Reviewed by Eric Carlson.
     7
     8        Adopt a new AVAssetResourceLoader API allowing clients to specify a NSURLSession object to
     9        use for media loading, and control the use of this property with a new Setting.
     10
     11        * page/Settings.cpp:
     12        (WebCore::Settings::setAVFoundationNSURLSessionEnabled):
     13        * page/Settings.h:
     14        (WebCore::Settings::isAVFoundationNSURLSessionEnabled):
     15        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
     16        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
     17        * platform/spi/mac/AVFoundationSPI.h:
     18
    1192016-02-09  Myles C. Maxfield  <mmaxfield@apple.com>
    220
  • trunk/Source/WebCore/page/Settings.cpp

    r195644 r196328  
    7676#if USE(AVFOUNDATION)
    7777bool Settings::gAVFoundationEnabled = true;
     78bool Settings::gAVFoundationNSURLSessionEnabled = false;
    7879#endif
    7980
     
    590591    HTMLMediaElement::resetMediaEngines();
    591592}
     593
     594void Settings::setAVFoundationNSURLSessionEnabled(bool enabled)
     595{
     596    if (gAVFoundationEnabled == enabled)
     597        return;
     598
     599    gAVFoundationEnabled = enabled;
     600}
    592601#endif
    593602
  • trunk/Source/WebCore/page/Settings.h

    r196134 r196328  
    198198    WEBCORE_EXPORT static void setAVFoundationEnabled(bool flag);
    199199    static bool isAVFoundationEnabled() { return gAVFoundationEnabled; }
     200    WEBCORE_EXPORT static void setAVFoundationNSURLSessionEnabled(bool flag);
     201    static bool isAVFoundationNSURLSessionEnabled() { return gAVFoundationNSURLSessionEnabled; }
    200202#endif
    201203
     
    344346#if USE(AVFOUNDATION)
    345347    WEBCORE_EXPORT static bool gAVFoundationEnabled;
     348    WEBCORE_EXPORT static bool gAVFoundationNSURLSessionEnabled;
    346349#endif
    347350
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r196263 r196328  
    5858#import "SecurityOrigin.h"
    5959#import "SerializedPlatformRepresentationMac.h"
     60#import "Settings.h"
    6061#import "TextEncoding.h"
    6162#import "TextTrackRepresentation.h"
     
    6465#import "WebCoreAVFResourceLoader.h"
    6566#import "WebCoreCALayerExtras.h"
     67#import "WebCoreNSURLSession.h"
    6668#import "WebCoreSystemInterface.h"
    6769#import <functional>
     
    913915
    914916#if HAVE(AVFOUNDATION_LOADER_DELEGATE)
    915     [[m_avAsset.get() resourceLoader] setDelegate:m_loaderDelegate.get() queue:globalLoaderDelegateQueue()];
     917    AVAssetResourceLoader *resourceLoader = m_avAsset.get().resourceLoader;
     918    [resourceLoader setDelegate:m_loaderDelegate.get() queue:globalLoaderDelegateQueue()];
     919
     920#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
     921    if (Settings::isAVFoundationNSURLSessionEnabled()
     922        && [resourceLoader respondsToSelector:@selector(setURLSession:)]
     923        && [resourceLoader respondsToSelector:@selector(URLSessionDataDelegate)]
     924        && [resourceLoader respondsToSelector:@selector(URLSessionDataDelegateQueue)])
     925        resourceLoader.URLSession = (NSURLSession *)[[[WebCoreNSURLSession alloc] initWithResourceLoader:*player()->cachedResourceLoader() delegate:resourceLoader.URLSessionDataDelegate delegateQueue:resourceLoader.URLSessionDataDelegateQueue] autorelease];
     926#endif
     927
    916928#endif
    917929
  • trunk/Source/WebCore/platform/spi/mac/AVFoundationSPI.h

    r190841 r196328  
    7575#endif // PLATFORM(IOS)
    7676
     77// FIXME: Wrap in a #if USE(APPLE_INTERNAL_SDK) once this SPI lands
     78#import <AVFoundation/AVAssetResourceLoader.h>
     79
     80NS_ASSUME_NONNULL_BEGIN
     81
     82@interface AVAssetResourceLoader (AVAssetResourceLoaderPrivate)
     83@property (nonatomic, readonly) id<NSURLSessionDataDelegate> URLSessionDataDelegate;
     84@property (nonatomic, readonly) NSOperationQueue *URLSessionDataDelegateQueue;
     85@property (nonatomic, nullable, retain) NSURLSession *URLSession;
     86@end
     87
     88NS_ASSUME_NONNULL_END
  • trunk/Source/WebKit/mac/ChangeLog

    r196310 r196328  
     12016-02-04  Jer Noble  <jer.noble@apple.com>
     2
     3        [Mac] Adopt NSURLSession properties in AVAssetResourceLoader
     4        https://bugs.webkit.org/show_bug.cgi?id=153873
     5
     6        Reviewed by Eric Carlson.
     7
     8        Add a WebKit preference to control the WebCore isAVFoundationNSURLSessionEnabled()
     9        setting.
     10
     11        * WebView/WebPreferenceKeysPrivate.h:
     12        * WebView/WebPreferences.mm:
     13        (+[WebPreferences initialize]):
     14        (-[WebPreferences setAVFoundationNSURLSessionEnabled:]):
     15        (-[WebPreferences isAVFoundationNSURLSessionEnabled]):
     16        * WebView/WebPreferencesPrivate.h:
     17        * WebView/WebView.mm:
     18        (-[WebView _preferencesChanged:]):
     19
    1202016-02-09  Eric Carlson  <eric.carlson@apple.com>
    221
  • trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h

    r194683 r196328  
    120120#define WebKitHyperlinkAuditingEnabledPreferenceKey @"WebKitHyperlinkAuditingEnabled"
    121121#define WebKitAVFoundationEnabledKey @"WebKitAVFoundationEnabled"
     122#define WebKitAVFoundationNSURLSessionEnabledKey @"WebKitAVFoundationNSURLSessionEnabled"
    122123#define WebKitHixie76WebSocketProtocolEnabledKey @"WebKitHixie76WebSocketProtocolEnabled"
    123124#define WebKitRequiresUserGestureForMediaPlaybackPreferenceKey @"WebKitMediaPlaybackRequiresUserGesture"
  • trunk/Source/WebKit/mac/WebView/WebPreferences.mm

    r194727 r196328  
    518518        [NSNumber numberWithBool:NO],   WebKitUsePreHTML5ParserQuirksKey,
    519519        [NSNumber numberWithBool:YES],  WebKitAVFoundationEnabledKey,
     520        [NSNumber numberWithBool:NO],   WebKitAVFoundationNSURLSessionEnabledKey,
    520521        [NSNumber numberWithBool:NO],   WebKitSuppressesIncrementalRenderingKey,
    521522#if !PLATFORM(IOS)
     
    20672068{
    20682069    return [self _boolValueForKey:WebKitAVFoundationEnabledKey];
     2070}
     2071
     2072- (void)setAVFoundationNSURLSessionEnabled:(BOOL)flag
     2073{
     2074    [self _setBoolValue:flag forKey:WebKitAVFoundationNSURLSessionEnabledKey];
     2075}
     2076
     2077- (BOOL)isAVFoundationNSURLSessionEnabled
     2078{
     2079    return [self _boolValueForKey:WebKitAVFoundationNSURLSessionEnabledKey];
    20692080}
    20702081
  • trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h

    r194683 r196328  
    371371- (BOOL)isAVFoundationEnabled;
    372372
     373- (void)setAVFoundationNSURLSessionEnabled:(BOOL)flag;
     374- (BOOL)isAVFoundationNSURLSessionEnabled;
     375
    373376- (void)setQTKitEnabled:(BOOL)flag;
    374377- (BOOL)isQTKitEnabled;
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r196024 r196328  
    24322432#if USE(AVFOUNDATION)
    24332433    settings.setAVFoundationEnabled([preferences isAVFoundationEnabled]);
     2434    settings.setAVFoundationNSURLSessionEnabled([preferences isAVFoundationNSURLSessionEnabled]);
    24342435#endif
    24352436
  • trunk/Source/WebKit2/ChangeLog

    r196321 r196328  
     12016-02-04  Jer Noble  <jer.noble@apple.com>
     2
     3        [Mac] Adopt NSURLSession properties in AVAssetResourceLoader
     4        https://bugs.webkit.org/show_bug.cgi?id=153873
     5
     6        Reviewed by Eric Carlson.
     7
     8        Add a WebKit2 preference to control the WebCore isAVFoundationNSURLSessionEnabled()
     9        setting.
     10
     11        * Shared/WebPreferencesDefinitions.h:
     12        * UIProcess/API/C/WKPreferences.cpp:
     13        (WKPreferencesSetAVFoundationNSURLSessionEnabled):
     14        (WKPreferencesGetAVFoundationNSURLSessionEnabled):
     15        * UIProcess/API/C/WKPreferencesRef.h:
     16        * WebProcess/WebPage/WebPage.cpp:
     17        (WebKit::WebPage::updatePreferences):
     18
    1192016-02-09  Anders Carlsson  <andersca@apple.com>
    220
  • trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h

    r195317 r196328  
    142142    macro(AllowFileAccessFromFileURLs, allowFileAccessFromFileURLs, Bool, bool, false) \
    143143    macro(AVFoundationEnabled, isAVFoundationEnabled, Bool, bool, true) \
     144    macro(AVFoundationNSURLSessionEnabled, isAVFoundationNSURLSessionEnabled, Bool, bool, false) \
    144145    macro(RequiresUserGestureForMediaPlayback, requiresUserGestureForMediaPlayback, Bool, bool, DEFAULT_REQUIRES_USER_GESTURE_FOR_MEDIA_PLAYBACK) \
    145146    macro(RequiresUserGestureForAudioPlayback, requiresUserGestureForAudioPlayback, Bool, bool, DEFAULT_REQUIRES_USER_GESTURE_FOR_AUDIO_PLAYBACK) \
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp

    r194000 r196328  
    700700}
    701701
     702void WKPreferencesSetAVFoundationNSURLSessionEnabled(WKPreferencesRef preferencesRef, bool enabled)
     703{
     704    toImpl(preferencesRef)->setAVFoundationNSURLSessionEnabled(enabled);
     705}
     706
     707bool WKPreferencesGetAVFoundationNSURLSessionEnabled(WKPreferencesRef preferencesRef)
     708{
     709    return toImpl(preferencesRef)->isAVFoundationNSURLSessionEnabled();
     710}
     711
    702712void WKPreferencesSetWebSecurityEnabled(WKPreferencesRef preferencesRef, bool enabled)
    703713{
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRef.h

    r185016 r196328  
    183183WK_EXPORT bool WKPreferencesGetAVFoundationEnabled(WKPreferencesRef preferencesRef);
    184184
     185// Defaults to false.
     186WK_EXPORT void WKPreferencesSetAVFoundationNSURLSessionEnabled(WKPreferencesRef preferencesRef, bool enabled);
     187WK_EXPORT bool WKPreferencesGetAVFoundationNSURLSessionEnabled(WKPreferencesRef preferencesRef);
     188
    185189// Defaults to false
    186190WK_EXPORT void WKPreferencesSetWebAudioEnabled(WKPreferencesRef preferencesRef, bool enabled);
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r196024 r196328  
    28392839#if USE(AVFOUNDATION)
    28402840    settings.setAVFoundationEnabled(store.getBoolValueForKey(WebPreferencesKey::isAVFoundationEnabledKey()));
     2841    settings.setAVFoundationNSURLSessionEnabled(store.getBoolValueForKey(WebPreferencesKey::isAVFoundationNSURLSessionEnabledKey()));
    28412842#endif
    28422843
Note: See TracChangeset for help on using the changeset viewer.