Title: [196506] trunk
Revision
196506
Author
[email protected]
Date
2016-02-12 14:13:31 -0800 (Fri, 12 Feb 2016)

Log Message

[Mac] Adopt MediaResourceLoader (instead of CachedResourceLoader) in WebCoreNSURLSession.
https://bugs.webkit.org/show_bug.cgi?id=154136

Reviewed by Alex Christensen.

Source/WebCore:

MediaResourceLoader already supports using CORS attribute to verify CORS access requirements
when loading media resources, so use it, rather than CachedResourceLoader, as the backing for
WebCoreNSURLSession.

* platform/network/cocoa/WebCoreNSURLSession.h:
* platform/network/cocoa/WebCoreNSURLSession.mm:
(-[WebCoreNSURLSession delegateQueue]):
(-[WebCoreNSURLSession streamTaskWithNetService:]):
(-[WebCoreNSURLSession isKindOfClass:]):
(-[WebCoreNSURLSessionDataTask initWithSession:identifier:request:]):
(-[WebCoreNSURLSessionDataTask _restart]):
(-[WebCoreNSURLSessionDataTask _cancel]):
(-[WebCoreNSURLSessionDataTask resume]):
(-[WebCoreNSURLSessionDataTask _timingData]):
(-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):
(-[WebCoreNSURLSessionDataTask resource:receivedData:length:]):
(-[WebCoreNSURLSession initWithResourceLoader:delegate:delegateQueue:]): Deleted.
(-[WebCoreNSURLSession loader]): Deleted.
(WebCore::WebCoreNSURLSessionDataTaskClient::dataSent): Deleted.
(WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived): Deleted.
(WebCore::WebCoreNSURLSessionDataTaskClient::dataReceived): Deleted.
(WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived): Deleted.
(WebCore::WebCoreNSURLSessionDataTaskClient::notifyFinished): Deleted.
(-[WebCoreNSURLSessionDataTask initWithSession:identifier:URL:]): Deleted.
(-[WebCoreNSURLSessionDataTask _finish]): Deleted.
(-[WebCoreNSURLSessionDataTask _setDefersLoading:]): Deleted.
(-[WebCoreNSURLSessionDataTask resource:sentBytes:totalBytesToBeSent:]): Deleted.
(-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:]): Deleted.
(-[WebCoreNSURLSessionDataTask resourceFinished:]): Deleted.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):

Tools:

Use a MediaResourceLoader instead of a CachedResourceLoader for WebCoreNSURLSession.

Drive-by fix: generate USE and ENABLE macros for TestWebKitAPI by adding FEATURE_DEFINES
to GCC_PREPROCESSOR_DEFINES.

* TestWebKitAPI/Configurations/Base.xcconfig:
* TestWebKitAPI/Tests/WebCore/WebCoreNSURLSession.mm:
(TestWebKitAPI::WebCoreNSURLSessionTest::SetUp):
(TestWebKitAPI::WebCoreNSURLSessionTest::TearDown):
(TestWebKitAPI::TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (196505 => 196506)


--- trunk/Source/WebCore/ChangeLog	2016-02-12 22:04:08 UTC (rev 196505)
+++ trunk/Source/WebCore/ChangeLog	2016-02-12 22:13:31 UTC (rev 196506)
@@ -1,3 +1,42 @@
+2016-02-11  Jer Noble  <[email protected]>
+
+        [Mac] Adopt MediaResourceLoader (instead of CachedResourceLoader) in WebCoreNSURLSession.
+        https://bugs.webkit.org/show_bug.cgi?id=154136
+
+        Reviewed by Alex Christensen.
+
+        MediaResourceLoader already supports using CORS attribute to verify CORS access requirements
+        when loading media resources, so use it, rather than CachedResourceLoader, as the backing for
+        WebCoreNSURLSession.
+
+        * platform/network/cocoa/WebCoreNSURLSession.h:
+        * platform/network/cocoa/WebCoreNSURLSession.mm:
+        (-[WebCoreNSURLSession delegateQueue]):
+        (-[WebCoreNSURLSession streamTaskWithNetService:]):
+        (-[WebCoreNSURLSession isKindOfClass:]):
+        (-[WebCoreNSURLSessionDataTask initWithSession:identifier:request:]):
+        (-[WebCoreNSURLSessionDataTask _restart]):
+        (-[WebCoreNSURLSessionDataTask _cancel]):
+        (-[WebCoreNSURLSessionDataTask resume]):
+        (-[WebCoreNSURLSessionDataTask _timingData]):
+        (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):
+        (-[WebCoreNSURLSessionDataTask resource:receivedData:length:]):
+        (-[WebCoreNSURLSession initWithResourceLoader:delegate:delegateQueue:]): Deleted.
+        (-[WebCoreNSURLSession loader]): Deleted.
+        (WebCore::WebCoreNSURLSessionDataTaskClient::dataSent): Deleted.
+        (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived): Deleted.
+        (WebCore::WebCoreNSURLSessionDataTaskClient::dataReceived): Deleted.
+        (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived): Deleted.
+        (WebCore::WebCoreNSURLSessionDataTaskClient::notifyFinished): Deleted.
+        (-[WebCoreNSURLSessionDataTask initWithSession:identifier:URL:]): Deleted.
+        (-[WebCoreNSURLSessionDataTask _finish]): Deleted.
+        (-[WebCoreNSURLSessionDataTask _setDefersLoading:]): Deleted.
+        (-[WebCoreNSURLSessionDataTask resource:sentBytes:totalBytesToBeSent:]): Deleted.
+        (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:]): Deleted.
+        (-[WebCoreNSURLSessionDataTask resourceFinished:]): Deleted.
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
+
 2016-02-12  Alex Christensen  <[email protected]>
 
         Fix non-internal builds when using NetworkSession

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (196505 => 196506)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2016-02-12 22:04:08 UTC (rev 196505)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2016-02-12 22:13:31 UTC (rev 196506)
@@ -921,8 +921,11 @@
     if (Settings::isAVFoundationNSURLSessionEnabled()
         && [resourceLoader respondsToSelector:@selector(setURLSession:)]
         && [resourceLoader respondsToSelector:@selector(URLSessionDataDelegate)]
-        && [resourceLoader respondsToSelector:@selector(URLSessionDataDelegateQueue)])
-        resourceLoader.URLSession = (NSURLSession *)[[[WebCoreNSURLSession alloc] initWithResourceLoader:*player()->cachedResourceLoader() delegate:resourceLoader.URLSessionDataDelegate delegateQueue:resourceLoader.URLSessionDataDelegateQueue] autorelease];
+        && [resourceLoader respondsToSelector:@selector(URLSessionDataDelegateQueue)]) {
+        RefPtr<PlatformMediaResourceLoader> mediaResourceLoader = player()->createResourceLoader();
+        if (mediaResourceLoader)
+            resourceLoader.URLSession = (NSURLSession *)[[[WebCoreNSURLSession alloc] initWithResourceLoader:*mediaResourceLoader delegate:resourceLoader.URLSessionDataDelegate delegateQueue:resourceLoader.URLSessionDataDelegateQueue] autorelease];
+    }
 #endif
 
 #endif

Modified: trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.h (196505 => 196506)


--- trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.h	2016-02-12 22:04:08 UTC (rev 196505)
+++ trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.h	2016-02-12 22:13:31 UTC (rev 196506)
@@ -28,8 +28,6 @@
 
 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
 
-#import "CachedRawResource.h"
-#import "CachedResourceHandle.h"
 #import <Foundation/NSURLSession.h>
 #import <wtf/HashSet.h>
 #import <wtf/OSObjectPtr.h>
@@ -44,15 +42,16 @@
 @class WebCoreNSURLSessionDataTask;
 
 namespace WebCore {
-class CachedResourceLoader;
 class CachedResourceRequest;
+class PlatformMediaResource;
+class PlatformMediaResourceLoader;
 class WebCoreNSURLSessionDataTaskClient;
 }
 
 NS_ASSUME_NONNULL_BEGIN
 
 WEBCORE_EXPORT @interface WebCoreNSURLSession : NSObject {
-    RefPtr<WebCore::CachedResourceLoader> _loader;
+    RefPtr<WebCore::PlatformMediaResourceLoader> _loader;
     RetainPtr<id<NSURLSessionDelegate>> _delegate;
     RetainPtr<NSOperationQueue> _queue;
     NSString *_sessionDescription;
@@ -61,7 +60,7 @@
     NSUInteger _nextTaskIdentifier;
     OSObjectPtr<dispatch_queue_t> _internalQueue;
 }
-- (id)initWithResourceLoader:(WebCore::CachedResourceLoader&)loader delegate:(id<NSURLSessionTaskDelegate>)delegate delegateQueue:(NSOperationQueue*)queue;
+- (id)initWithResourceLoader:(WebCore::PlatformMediaResourceLoader&)loader delegate:(id<NSURLSessionTaskDelegate>)delegate delegateQueue:(NSOperationQueue*)queue;
 @property (readonly, retain) NSOperationQueue *delegateQueue;
 @property (nullable, readonly, retain) id <NSURLSessionDelegate> delegate;
 @property (readonly, copy) NSURLSessionConfiguration *configuration;
@@ -98,9 +97,8 @@
 
 @interface WebCoreNSURLSessionDataTask : NSObject {
     WebCoreNSURLSession *_session;
-    std::unique_ptr<WebCore::CachedResourceRequest> _request;
     std::unique_ptr<WebCore::WebCoreNSURLSessionDataTaskClient> _client;
-    WebCore::CachedResourceHandle<WebCore::CachedRawResource> _resource;
+    RefPtr<WebCore::PlatformMediaResource> _resource;
     RetainPtr<NSURLResponse> _response;
     NSUInteger _taskIdentifier;
     NSURLRequest *_originalRequest;

Modified: trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm (196505 => 196506)


--- trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm	2016-02-12 22:04:08 UTC (rev 196505)
+++ trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm	2016-02-12 22:13:31 UTC (rev 196506)
@@ -28,9 +28,8 @@
 
 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
 
-#import "CachedRawResource.h"
-#import "CachedResourceLoader.h"
 #import "CachedResourceRequest.h"
+#import "PlatformMediaResourceLoader.h"
 #import "SubresourceLoader.h"
 
 using namespace WebCore;
@@ -40,7 +39,7 @@
 NS_ASSUME_NONNULL_BEGIN
 
 @interface WebCoreNSURLSession ()
-@property (readonly) CachedResourceLoader& loader;
+@property (readonly) PlatformMediaResourceLoader& loader;
 @property (readwrite, retain) id<NSURLSessionTaskDelegate> delegate;
 - (void)taskCompleted:(WebCoreNSURLSessionDataTask *)task;
 - (void)addDelegateOperation:(void (^)(void))operation;
@@ -55,11 +54,11 @@
 - (void)_setDefersLoading:(BOOL)defers;
 @property (assign) WebCoreNSURLSession * _Nullable session;
 
-- (void)resource:(CachedResource*)resource sentBytes:(unsigned long long)bytesSent totalBytesToBeSent:(unsigned long long)totalBytesToBeSent;
-- (void)resource:(CachedResource*)resource receivedResponse:(const ResourceResponse&)response;
-- (void)resource:(CachedResource*)resource receivedData:(const char*)data length:(int)length;
-- (void)resource:(CachedResource*)resource receivedRedirect:(const ResourceResponse&)response request:(ResourceRequest&)request;
-- (void)resourceFinished:(CachedResource*)resource;
+- (void)resource:(PlatformMediaResource&)resource sentBytes:(unsigned long long)bytesSent totalBytesToBeSent:(unsigned long long)totalBytesToBeSent;
+- (void)resource:(PlatformMediaResource&)resource receivedResponse:(const ResourceResponse&)response;
+- (void)resource:(PlatformMediaResource&)resource receivedData:(const char*)data length:(int)length;
+- (void)resource:(PlatformMediaResource&)resource receivedRedirect:(const ResourceResponse&)response request:(ResourceRequest&)request;
+- (void)resourceFinished:(PlatformMediaResource&)resource;
 @end
 
 NS_ASSUME_NONNULL_END
@@ -67,7 +66,7 @@
 #pragma mark - WebCoreNSURLSession
 
 @implementation WebCoreNSURLSession
-- (id)initWithResourceLoader:(CachedResourceLoader&)loader delegate:(id<NSURLSessionTaskDelegate>)inDelegate delegateQueue:(NSOperationQueue*)inQueue
+- (id)initWithResourceLoader:(PlatformMediaResourceLoader&)loader delegate:(id<NSURLSessionTaskDelegate>)inDelegate delegateQueue:(NSOperationQueue*)inQueue
 {
     self = [super init];
     if (!self)
@@ -147,7 +146,7 @@
 }
 
 @dynamic loader;
-- (CachedResourceLoader&)loader
+- (PlatformMediaResourceLoader&)loader
 {
     return *_loader;
 }
@@ -288,44 +287,44 @@
 
 namespace WebCore {
 
-class WebCoreNSURLSessionDataTaskClient : public CachedRawResourceClient {
+class WebCoreNSURLSessionDataTaskClient : public PlatformMediaResourceClient {
 public:
     WebCoreNSURLSessionDataTaskClient(WebCoreNSURLSessionDataTask *task)
         : m_task(task)
     {
     }
 
-    void dataSent(CachedResource*, unsigned long long, unsigned long long) override;
-    void responseReceived(CachedResource*, const ResourceResponse&) override;
-    void dataReceived(CachedResource*, const char* /* data */, int /* length */) override;
-    void redirectReceived(CachedResource*, ResourceRequest&, const ResourceResponse&) override;
-    void notifyFinished(CachedResource*) override;
+    void responseReceived(PlatformMediaResource&, const ResourceResponse&) override;
+    void redirectReceived(PlatformMediaResource&, ResourceRequest&, const ResourceResponse&) override;
+    void dataSent(PlatformMediaResource&, unsigned long long, unsigned long long) override;
+    void dataReceived(PlatformMediaResource&, const char* /* data */, int /* length */) override;
+    void loadFinished(PlatformMediaResource&) override;
 
 private:
     WebCoreNSURLSessionDataTask *m_task;
 };
 
-void WebCoreNSURLSessionDataTaskClient::dataSent(CachedResource* resource, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
+void WebCoreNSURLSessionDataTaskClient::dataSent(PlatformMediaResource& resource, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
 {
     [m_task resource:resource sentBytes:bytesSent totalBytesToBeSent:totalBytesToBeSent];
 }
 
-void WebCoreNSURLSessionDataTaskClient::responseReceived(CachedResource* resource, const ResourceResponse& response)
+void WebCoreNSURLSessionDataTaskClient::responseReceived(PlatformMediaResource& resource, const ResourceResponse& response)
 {
     [m_task resource:resource receivedResponse:response];
 }
 
-void WebCoreNSURLSessionDataTaskClient::dataReceived(CachedResource* resource, const char* data, int length)
+void WebCoreNSURLSessionDataTaskClient::dataReceived(PlatformMediaResource& resource, const char* data, int length)
 {
     [m_task resource:resource receivedData:data length:length];
 }
 
-void WebCoreNSURLSessionDataTaskClient::redirectReceived(CachedResource* resource, ResourceRequest& request, const ResourceResponse& response)
+void WebCoreNSURLSessionDataTaskClient::redirectReceived(PlatformMediaResource& resource, ResourceRequest& request, const ResourceResponse& response)
 {
     [m_task resource:resource receivedRedirect:response request:request];
 }
 
-void WebCoreNSURLSessionDataTaskClient::notifyFinished(CachedResource* resource)
+void WebCoreNSURLSessionDataTaskClient::loadFinished(PlatformMediaResource& resource)
 {
     [m_task resourceFinished:resource];
 }
@@ -342,7 +341,6 @@
     self.state = NSURLSessionTaskStateSuspended;
     self.priority = NSURLSessionTaskPriorityDefault;
     self.originalRequest = self.currentRequest = [NSURLRequest requestWithURL:url];
-    _client = std::make_unique<WebCoreNSURLSessionDataTaskClient>(self);
 
     return self;
 }
@@ -354,7 +352,6 @@
     self.state = NSURLSessionTaskStateSuspended;
     self.priority = NSURLSessionTaskPriorityDefault;
     self.originalRequest = self.currentRequest = request;
-    _client = std::make_unique<WebCoreNSURLSessionDataTaskClient>(self);
 
     return self;
 }
@@ -372,19 +369,17 @@
     ASSERT(isMainThread());
     [self _cancel];
 
-    _request = std::make_unique<CachedResourceRequest>(self.originalRequest, ResourceLoaderOptions(SendCallbacks, DoNotSniffContent, DoNotBufferData, DoNotAllowStoredCredentials, DoNotAskClientForCrossOriginCredentials, ClientDidNotRequestCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading, CachingPolicy::DisallowCaching));
-    _resource = self.session.loader.requestRawResource(*_request);
+    _resource = self.session.loader.requestResource(self.originalRequest, 0);
     if (_resource)
-        _resource->addClient(_client.get());
+        _resource->setClient(std::make_unique<WebCoreNSURLSessionDataTaskClient>(self));
 }
 
 - (void)_cancel
 {
     ASSERT(isMainThread());
     if (_resource) {
-        if (SubresourceLoader* loader = _resource->loader())
-            loader->cancel(ResourceError());
-        _resource->removeClient(_client.get());
+        _resource->stop();
+        _resource->setClient(nullptr);
         _resource = nil;
     }
 }
@@ -393,14 +388,14 @@
 {
     ASSERT(isMainThread());
     if (_resource)
-        [self resourceFinished:_resource.get()];
+        [self resourceFinished:*_resource];
 }
 
 - (void)_setDefersLoading:(BOOL)defers
 {
     ASSERT(isMainThread());
-    if (_resource && _resource->loader())
-        _resource->loader()->setDefersLoading(defers);
+    if (_resource)
+        _resource->setDefersLoading(defers);
 }
 
 #pragma mark - NSURLSession API
@@ -464,19 +459,19 @@
     return @{ };
 }
 
-#pragma mark - CachedRawResourceClient callbacks
+#pragma mark - PlatformMediaResourceClient callbacks
 
-- (void)resource:(CachedResource*)resource sentBytes:(unsigned long long)bytesSent totalBytesToBeSent:(unsigned long long)totalBytesToBeSent
+- (void)resource:(PlatformMediaResource&)resource sentBytes:(unsigned long long)bytesSent totalBytesToBeSent:(unsigned long long)totalBytesToBeSent
 {
-    ASSERT_UNUSED(resource, resource == _resource);
+    ASSERT_UNUSED(resource, &resource == _resource);
     UNUSED_PARAM(bytesSent);
     UNUSED_PARAM(totalBytesToBeSent);
     // No-op.
 }
 
-- (void)resource:(CachedResource*)resource receivedResponse:(const ResourceResponse&)response
+- (void)resource:(PlatformMediaResource&)resource receivedResponse:(const ResourceResponse&)response
 {
-    ASSERT_UNUSED(resource, resource == _resource);
+    ASSERT_UNUSED(resource, &resource == _resource);
     ASSERT(isMainThread());
     _response = response.nsURLResponse();
     self.countOfBytesExpectedToReceive = response.expectedContentLength();
@@ -505,9 +500,9 @@
     }];
 }
 
-- (void)resource:(CachedResource*)resource receivedData:(const char*)data length:(int)length
+- (void)resource:(PlatformMediaResource&)resource receivedData:(const char*)data length:(int)length
 {
-    ASSERT_UNUSED(resource, resource == _resource);
+    ASSERT_UNUSED(resource, &resource == _resource);
     UNUSED_PARAM(data);
     UNUSED_PARAM(length);
     // FIXME: try to avoid a copy, if possible.
@@ -523,9 +518,9 @@
     }];
 }
 
-- (void)resource:(CachedResource*)resource receivedRedirect:(const ResourceResponse&)response request:(ResourceRequest&)request
+- (void)resource:(PlatformMediaResource&)resource receivedRedirect:(const ResourceResponse&)response request:(ResourceRequest&)request
 {
-    ASSERT_UNUSED(resource, resource == _resource);
+    ASSERT_UNUSED(resource, &resource == _resource);
     UNUSED_PARAM(response);
     UNUSED_PARAM(request);
     // FIXME: This cannot currently be implemented, as the callback is synchronous
@@ -536,9 +531,9 @@
     // API, this can be implemented.
 }
 
-- (void)resourceFinished:(CachedResource*)resource
+- (void)resourceFinished:(PlatformMediaResource&)resource
 {
-    ASSERT_UNUSED(resource, resource == _resource);
+    ASSERT_UNUSED(resource, &resource == _resource);
     self.state = NSURLSessionTaskStateCompleted;
 
     RetainPtr<WebCoreNSURLSessionDataTask> strongSelf { self };

Modified: trunk/Tools/ChangeLog (196505 => 196506)


--- trunk/Tools/ChangeLog	2016-02-12 22:04:08 UTC (rev 196505)
+++ trunk/Tools/ChangeLog	2016-02-12 22:13:31 UTC (rev 196506)
@@ -1,3 +1,21 @@
+2016-02-12  Jer Noble  <[email protected]>
+
+        [Mac] Adopt MediaResourceLoader (instead of CachedResourceLoader) in WebCoreNSURLSession.
+        https://bugs.webkit.org/show_bug.cgi?id=154136
+
+        Reviewed by Alex Christensen.
+
+        Use a MediaResourceLoader instead of a CachedResourceLoader for WebCoreNSURLSession.
+
+        Drive-by fix: generate USE and ENABLE macros for TestWebKitAPI by adding FEATURE_DEFINES
+        to GCC_PREPROCESSOR_DEFINES.
+
+        * TestWebKitAPI/Configurations/Base.xcconfig:
+        * TestWebKitAPI/Tests/WebCore/WebCoreNSURLSession.mm:
+        (TestWebKitAPI::WebCoreNSURLSessionTest::SetUp):
+        (TestWebKitAPI::WebCoreNSURLSessionTest::TearDown):
+        (TestWebKitAPI::TEST_F):
+
 2016-02-11  Dana Burkart  <[email protected]>
 
         Large logs can bring down the webkit master

Modified: trunk/Tools/TestWebKitAPI/Configurations/Base.xcconfig (196505 => 196506)


--- trunk/Tools/TestWebKitAPI/Configurations/Base.xcconfig	2016-02-12 22:04:08 UTC (rev 196505)
+++ trunk/Tools/TestWebKitAPI/Configurations/Base.xcconfig	2016-02-12 22:13:31 UTC (rev 196506)
@@ -36,7 +36,7 @@
 FRAMEWORK_SEARCH_PATHS_macosx = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks;
 
 GCC_NO_COMMON_BLOCKS = YES;
-GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) GTEST_HAS_TR1_TUPLE=0 GTEST_HAS_RTTI=0 $(GCC_PREPROCESSOR_DEFINITIONS_$(PLATFORM_NAME));
+GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(FEATURE_DEFINES) GTEST_HAS_TR1_TUPLE=0 GTEST_HAS_RTTI=0 $(GCC_PREPROCESSOR_DEFINITIONS_$(PLATFORM_NAME));
 GCC_PREPROCESSOR_DEFINITIONS_macosx = ENABLE_DASHBOARD_SUPPORT;
 DEBUG_INFORMATION_FORMAT = dwarf-with-dsym;
 PREBINDING = NO

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/WebCoreNSURLSession.mm (196505 => 196506)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/WebCoreNSURLSession.mm	2016-02-12 22:04:08 UTC (rev 196505)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/WebCoreNSURLSession.mm	2016-02-12 22:13:31 UTC (rev 196506)
@@ -36,6 +36,7 @@
 #import <WebCore/PageConfiguration.h>
 #import <WebCore/Document.h>
 #import <WebCore/DocumentLoader.h>
+#import <WebCore/MediaResourceLoader.h>
 #import <WebCore/Settings.h>
 #import <WebCore/SubresourceLoader.h>
 #import <WebCore/WebCoreNSURLSession.h>
@@ -106,6 +107,7 @@
     WebView *view { nil };
     Frame* frame { nullptr };
     TestNSURLSessionDataDelegate *delegate { nil };
+    RefPtr<MediaResourceLoader> loader;
 
     virtual void SetUp()
     {
@@ -121,18 +123,20 @@
 
         delegate = [[TestNSURLSessionDataDelegate alloc] init];
         frame = [view _mainCoreFrame];
+        loader = adoptRef(new MediaResourceLoader(*frame->document(), emptyString()));
     }
 
     virtual void TearDown()
     {
         [view release];
         [delegate release];
+        loader = nullptr;
     }
 };
 
 TEST_F(WebCoreNSURLSessionTest, BasicOperation)
 {
-    WebCoreNSURLSession* session = [[WebCoreNSURLSession alloc] initWithResourceLoader:frame->document()->loader()->cachedResourceLoader() delegate:delegate delegateQueue:[NSOperationQueue mainQueue]];
+    WebCoreNSURLSession* session = [[WebCoreNSURLSession alloc] initWithResourceLoader:*loader delegate:delegate delegateQueue:[NSOperationQueue mainQueue]];
     didRecieveResponse = false;
     didRecieveData = false;
     didComplete = false;
@@ -157,7 +161,7 @@
 
 TEST_F(WebCoreNSURLSessionTest, InvalidateEmpty)
 {
-    WebCoreNSURLSession* session = [[WebCoreNSURLSession alloc] initWithResourceLoader:frame->document()->loader()->cachedResourceLoader() delegate:delegate delegateQueue:[NSOperationQueue mainQueue]];
+    WebCoreNSURLSession* session = [[WebCoreNSURLSession alloc] initWithResourceLoader:*loader delegate:delegate delegateQueue:[NSOperationQueue mainQueue]];
     didInvalidate = false;
     [session finishTasksAndInvalidate];
     TestWebKitAPI::Util::run(&didInvalidate);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to