[watchOS] Remove unused Proximity Networking code
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 24 Mar 2019 20:42:37 +0000 (20:42 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 24 Mar 2019 20:42:37 +0000 (20:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196188

Reviewed by Tim Horton.

Source/WebKit:

* Configurations/WebKit.xcconfig:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::NetworkProcess):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode const):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformPrepareToSuspend):
(WebKit::NetworkProcess::platformProcessDidResume):
(WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
(WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
* NetworkProcess/watchos/NetworkProximityAssertion.h: Removed.
* NetworkProcess/watchos/NetworkProximityAssertion.mm: Removed.
* NetworkProcess/watchos/NetworkProximityManager.h: Removed.
* NetworkProcess/watchos/NetworkProximityManager.mm: Removed.
* SourcesCocoa.txt:
* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::copy):
* UIProcess/API/APIProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
(-[_WKProcessPoolConfiguration wirelessContextIdentifier]):
(-[_WKProcessPoolConfiguration setWirelessContextIdentifier:]):
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
* WebKit.xcodeproj/project.pbxproj:

Source/WTF:

* wtf/FeatureDefines.h:

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/WKProcessPoolConfiguration.mm:
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243427 268f45cc-cd09-0410-ab3c-d52691b4dbfc

24 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/FeatureDefines.h
Source/WebKit/ChangeLog
Source/WebKit/Configurations/WebKit.xcconfig
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h
Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h
Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm
Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm
Source/WebKit/NetworkProcess/watchos/NetworkProximityAssertion.h [deleted file]
Source/WebKit/NetworkProcess/watchos/NetworkProximityAssertion.mm [deleted file]
Source/WebKit/NetworkProcess/watchos/NetworkProximityManager.h [deleted file]
Source/WebKit/NetworkProcess/watchos/NetworkProximityManager.mm [deleted file]
Source/WebKit/SourcesCocoa.txt
Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp
Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h
Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h
Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm
Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKProcessPoolConfiguration.mm

index 4196136..dcd8d05 100644 (file)
@@ -1,3 +1,12 @@
+2019-03-24  Andy Estes  <aestes@apple.com>
+
+        [watchOS] Remove unused Proximity Networking code
+        https://bugs.webkit.org/show_bug.cgi?id=196188
+
+        Reviewed by Tim Horton.
+
+        * wtf/FeatureDefines.h:
+
 2019-03-23  Keith Miller  <keith_miller@apple.com>
 
         Refactor clz/ctz and fix getLSBSet.
index e2698f6..c4069ac 100644 (file)
@@ -198,12 +198,6 @@ the public iOS SDK. See <https://webkit.org/b/179167>. */
 /* --------- Apple WATCHOS port --------- */
 #if PLATFORM(WATCHOS)
 
-#if !defined(ENABLE_PROXIMITY_NETWORKING)
-#if !TARGET_OS_SIMULATOR && __WATCH_OS_VERSION_MIN_REQUIRED < 60000
-#define ENABLE_PROXIMITY_NETWORKING 1
-#endif
-#endif
-
 #endif /* PLATFORM(WATCHOS) */
 
 /* --------- Apple MAC port (not IOS) --------- */
index d72a8c0..0621b2d 100644 (file)
@@ -1,3 +1,42 @@
+2019-03-24  Andy Estes  <aestes@apple.com>
+
+        [watchOS] Remove unused Proximity Networking code
+        https://bugs.webkit.org/show_bug.cgi?id=196188
+
+        Reviewed by Tim Horton.
+
+        * Configurations/WebKit.xcconfig:
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::NetworkProcess):
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcessCreationParameters.cpp:
+        (WebKit::NetworkProcessCreationParameters::encode const):
+        (WebKit::NetworkProcessCreationParameters::decode):
+        * NetworkProcess/NetworkProcessCreationParameters.h:
+        * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
+        * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+        (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
+        * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
+        (WebKit::NetworkProcess::platformPrepareToSuspend):
+        (WebKit::NetworkProcess::platformProcessDidResume):
+        (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
+        (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
+        * NetworkProcess/watchos/NetworkProximityAssertion.h: Removed.
+        * NetworkProcess/watchos/NetworkProximityAssertion.mm: Removed.
+        * NetworkProcess/watchos/NetworkProximityManager.h: Removed.
+        * NetworkProcess/watchos/NetworkProximityManager.mm: Removed.
+        * SourcesCocoa.txt:
+        * UIProcess/API/APIProcessPoolConfiguration.cpp:
+        (API::ProcessPoolConfiguration::copy):
+        * UIProcess/API/APIProcessPoolConfiguration.h:
+        * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
+        * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
+        (-[_WKProcessPoolConfiguration wirelessContextIdentifier]):
+        (-[_WKProcessPoolConfiguration setWirelessContextIdentifier:]):
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeNetworkProcess):
+        * WebKit.xcodeproj/project.pbxproj:
+
 2019-03-23  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, fix typo in comment added in r243379.
index 479bd6d..e8e77f7 100644 (file)
@@ -105,9 +105,6 @@ WK_PDFKIT_LDFLAGS_iphoneos[sdk=iphone*11.*] = ;
 WK_PDFKIT_LDFLAGS_iphonesimulator = $(WK_PDFKIT_LDFLAGS_iphoneos);
 WK_PDFKIT_LDFLAGS_iphonesimulator[sdk=iphone*11.*] = ;
 
-WK_PROXIMITY_NETWORKING_LDFLAGS = $(WK_PROXIMITY_NETWORKING_LDFLAGS_$(WK_PLATFORM_NAME));
-WK_PROXIMITY_NETWORKING_LDFLAGS_watchos = -framework IDS -framework MobileWiFi -framework SystemConfiguration -framework WirelessCoexManager;
-
 WK_SAFE_BROWSING_LDFLAGS = $(WK_SAFE_BROWSING_LDFLAGS_$(WK_PLATFORM_NAME));
 WK_SAFE_BROWSING_LDFLAGS_iphoneos = -framework SafariSafeBrowsing;
 WK_SAFE_BROWSING_LDFLAGS_iphoneos[sdk=iphone*10.*] = ;
@@ -130,7 +127,7 @@ WK_URL_FORMATTING_LDFLAGS_YES = -framework URLFormatting;
 WK_WEBINSPECTORUI_LDFLAGS = $(WK_WEBINSPECTORUI_LDFLAGS_$(WK_PLATFORM_NAME));
 WK_WEBINSPECTORUI_LDFLAGS_macosx = -weak_framework WebInspectorUI;
 
-FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework WebKitLegacy -lnetwork $(WK_ACCESSIBILITY_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_ASSERTION_SERVICES_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_PDF_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_DEVICE_IDENTITY_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_LDFLAGS) $(WK_LIBSANDBOX_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_PROXIMITY_NETWORKING_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_SECURITY_INTERFACE_LDFLAGS) $(WK_UIKIT_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS) $(WK_WEBINSPECTORUI_LDFLAGS);
+FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework WebKitLegacy -lnetwork $(WK_ACCESSIBILITY_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_ASSERTION_SERVICES_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_PDF_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_DEVICE_IDENTITY_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_LDFLAGS) $(WK_LIBSANDBOX_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_SECURITY_INTERFACE_LDFLAGS) $(WK_UIKIT_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS) $(WK_WEBINSPECTORUI_LDFLAGS);
 
 // Prevent C++ standard library basic_stringstream, operator new, delete and their related exception types from being exported as weak symbols.
 UNEXPORTED_SYMBOL_LDFLAGS = -Wl,-unexported_symbol -Wl,__ZTISt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTISt9exception -Wl,-unexported_symbol -Wl,__ZTSSt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTSSt9exception -Wl,-unexported_symbol -Wl,__ZdlPvS_ -Wl,-unexported_symbol -Wl,__ZnwmPv -Wl,-unexported_symbol -Wl,__Znwm -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC2EOS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC1EOS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEaSEDn -Wl,-unexported_symbol -Wl,__ZNKSt3__18functionIFvN7WebCore12PolicyActionEEEclES2_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEE4swapERS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC1ERKS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC2ERKS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEED1Ev -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEED2Ev -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEaSERKS4_ -Wl,-unexported_symbol -Wl,__ZTVNSt3__117bad_function_callE -Wl,-unexported_symbol -Wl,__ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE0_NS_13basic_istreamIcS2_EE -Wl,-unexported_symbol -Wl,__ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE0_NS_14basic_iostreamIcS2_EE -Wl,-unexported_symbol -Wl,__ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE16_NS_13basic_ostreamIcS2_EE -Wl,-unexported_symbol -Wl,__ZTTNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE -Wl,-unexported_symbol -Wl,__ZTVNSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEEE -Wl,-unexported_symbol -Wl,__ZTVNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE -Wl,-unexported_symbol -Wl,__ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE8_NS_13basic_ostreamIcS2_EE;
index b5b7bec..73f1b48 100644 (file)
@@ -42,7 +42,6 @@
 #include "NetworkProcessCreationParameters.h"
 #include "NetworkProcessPlatformStrategies.h"
 #include "NetworkProcessProxyMessages.h"
-#include "NetworkProximityManager.h"
 #include "NetworkResourceLoader.h"
 #include "NetworkSession.h"
 #include "NetworkSessionCreationParameters.h"
@@ -145,9 +144,6 @@ NetworkProcess::NetworkProcess(AuxiliaryProcessInitializationParameters&& parame
 #if PLATFORM(COCOA) || USE(SOUP)
     LegacyCustomProtocolManager::networkProcessCreated(*this);
 #endif
-#if ENABLE(PROXIMITY_NETWORKING)
-    addSupplement<NetworkProximityManager>();
-#endif
 
 #if USE(SOUP)
     DNSResolveQueueSoup::setGlobalDefaultNetworkStorageSessionAccessor([this]() -> NetworkStorageSession& {
@@ -183,13 +179,6 @@ DownloadManager& NetworkProcess::downloadManager()
     return m_downloadManager;
 }
 
-#if ENABLE(PROXIMITY_NETWORKING)
-NetworkProximityManager& NetworkProcess::proximityManager()
-{
-    return *supplement<NetworkProximityManager>();
-}
-#endif
-
 void NetworkProcess::removeNetworkConnectionToWebProcess(NetworkConnectionToWebProcess& connection)
 {
     auto count = m_webProcessConnections.removeAllMatching([&] (const auto& c) {
index cc268dc..529f879 100644 (file)
@@ -154,9 +154,6 @@ public:
 
     AuthenticationManager& authenticationManager();
     DownloadManager& downloadManager();
-#if ENABLE(PROXIMITY_NETWORKING)
-    NetworkProximityManager& proximityManager();
-#endif
 
     NetworkCache::Cache* cache() { return m_cache.get(); }
 
index ab51959..ed31997 100644 (file)
@@ -85,10 +85,6 @@ void NetworkProcessCreationParameters::encode(IPC::Encoder& encoder) const
     encoder << urlSchemesRegisteredAsCORSEnabled;
     encoder << urlSchemesRegisteredAsCanDisplayOnlyIfCanRequest;
 
-#if ENABLE(PROXIMITY_NETWORKING)
-    encoder << wirelessContextIdentifier;
-#endif
-
 #if ENABLE(SERVICE_WORKER)
     encoder << serviceWorkerRegistrationDirectory << serviceWorkerRegistrationDirectoryExtensionHandle << urlSchemesServiceWorkersCanHandle << shouldDisableServiceWorkerProcessTerminationDelay;
 #endif
@@ -195,11 +191,6 @@ bool NetworkProcessCreationParameters::decode(IPC::Decoder& decoder, NetworkProc
     if (!decoder.decode(result.urlSchemesRegisteredAsCanDisplayOnlyIfCanRequest))
         return false;
 
-#if ENABLE(PROXIMITY_NETWORKING)
-    if (!decoder.decode(result.wirelessContextIdentifier))
-        return false;
-#endif
-
 #if ENABLE(SERVICE_WORKER)
     if (!decoder.decode(result.serviceWorkerRegistrationDirectory))
         return false;
index 0aa1abd..0f1f440 100644 (file)
@@ -100,10 +100,6 @@ struct NetworkProcessCreationParameters {
     Vector<String> urlSchemesRegisteredAsCanDisplayOnlyIfCanRequest;
     Vector<String> urlSchemesRegisteredAsCORSEnabled;
 
-#if ENABLE(PROXIMITY_NETWORKING)
-    unsigned wirelessContextIdentifier { 0 };
-#endif
-
 #if ENABLE(SERVICE_WORKER)
     String serviceWorkerRegistrationDirectory;
     SandboxExtension::Handle serviceWorkerRegistrationDirectoryExtensionHandle;
index 2ce677d..965c6fa 100644 (file)
@@ -28,7 +28,6 @@
 #include "NetworkActivityTracker.h"
 #include "NetworkDataTask.h"
 #include "NetworkLoadParameters.h"
-#include "NetworkProximityAssertion.h"
 #include <WebCore/NetworkLoadMetrics.h>
 #include <wtf/RetainPtr.h>
 
@@ -73,14 +72,6 @@ public:
     uint64_t frameID() const { return m_frameID; };
     uint64_t pageID() const { return m_pageID; };
 
-#if ENABLE(PROXIMITY_NETWORKING)
-    void holdProximityAssertion(NetworkProximityAssertion& assertion)
-    {
-        ASSERT(!m_proximityAssertionToken);
-        m_proximityAssertionToken.emplace(assertion);
-    }
-#endif
-
     String description() const override;
 
 private:
@@ -107,10 +98,6 @@ private:
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
     bool m_hasBeenSetToUseStatelessCookieStorage { false };
 #endif
-
-#if ENABLE(PROXIMITY_NETWORKING)
-    Optional<NetworkProximityAssertion::Token> m_proximityAssertionToken;
-#endif
 };
 
 WebCore::Credential serverTrustCredential(const WebCore::AuthenticationChallenge&);
index 5cdd316..1d0a59f 100644 (file)
@@ -32,7 +32,6 @@
 #import "DownloadProxyMessages.h"
 #import "Logging.h"
 #import "NetworkProcess.h"
-#import "NetworkProximityManager.h"
 #import "NetworkSessionCocoa.h"
 #import "WebCoreArgumentCoders.h"
 #import <WebCore/AuthenticationChallenge.h>
@@ -200,9 +199,6 @@ NetworkDataTaskCocoa::NetworkDataTaskCocoa(NetworkSession& session, NetworkDataT
 
     NSURLRequest *nsRequest = request.nsURLRequest(WebCore::HTTPBodyUpdatePolicy::UpdateHTTPBody);
     applySniffingPoliciesAndBindRequestToInferfaceIfNeeded(nsRequest, shouldContentSniff == WebCore::ContentSniffingPolicy::SniffContent && !url.isLocalFile(), shouldContentEncodingSniff == WebCore::ContentEncodingSniffingPolicy::Sniff);
-#if ENABLE(PROXIMITY_NETWORKING)
-    m_session->networkProcess().proximityManager().applyProperties(request, *this, nsRequest);
-#endif
 
     auto& cocoaSession = static_cast<NetworkSessionCocoa&>(m_session.get());
     if (storedCredentialsPolicy == WebCore::StoredCredentialsPolicy::Use) {
index 70b39c9..5ae49f6 100644 (file)
@@ -30,7 +30,6 @@
 #import "Logging.h"
 #import "NetworkCache.h"
 #import "NetworkProcessCreationParameters.h"
-#import "NetworkProximityManager.h"
 #import "NetworkResourceLoader.h"
 #import "NetworkSessionCocoa.h"
 #import "SandboxExtension.h"
@@ -247,32 +246,19 @@ void NetworkProcess::platformSyncAllCookies(CompletionHandler<void()>&& completi
 
 void NetworkProcess::platformPrepareToSuspend(CompletionHandler<void()>&& completionHandler)
 {
-#if ENABLE(PROXIMITY_NETWORKING)
-    proximityManager().suspend(SuspensionReason::ProcessSuspending, WTFMove(completionHandler));
-#else
     completionHandler();
-#endif
 }
 
 void NetworkProcess::platformProcessDidResume()
 {
-#if ENABLE(PROXIMITY_NETWORKING)
-    proximityManager().resume(ResumptionReason::ProcessResuming);
-#endif
 }
 
 void NetworkProcess::platformProcessDidTransitionToBackground()
 {
-#if ENABLE(PROXIMITY_NETWORKING)
-    proximityManager().suspend(SuspensionReason::ProcessBackgrounding, [] { });
-#endif
 }
 
 void NetworkProcess::platformProcessDidTransitionToForeground()
 {
-#if ENABLE(PROXIMITY_NETWORKING)
-    proximityManager().resume(ResumptionReason::ProcessForegrounding);
-#endif
 }
 
 } // namespace WebKit
diff --git a/Source/WebKit/NetworkProcess/watchos/NetworkProximityAssertion.h b/Source/WebKit/NetworkProcess/watchos/NetworkProximityAssertion.h
deleted file mode 100644 (file)
index 9110712..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(PROXIMITY_NETWORKING)
-
-#include "MobileWiFiSPI.h"
-#include <WebCore/Timer.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/RetainPtr.h>
-
-OBJC_CLASS IDSService;
-
-namespace WebKit {
-
-enum class ResumptionReason : uint8_t;
-enum class SuspensionReason : uint8_t;
-
-class NetworkProximityAssertion {
-    WTF_MAKE_NONCOPYABLE(NetworkProximityAssertion);
-public:
-    class Token {
-        WTF_MAKE_NONCOPYABLE(Token);
-    public:
-        explicit Token(NetworkProximityAssertion& assertion)
-            : m_assertion { assertion }
-        {
-            m_assertion.hold();
-        }
-
-        ~Token()
-        {
-            m_assertion.release();
-        }
-
-    private:
-        NetworkProximityAssertion& m_assertion;
-    };
-
-    void resume(ResumptionReason);
-    void suspend(SuspensionReason, CompletionHandler<void()>&&);
-
-protected:
-    NetworkProximityAssertion();
-    virtual ~NetworkProximityAssertion() = default;
-
-    bool m_isHoldingAssertion { false };
-
-private:
-    enum class State {
-        Backgrounded, // Can hold assertions until m_suspendAfterBackgroundingTimer fires.
-        Resumed, // Can hold assertions at any time.
-        Suspended, // Can not hold assertions.
-    };
-
-    virtual void holdNow() = 0;
-    virtual void releaseNow() = 0;
-
-    void hold();
-    void release();
-    void releaseTimerFired();
-    void suspendAfterBackgroundingTimerFired();
-    void suspendNow();
-
-    uint64_t m_assertionCount { 0 };
-    State m_state { State::Suspended };
-    WebCore::DeferrableOneShotTimer m_releaseTimer;
-    WebCore::DeferrableOneShotTimer m_suspendAfterBackgroundingTimer;
-};
-
-class BluetoothProximityAssertion final : public NetworkProximityAssertion {
-public:
-    explicit BluetoothProximityAssertion(IDSService *);
-
-    void suspend(SuspensionReason, CompletionHandler<void()>&&);
-
-private:
-    void holdNow() override;
-    void releaseNow() override;
-
-    RetainPtr<IDSService> m_idsService;
-};
-
-class WiFiProximityAssertion final : public NetworkProximityAssertion {
-public:
-    WiFiProximityAssertion();
-
-private:
-    void holdNow() override;
-    void releaseNow() override;
-
-    RetainPtr<WiFiManagerClientRef> m_wiFiManagerClient;
-};
-
-} // namespace WebKit
-
-#endif // ENABLE(PROXIMITY_NETWORKING)
diff --git a/Source/WebKit/NetworkProcess/watchos/NetworkProximityAssertion.mm b/Source/WebKit/NetworkProcess/watchos/NetworkProximityAssertion.mm
deleted file mode 100644 (file)
index 7223a53..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "NetworkProximityAssertion.h"
-
-#if ENABLE(PROXIMITY_NETWORKING)
-
-#import "Logging.h"
-#import "NetworkProcess.h"
-#import "NetworkProximityManager.h"
-#import <IDS/IDS_Private.h>
-#import <wtf/BlockPtr.h>
-
-namespace WebKit {
-
-static auto assertionReleaseDelayAfterBackgrounding = 10_s;
-static auto assertionReleaseDelayForHysteresis = 10_s;
-
-NetworkProximityAssertion::NetworkProximityAssertion()
-    : m_releaseTimer { *this, &NetworkProximityAssertion::releaseTimerFired, assertionReleaseDelayForHysteresis }
-    , m_suspendAfterBackgroundingTimer { *this, &NetworkProximityAssertion::suspendAfterBackgroundingTimerFired, assertionReleaseDelayAfterBackgrounding }
-{
-}
-
-void NetworkProximityAssertion::hold()
-{
-    ++m_assertionCount;
-
-    if (m_state == State::Suspended) {
-        ASSERT(!m_isHoldingAssertion);
-        ASSERT(!m_releaseTimer.isActive());
-        ASSERT(!m_suspendAfterBackgroundingTimer.isActive());
-        return;
-    }
-
-    if (m_releaseTimer.isActive()) {
-        ASSERT(m_isHoldingAssertion);
-        m_releaseTimer.stop();
-        return;
-    }
-
-    if (m_assertionCount == 1) {
-        ASSERT(!m_isHoldingAssertion);
-        holdNow();
-    }
-
-    ASSERT(m_isHoldingAssertion);
-}
-
-void NetworkProximityAssertion::release()
-{
-    ASSERT(m_assertionCount);
-    if (!m_assertionCount)
-        return;
-
-    --m_assertionCount;
-
-    if (m_state == State::Suspended) {
-        ASSERT(!m_isHoldingAssertion);
-        ASSERT(!m_releaseTimer.isActive());
-        ASSERT(!m_suspendAfterBackgroundingTimer.isActive());
-        return;
-    }
-
-    ASSERT(m_isHoldingAssertion);
-    ASSERT(!m_releaseTimer.isActive());
-    if (!m_assertionCount)
-        m_releaseTimer.restart();
-}
-
-void NetworkProximityAssertion::resume(ResumptionReason)
-{
-    switch (m_state) {
-    case State::Backgrounded:
-        m_suspendAfterBackgroundingTimer.stop();
-        break;
-    case State::Resumed:
-        ASSERT(!m_suspendAfterBackgroundingTimer.isActive());
-        break;
-    case State::Suspended:
-        ASSERT(!m_isHoldingAssertion);
-        ASSERT(!m_releaseTimer.isActive());
-        ASSERT(!m_suspendAfterBackgroundingTimer.isActive());
-        holdNow();
-        if (!m_assertionCount)
-            m_releaseTimer.restart();
-        break;
-    }
-
-    m_state = State::Resumed;
-}
-
-void NetworkProximityAssertion::suspend(SuspensionReason reason, CompletionHandler<void()>&& completionHandler)
-{
-    switch (reason) {
-    case SuspensionReason::ProcessBackgrounding:
-        // The Networking process is being backgrounded. We should drop our assertions
-        // soon, in case the system suspends the process before we receive ProcessSuspending.
-        m_state = State::Backgrounded;
-        m_suspendAfterBackgroundingTimer.restart();
-        break;
-    case SuspensionReason::ProcessSuspending:
-        // The Networking process is being suspended, so we need to drop our assertions
-        // immediately before that happens.
-        suspendNow();
-        break;
-    }
-
-    completionHandler();
-}
-
-void NetworkProximityAssertion::suspendNow()
-{
-    if (m_state == State::Suspended)
-        return;
-
-    m_state = State::Suspended;
-    m_releaseTimer.stop();
-    m_suspendAfterBackgroundingTimer.stop();
-    releaseNow();
-}
-
-void NetworkProximityAssertion::releaseTimerFired()
-{
-    ASSERT(m_isHoldingAssertion);
-    ASSERT(m_state != State::Suspended);
-    ASSERT(!m_assertionCount);
-    ASSERT(!m_releaseTimer.isActive());
-    releaseNow();
-}
-
-void NetworkProximityAssertion::suspendAfterBackgroundingTimerFired()
-{
-    ASSERT(!m_suspendAfterBackgroundingTimer.isActive());
-    ASSERT(m_state != State::Suspended);
-    suspendNow();
-}
-
-BluetoothProximityAssertion::BluetoothProximityAssertion(IDSService *idsService)
-    : m_idsService { idsService }
-{
-}
-
-void BluetoothProximityAssertion::suspend(SuspensionReason reason, CompletionHandler<void()>&& completionHandler)
-{
-    auto wasHoldingAssertion = m_isHoldingAssertion;
-    NetworkProximityAssertion::suspend(reason, [] { });
-
-    switch (reason) {
-    case SuspensionReason::ProcessBackgrounding:
-        completionHandler();
-        break;
-    case SuspensionReason::ProcessSuspending:
-        ASSERT(!m_isHoldingAssertion);
-        if (!wasHoldingAssertion) {
-            completionHandler();
-            break;
-        }
-
-        // IDS processes -setLinkPreferences: on a background dispatch queue and provides no
-        // completion handler. If we suspend before IDS finishes setting link preferences, the
-        // Bluetooth radio might stay in a high power mode, harming battery life. Delay suspension
-        // by 30 seconds to ensure -setLinkPreferences: always finishes its work.
-        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 30 * NSEC_PER_SEC), dispatch_get_main_queue(), makeBlockPtr(WTFMove(completionHandler)).get());
-        break;
-    }
-}
-
-void BluetoothProximityAssertion::holdNow()
-{
-    if (m_isHoldingAssertion)
-        return;
-
-    RELEASE_LOG(ProximityNetworking, "Holding Bluetooth Classic assertion.");
-    [m_idsService setLinkPreferences:@{ IDSLinkPreferenceOptionPacketsPerSecondKey : @(200) }];
-    m_isHoldingAssertion = true;
-}
-
-void BluetoothProximityAssertion::releaseNow()
-{
-    if (!m_isHoldingAssertion)
-        return;
-
-    RELEASE_LOG(ProximityNetworking, "Releasing Bluetooth Classic assertion.");
-    [m_idsService setLinkPreferences:@{ IDSLinkPreferenceOptionPacketsPerSecondKey : @(0) }];
-    m_isHoldingAssertion = false;
-}
-
-WiFiProximityAssertion::WiFiProximityAssertion()
-    : m_wiFiManagerClient { adoptCF(WiFiManagerClientCreate(kCFAllocatorDefault, kWiFiClientTypeNormal)) }
-{
-}
-
-void WiFiProximityAssertion::holdNow()
-{
-    if (m_isHoldingAssertion)
-        return;
-
-    RELEASE_LOG(ProximityNetworking, "Holding Wi-Fi assertion.");
-    ASSERT(WiFiManagerClientGetType(m_wiFiManagerClient.get()) == kWiFiClientTypeNormal);
-    WiFiManagerClientSetType(m_wiFiManagerClient.get(), kWiFiClientTypeDirectToCloud);
-    m_isHoldingAssertion = true;
-}
-
-void WiFiProximityAssertion::releaseNow()
-{
-    if (!m_isHoldingAssertion)
-        return;
-
-    RELEASE_LOG(ProximityNetworking, "Releasing Wi-Fi assertion.");
-    ASSERT(WiFiManagerClientGetType(m_wiFiManagerClient.get()) == kWiFiClientTypeDirectToCloud);
-    WiFiManagerClientSetType(m_wiFiManagerClient.get(), kWiFiClientTypeNormal);
-    m_isHoldingAssertion = false;
-}
-
-} // namespace WebKit
-
-#endif // ENABLE(PROXIMITY_NETWORKING)
diff --git a/Source/WebKit/NetworkProcess/watchos/NetworkProximityManager.h b/Source/WebKit/NetworkProcess/watchos/NetworkProximityManager.h
deleted file mode 100644 (file)
index 034a798..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(PROXIMITY_NETWORKING)
-
-#include "NetworkProcessSupplement.h"
-#include "NetworkProximityAssertion.h"
-#include <wtf/Forward.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/OSObjectPtr.h>
-#include <wtf/RetainPtr.h>
-
-OBJC_CLASS IDSService;
-OBJC_CLASS NSArray;
-OBJC_CLASS NSURLRequest;
-OBJC_CLASS WKProximityServiceDelegate;
-OBJC_CLASS WRM_iRATInterface;
-
-namespace WebCore {
-class ResourceRequest;
-}
-
-namespace WebKit {
-
-class NetworkProcess;
-class NetworkDataTaskCocoa;
-enum class NetworkProximityRecommendation : uint8_t;
-
-enum class ResumptionReason : uint8_t {
-    ProcessForegrounding,
-    ProcessResuming,
-};
-
-enum class SuspensionReason : uint8_t {
-    ProcessBackgrounding,
-    ProcessSuspending
-};
-
-class NetworkProximityServiceClient {
-public:
-    virtual ~NetworkProximityServiceClient() = default;
-    virtual void devicesChanged(NSArray *devices) = 0;
-};
-
-class NetworkProximityManager final : public NetworkProcessSupplement, private NetworkProximityServiceClient {
-    WTF_MAKE_FAST_ALLOCATED;
-    WTF_MAKE_NONCOPYABLE(NetworkProximityManager);
-public:
-    explicit NetworkProximityManager(NetworkProcess&);
-    ~NetworkProximityManager();
-
-    static const char* supplementName();
-
-    void applyProperties(const WebCore::ResourceRequest&, NetworkDataTaskCocoa&, NSURLRequest *&);
-    void resume(ResumptionReason);
-    void suspend(SuspensionReason, CompletionHandler<void()>&&);
-
-private:
-    enum class State : uint8_t {
-        Backgrounded,
-        Foregrounded,
-        Initialized,
-        Resumed,
-        Suspended,
-    };
-
-    bool isCompanionInProximity() const { return m_isCompanionInProximity; }
-    NetworkProximityRecommendation recommendation() const;
-    bool shouldUseDirectWiFiInProximity() const { return m_shouldUseDirectWiFiInProximity; }
-
-    void processRecommendations(NSArray *recommendations);
-    void resumeRecommendations();
-    void suspendRecommendations(State oldState);
-    void updateCompanionProximity();
-    void updateRecommendation();
-
-    // NetworkProcessSupplement
-    void initialize(const NetworkProcessCreationParameters&) override;
-
-    // NetworkProximityServiceClient
-    void devicesChanged(NSArray *devices) override;
-
-    unsigned m_contextIdentifier { 0 };
-    bool m_isCompanionInProximity { false };
-    bool m_shouldUseDirectWiFiInProximity { false };
-    State m_state { State::Initialized };
-    RetainPtr<WRM_iRATInterface> m_iRATInterface;
-    RetainPtr<IDSService> m_idsService;
-    RetainPtr<WKProximityServiceDelegate> m_idsServiceDelegate;
-    OSObjectPtr<dispatch_queue_t> m_recommendationQueue;
-    BluetoothProximityAssertion m_bluetoothProximityAssertion;
-    WiFiProximityAssertion m_wiFiProximityAssertion;
-};
-
-} // namespace WebKit
-
-#endif // ENABLE(PROXIMITY_NETWORKING)
diff --git a/Source/WebKit/NetworkProcess/watchos/NetworkProximityManager.mm b/Source/WebKit/NetworkProcess/watchos/NetworkProximityManager.mm
deleted file mode 100644 (file)
index 55773eb..0000000
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "NetworkProximityManager.h"
-
-#if ENABLE(PROXIMITY_NETWORKING)
-
-#import "Logging.h"
-#import "NetworkDataTaskCocoa.h"
-#import "NetworkProcess.h"
-#import "NetworkProcessCreationParameters.h"
-#import <IDS/IDS.h>
-#import <WirelessCoexManager/WRM_iRATInterface.h>
-#import <pal/spi/cf/CFNetworkSPI.h>
-#import <wtf/BlockPtr.h>
-#import <wtf/Box.h>
-#import <wtf/CompletionHandler.h>
-#import <wtf/cf/TypeCastsCF.h>
-#import <wtf/threads/BinarySemaphore.h>
-
-WTF_DECLARE_CF_TYPE_TRAIT(SCNetworkInterface);
-
-@interface WKProximityServiceDelegate : NSObject <IDSServiceDelegate>
-- (void)setClient:(WebKit::NetworkProximityServiceClient*)client;
-@end
-
-@implementation WKProximityServiceDelegate {
-    WebKit::NetworkProximityServiceClient* _client;
-}
-
-- (void)setClient:(WebKit::NetworkProximityServiceClient*)client
-{
-    _client = client;
-}
-
-- (void)service:(IDSService *)service devicesChanged:(NSArray *)devices
-{
-    if (_client)
-        _client->devicesChanged(devices);
-}
-
-- (void)service:(IDSService *)service nearbyDevicesChanged:(NSArray *)devices
-{
-    if (_client)
-        _client->devicesChanged(devices);
-}
-
-@end
-
-namespace WebKit {
-
-enum class NetworkProximityRecommendation : uint8_t {
-    Bluetooth,
-    None,
-    WiFi,
-};
-
-NetworkProximityManager::NetworkProximityManager(NetworkProcess&)
-    : m_idsService { adoptNS([[IDSService alloc] initWithService:@"com.apple.private.alloy.webkitnetworking"]) }
-    , m_idsServiceDelegate { adoptNS([[WKProximityServiceDelegate alloc] init]) }
-    , m_recommendationQueue { adoptOSObject(dispatch_queue_create("WebKit Network Proximity Recommendation Queue", DISPATCH_QUEUE_SERIAL)) }
-    , m_bluetoothProximityAssertion { m_idsService.get() }
-{
-    [m_idsServiceDelegate setClient:this];
-    [m_idsService addDelegate:m_idsServiceDelegate.get() queue:dispatch_get_main_queue()];
-}
-
-NetworkProximityManager::~NetworkProximityManager()
-{
-    [m_idsServiceDelegate setClient:nullptr];
-}
-
-const char* NetworkProximityManager::supplementName()
-{
-    return "NetworkProximityManager";
-}
-
-static void bindRequestToWiFi(NSURLRequest *& request)
-{
-    static NSString *wiFiInterfaceIdentifier = []() -> NSString * {
-        auto interfaces = adoptCF(SCNetworkInterfaceCopyAll());
-        for (CFIndex i = 0, count = CFArrayGetCount(interfaces.get()); i < count; ++i) {
-            auto interface = checked_cf_cast<SCNetworkInterfaceRef>(CFArrayGetValueAtIndex(interfaces.get(), i));
-            if (!CFEqual(SCNetworkInterfaceGetInterfaceType(interface), kSCNetworkInterfaceTypeIEEE80211))
-                continue;
-
-            auto identifier = retainPtr(SCNetworkInterfaceGetBSDName(interface));
-            RELEASE_LOG(ProximityNetworking, "Determined Wi-Fi interface identifier is %@.", identifier.get());
-            return (NSString *)identifier.leakRef();
-        }
-
-        RELEASE_LOG(ProximityNetworking, "Failed to determine Wi-Fi interface identifier.");
-        return nil;
-    }();
-
-    if (!wiFiInterfaceIdentifier)
-        return;
-
-    auto mutableRequest = adoptNS([request mutableCopy]);
-    [mutableRequest setBoundInterfaceIdentifier:wiFiInterfaceIdentifier];
-    request = mutableRequest.autorelease();
-}
-
-void NetworkProximityManager::applyProperties(const WebCore::ResourceRequest& request, WebKit::NetworkDataTaskCocoa& dataTask, NSURLRequest *& nsRequest)
-{
-    // If the client has already bound the request to an identifier, don't override it.
-    if (nsRequest.boundInterfaceIdentifier.length)
-        return;
-
-    if (dataTask.isTopLevelNavigation())
-        updateRecommendation();
-
-    switch (recommendation()) {
-    case NetworkProximityRecommendation::Bluetooth:
-        dataTask.holdProximityAssertion(m_bluetoothProximityAssertion);
-        break;
-    case NetworkProximityRecommendation::None:
-        break;
-    case NetworkProximityRecommendation::WiFi:
-        dataTask.holdProximityAssertion(m_wiFiProximityAssertion);
-        bindRequestToWiFi(nsRequest);
-        break;
-    }
-}
-
-void NetworkProximityManager::resume(ResumptionReason reason)
-{
-    switch (reason) {
-    case ResumptionReason::ProcessForegrounding:
-        m_state = State::Foregrounded;
-        break;
-    case ResumptionReason::ProcessResuming:
-        m_state = State::Resumed;
-        break;
-    }
-
-    resumeRecommendations();
-
-    switch (recommendation()) {
-    case NetworkProximityRecommendation::Bluetooth:
-        m_bluetoothProximityAssertion.resume(reason);
-        break;
-    case NetworkProximityRecommendation::None:
-        break;
-    case NetworkProximityRecommendation::WiFi:
-        m_wiFiProximityAssertion.resume(reason);
-        break;
-    }
-}
-
-void NetworkProximityManager::suspend(SuspensionReason reason, CompletionHandler<void()>&& completionHandler)
-{
-    auto oldState = m_state;
-    switch (reason) {
-    case SuspensionReason::ProcessBackgrounding:
-        m_state = State::Backgrounded;
-        break;
-    case SuspensionReason::ProcessSuspending:
-        m_state = State::Suspended;
-        break;
-    }
-
-    suspendRecommendations(oldState);
-
-    auto wrappedCompletionHandler = [this, completionHandler = WTFMove(completionHandler)]() mutable {
-        completionHandler();
-        RELEASE_LOG(ProximityNetworking, "Finished suspending NetworkProximityManager (state: %hhu).", m_state);
-    };
-
-    RELEASE_LOG(ProximityNetworking, "Suspending NetworkProximityManager (state: %hhu).", m_state);
-    m_bluetoothProximityAssertion.suspend(reason, WTFMove(wrappedCompletionHandler));
-    m_wiFiProximityAssertion.suspend(reason, [] { });
-}
-
-NetworkProximityRecommendation NetworkProximityManager::recommendation() const
-{
-    if (!isCompanionInProximity())
-        return NetworkProximityRecommendation::None;
-
-    if (shouldUseDirectWiFiInProximity())
-        return NetworkProximityRecommendation::WiFi;
-
-    return NetworkProximityRecommendation::Bluetooth;
-}
-
-void NetworkProximityManager::processRecommendations(NSArray *recommendations)
-{
-    m_shouldUseDirectWiFiInProximity = false;
-    bool didSeeDirectWiFiRecommendation = false;
-    for (WRM_iRATProximityRecommendation *recommendation in recommendations) {
-        switch (recommendation.RecommendationType) {
-        case WRMRecommendationLinkTypeBT:
-        case WRMRecommendationLinkTypeCompanionWifi:
-            break;
-        case WRMRecommendationLinkTypeDirectWifi:
-            ASSERT(!didSeeDirectWiFiRecommendation);
-            didSeeDirectWiFiRecommendation = true;
-            m_shouldUseDirectWiFiInProximity = recommendation.linkRecommendationIsValid && recommendation.linkIsRecommended;
-            break;
-        }
-    }
-
-    RELEASE_LOG(ProximityNetworking, "Processed iRATManager recommendations (shouldUseDirectWiFiInProximity: %d).\n", m_shouldUseDirectWiFiInProximity);
-}
-
-static WCMProcessId toProcessID(unsigned contextIdentifier)
-{
-    switch (contextIdentifier) {
-    case WRMWebkit:
-        return WRMWebkit;
-    case WRMWebkitMail:
-        return WRMWebkitMail;
-    case WRMWebkitNotification:
-        return WRMWebkitNotification;
-    default:
-        return WCMUnknown;
-    }
-}
-
-void NetworkProximityManager::resumeRecommendations()
-{
-    if (m_iRATInterface)
-        return;
-
-    updateCompanionProximity();
-
-    auto processID = toProcessID(m_contextIdentifier);
-    if (processID == WCMUnknown) {
-        RELEASE_LOG(ProximityNetworking, "Invalid WCM process ID (%d).", m_contextIdentifier);
-        return;
-    }
-
-    RELEASE_LOG(ProximityNetworking, "Registering with iRATManager (WCM process ID: %d, state: %hhu).", processID, m_state);
-    m_iRATInterface = adoptNS([[WRM_iRATInterface alloc] init]);
-    [m_iRATInterface registerClient:processID queue:m_recommendationQueue.get()];
-    updateRecommendation();
-}
-
-void NetworkProximityManager::suspendRecommendations(State oldState)
-{
-    // If this is not a foreground-to-background transition, avoid unregistering. Page loads can
-    // often cause the network process to resume, transition to the background, then transition to
-    // the foreground in rapid succession, causing unnecessary iRATManager registration churn and
-    // exposing bugs such as <rdar://problem/42560320>.
-    if (m_state == State::Backgrounded && oldState != State::Foregrounded)
-        return;
-
-    if (!m_iRATInterface)
-        return;
-
-    RELEASE_LOG(ProximityNetworking, "Unregistering with iRATManager (WCM process ID: %d, state: %hhu).", m_contextIdentifier, m_state);
-    [m_iRATInterface unregisterClient];
-    m_iRATInterface = nil;
-    m_isCompanionInProximity = false;
-    m_shouldUseDirectWiFiInProximity = false;
-}
-
-void NetworkProximityManager::updateCompanionProximity()
-{
-    m_isCompanionInProximity = false;
-    for (IDSDevice *device in [m_idsService devices]) {
-        if (device.isDefaultPairedDevice && device.isNearby) {
-            m_isCompanionInProximity = true;
-            break;
-        }
-    }
-
-    RELEASE_LOG(ProximityNetworking, "Determined companion proximity (isCompanionInProximity: %d).", m_isCompanionInProximity);
-}
-
-void NetworkProximityManager::updateRecommendation()
-{
-    if (!isCompanionInProximity())
-        return;
-
-    if (!m_iRATInterface)
-        return;
-
-    RELEASE_LOG(ProximityNetworking, "Requesting an immediate recommendation from iRATManager.");
-
-    auto semaphore = Box<BinarySemaphore>::create();
-    [m_iRATInterface getProximityLinkRecommendation:NO recommendation:[this, semaphore](NSArray<WRM_iRATProximityRecommendation *> *recommendations) {
-        processRecommendations(recommendations);
-        semaphore->signal();
-    }];
-    semaphore->waitFor(1_s);
-}
-
-void NetworkProximityManager::initialize(const NetworkProcessCreationParameters& parameters)
-{
-    m_contextIdentifier = parameters.wirelessContextIdentifier;
-    resume(ResumptionReason::ProcessResuming);
-}
-
-void NetworkProximityManager::devicesChanged(NSArray *)
-{
-    updateCompanionProximity();
-}
-
-} // namespace WebKit
-
-#endif // ENABLE(PROXIMITY_NETWORKING)
index 05086cf..13053f7 100644 (file)
@@ -48,9 +48,6 @@ NetworkProcess/ios/NetworkProcessIOS.mm
 NetworkProcess/mac/NetworkProcessMac.mm
 NetworkProcess/mac/RemoteNetworkingContext.mm
 
-NetworkProcess/watchos/NetworkProximityAssertion.mm
-NetworkProcess/watchos/NetworkProximityManager.mm
-
 NetworkProcess/webrtc/LibWebRTCSocketClient.cpp
 NetworkProcess/webrtc/NetworkRTCMonitor.cpp
 NetworkProcess/webrtc/NetworkRTCProvider.cpp
index 332b0e5..3db7056 100644 (file)
@@ -126,9 +126,6 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::copy()
     copy->m_processSwapsOnWindowOpenWithOpener = this->m_processSwapsOnWindowOpenWithOpener;
     copy->m_isAutomaticProcessWarmingEnabledByClient = this->m_isAutomaticProcessWarmingEnabledByClient;
     copy->m_usesWebProcessCache = this->m_usesWebProcessCache;
-#if ENABLE(PROXIMITY_NETWORKING)
-    copy->m_wirelessContextIdentifier = this->m_wirelessContextIdentifier;
-#endif
 #if PLATFORM(COCOA)
     copy->m_suppressesConnectionTerminationOnSystemChange = this->m_suppressesConnectionTerminationOnSystemChange;
 #endif
index d3b09a8..f21af5f 100644 (file)
@@ -180,11 +180,6 @@ public:
     const WTF::String& customWebContentServiceBundleIdentifier() const { return m_customWebContentServiceBundleIdentifier; }
     void setCustomWebContentServiceBundleIdentifier(const WTF::String& customWebContentServiceBundleIdentifier) { m_customWebContentServiceBundleIdentifier = customWebContentServiceBundleIdentifier; }
 
-#if ENABLE(PROXIMITY_NETWORKING)
-    unsigned wirelessContextIdentifier() const { return m_wirelessContextIdentifier; }
-    void setWirelessContextIdentifier(unsigned wirelessContextIdentifier) { m_wirelessContextIdentifier = wirelessContextIdentifier; }
-#endif
-
 #if PLATFORM(COCOA)
     bool suppressesConnectionTerminationOnSystemChange() const { return m_suppressesConnectionTerminationOnSystemChange; }
     void setSuppressesConnectionTerminationOnSystemChange(bool suppressesConnectionTerminationOnSystemChange) { m_suppressesConnectionTerminationOnSystemChange = suppressesConnectionTerminationOnSystemChange; }
@@ -237,10 +232,6 @@ private:
     WTF::String m_ctDataConnectionServiceType;
 #endif
 
-#if ENABLE(PROXIMITY_NETWORKING)
-    unsigned m_wirelessContextIdentifier { 0 };
-#endif
-
 #if PLATFORM(COCOA)
     bool m_suppressesConnectionTerminationOnSystemChange { false };
 #endif
index 3ab0c3b..e188dd8 100644 (file)
@@ -42,7 +42,7 @@ WK_CLASS_AVAILABLE(macos(10.10), ios(8.0))
 @property (nonatomic, copy) NSArray<NSURL *> *additionalReadAccessAllowedURLs WK_API_AVAILABLE(macos(10.13), ios(11.0));
 
 #if TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR
-@property (nonatomic) NSUInteger wirelessContextIdentifier;
+@property (nonatomic) NSUInteger wirelessContextIdentifier WK_API_DEPRECATED("Use of this API is no longer necessary and can be removed", ios(10.12, WK_IOS_TBA));
 #endif
 
 // Network Process properties
index 96b0a98..16c323b 100644 (file)
     _processPoolConfiguration->setAdditionalReadAccessAllowedPaths(WTFMove(paths));
 }
 
-#if ENABLE(PROXIMITY_NETWORKING)
+#if PLATFORM(IOS_FAMILY) && !PLATFORM(IOS_FAMILY_SIMULATOR)
 - (NSUInteger)wirelessContextIdentifier
 {
-    return _processPoolConfiguration->wirelessContextIdentifier();
+    return 0;
 }
 
 - (void)setWirelessContextIdentifier:(NSUInteger)identifier
 {
-    _processPoolConfiguration->setWirelessContextIdentifier(identifier);
 }
 #endif
 
index bea0d92..ef92bad 100644 (file)
@@ -296,10 +296,6 @@ void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationPara
     parameters.storageAccessAPIEnabled = storageAccessAPIEnabled();
     parameters.suppressesConnectionTerminationOnSystemChange = m_configuration->suppressesConnectionTerminationOnSystemChange();
 
-#if ENABLE(PROXIMITY_NETWORKING)
-    parameters.wirelessContextIdentifier = m_configuration->wirelessContextIdentifier();
-#endif
-
     parameters.shouldEnableITPDatabase = [defaults boolForKey:[NSString stringWithFormat:@"InternalDebug%@", WebPreferencesKey::isITPDatabaseEnabledKey().createCFString().get()]];
     parameters.downloadMonitorSpeedMultiplier = m_configuration->downloadMonitorSpeedMultiplier();
 
index 1f2c5b0..8e99aa4 100644 (file)
                A102A7081EC0EEE900D81D82 /* com.macromedia.Flash Player ESR.plugin.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 7A5E39491D5BD8A700B4B7CE /* com.macromedia.Flash Player ESR.plugin.sb */; };
                A1046EA12079263100F0C5D8 /* WKPDFView.h in Headers */ = {isa = PBXBuildFile; fileRef = A1046E9F2079263100F0C5D8 /* WKPDFView.h */; };
                A105D0D1212734B20034F6C7 /* NetworkBlobRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = A105D0D0212734B10034F6C7 /* NetworkBlobRegistry.h */; };
-               A11455AC211FCFCA00CA935B /* NetworkProximityAssertion.h in Headers */ = {isa = PBXBuildFile; fileRef = A11455AA211FCFCA00CA935B /* NetworkProximityAssertion.h */; };
-               A11455B0211FD25200CA935B /* NetworkProximityManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A11455AE211FD25200CA935B /* NetworkProximityManager.h */; };
                A115DC72191D82DA00DA8072 /* _WKWebViewPrintFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = A115DC6E191D82AB00DA8072 /* _WKWebViewPrintFormatter.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A118A9EF1907AD6F00F7C92B /* QuickLookDocumentData.h in Headers */ = {isa = PBXBuildFile; fileRef = A118A9ED1907AD6F00F7C92B /* QuickLookDocumentData.h */; };
                A118A9F31908B8EA00F7C92B /* _WKNSFileManagerExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = A118A9F11908B8EA00F7C92B /* _WKNSFileManagerExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A1046E9F2079263100F0C5D8 /* WKPDFView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKPDFView.h; path = ios/WKPDFView.h; sourceTree = "<group>"; };
                A1046EA02079263100F0C5D8 /* WKPDFView.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKPDFView.mm; path = ios/WKPDFView.mm; sourceTree = "<group>"; };
                A105D0D0212734B10034F6C7 /* NetworkBlobRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkBlobRegistry.h; sourceTree = "<group>"; };
-               A11455AA211FCFCA00CA935B /* NetworkProximityAssertion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NetworkProximityAssertion.h; sourceTree = "<group>"; };
-               A11455AB211FCFCA00CA935B /* NetworkProximityAssertion.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkProximityAssertion.mm; sourceTree = "<group>"; };
-               A11455AE211FD25200CA935B /* NetworkProximityManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NetworkProximityManager.h; sourceTree = "<group>"; };
-               A11455AF211FD25200CA935B /* NetworkProximityManager.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkProximityManager.mm; sourceTree = "<group>"; };
                A115DC6D191D82AB00DA8072 /* _WKWebViewPrintFormatter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKWebViewPrintFormatter.mm; sourceTree = "<group>"; };
                A115DC6E191D82AB00DA8072 /* _WKWebViewPrintFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKWebViewPrintFormatter.h; sourceTree = "<group>"; };
                A118A9EC1907AD6F00F7C92B /* QuickLookDocumentData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = QuickLookDocumentData.cpp; path = ios/QuickLookDocumentData.cpp; sourceTree = "<group>"; };
                                2DA944BB188511DD00ED86DB /* ios */,
                                510CC7DC16138E2900D03ED3 /* mac */,
                                93BA04D92151ADCD007F455F /* ServiceWorker */,
-                               A11455A1211FCE7F00CA935B /* watchos */,
                                413075971DE84ED70039EC69 /* webrtc */,
                                53F3CAA5206C443E0086490E /* NetworkActivityTracker.cpp */,
                                535BCB902069C49C00CCCE02 /* NetworkActivityTracker.h */,
                        path = cocoa;
                        sourceTree = "<group>";
                };
-               A11455A1211FCE7F00CA935B /* watchos */ = {
-                       isa = PBXGroup;
-                       children = (
-                               A11455AA211FCFCA00CA935B /* NetworkProximityAssertion.h */,
-                               A11455AB211FCFCA00CA935B /* NetworkProximityAssertion.mm */,
-                               A11455AE211FD25200CA935B /* NetworkProximityManager.h */,
-                               A11455AF211FD25200CA935B /* NetworkProximityManager.mm */,
-                       );
-                       path = watchos;
-                       sourceTree = "<group>";
-               };
                A182D5B11BE6BCF40087A7CC /* ios */ = {
                        isa = PBXGroup;
                        children = (
                                5179556E162877B300FA43B6 /* NetworkProcessProxy.h in Headers */,
                                513A163D163088F6005D7D22 /* NetworkProcessProxyMessages.h in Headers */,
                                5C1426EE1C23F80900D41183 /* NetworkProcessSupplement.h in Headers */,
-                               A11455AC211FCFCA00CA935B /* NetworkProximityAssertion.h in Headers */,
-                               A11455B0211FD25200CA935B /* NetworkProximityManager.h in Headers */,
                                51FD18B61651FBAD00DBE1CE /* NetworkResourceLoader.h in Headers */,
                                E152551B17011819003D7ADB /* NetworkResourceLoaderMessages.h in Headers */,
                                51240EC0220B694C005CFC63 /* NetworkResourceLoadMap.h in Headers */,
index 3057897..5dc45a1 100644 (file)
@@ -1,3 +1,13 @@
+2019-03-24  Andy Estes  <aestes@apple.com>
+
+        [watchOS] Remove unused Proximity Networking code
+        https://bugs.webkit.org/show_bug.cgi?id=196188
+
+        Reviewed by Tim Horton.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/WKProcessPoolConfiguration.mm:
+        (TEST):
+
 2019-03-23  Keith Miller  <keith_miller@apple.com>
 
         Refactor clz/ctz and fix getLSBSet.
index 4ede5fb..d3b530d 100644 (file)
@@ -38,9 +38,6 @@ TEST(WKProcessPoolConfiguration, Copy)
     [configuration setIgnoreSynchronousMessagingTimeoutsForTesting:YES];
     [configuration setAttrStyleEnabled:YES];
     [configuration setAdditionalReadAccessAllowedURLs:@[ [NSURL fileURLWithPath:@"/path/to/allow/read/access/"] ]];
-#if PLATFORM(IOS_FAMILY) && !PLATFORM(IOS_FAMILY_SIMULATOR)
-    [configuration setWirelessContextIdentifier:25];
-#endif
     [configuration setDiskCacheSizeOverride:42000];
     [configuration setCachePartitionedURLSchemes:@[ @"ssh", @"vnc" ]];
     [configuration setAlwaysRevalidatedURLSchemes:@[ @"afp", @"smb" ]];
@@ -66,9 +63,6 @@ TEST(WKProcessPoolConfiguration, Copy)
     EXPECT_EQ([configuration ignoreSynchronousMessagingTimeoutsForTesting], [copy ignoreSynchronousMessagingTimeoutsForTesting]);
     EXPECT_EQ([configuration attrStyleEnabled], [copy attrStyleEnabled]);
     EXPECT_TRUE([[configuration additionalReadAccessAllowedURLs] isEqual:[copy additionalReadAccessAllowedURLs]]);
-#if PLATFORM(IOS_FAMILY) && !PLATFORM(IOS_FAMILY_SIMULATOR)
-    EXPECT_EQ([configuration wirelessContextIdentifier], [copy wirelessContextIdentifier]);
-#endif
     EXPECT_EQ([configuration diskCacheSizeOverride], [copy diskCacheSizeOverride]);
     EXPECT_TRUE([[configuration cachePartitionedURLSchemes] isEqual:[copy cachePartitionedURLSchemes]]);
     EXPECT_TRUE([[configuration alwaysRevalidatedURLSchemes] isEqual:[copy alwaysRevalidatedURLSchemes]]);