⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 278649 in webkit


Ignore:
Timestamp:
Jun 8, 2021, 10:08:25 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Move PrivacyStance code from WebKitAdditions
https://bugs.webkit.org/show_bug.cgi?id=226774

Patch by Alex Christensen <achristensen@webkit.org> on 2021-06-08
Reviewed by Jer Noble.

Source/WebCore:

  • platform/network/NetworkLoadMetrics.h:

(WebCore::NetworkLoadMetrics::isolatedCopy const):
(WebCore::NetworkLoadMetrics::operator== const):
(WebCore::NetworkLoadMetrics::encode const):
(WebCore::NetworkLoadMetrics::decode):

  • platform/network/cocoa/WebCoreNSURLSession.mm:

(-[WebCoreNSURLSessionTaskTransactionMetrics _privacyStance]):

Source/WebCore/PAL:

  • pal/spi/cf/CFNetworkSPI.h:

Source/WebKit:

  • NetworkProcess/cocoa/NetworkSessionCocoa.mm:

(toPrivacyStance):
(-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):

Source/WTF:

  • wtf/PlatformHave.h:
Location:
trunk/Source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r278641 r278649  
     12021-06-08  Alex Christensen  <achristensen@webkit.org>
     2
     3        Move PrivacyStance code from WebKitAdditions
     4        https://bugs.webkit.org/show_bug.cgi?id=226774
     5
     6        Reviewed by Jer Noble.
     7
     8        * wtf/PlatformHave.h:
     9
    1102021-06-08  Ben Nham  <nham@apple.com>
    211
  • trunk/Source/WTF/wtf/PlatformHave.h

    r278630 r278649  
    333333#endif
    334334
     335#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000) \
     336    || ((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150000) \
     337    || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 80000) \
     338    || (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 150000)
     339#define HAVE_NETWORK_CONNECTION_PRIVACY_STANCE 1
     340#endif
     341
    335342#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 110300) \
    336343    || (((PLATFORM(IOS) && !PLATFORM(IOS_FAMILY_SIMULATOR)) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140500) \
  • trunk/Source/WebCore/ChangeLog

    r278648 r278649  
     12021-06-08  Alex Christensen  <achristensen@webkit.org>
     2
     3        Move PrivacyStance code from WebKitAdditions
     4        https://bugs.webkit.org/show_bug.cgi?id=226774
     5
     6        Reviewed by Jer Noble.
     7
     8        * platform/network/NetworkLoadMetrics.h:
     9        (WebCore::NetworkLoadMetrics::isolatedCopy const):
     10        (WebCore::NetworkLoadMetrics::operator== const):
     11        (WebCore::NetworkLoadMetrics::encode const):
     12        (WebCore::NetworkLoadMetrics::decode):
     13        * platform/network/cocoa/WebCoreNSURLSession.mm:
     14        (-[WebCoreNSURLSessionTaskTransactionMetrics _privacyStance]):
     15
    1162021-06-08  Rob Buis  <rbuis@igalia.com>
    217
  • trunk/Source/WebCore/PAL/ChangeLog

    r278630 r278649  
     12021-06-08  Alex Christensen  <achristensen@webkit.org>
     2
     3        Move PrivacyStance code from WebKitAdditions
     4        https://bugs.webkit.org/show_bug.cgi?id=226774
     5
     6        Reviewed by Jer Noble.
     7
     8        * pal/spi/cf/CFNetworkSPI.h:
     9
    1102021-06-08  Devin Rousso  <drousso@apple.com>
    211
  • trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h

    r276340 r278649  
    287287@property (assign, readonly) int64_t _responseBodyBytesReceived;
    288288@property (assign, readonly) int64_t _responseBodyBytesDecoded;
     289#if HAVE(NETWORK_CONNECTION_PRIVACY_STANCE)
     290@property (assign, readonly) nw_connection_privacy_stance_t _privacyStance;
     291#endif
    289292@end
    290293
  • trunk/Source/WebCore/platform/network/NetworkLoadMetrics.h

    r278391 r278649  
    3333#include <wtf/text/WTFString.h>
    3434
    35 #if USE(APPLE_INTERNAL_SDK)
    36 #include <WebKitAdditions/NetworkLoadMetricsAdditions.h>
    37 #else
    38 #define NETWORK_LOAD_METRICS_ADDITIONS_1
    39 #define NETWORK_LOAD_METRICS_ADDITIONS_2
    40 #define NETWORK_LOAD_METRICS_ADDITIONS_3
    41 #define NETWORK_LOAD_METRICS_ADDITIONS_4
    42 #define NETWORK_LOAD_METRICS_ADDITIONS_5
    43 #define NETWORK_LOAD_METRICS_ADDITIONS_6
    44 #define NETWORK_LOAD_METRICS_ADDITIONS_7
    45 #endif
    46 
    4735#if PLATFORM(COCOA)
    4836OBJC_CLASS NSURLConnection;
     
    6250};
    6351
    64 NETWORK_LOAD_METRICS_ADDITIONS_1;
     52enum class PrivacyStance : uint8_t {
     53    Unknown,
     54    NotEligible,
     55    Proxied,
     56    Failed,
     57    Direct,
     58};
    6559
    6660constexpr MonotonicTime reusedTLSConnectionSentinel { MonotonicTime::fromRawSeconds(-1) };
     
    136130        copy.tlsCipher = tlsCipher.isolatedCopy();
    137131        copy.priority = priority;
    138         NETWORK_LOAD_METRICS_ADDITIONS_2;
     132        copy.privacyStance = privacyStance;
    139133        copy.requestHeaders = requestHeaders.isolatedCopy();
    140134
     
    174168            && tlsCipher == other.tlsCipher
    175169            && priority == other.priority
    176             NETWORK_LOAD_METRICS_ADDITIONS_3
     170            && privacyStance == other.privacyStance
    177171            && requestHeaders == other.requestHeaders
    178172            && requestHeaderBytesSent == other.requestHeaderBytesSent
     
    198192
    199193    NetworkLoadPriority priority { NetworkLoadPriority::Unknown };
    200     NETWORK_LOAD_METRICS_ADDITIONS_4;
     194    PrivacyStance privacyStance { PrivacyStance::Unknown };
    201195
    202196    HTTPHeaderMap requestHeaders;
     
    243237    encoder << tlsCipher;
    244238    encoder << priority;
    245     NETWORK_LOAD_METRICS_ADDITIONS_5;
     239    encoder << privacyStance;
    246240    encoder << requestHeaders;
    247241    encoder << requestHeaderBytesSent;
     
    281275        && decoder.decode(metrics.tlsCipher)
    282276        && decoder.decode(metrics.priority)
    283         NETWORK_LOAD_METRICS_ADDITIONS_6
     277        && decoder.decode(metrics.privacyStance)
    284278        && decoder.decode(metrics.requestHeaders)
    285279        && decoder.decode(metrics.requestHeaderBytesSent)
     
    292286} // namespace WebCore
    293287
    294 NETWORK_LOAD_METRICS_ADDITIONS_7
     288namespace WTF {
     289
     290template<> struct EnumTraits<WebCore::PrivacyStance> {
     291    using values = EnumValues<
     292        WebCore::PrivacyStance,
     293        WebCore::PrivacyStance::Unknown,
     294        WebCore::PrivacyStance::NotEligible,
     295        WebCore::PrivacyStance::Proxied,
     296        WebCore::PrivacyStance::Failed,
     297        WebCore::PrivacyStance::Direct
     298    >;
     299};
     300
     301}
  • trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm

    r278516 r278649  
    3838#import <wtf/cocoa/VectorCocoa.h>
    3939
    40 #if USE(APPLE_INTERNAL_SDK)
    41 #include <WebKitAdditions/WebCoreNSURLSessionAdditions.h>
    42 #else
    43 #define WEBCORE_SESSION_ADDITIONS_1
    44 #define WEBCORE_SESSION_ADDITIONS_2
    45 #endif
    46 
    4740using namespace WebCore;
    4841
     
    7871@property (readonly, getter=isConstrained) BOOL constrained;
    7972@property (readonly, getter=isMultipath) BOOL multipath;
    80 WEBCORE_SESSION_ADDITIONS_1;
     73#if HAVE(NETWORK_CONNECTION_PRIVACY_STANCE)
     74@property (assign, readonly) nw_connection_privacy_stance_t _privacyStance;
     75#endif
    8176@end
    8277
     
    161156}
    162157
    163 WEBCORE_SESSION_ADDITIONS_2
     158#if HAVE(NETWORK_CONNECTION_PRIVACY_STANCE)
     159@dynamic _privacyStance;
     160- (nw_connection_privacy_stance_t)_privacyStance
     161{
     162    auto toConnectionPrivacyStance = [] (WebCore::PrivacyStance privacyStance) {
     163        switch (privacyStance) {
     164        case WebCore::PrivacyStance::Unknown:
     165            return nw_connection_privacy_stance_unknown;
     166        case WebCore::PrivacyStance::NotEligible:
     167            return nw_connection_privacy_stance_not_eligible;
     168        case WebCore::PrivacyStance::Proxied:
     169            return nw_connection_privacy_stance_proxied;
     170        case WebCore::PrivacyStance::Failed:
     171            return nw_connection_privacy_stance_failed;
     172        case WebCore::PrivacyStance::Direct:
     173            return nw_connection_privacy_stance_direct;
     174        }
     175        ASSERT_NOT_REACHED();
     176        return nw_connection_privacy_stance_unknown;
     177    };
     178    return toConnectionPrivacyStance(_metrics.privacyStance);
     179}
     180#endif
    164181
    165182@dynamic cellular;
  • trunk/Source/WebKit/ChangeLog

    r278647 r278649  
     12021-06-08  Alex Christensen  <achristensen@webkit.org>
     2
     3        Move PrivacyStance code from WebKitAdditions
     4        https://bugs.webkit.org/show_bug.cgi?id=226774
     5
     6        Reviewed by Jer Noble.
     7
     8        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
     9        (toPrivacyStance):
     10        (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
     11
    1122021-06-08  Sam Weinig  <weinig@apple.com>
    213
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm

    r278517 r278649  
    6666#else
    6767#define NETWORK_SESSION_COCOA_ADDITIONS_1
    68 #define NETWORK_SESSION_COCOA_ADDITIONS_2
    69 #define NETWORK_SESSION_COCOA_ADDITIONS_3
    7068void WebKit::NetworkSessionCocoa::removeNetworkWebsiteData(std::optional<WallTime>, std::optional<HashSet<WebCore::RegistrableDomain>>&&, CompletionHandler<void()>&& completionHandler) { completionHandler(); }
    7169#endif
     
    124122}
    125123
    126 NETWORK_SESSION_COCOA_ADDITIONS_2
     124#if HAVE(NETWORK_CONNECTION_PRIVACY_STANCE)
     125static WebCore::PrivacyStance toPrivacyStance(nw_connection_privacy_stance_t stance)
     126{
     127    switch (stance) {
     128    case nw_connection_privacy_stance_unknown:
     129        return WebCore::PrivacyStance::Unknown;
     130    case nw_connection_privacy_stance_not_eligible:
     131        return WebCore::PrivacyStance::NotEligible;
     132    case nw_connection_privacy_stance_proxied:
     133        return WebCore::PrivacyStance::Proxied;
     134    case nw_connection_privacy_stance_failed:
     135        return WebCore::PrivacyStance::Failed;
     136    case nw_connection_privacy_stance_direct:
     137        return WebCore::PrivacyStance::Direct;
     138    }
     139    ASSERT_NOT_REACHED();
     140    return WebCore::PrivacyStance::Unknown;
     141}
     142#endif
    127143
    128144#if HAVE(CFNETWORK_NEGOTIATED_SSL_PROTOCOL_CIPHER)
     
    810826        networkLoadMetrics.isReusedConnection = m.isReusedConnection;
    811827
    812         NETWORK_SESSION_COCOA_ADDITIONS_3
     828#if HAVE(NETWORK_CONNECTION_PRIVACY_STANCE)
     829        networkLoadMetrics.privacyStance = toPrivacyStance(m._privacyStance);
     830#endif
    813831
    814832        if (networkDataTask->shouldCaptureExtraNetworkLoadMetrics()) {
Note: See TracChangeset for help on using the changeset viewer.