Title: [231857] branches/safari-606.1.17-branch/Source/WebKit
- Revision
- 231857
- Author
- bshaf...@apple.com
- Date
- 2018-05-16 11:47:28 -0700 (Wed, 16 May 2018)
Log Message
Cherry-pick r231824. rdar://problem/40278181
Post-review cleanup for 185459
https://bugs.webkit.org/show_bug.cgi?id=185665
<rdar://problem/40276689>
Reviewed by Tim Horton.
Jon made some comments in 185459 that I'm addressing here.
* UIProcess/Cocoa/DownloadClient.h:
* UIProcess/Cocoa/DownloadClient.mm: Guard the activity token for iOS
in a way that means it will still work ok on macOS.
(WebKit::DownloadClient::didStart):
(WebKit::DownloadClient::processDidCrash):
(WebKit::DownloadClient::didFinish):
(WebKit::DownloadClient::didFail):
(WebKit::DownloadClient::didCancel):
(WebKit::DownloadClient::takeActivityToken):
(WebKit::DownloadClient::releaseActivityTokenIfNecessary):
(WebKit::DownloadClient::releaseActivityToken): Deleted.
* UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Add an early return.
(-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231824 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-606.1.17-branch/Source/WebKit/ChangeLog (231856 => 231857)
--- branches/safari-606.1.17-branch/Source/WebKit/ChangeLog 2018-05-16 18:47:26 UTC (rev 231856)
+++ branches/safari-606.1.17-branch/Source/WebKit/ChangeLog 2018-05-16 18:47:28 UTC (rev 231857)
@@ -1,5 +1,59 @@
2018-05-16 Babak Shafiei <bshaf...@apple.com>
+ Cherry-pick r231824. rdar://problem/40278181
+
+ Post-review cleanup for 185459
+ https://bugs.webkit.org/show_bug.cgi?id=185665
+ <rdar://problem/40276689>
+
+ Reviewed by Tim Horton.
+
+ Jon made some comments in 185459 that I'm addressing here.
+
+ * UIProcess/Cocoa/DownloadClient.h:
+ * UIProcess/Cocoa/DownloadClient.mm: Guard the activity token for iOS
+ in a way that means it will still work ok on macOS.
+ (WebKit::DownloadClient::didStart):
+ (WebKit::DownloadClient::processDidCrash):
+ (WebKit::DownloadClient::didFinish):
+ (WebKit::DownloadClient::didFail):
+ (WebKit::DownloadClient::didCancel):
+ (WebKit::DownloadClient::takeActivityToken):
+ (WebKit::DownloadClient::releaseActivityTokenIfNecessary):
+ (WebKit::DownloadClient::releaseActivityToken): Deleted.
+
+ * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Add an early return.
+ (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231824 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2018-05-15 Dean Jackson <d...@apple.com>
+
+ Post-review cleanup for 185459
+ https://bugs.webkit.org/show_bug.cgi?id=185665
+ <rdar://problem/40276689>
+
+ Reviewed by Tim Horton.
+
+ Jon made some comments in 185459 that I'm addressing here.
+
+ * UIProcess/Cocoa/DownloadClient.h:
+ * UIProcess/Cocoa/DownloadClient.mm: Guard the activity token for iOS
+ in a way that means it will still work ok on macOS.
+ (WebKit::DownloadClient::didStart):
+ (WebKit::DownloadClient::processDidCrash):
+ (WebKit::DownloadClient::didFinish):
+ (WebKit::DownloadClient::didFail):
+ (WebKit::DownloadClient::didCancel):
+ (WebKit::DownloadClient::takeActivityToken):
+ (WebKit::DownloadClient::releaseActivityTokenIfNecessary):
+ (WebKit::DownloadClient::releaseActivityToken): Deleted.
+
+ * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Add an early return.
+ (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
+
+2018-05-16 Babak Shafiei <bshaf...@apple.com>
+
Cherry-pick r231814. rdar://problem/40267224
Provide UIView and UIImage for zoom transition
Modified: branches/safari-606.1.17-branch/Source/WebKit/UIProcess/Cocoa/DownloadClient.h (231856 => 231857)
--- branches/safari-606.1.17-branch/Source/WebKit/UIProcess/Cocoa/DownloadClient.h 2018-05-16 18:47:26 UTC (rev 231856)
+++ branches/safari-606.1.17-branch/Source/WebKit/UIProcess/Cocoa/DownloadClient.h 2018-05-16 18:47:28 UTC (rev 231857)
@@ -60,12 +60,17 @@
void didCreateDestination(WebProcessPool&, DownloadProxy&, const String&) final;
void processDidCrash(WebProcessPool&, DownloadProxy&) final;
-#if PLATFORM(IOS) && USE(SYSTEM_PREVIEW)
- void releaseActivityToken(DownloadProxy&);
+#if USE(SYSTEM_PREVIEW)
+ void takeActivityToken(DownloadProxy&);
+ void releaseActivityTokenIfNecessary(DownloadProxy&);
#endif
WeakObjCPtr<id <_WKDownloadDelegate>> m_delegate;
+#if PLATFORM(IOS) && USE(SYSTEM_PREVIEW)
+ ProcessThrottler::BackgroundActivityToken m_activityToken { nullptr };
+#endif
+
struct {
bool downloadDidStart : 1;
bool downloadDidReceiveResponse : 1;
@@ -81,10 +86,6 @@
bool downloadDidCreateDestination : 1;
bool downloadProcessDidCrash : 1;
} m_delegateMethods;
-
-#if PLATFORM(IOS) && USE(SYSTEM_PREVIEW)
- ProcessThrottler::BackgroundActivityToken m_activityToken;
-#endif
};
} // namespace WebKit
Modified: branches/safari-606.1.17-branch/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm (231856 => 231857)
--- branches/safari-606.1.17-branch/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm 2018-05-16 18:47:26 UTC (rev 231856)
+++ branches/safari-606.1.17-branch/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm 2018-05-16 18:47:28 UTC (rev 231857)
@@ -76,11 +76,7 @@
{
#if USE(SYSTEM_PREVIEW)
if (downloadProxy.isSystemPreviewDownload()) {
- if (auto* webPage = downloadProxy.originatingPage()) {
- RELEASE_LOG_IF(webPage->isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - UIProcess is taking a background assertion because it is downloading a system preview", this);
- ASSERT(!m_activityToken);
- m_activityToken = webPage->process().throttler().backgroundActivityToken();
- }
+ takeActivityToken(downloadProxy);
return;
}
#endif
@@ -179,8 +175,7 @@
{
#if USE(SYSTEM_PREVIEW)
if (downloadProxy.isSystemPreviewDownload()) {
- if (m_activityToken)
- releaseActivityToken(downloadProxy);
+ releaseActivityTokenIfNecessary(downloadProxy);
return;
}
#endif
@@ -228,8 +223,7 @@
NSURL *destinationURL = [NSURL fileURLWithPath:(NSString *)downloadProxy.destinationFilename()];
webPage->systemPreviewController()->finish(WebCore::URL(destinationURL));
}
- if (m_activityToken)
- releaseActivityToken(downloadProxy);
+ releaseActivityTokenIfNecessary(downloadProxy);
return;
}
#endif
@@ -244,8 +238,7 @@
if (downloadProxy.isSystemPreviewDownload()) {
if (auto* webPage = downloadProxy.originatingPage())
webPage->systemPreviewController()->cancel();
- if (m_activityToken)
- releaseActivityToken(downloadProxy);
+ releaseActivityTokenIfNecessary(downloadProxy);
return;
}
#endif
@@ -260,8 +253,7 @@
if (downloadProxy.isSystemPreviewDownload()) {
if (auto* webPage = downloadProxy.originatingPage())
webPage->systemPreviewController()->cancel();
- if (m_activityToken)
- releaseActivityToken(downloadProxy);
+ releaseActivityTokenIfNecessary(downloadProxy);
return;
}
#endif
@@ -278,14 +270,32 @@
completionHandler(WTFMove(request));
}
-#if PLATFORM(IOS) && USE(SYSTEM_PREVIEW)
-void DownloadClient::releaseActivityToken(DownloadProxy& downloadProxy)
+#if USE(SYSTEM_PREVIEW)
+void DownloadClient::takeActivityToken(DownloadProxy& downloadProxy)
{
- RELEASE_LOG_IF(downloadProxy.originatingPage()->isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p UIProcess is releasing a background assertion because a system preview download completed", this);
- ASSERT(m_activityToken);
- m_activityToken = nullptr;
+#if PLATFORM(IOS)
+ if (auto* webPage = downloadProxy.originatingPage()) {
+ RELEASE_LOG_IF(webPage->isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - UIProcess is taking a background assertion because it is downloading a system preview", this);
+ ASSERT(!m_activityToken);
+ m_activityToken = webPage->process().throttler().backgroundActivityToken();
+ }
+#else
+ UNUSED_PARAM(downloadProxy);
+#endif
}
+
+void DownloadClient::releaseActivityTokenIfNecessary(DownloadProxy& downloadProxy)
+{
+#if PLATFORM(IOS)
+ if (m_activityToken) {
+ RELEASE_LOG_IF(downloadProxy.originatingPage()->isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p UIProcess is releasing a background assertion because a system preview download completed", this);
+ m_activityToken = nullptr;
+ }
+#else
+ UNUSED_PARAM(downloadProxy);
#endif
+}
+#endif
} // namespace WebKit
Modified: branches/safari-606.1.17-branch/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm (231856 => 231857)
--- branches/safari-606.1.17-branch/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm 2018-05-16 18:47:26 UTC (rev 231856)
+++ branches/safari-606.1.17-branch/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm 2018-05-16 18:47:28 UTC (rev 231857)
@@ -74,20 +74,21 @@
- (id<QLPreviewItem>)previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index
{
- if (!_item) {
- _itemProvider = adoptNS([[NSItemProvider alloc] init]);
- NSString *contentType = @"public.content";
+ if (_item)
+ return _item.get();
+
+ _itemProvider = adoptNS([[NSItemProvider alloc] init]);
+ NSString *contentType = @"public.content";
#if USE(APPLE_INTERNAL_SDK)
- contentType = WebKit::getUTIForMIMEType(self.mimeType);
+ contentType = WebKit::getUTIForMIMEType(self.mimeType);
#endif
- _item = adoptNS([allocQLItemInstance() initWithPreviewItemProvider:_itemProvider.get() contentType:contentType previewTitle:@"Preview" fileSize:@(0)]);
- [_item setUseLoadingTimeout:NO];
+ _item = adoptNS([allocQLItemInstance() initWithPreviewItemProvider:_itemProvider.get() contentType:contentType previewTitle:@"Preview" fileSize:@(0)]);
+ [_item setUseLoadingTimeout:NO];
- [_itemProvider registerItemForTypeIdentifier:contentType loadHandler:^(NSItemProviderCompletionHandler completionHandler, Class expectedValueClass, NSDictionary * options) {
- // This will get called once the download completes.
- self.completionHandler = completionHandler;
- }];
- }
+ [_itemProvider registerItemForTypeIdentifier:contentType loadHandler:^(NSItemProviderCompletionHandler completionHandler, Class expectedValueClass, NSDictionary * options) {
+ // This will get called once the download completes.
+ self.completionHandler = completionHandler;
+ }];
return _item.get();
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes