Changeset 213747 in webkit


Ignore:
Timestamp:
Mar 10, 2017 7:24:30 PM (7 years ago)
Author:
achristensen@apple.com
Message:

Add SPI to set NSURLSessionConfiguration.allowsCellularAccess from _WKProcessPoolConfiguration
https://bugs.webkit.org/show_bug.cgi?id=169500
<rdar://problem/29599569>

Reviewed by Joseph Pecoraro.

  • NetworkProcess/NetworkProcessCreationParameters.cpp:

(WebKit::NetworkProcessCreationParameters::encode):
(WebKit::NetworkProcessCreationParameters::decode):

  • NetworkProcess/NetworkProcessCreationParameters.h:
  • NetworkProcess/cocoa/NetworkProcessCocoa.mm:

(WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):

  • NetworkProcess/cocoa/NetworkSessionCocoa.h:
  • NetworkProcess/cocoa/NetworkSessionCocoa.mm:

(WebKit::globalAllowsCellularAccess):
(WebKit::NetworkSessionCocoa::setAllowsCellularAccess):
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):

  • UIProcess/API/APIProcessPoolConfiguration.h:
  • UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
  • UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:

(-[_WKProcessPoolConfiguration allowsCellularAccess]):
(-[_WKProcessPoolConfiguration setAllowsCellularAccess:]):

Location:
trunk/Source/WebKit2
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r213746 r213747  
     12017-03-10  Alex Christensen  <achristensen@webkit.org>
     2
     3        Add SPI to set NSURLSessionConfiguration.allowsCellularAccess from _WKProcessPoolConfiguration
     4        https://bugs.webkit.org/show_bug.cgi?id=169500
     5        <rdar://problem/29599569>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * NetworkProcess/NetworkProcessCreationParameters.cpp:
     10        (WebKit::NetworkProcessCreationParameters::encode):
     11        (WebKit::NetworkProcessCreationParameters::decode):
     12        * NetworkProcess/NetworkProcessCreationParameters.h:
     13        * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
     14        (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
     15        * NetworkProcess/cocoa/NetworkSessionCocoa.h:
     16        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
     17        (WebKit::globalAllowsCellularAccess):
     18        (WebKit::NetworkSessionCocoa::setAllowsCellularAccess):
     19        (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
     20        * UIProcess/API/APIProcessPoolConfiguration.h:
     21        * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
     22        * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
     23        (-[_WKProcessPoolConfiguration allowsCellularAccess]):
     24        (-[_WKProcessPoolConfiguration setAllowsCellularAccess:]):
     25
    1262017-03-10  Alex Christensen  <achristensen@webkit.org>
    227
  • trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.cpp

    r212746 r213747  
    7777    encoder << sourceApplicationBundleIdentifier;
    7878    encoder << sourceApplicationSecondaryIdentifier;
     79    encoder << allowsCellularAccess;
    7980#if PLATFORM(IOS)
    8081    encoder << ctDataConnectionServiceType;
     
    164165    if (!decoder.decode(result.sourceApplicationSecondaryIdentifier))
    165166        return false;
     167    if (!decoder.decode(result.allowsCellularAccess))
     168        return false;
    166169#if PLATFORM(IOS)
    167170    if (!decoder.decode(result.ctDataConnectionServiceType))
  • trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.h

    r212746 r213747  
    8585    String sourceApplicationBundleIdentifier;
    8686    String sourceApplicationSecondaryIdentifier;
     87    bool allowsCellularAccess { true };
    8788#if PLATFORM(IOS)
    8889    String ctDataConnectionServiceType;
  • trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm

    r212746 r213747  
    8888    NetworkSessionCocoa::setSourceApplicationBundleIdentifier(parameters.sourceApplicationBundleIdentifier);
    8989    NetworkSessionCocoa::setSourceApplicationSecondaryIdentifier(parameters.sourceApplicationSecondaryIdentifier);
     90    NetworkSessionCocoa::setAllowsCellularAccess(parameters.allowsCellularAccess);
    9091#if PLATFORM(IOS)
    9192    NetworkSessionCocoa::setCTDataConnectionServiceType(parameters.ctDataConnectionServiceType);
  • trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.h

    r213441 r213747  
    5252    static void setSourceApplicationBundleIdentifier(const String&);
    5353    static void setSourceApplicationSecondaryIdentifier(const String&);
     54    static void setAllowsCellularAccess(bool);
    5455#if PLATFORM(IOS)
    5556    static void setCTDataConnectionServiceType(const String&);
  • trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm

    r213685 r213747  
    430430}
    431431
     432static bool& globalAllowsCellularAccess()
     433{
     434    static bool allowsCellularAccess { true };
     435    return allowsCellularAccess;
     436}
     437
    432438static LegacyCustomProtocolManager*& globalLegacyCustomProtocolManager()
    433439{
     
    488494    ASSERT(!sessionsCreated);
    489495    globalSourceApplicationSecondaryIdentifier() = identifier;
     496}
     497   
     498void NetworkSessionCocoa::setAllowsCellularAccess(bool value)
     499{
     500    globalAllowsCellularAccess() = value;
    490501}
    491502
     
    521532    NSURLSessionConfiguration *configuration = configurationForSessionID(m_sessionID);
    522533
     534    if (!globalAllowsCellularAccess())
     535        configuration.allowsCellularAccess = NO;
     536   
    523537    if (NetworkCache::singleton().isEnabled())
    524538        configuration.URLCache = nil;
  • trunk/Source/WebKit2/UIProcess/API/APIProcessPoolConfiguration.h

    r213690 r213747  
    112112    void setSourceApplicationSecondaryIdentifier(const WTF::String& sourceApplicationSecondaryIdentifier) { m_sourceApplicationSecondaryIdentifier = sourceApplicationSecondaryIdentifier; }
    113113
     114    bool allowsCellularAccess() const { return m_allowsCellularAccess; }
     115    void setAllowsCellularAccess(bool allowsCellularAccess) { m_allowsCellularAccess = allowsCellularAccess; }
     116   
    114117    bool alwaysRunsAtBackgroundPriority() const { return m_alwaysRunsAtBackgroundPriority; }
    115118    void setAlwaysRunsAtBackgroundPriority(bool alwaysRunsAtBackgroundPriority) { m_alwaysRunsAtBackgroundPriority = alwaysRunsAtBackgroundPriority; }
     
    146149    WTF::String m_sourceApplicationBundleIdentifier;
    147150    WTF::String m_sourceApplicationSecondaryIdentifier;
     151    bool m_allowsCellularAccess { true };
    148152    bool m_alwaysRunsAtBackgroundPriority { false };
    149153#if PLATFORM(IOS)
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h

    r207346 r213747  
    4848@property (nonatomic, nullable, copy) NSString *sourceApplicationBundleIdentifier WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
    4949@property (nonatomic, nullable, copy) NSString *sourceApplicationSecondaryIdentifier WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     50@property (nonatomic) BOOL allowsCellularAccess WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
    5051#if TARGET_OS_IPHONE
    5152@property (nonatomic, nullable, copy) NSString *CTDataConnectionServiceType WK_API_AVAILABLE(ios(WK_IOS_TBA));
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm

    r207346 r213747  
    172172}
    173173
     174- (BOOL)allowsCellularAccess
     175{
     176    return _processPoolConfiguration->allowsCellularAccess();
     177}
     178
     179- (void)setAllowsCellularAccess:(BOOL)allowsCellularAccess
     180{
     181    _processPoolConfiguration->setAllowsCellularAccess(allowsCellularAccess);
     182}
     183
    174184#if PLATFORM(IOS)
    175185- (NSString *)CTDataConnectionServiceType
Note: See TracChangeset for help on using the changeset viewer.