- Revision
- 185541
- Author
- [email protected]
- Date
- 2015-06-13 17:24:43 -0700 (Sat, 13 Jun 2015)
Log Message
Add private API to force page to always run at foreground priority
https://bugs.webkit.org/show_bug.cgi?id=145946
<rdar://problem/21267221>
Reviewed by Anders Carlsson.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):
- copy _alwaysRunsAtForegroundPriority to WebPageConfiguration.
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _alwaysRunsAtForegroundPriority]):
(-[WKWebViewConfiguration _setAlwaysRunsAtForegroundPriority:]):
- added _alwaysRunsAtForegroundPriority.
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
- added _alwaysRunsAtForegroundPriority.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
- initialize m_alwaysRunsAtForegroundPriority.
(WebKit::WebPageProxy::updateActivityToken):
- if m_alwaysRunsAtForegroundPriority is set always take the foreground activity token.
* UIProcess/WebPageProxy.h:
- added m_alwaysRunsAtForegroundPriority, alwaysRunsAtForegroundPriority.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (185540 => 185541)
--- trunk/Source/WebKit2/ChangeLog 2015-06-13 20:42:04 UTC (rev 185540)
+++ trunk/Source/WebKit2/ChangeLog 2015-06-14 00:24:43 UTC (rev 185541)
@@ -1,3 +1,29 @@
+2015-06-12 Gavin Barraclough <[email protected]>
+
+ Add private API to force page to always run at foreground priority
+ https://bugs.webkit.org/show_bug.cgi?id=145946
+ <rdar://problem/21267221>
+
+ Reviewed by Anders Carlsson.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView initWithFrame:configuration:]):
+ - copy _alwaysRunsAtForegroundPriority to WebPageConfiguration.
+ * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+ (-[WKWebViewConfiguration copyWithZone:]):
+ (-[WKWebViewConfiguration _alwaysRunsAtForegroundPriority]):
+ (-[WKWebViewConfiguration _setAlwaysRunsAtForegroundPriority:]):
+ - added _alwaysRunsAtForegroundPriority.
+ * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
+ - added _alwaysRunsAtForegroundPriority.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy):
+ - initialize m_alwaysRunsAtForegroundPriority.
+ (WebKit::WebPageProxy::updateActivityToken):
+ - if m_alwaysRunsAtForegroundPriority is set always take the foreground activity token.
+ * UIProcess/WebPageProxy.h:
+ - added m_alwaysRunsAtForegroundPriority, alwaysRunsAtForegroundPriority.
+
2015-06-12 Anders Carlsson <[email protected]>
Reimplement WKResourceCacheManagerRef on top of WKWebsiteDataStoreRef
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (185540 => 185541)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-06-13 20:42:04 UTC (rev 185540)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-06-14 00:24:43 UTC (rev 185541)
@@ -320,6 +320,8 @@
webPageConfiguration.preferenceValues.set(WebKit::WebPreferencesKey::suppressesIncrementalRenderingKey(), WebKit::WebPreferencesStore::Value(!![_configuration suppressesIncrementalRendering]));
#if PLATFORM(IOS)
+ webPageConfiguration.alwaysRunsAtForegroundPriority = [_configuration _alwaysRunsAtForegroundPriority];
+
webPageConfiguration.preferenceValues.set(WebKit::WebPreferencesKey::allowsInlineMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration allowsInlineMediaPlayback]));
webPageConfiguration.preferenceValues.set(WebKit::WebPreferencesKey::allowsAlternateFullscreenKey(), WebKit::WebPreferencesStore::Value(!![_configuration _allowsAlternateFullscreen] && shouldAllowAlternateFullscreen()));
webPageConfiguration.preferenceValues.set(WebKit::WebPreferencesKey::requiresUserGestureForMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration requiresUserActionForMediaPlayback]));
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (185540 => 185541)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2015-06-13 20:42:04 UTC (rev 185540)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2015-06-14 00:24:43 UTC (rev 185541)
@@ -94,6 +94,7 @@
#if PLATFORM(IOS)
LazyInitialized<RetainPtr<WKWebViewContentProviderRegistry>> _contentProviderRegistry;
BOOL _allowsAlternateFullscreen;
+ BOOL _alwaysRunsAtForegroundPriority;
#endif
}
@@ -140,6 +141,7 @@
#if PLATFORM(IOS)
configuration->_allowsInlineMediaPlayback = self->_allowsInlineMediaPlayback;
configuration->_allowsAlternateFullscreen = self->_allowsAlternateFullscreen;
+ configuration->_alwaysRunsAtForegroundPriority = _alwaysRunsAtForegroundPriority;
configuration->_requiresUserActionForMediaPlayback = self->_requiresUserActionForMediaPlayback;
configuration->_selectionGranularity = self->_selectionGranularity;
#endif
@@ -323,6 +325,16 @@
{
_allowsAlternateFullscreen = allowed;
}
+
+- (BOOL)_alwaysRunsAtForegroundPriority
+{
+ return _alwaysRunsAtForegroundPriority;
+}
+
+- (void)_setAlwaysRunsAtForegroundPriority:(BOOL)alwaysRunsAtForegroundPriority
+{
+ _alwaysRunsAtForegroundPriority = alwaysRunsAtForegroundPriority;
+}
#endif
@end
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h (185540 => 185541)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h 2015-06-13 20:42:04 UTC (rev 185540)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h 2015-06-14 00:24:43 UTC (rev 185541)
@@ -46,6 +46,8 @@
#if TARGET_OS_IPHONE
@property (nonatomic, setter=_setAllowsAlternateFullscreen:) BOOL _allowsAlternateFullscreen WK_AVAILABLE(NA, WK_IOS_TBA);
+
+@property (nonatomic, setter=_setAlwaysRunsAtForegroundPriority:) BOOL _alwaysRunsAtForegroundPriority WK_AVAILABLE(NA, WK_IOS_TBA);
#endif
@end
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (185540 => 185541)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-06-13 20:42:04 UTC (rev 185540)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-06-14 00:24:43 UTC (rev 185541)
@@ -309,6 +309,9 @@
, m_userMediaPermissionRequestManager(*this)
, m_viewState(ViewState::NoFlags)
, m_viewWasEverInWindow(false)
+#if PLATFORM(IOS)
+ , m_alwaysRunsAtForegroundPriority(configuration.alwaysRunsAtForegroundPriority)
+#endif
, m_backForwardList(WebBackForwardList::create(*this))
, m_maintainsInactiveSelection(false)
, m_isEditable(false)
@@ -1414,7 +1417,7 @@
m_pageIsUserObservableCount = m_process->processPool().userObservablePageCount();
#if PLATFORM(IOS)
- if (!isViewVisible())
+ if (!isViewVisible() && !m_alwaysRunsAtForegroundPriority)
m_activityToken = nullptr;
else if (!m_activityToken)
m_activityToken = m_process->throttler().foregroundActivityToken();
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (185540 => 185541)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2015-06-13 20:42:04 UTC (rev 185540)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2015-06-14 00:24:43 UTC (rev 185541)
@@ -262,6 +262,10 @@
bool treatsSHA1SignedCertificatesAsInsecure = false;
+#if PLATFORM(IOS)
+ bool alwaysRunsAtForegroundPriority = false;
+#endif
+
WebPreferencesStore::ValueMap preferenceValues;
};
@@ -1541,8 +1545,8 @@
WebCore::ViewState::Flags m_viewState;
bool m_viewWasEverInWindow;
-
#if PLATFORM(IOS)
+ bool m_alwaysRunsAtForegroundPriority;
ProcessThrottler::ForegroundActivityToken m_activityToken;
#endif