Title: [194472] trunk/Source
Revision
194472
Author
[email protected]
Date
2015-12-31 15:49:46 -0800 (Thu, 31 Dec 2015)

Log Message

Stop using USE(CFNETWORK) path on iOS
Source/WebCore:

https://bugs.webkit.org/show_bug.cgi?id=142540

Step 1/2: Do everything but turn off USE(CFNETWORK) internally.

Original patch by Antti Koivisto <[email protected]> on 2015-03-10
Reviewed by Daniel Bates.

Unify OS X and iOS code paths.

This patch just fixes the NSURLConnection code path on iOS. It
doesn't yet delete any unnecessary code.

Changes covered by most existing tests.

* loader/DocumentLoader.h:
* loader/ResourceLoader.cpp:
* loader/ResourceLoader.h:
* loader/mac/DocumentLoaderMac.cpp:
- Update for iOS to use NSURLConnection loader.

* page/mac/PageMac.mm:
(WebCore::Page::platformInitialize): Always use the correct
runloop on iOS regardless of which thread this was called on.
(WebCore::Page::addSchedulePair): Update for iOS to use
NSURLConnection loader.
(WebCore::Page::removeSchedulePair): Ditto.

* platform/ios/wak/WebCoreThread.h:
(WebThreadRunLoop): No longer needs to be exported.
(WebThreadNSRunLoop): Export for WebKitLegacy.

* platform/network/ios/QuickLook.mm: Fix header order.
(WebQuickLookHandleAsDelegate): Make delegate objects implement
WebCoreResourceLoaderDelegate protocol.  This unifies the
-clearHandle and -detachHandle methods that were used on iOS and
OS X, respectively.
(-[WebQuickLookHandleAsDelegate clearHandle]): Deleted.
(-[WebQuickLookHandleAsDelegate detachHandle]): Renamed from
-clearHandle.
(WebResourceLoaderQuickLookDelegate): Make delegate objects
implement WebCoreResourceLoaderDelegate protocol.
(-[WebResourceLoaderQuickLookDelegate clearHandle]): Deleted.
(-[WebResourceLoaderQuickLookDelegate detachHandle]): Renamed from
-clearHandle.
(WebCore::QuickLookHandle::~QuickLookHandle): Call
-detachHandle instead of -clearHandle.

* platform/network/mac/ResourceHandleMac.mm:
- Update for iOS to use NSURLConnection loader.

* platform/network/mac/WebCoreResourceHandleAsDelegate.h:
(WebCoreResourceLoaderDelegate): Define new protocol.

* platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
(-[WebCoreResourceHandleAsDelegate detachHandle]): Gratuitous
nullptr fix.

* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
(WebCoreResourceHandleAsOperationQueueDelegate): Implement
WebCoreResourceLoaderDelegate protocol.

* platform/spi/cocoa/NSURLDownloadSPI.h: Declare more
NSURDownload SPI to clean up other source files and make
source compile on iOS with NSURLConnection code path.

Source/WebKit/mac:

https://bugs.webkit.org/show_bug.cgi?id=142540

Step 1/2: Do everything but turn off USE(CFNETWORK) internally.

Original patch by Antti Koivisto <[email protected]> on 2015-03-10
Reviewed by Daniel Bates.

* Misc/WebDownload.h: Add header guard to make
NSURLDownloadSPI.h work when pre-declaring NSURLDownload object.
* Misc/WebKitVersionChecks.h: Define
WEBKIT_FIRST_VERSION_WITH_LOADING_DURING_COMMON_RUNLOOP_MODES
for iOS.
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]): Use
the correct runloop on iOS.
* WebView/WebViewPrivate.h:
(-[WebView(WebPendingPublic) scheduleInRunLoop:forMode:]):
(-[WebView(WebPendingPublic) unscheduleFromRunLoop:forMode:]):
- These are available on iOS now.

Source/WebKit2:

https://bugs.webkit.org/show_bug.cgi?id=142540

Step 1/2: Do everything but turn off USE(CFNETWORK) internally.

Original patch by Antti Koivisto <[email protected]> on 2015-03-10
Reviewed by Daniel Bates.

* NetworkProcess/Downloads/ios/DownloadIOS.mm: This is now the
USE(CFNETWORK) && !USE(NETWORK_SESSION) code path.
* NetworkProcess/Downloads/mac/DownloadMac.mm: This is now the
!USE(CFNETWORK) && !USE(NETWORK_SESSION) code path.  Make use of
NSURLDownloadSPI.h.  Ignore a deprecated delcaration warning now
that we're using actual header declarations internally.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess): Update for
iOS to use NSURLConnection loader.

Source/WTF:

<https://webkit.org/b/142540>

Step 1/2: Do everything but turn off USE(CFNETWORK) internally.

Original patch by Antti Koivisto <[email protected]> on 2015-03-10
Reviewed by Daniel Bates.

* wtf/SchedulePair.h: Update macros to match WebCore.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (194471 => 194472)


--- trunk/Source/WTF/ChangeLog	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WTF/ChangeLog	2015-12-31 23:49:46 UTC (rev 194472)
@@ -1,3 +1,15 @@
+2015-12-31  David Kilzer  <[email protected]>
+
+        Stop using USE(CFNETWORK) path on iOS
+        <https://webkit.org/b/142540>
+
+        Step 1/2: Do everything but turn off USE(CFNETWORK) internally.
+
+        Original patch by Antti Koivisto <[email protected]> on 2015-03-10
+        Reviewed by Daniel Bates.
+
+        * wtf/SchedulePair.h: Update macros to match WebCore.
+
 2015-12-31  Andy Estes  <[email protected]>
 
         Rename WTF_MOVE to WTFMove

Modified: trunk/Source/WTF/wtf/SchedulePair.h (194471 => 194472)


--- trunk/Source/WTF/wtf/SchedulePair.h	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WTF/wtf/SchedulePair.h	2015-12-31 23:49:46 UTC (rev 194472)
@@ -35,7 +35,7 @@
 #include <wtf/text/StringHash.h>
 #include <wtf/text/WTFString.h>
 
-#if USE(FOUNDATION)
+#if PLATFORM(COCOA) && !USE(CFNETWORK)
 OBJC_CLASS NSRunLoop;
 #endif
 
@@ -45,7 +45,7 @@
 public:
     static Ref<SchedulePair> create(CFRunLoopRef runLoop, CFStringRef mode) { return adoptRef(*new SchedulePair(runLoop, mode)); }
 
-#if USE(FOUNDATION) && !USE(CFNETWORK)
+#if PLATFORM(COCOA) && !USE(CFNETWORK)
     static Ref<SchedulePair> create(NSRunLoop* runLoop, CFStringRef mode) { return adoptRef(*new SchedulePair(runLoop, mode)); }
     NSRunLoop* nsRunLoop() const { return m_nsRunLoop.get(); }
 #endif
@@ -63,7 +63,7 @@
             m_mode = adoptCF(CFStringCreateCopy(0, mode));
     }
 
-#if USE(FOUNDATION) && !USE(CFNETWORK)
+#if PLATFORM(COCOA) && !USE(CFNETWORK)
     WTF_EXPORT_PRIVATE SchedulePair(NSRunLoop*, CFStringRef);
     RetainPtr<NSRunLoop*> m_nsRunLoop;
 #endif

Modified: trunk/Source/WebCore/ChangeLog (194471 => 194472)


--- trunk/Source/WebCore/ChangeLog	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebCore/ChangeLog	2015-12-31 23:49:46 UTC (rev 194472)
@@ -1,3 +1,71 @@
+2015-12-31  David Kilzer  <[email protected]>
+
+        Stop using USE(CFNETWORK) path on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=142540
+
+        Step 1/2: Do everything but turn off USE(CFNETWORK) internally.
+
+        Original patch by Antti Koivisto <[email protected]> on 2015-03-10
+        Reviewed by Daniel Bates.
+
+        Unify OS X and iOS code paths.
+
+        This patch just fixes the NSURLConnection code path on iOS. It
+        doesn't yet delete any unnecessary code.
+
+        Changes covered by most existing tests.
+
+        * loader/DocumentLoader.h:
+        * loader/ResourceLoader.cpp:
+        * loader/ResourceLoader.h:
+        * loader/mac/DocumentLoaderMac.cpp:
+        - Update for iOS to use NSURLConnection loader.
+
+        * page/mac/PageMac.mm:
+        (WebCore::Page::platformInitialize): Always use the correct
+        runloop on iOS regardless of which thread this was called on.
+        (WebCore::Page::addSchedulePair): Update for iOS to use
+        NSURLConnection loader.
+        (WebCore::Page::removeSchedulePair): Ditto.
+
+        * platform/ios/wak/WebCoreThread.h:
+        (WebThreadRunLoop): No longer needs to be exported.
+        (WebThreadNSRunLoop): Export for WebKitLegacy.
+
+        * platform/network/ios/QuickLook.mm: Fix header order.
+        (WebQuickLookHandleAsDelegate): Make delegate objects implement
+        WebCoreResourceLoaderDelegate protocol.  This unifies the
+        -clearHandle and -detachHandle methods that were used on iOS and
+        OS X, respectively.
+        (-[WebQuickLookHandleAsDelegate clearHandle]): Deleted.
+        (-[WebQuickLookHandleAsDelegate detachHandle]): Renamed from
+        -clearHandle.
+        (WebResourceLoaderQuickLookDelegate): Make delegate objects
+        implement WebCoreResourceLoaderDelegate protocol.
+        (-[WebResourceLoaderQuickLookDelegate clearHandle]): Deleted.
+        (-[WebResourceLoaderQuickLookDelegate detachHandle]): Renamed from
+        -clearHandle.
+        (WebCore::QuickLookHandle::~QuickLookHandle): Call
+        -detachHandle instead of -clearHandle.
+
+        * platform/network/mac/ResourceHandleMac.mm:
+        - Update for iOS to use NSURLConnection loader.
+
+        * platform/network/mac/WebCoreResourceHandleAsDelegate.h:
+        (WebCoreResourceLoaderDelegate): Define new protocol.
+
+        * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
+        (-[WebCoreResourceHandleAsDelegate detachHandle]): Gratuitous
+        nullptr fix.
+
+        * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
+        (WebCoreResourceHandleAsOperationQueueDelegate): Implement
+        WebCoreResourceLoaderDelegate protocol.
+
+        * platform/spi/cocoa/NSURLDownloadSPI.h: Declare more
+        NSURDownload SPI to clean up other source files and make
+        source compile on iOS with NSURLConnection code path.
+
 2015-12-31  Andy Estes  <[email protected]>
 
         Fix warnings uncovered by migrating to WTF_MOVE

Modified: trunk/Source/WebCore/loader/DocumentLoader.h (194471 => 194472)


--- trunk/Source/WebCore/loader/DocumentLoader.h	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebCore/loader/DocumentLoader.h	2015-12-31 23:49:46 UTC (rev 194472)
@@ -56,6 +56,10 @@
 #include "QuickLook.h"
 #endif
 
+#if PLATFORM(COCOA) && !USE(CFNETWORK)
+#include <wtf/SchedulePair.h>
+#endif
+
 namespace WebCore {
 
     class ApplicationCacheHost;
@@ -144,7 +148,7 @@
         WEBCORE_EXPORT void setTitle(const StringWithDirection&);
         const String& overrideEncoding() const { return m_overrideEncoding; }
 
-#if PLATFORM(MAC)
+#if PLATFORM(COCOA) && !USE(CFNETWORK)
         void schedule(SchedulePair&);
         void unschedule(SchedulePair&);
 #endif

Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (194471 => 194472)


--- trunk/Source/WebCore/loader/ResourceLoader.cpp	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp	2015-12-31 23:49:46 UTC (rev 194472)
@@ -724,7 +724,7 @@
     cancel();
 }
 
-#if PLATFORM(MAC)
+#if PLATFORM(COCOA) && !USE(CFNETWORK)
 
 void ResourceLoader::schedule(SchedulePair& pair)
 {

Modified: trunk/Source/WebCore/loader/ResourceLoader.h (194471 => 194472)


--- trunk/Source/WebCore/loader/ResourceLoader.h	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebCore/loader/ResourceLoader.h	2015-12-31 23:49:46 UTC (rev 194472)
@@ -140,7 +140,7 @@
 
     void willSwitchToSubstituteResource();
 
-#if PLATFORM(MAC)
+#if PLATFORM(COCOA) && !USE(CFNETWORK)
     void schedule(WTF::SchedulePair&);
     void unschedule(WTF::SchedulePair&);
 #endif

Modified: trunk/Source/WebCore/loader/mac/DocumentLoaderMac.cpp (194471 => 194472)


--- trunk/Source/WebCore/loader/mac/DocumentLoaderMac.cpp	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebCore/loader/mac/DocumentLoaderMac.cpp	2015-12-31 23:49:46 UTC (rev 194472)
@@ -33,7 +33,7 @@
 
 namespace WebCore {
 
-#if PLATFORM(MAC)
+#if !USE(CFNETWORK)
 
 static void scheduleAll(const ResourceLoaderMap& loaders, SchedulePair& pair)
 {

Modified: trunk/Source/WebCore/page/mac/PageMac.mm (194471 => 194472)


--- trunk/Source/WebCore/page/mac/PageMac.mm	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebCore/page/mac/PageMac.mm	2015-12-31 23:49:46 UTC (rev 194472)
@@ -34,13 +34,21 @@
 #import "FrameTree.h"
 #import "MainFrame.h"
 
+#if PLATFORM(IOS)
+#import "WebCoreThread.h"
+#endif
+
 namespace WebCore {
 
 void Page::platformInitialize()
 {
+#if PLATFORM(IOS)
 #if USE(CFNETWORK)
-    addSchedulePair(SchedulePair::create([[NSRunLoop currentRunLoop] getCFRunLoop], kCFRunLoopCommonModes));
+    addSchedulePair(SchedulePair::create(WebThreadRunLoop(), kCFRunLoopCommonModes));
 #else
+    addSchedulePair(SchedulePair::create(WebThreadNSRunLoop(), kCFRunLoopCommonModes));
+#endif // USE(CFNETWORK)
+#else
     addSchedulePair(SchedulePair::create([NSRunLoop currentRunLoop], kCFRunLoopCommonModes));
 #endif
 }
@@ -51,7 +59,7 @@
         m_scheduledRunLoopPairs = std::make_unique<SchedulePairHashSet>();
     m_scheduledRunLoopPairs->add(pair.ptr());
 
-#if !PLATFORM(IOS)
+#if !USE(CFNETWORK)
     for (Frame* frame = m_mainFrame.get(); frame; frame = frame->tree().traverseNext()) {
         if (DocumentLoader* documentLoader = frame->loader().documentLoader())
             documentLoader->schedule(pair);
@@ -71,7 +79,7 @@
 
     m_scheduledRunLoopPairs->remove(pair.ptr());
 
-#if !PLATFORM(IOS)
+#if !USE(CFNETWORK)
     for (Frame* frame = m_mainFrame.get(); frame; frame = frame->tree().traverseNext()) {
         if (DocumentLoader* documentLoader = frame->loader().documentLoader())
             documentLoader->unschedule(pair);

Modified: trunk/Source/WebCore/platform/ios/wak/WebCoreThread.h (194471 => 194472)


--- trunk/Source/WebCore/platform/ios/wak/WebCoreThread.h	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebCore/platform/ios/wak/WebCoreThread.h	2015-12-31 23:49:46 UTC (rev 194472)
@@ -80,8 +80,8 @@
 static inline bool WebThreadShouldYield(void) { return webThreadShouldYield; }
 static inline void WebThreadSetShouldYield() { webThreadShouldYield = true; }
 
-WEBCORE_EXPORT CFRunLoopRef WebThreadRunLoop(void);
-NSRunLoop* WebThreadNSRunLoop(void);
+CFRunLoopRef WebThreadRunLoop(void);
+WEBCORE_EXPORT NSRunLoop* WebThreadNSRunLoop(void);
 WebThreadContext *WebThreadCurrentContext(void);
 bool WebThreadContextIsCurrent(void);
 

Modified: trunk/Source/WebCore/platform/network/ios/QuickLook.mm (194471 => 194472)


--- trunk/Source/WebCore/platform/network/ios/QuickLook.mm	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebCore/platform/network/ios/QuickLook.mm	2015-12-31 23:49:46 UTC (rev 194472)
@@ -32,12 +32,12 @@
 #import "FileSystemIOS.h"
 #import "Logging.h"
 #import "NSFileManagerSPI.h"
-#import "QuickLookSoftLink.h"
 #import "ResourceError.h"
 #import "ResourceHandle.h"
 #import "ResourceLoader.h"
 #import "RuntimeApplicationChecksIOS.h"
 #import "SynchronousResourceHandleCFURLConnectionDelegate.h"
+#import "WebCoreResourceHandleAsDelegate.h"
 #import "WebCoreURLResponseIOS.h"
 #import <Foundation/Foundation.h>
 #import <wtf/NeverDestroyed.h>
@@ -46,6 +46,8 @@
 #import <wtf/Vector.h>
 #import <wtf/text/WTFString.h>
 
+#import "QuickLookSoftLink.h"
+
 using namespace WebCore;
 
 NSSet *WebCore::QLPreviewGetSupportedMIMETypesSet()
@@ -193,12 +195,11 @@
 // This works fine when using NS APIs, but when using CFNetwork, we don't have a NSURLConnectionDelegate.
 // So we create WebQuickLookHandleAsDelegate as an intermediate delegate object and pass it to
 // QLPreviewConverter. The proxy delegate then forwards the messages on to the CFNetwork code.
-@interface WebQuickLookHandleAsDelegate : NSObject <NSURLConnectionDelegate> {
+@interface WebQuickLookHandleAsDelegate : NSObject <NSURLConnectionDelegate, WebCoreResourceLoaderDelegate> {
     RefPtr<SynchronousResourceHandleCFURLConnectionDelegate> m_connectionDelegate;
 }
 
 - (id)initWithConnectionDelegate:(SynchronousResourceHandleCFURLConnectionDelegate*)connectionDelegate;
-- (void)clearHandle;
 @end
 
 @implementation WebQuickLookHandleAsDelegate
@@ -252,14 +253,14 @@
     m_connectionDelegate->didFail(reinterpret_cast<CFErrorRef>(error));
 }
 
-- (void)clearHandle
+- (void)detachHandle
 {
     m_connectionDelegate = nullptr;
 }
 @end
 #endif
 
-@interface WebResourceLoaderQuickLookDelegate : NSObject <NSURLConnectionDelegate> {
+@interface WebResourceLoaderQuickLookDelegate : NSObject <NSURLConnectionDelegate, WebCoreResourceLoaderDelegate> {
     RefPtr<ResourceLoader> _resourceLoader;
     BOOL _hasSentDidReceiveResponse;
     BOOL _hasFailed;
@@ -350,7 +351,7 @@
     _resourceLoader->didFail(ResourceError(error));
 }
 
-- (void)clearHandle
+- (void)detachHandle
 {
     _resourceLoader = nullptr;
     _quickLookHandle = nullptr;
@@ -491,7 +492,7 @@
     LOG(Network, "QuickLookHandle::~QuickLookHandle()");
     m_converter = nullptr;
 
-    [m_delegate clearHandle];
+    [m_delegate detachHandle];
 }
 
 String QuickLookHandle::previewFileName() const

Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (194471 => 194472)


--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2015-12-31 23:49:46 UTC (rev 194472)
@@ -314,7 +314,7 @@
         [d->m_connection setDefersCallbacks:defers];
 }
 
-#if PLATFORM(MAC)
+#if !USE(CFNETWORK)
 
 void ResourceHandle::schedule(SchedulePair& pair)
 {

Modified: trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.h (194471 => 194472)


--- trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.h	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.h	2015-12-31 23:49:46 UTC (rev 194472)
@@ -26,17 +26,20 @@
 #ifndef WebCoreResourceHandleAsDelegate_h
 #define WebCoreResourceHandleAsDelegate_h
 
-#if !USE(CFNETWORK)
-
 namespace WebCore {
 class ResourceHandle;
 }
 
-@interface WebCoreResourceHandleAsDelegate : NSObject <NSURLConnectionDelegate> {
+@protocol WebCoreResourceLoaderDelegate
+- (void)detachHandle;
+@end
+
+#if !USE(CFNETWORK)
+
+@interface WebCoreResourceHandleAsDelegate : NSObject <NSURLConnectionDelegate, WebCoreResourceLoaderDelegate> {
     WebCore::ResourceHandle* m_handle;
 }
 - (id)initWithHandle:(WebCore::ResourceHandle*)handle;
-- (void)detachHandle;
 @end
 
 #endif // !USE(CFNETWORK)

Modified: trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm (194471 => 194472)


--- trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm	2015-12-31 23:49:46 UTC (rev 194472)
@@ -54,7 +54,7 @@
 
 - (void)detachHandle
 {
-    m_handle = 0;
+    m_handle = nullptr;
 }
 
 - (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)newRequest redirectResponse:(NSURLResponse *)redirectResponse

Modified: trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h (194471 => 194472)


--- trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h	2015-12-31 23:49:46 UTC (rev 194472)
@@ -28,6 +28,7 @@
 
 #if !USE(CFNETWORK)
 
+#include "WebCoreResourceHandleAsDelegate.h"
 #include <dispatch/dispatch.h>
 #include <wtf/RetainPtr.h>
 
@@ -35,7 +36,7 @@
 class ResourceHandle;
 }
 
-@interface WebCoreResourceHandleAsOperationQueueDelegate : NSObject <NSURLConnectionDelegate> {
+@interface WebCoreResourceHandleAsOperationQueueDelegate : NSObject <NSURLConnectionDelegate, WebCoreResourceLoaderDelegate> {
     WebCore::ResourceHandle* m_handle;
 
     // Synchronous delegates on operation queue wait until main thread sends an asynchronous response.
@@ -46,7 +47,6 @@
 }
 
 - (id)initWithHandle:(WebCore::ResourceHandle*)handle;
-- (void)detachHandle;
 - (void)continueWillSendRequest:(NSURLRequest *)newRequest;
 - (void)continueDidReceiveResponse;
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)

Modified: trunk/Source/WebCore/platform/spi/cocoa/NSURLDownloadSPI.h (194471 => 194472)


--- trunk/Source/WebCore/platform/spi/cocoa/NSURLDownloadSPI.h	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebCore/platform/spi/cocoa/NSURLDownloadSPI.h	2015-12-31 23:49:46 UTC (rev 194472)
@@ -29,8 +29,16 @@
 
 #import <Foundation/NSURLDownload.h>
 
+#if USE(APPLE_INTERNAL_SDK)
+#import <Foundation/NSURLDownloadPrivate.h>
 #else
+@interface NSURLDownload ()
++(id)_downloadWithLoadingConnection:(NSURLConnection *)connection request:(NSURLRequest *)request response:(NSURLResponse *)response delegate:(id)delegate proxy:(id)proxy;
+@end
+#endif
 
+#else
+
 @class NSString;
 @class NSURLAuthenticationChallenge;
 @class NSURLDownload;
@@ -56,8 +64,22 @@
 - (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error;
 @end
 
+#ifndef WebDownload_h
+/* Also defined in <WebKit/WebDownload.h>. */
+@interface NSURLDownload : NSObject
+@end
+#endif
+
 @interface NSURLDownload ()
 - (instancetype)initWithRequest:(NSURLRequest *)request delegate:(id <NSURLDownloadDelegate>)delegate;
+- (instancetype)initWithResumeData:(NSData *)resumeData delegate:(id <NSURLDownloadDelegate>)delegate path:(NSString *)path;
+- (void)cancel;
+- (void)setDestination:(NSString *)path allowOverwrite:(BOOL)allowOverwrite;
+@property (readonly, copy) NSURLRequest *request;
+@property (readonly, copy) NSData *resumeData;
+@property BOOL deletesFileUponFailure;
+
++(id)_downloadWithLoadingConnection:(NSURLConnection *)connection request:(NSURLRequest *)request response:(NSURLResponse *)response delegate:(id)delegate proxy:(id)proxy;
 @end
 
 #endif

Modified: trunk/Source/WebKit/mac/ChangeLog (194471 => 194472)


--- trunk/Source/WebKit/mac/ChangeLog	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebKit/mac/ChangeLog	2015-12-31 23:49:46 UTC (rev 194472)
@@ -1,3 +1,26 @@
+2015-12-31  David Kilzer  <[email protected]>
+
+        Stop using USE(CFNETWORK) path on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=142540
+
+        Step 1/2: Do everything but turn off USE(CFNETWORK) internally.
+
+        Original patch by Antti Koivisto <[email protected]> on 2015-03-10
+        Reviewed by Daniel Bates.
+
+        * Misc/WebDownload.h: Add header guard to make
+        NSURLDownloadSPI.h work when pre-declaring NSURLDownload object.
+        * Misc/WebKitVersionChecks.h: Define
+        WEBKIT_FIRST_VERSION_WITH_LOADING_DURING_COMMON_RUNLOOP_MODES
+        for iOS.
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]): Use
+        the correct runloop on iOS.
+        * WebView/WebViewPrivate.h:
+        (-[WebView(WebPendingPublic) scheduleInRunLoop:forMode:]):
+        (-[WebView(WebPendingPublic) unscheduleFromRunLoop:forMode:]):
+        - These are available on iOS now.
+
 2015-12-31  Simon Fraser  <[email protected]>
 
         Clarify that scrollPositionChangedViaPlatformWidget takes offsets

Modified: trunk/Source/WebKit/mac/Misc/WebDownload.h (194471 => 194472)


--- trunk/Source/WebKit/mac/Misc/WebDownload.h	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebKit/mac/Misc/WebDownload.h	2015-12-31 23:49:46 UTC (rev 194472)
@@ -26,6 +26,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef WebDownload_h
+#define WebDownload_h
+
 #if !TARGET_OS_IPHONE || (defined USE_APPLE_INTERNAL_SDK && USE_APPLE_INTERNAL_SDK)
 #import <Foundation/NSURLDownload.h>
 #else
@@ -78,3 +81,5 @@
 - (NSWindow *)downloadWindowForAuthenticationSheet:(WebDownload *)download;
 
 @end
+
+#endif /* WebDownload_h */

Modified: trunk/Source/WebKit/mac/Misc/WebKitVersionChecks.h (194471 => 194472)


--- trunk/Source/WebKit/mac/Misc/WebKitVersionChecks.h	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebKit/mac/Misc/WebKitVersionChecks.h	2015-12-31 23:49:46 UTC (rev 194472)
@@ -72,6 +72,7 @@
 #define WEBKIT_FIRST_VERSION_WITH_CSS_ATTRIBUTE_SETTERS_IGNORING_PRIORITY 2239 // iOS 6.0
 #define WEBKIT_FIRST_VERSION_WITH_YOUTUBE_EMBED_IFRAME_TRANSFORM 2239 // iOS 6.0
 #define WEBKIT_FIRST_VERSION_WITHOUT_LEGACY_BACKGROUNDSIZE_SHORTHAND_BEHAVIOR 2665 // iOS 7.0
+#define WEBKIT_FIRST_VERSION_WITH_LOADING_DURING_COMMON_RUNLOOP_MODES 2665 // iOS 7.0
 #define WEBKIT_FIRST_VERSION_WITH_INSECURE_CONTENT_BLOCKING 3454
 #endif // PLATFORM(IOS)
 

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (194471 => 194472)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2015-12-31 23:49:46 UTC (rev 194472)
@@ -1026,14 +1026,16 @@
 
     [WebFrame _createMainFrameWithPage:_private->page frameName:frameName frameView:frameView];
 
-#if !PLATFORM(IOS)
+#if PLATFORM(IOS)
+    NSRunLoop *runLoop = WebThreadNSRunLoop();
+#else
     NSRunLoop *runLoop = [NSRunLoop mainRunLoop];
+#endif
 
     if (WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_LOADING_DURING_COMMON_RUNLOOP_MODES))
         [self scheduleInRunLoop:runLoop forMode:(NSString *)kCFRunLoopCommonModes];
     else
         [self scheduleInRunLoop:runLoop forMode:NSDefaultRunLoopMode];
-#endif
 
     [self _addToAllWebViewsSet];
     
@@ -6618,7 +6620,6 @@
 
 @implementation WebView (WebPendingPublic)
 
-#if !PLATFORM(IOS)
 - (void)scheduleInRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode
 {
 #if USE(CFNETWORK)
@@ -6640,7 +6641,6 @@
     if (runLoop && mode)
         core(self)->removeSchedulePair(SchedulePair::create(schedulePairRunLoop, (CFStringRef)mode));
 }
-#endif
 
 static BOOL findString(NSView <WebDocumentSearching> *searchView, NSString *string, WebFindOptions options)
 {

Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (194471 => 194472)


--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h	2015-12-31 23:49:46 UTC (rev 194472)
@@ -198,10 +198,8 @@
 
 @interface WebView (WebPendingPublic)
 
-#if !TARGET_OS_IPHONE
 - (void)scheduleInRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode;
 - (void)unscheduleFromRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode;
-#endif
 
 - (BOOL)findString:(NSString *)string options:(WebFindOptions)options;
 - (DOMRange *)DOMRangeOfString:(NSString *)string relativeTo:(DOMRange *)previousRange options:(WebFindOptions)options;

Modified: trunk/Source/WebKit2/ChangeLog (194471 => 194472)


--- trunk/Source/WebKit2/ChangeLog	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebKit2/ChangeLog	2015-12-31 23:49:46 UTC (rev 194472)
@@ -1,3 +1,23 @@
+2015-12-31  David Kilzer  <[email protected]>
+
+        Stop using USE(CFNETWORK) path on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=142540
+
+        Step 1/2: Do everything but turn off USE(CFNETWORK) internally.
+
+        Original patch by Antti Koivisto <[email protected]> on 2015-03-10
+        Reviewed by Daniel Bates.
+
+        * NetworkProcess/Downloads/ios/DownloadIOS.mm: This is now the
+        USE(CFNETWORK) && !USE(NETWORK_SESSION) code path.
+        * NetworkProcess/Downloads/mac/DownloadMac.mm: This is now the
+        !USE(CFNETWORK) && !USE(NETWORK_SESSION) code path.  Make use of
+        NSURLDownloadSPI.h.  Ignore a deprecated delcaration warning now
+        that we're using actual header declarations internally.
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::initializeNetworkProcess): Update for
+        iOS to use NSURLConnection loader.
+
 2015-12-31  Andy Estes  <[email protected]>
 
         Fix warnings uncovered by migrating to WTF_MOVE

Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/ios/DownloadIOS.mm (194471 => 194472)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/ios/DownloadIOS.mm	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/ios/DownloadIOS.mm	2015-12-31 23:49:46 UTC (rev 194472)
@@ -26,9 +26,10 @@
 #import "config.h"
 #import "Download.h"
 
-#if PLATFORM(IOS) && !USE(NETWORK_SESSION)
+#if USE(CFNETWORK) && !USE(NETWORK_SESSION)
 
 #import "DataReference.h"
+#import <CFNetwork/CFURLDownload.h>
 #import <WebCore/NotImplemented.h>
 #import <WebCore/ResourceError.h>
 #import <WebCore/ResourceHandle.h>
@@ -36,15 +37,10 @@
 #import <wtf/RetainPtr.h>
 #import <wtf/RunLoop.h>
 
-#if USE(CFNETWORK)
-#import <CFNetwork/CFURLDownload.h>
-#endif
-
 using namespace WebCore;
 
 namespace WebKit {
 
-#if USE(CFNETWORK)
 // FIXME: If possible, we should consider moving some callbacks off the main thread or at least
 // making them asynchonous calls.
 static void dispatchOnMainThread(void(^block)())
@@ -125,7 +121,6 @@
         });
     };
 }
-#endif // USE(CFNETWORK)
 
 void Download::start()
 {
@@ -139,16 +134,12 @@
 
 void Download::startWithHandle(ResourceHandle* handle, const ResourceResponse& response)
 {
-#if USE(CFNETWORK)
     CFURLDownloadClient client;
     setUpDownloadClient(client, *this);
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
     m_download = adoptCF(CFURLDownloadCreateAndStartWithLoadingConnection(NULL, handle->releaseConnectionForDownload().get(), m_request.cfURLRequest(UpdateHTTPBody), response.cfURLResponse(), &client));
 #pragma clang diagnostic pop
-#else
-    notImplemented();
-#endif
 }
 
 void Download::cancel()
@@ -193,4 +184,4 @@
 
 } // namespace WebKit
 
-#endif // PLATFORM(IOS)
+#endif // USE(CFNETWORK) && !USE(NETWORK_SESSION)

Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/mac/DownloadMac.mm (194471 => 194472)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/mac/DownloadMac.mm	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/mac/DownloadMac.mm	2015-12-31 23:49:46 UTC (rev 194472)
@@ -26,10 +26,11 @@
 #import "config.h"
 #import "Download.h"
 
-#if PLATFORM(MAC) && !USE(NETWORK_SESSION)
+#if !USE(CFNETWORK) && !USE(NETWORK_SESSION)
 
 #import <WebCore/AuthenticationChallenge.h>
 #import <WebCore/AuthenticationMac.h>
+#import <WebCore/NSURLDownloadSPI.h>
 #import <WebCore/NotImplemented.h>
 #import <WebCore/ResourceHandle.h>
 #import <WebCore/ResourceHandleClient.h>
@@ -37,14 +38,6 @@
 #import "DataReference.h"
 #import "WebPage.h"
 
-@interface NSURLDownload (WebNSURLDownloadDetails)
-+(id)_downloadWithLoadingConnection:(NSURLConnection *)connection
-                            request:(NSURLRequest *)request
-                           response:(NSURLResponse *)r
-                           delegate:(id)delegate
-                              proxy:(id)proxy;
-@end
-
 @interface WKDownloadAsDelegate : NSObject <NSURLDownloadDelegate> {
     WebKit::Download* _download;
 }
@@ -77,11 +70,14 @@
     ASSERT(!m_delegate);
 
     m_delegate = adoptNS([[WKDownloadAsDelegate alloc] initWithDownload:this]);
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
     m_nsURLDownload = [NSURLDownload _downloadWithLoadingConnection:handle->connection()
                                                             request:m_request.nsURLRequest(UpdateHTTPBody)
                                                            response:response.nsURLResponse()
                                                             delegate:m_delegate.get()
                                                                proxy:nil];
+#pragma clang diagnostic pop
 
     // FIXME: Allow this to be changed by the client.
     [m_nsURLDownload setDeletesFileUponFailure:NO];
@@ -308,4 +304,4 @@
 
 @end
 
-#endif // PLATFORM(MAC) && !USE(NETWORK_SESSION)
+#endif // !USE(CFNETWORK) && !USE(NETWORK_SESSION)

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (194471 => 194472)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp	2015-12-31 22:51:40 UTC (rev 194471)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp	2015-12-31 23:49:46 UTC (rev 194472)
@@ -198,7 +198,7 @@
 
     setCanHandleHTTPSServerTrustEvaluation(parameters.canHandleHTTPSServerTrustEvaluation);
 
-#if PLATFORM(MAC) || USE(CFNETWORK)
+#if PLATFORM(COCOA) || USE(CFNETWORK)
     SessionTracker::setIdentifierBase(parameters.uiProcessBundleIdentifier);
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to