Diff
Modified: trunk/Source/WebKit/ChangeLog (235558 => 235559)
--- trunk/Source/WebKit/ChangeLog 2018-08-31 17:12:32 UTC (rev 235558)
+++ trunk/Source/WebKit/ChangeLog 2018-08-31 17:41:32 UTC (rev 235559)
@@ -1,3 +1,38 @@
+2018-08-31 Chris Dumez <[email protected]>
+
+ Rename ShouldProcessSwapIfPossible to ProcessSwapRequestedByClient for clarity
+ https://bugs.webkit.org/show_bug.cgi?id=189195
+
+ Reviewed by Alex Christensen.
+
+ Rename ShouldProcessSwapIfPossible to ProcessSwapRequestedByClient for clarity, since it indicates the client
+ requested a process swap via its navigation policy decision.
+
+ * UIProcess/API/C/WKFramePolicyListener.cpp:
+ (WKFramePolicyListenerUseInNewProcess):
+ (useWithPolicies):
+ (WKFramePolicyListenerUseWithPolicies):
+ (WKFramePolicyListenerUseInNewProcessWithPolicies):
+ * UIProcess/Cocoa/NavigationState.mm:
+ (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
+ * UIProcess/WebFramePolicyListenerProxy.cpp:
+ (WebKit::WebFramePolicyListenerProxy::use):
+ (WebKit::WebFramePolicyListenerProxy::download):
+ (WebKit::WebFramePolicyListenerProxy::ignore):
+ * UIProcess/WebFramePolicyListenerProxy.h:
+ * UIProcess/WebFrameProxy.cpp:
+ (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
+ * UIProcess/WebFrameProxy.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::decidePolicyForNavigationAction):
+ (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
+ (WebKit::WebPageProxy::decidePolicyForResponse):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::processForNavigation):
+ (WebKit::WebProcessPool::processForNavigationInternal):
+ * UIProcess/WebProcessPool.h:
+
2018-08-31 Aditya Keerthi <[email protected]>
[Datalist][iOS] Add suggestions UI for TextFieldInputTypes
Modified: trunk/Source/WebKit/UIProcess/API/C/WKFramePolicyListener.cpp (235558 => 235559)
--- trunk/Source/WebKit/UIProcess/API/C/WKFramePolicyListener.cpp 2018-08-31 17:12:32 UTC (rev 235558)
+++ trunk/Source/WebKit/UIProcess/API/C/WKFramePolicyListener.cpp 2018-08-31 17:41:32 UTC (rev 235559)
@@ -48,10 +48,10 @@
void WKFramePolicyListenerUseInNewProcess(WKFramePolicyListenerRef policyListenerRef)
{
- toImpl(policyListenerRef)->use(nullptr, ShouldProcessSwapIfPossible::Yes);
+ toImpl(policyListenerRef)->use(nullptr, ProcessSwapRequestedByClient::Yes);
}
-static void useWithPolicies(WKFramePolicyListenerRef policyListenerRef, WKWebsitePoliciesRef websitePolicies, ShouldProcessSwapIfPossible shouldProcessSwapIfPossible)
+static void useWithPolicies(WKFramePolicyListenerRef policyListenerRef, WKWebsitePoliciesRef websitePolicies, ProcessSwapRequestedByClient processSwapRequestedByClient)
{
if (auto* websiteDataStore = toImpl(websitePolicies)->websiteDataStore()) {
auto sessionID = websiteDataStore->websiteDataStore().sessionID();
@@ -58,17 +58,17 @@
RELEASE_ASSERT_WITH_MESSAGE(sessionID.isEphemeral() || sessionID == PAL::SessionID::defaultSessionID(), "If WebsitePolicies specifies a WebsiteDataStore, the data store's session must be default or non-persistent.");
}
- toImpl(policyListenerRef)->use(toImpl(websitePolicies), shouldProcessSwapIfPossible);
+ toImpl(policyListenerRef)->use(toImpl(websitePolicies), processSwapRequestedByClient);
}
void WKFramePolicyListenerUseWithPolicies(WKFramePolicyListenerRef policyListenerRef, WKWebsitePoliciesRef websitePolicies)
{
- useWithPolicies(policyListenerRef, websitePolicies, ShouldProcessSwapIfPossible::No);
+ useWithPolicies(policyListenerRef, websitePolicies, ProcessSwapRequestedByClient::No);
}
void WKFramePolicyListenerUseInNewProcessWithPolicies(WKFramePolicyListenerRef policyListenerRef, WKWebsitePoliciesRef websitePolicies)
{
- useWithPolicies(policyListenerRef, websitePolicies, ShouldProcessSwapIfPossible::Yes);
+ useWithPolicies(policyListenerRef, websitePolicies, ProcessSwapRequestedByClient::Yes);
}
void WKFramePolicyListenerDownload(WKFramePolicyListenerRef policyListenerRef)
Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm (235558 => 235559)
--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2018-08-31 17:12:32 UTC (rev 235558)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2018-08-31 17:41:32 UTC (rev 235559)
@@ -552,7 +552,7 @@
return;
}
- localListener->use(websitePolicies.get(), actionPolicy == _WKNavigationActionPolicyAllowInNewProcess ? ShouldProcessSwapIfPossible::Yes : ShouldProcessSwapIfPossible::No);
+ localListener->use(websitePolicies.get(), actionPolicy == _WKNavigationActionPolicyAllowInNewProcess ? ProcessSwapRequestedByClient::Yes : ProcessSwapRequestedByClient::No);
});
break;
Modified: trunk/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp (235558 => 235559)
--- trunk/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp 2018-08-31 17:12:32 UTC (rev 235558)
+++ trunk/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp 2018-08-31 17:41:32 UTC (rev 235559)
@@ -55,25 +55,25 @@
m_safeBrowsingResults = WTFMove(safeBrowsingResults);
}
-void WebFramePolicyListenerProxy::use(API::WebsitePolicies* policies, ShouldProcessSwapIfPossible swap)
+void WebFramePolicyListenerProxy::use(API::WebsitePolicies* policies, ProcessSwapRequestedByClient processSwapRequestedByClient)
{
if (m_safeBrowsingResults) {
if (m_reply)
- m_reply(WebCore::PolicyAction::Use, policies, swap, WTFMove(*m_safeBrowsingResults));
+ m_reply(WebCore::PolicyAction::Use, policies, processSwapRequestedByClient, WTFMove(*m_safeBrowsingResults));
} else if (!m_policyResult)
- m_policyResult = {{ policies, swap }};
+ m_policyResult = {{ policies, processSwapRequestedByClient }};
}
void WebFramePolicyListenerProxy::download()
{
if (m_reply)
- m_reply(WebCore::PolicyAction::Download, nullptr, ShouldProcessSwapIfPossible::No, { });
+ m_reply(WebCore::PolicyAction::Download, nullptr, ProcessSwapRequestedByClient::No, { });
}
void WebFramePolicyListenerProxy::ignore()
{
if (m_reply)
- m_reply(WebCore::PolicyAction::Ignore, nullptr, ShouldProcessSwapIfPossible::No, { });
+ m_reply(WebCore::PolicyAction::Ignore, nullptr, ProcessSwapRequestedByClient::No, { });
}
} // namespace WebKit
Modified: trunk/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h (235558 => 235559)
--- trunk/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h 2018-08-31 17:12:32 UTC (rev 235558)
+++ trunk/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h 2018-08-31 17:41:32 UTC (rev 235559)
@@ -41,13 +41,13 @@
class SafeBrowsingResult;
-enum class ShouldProcessSwapIfPossible { No, Yes };
+enum class ProcessSwapRequestedByClient { No, Yes };
enum class ShouldExpectSafeBrowsingResult { No, Yes };
class WebFramePolicyListenerProxy : public API::ObjectImpl<API::Object::Type::FramePolicyListener> {
public:
- using Reply = CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible, Vector<SafeBrowsingResult>&&)>;
+ using Reply = CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, Vector<SafeBrowsingResult>&&)>;
static Ref<WebFramePolicyListenerProxy> create(Reply&& reply, ShouldExpectSafeBrowsingResult expect)
{
return adoptRef(*new WebFramePolicyListenerProxy(WTFMove(reply), expect));
@@ -54,7 +54,7 @@
}
~WebFramePolicyListenerProxy();
- void use(API::WebsitePolicies* = nullptr, ShouldProcessSwapIfPossible = ShouldProcessSwapIfPossible::No);
+ void use(API::WebsitePolicies* = nullptr, ProcessSwapRequestedByClient = ProcessSwapRequestedByClient::No);
void download();
void ignore();
@@ -63,7 +63,7 @@
private:
WebFramePolicyListenerProxy(Reply&&, ShouldExpectSafeBrowsingResult);
- std::optional<std::pair<RefPtr<API::WebsitePolicies>, ShouldProcessSwapIfPossible>> m_policyResult;
+ std::optional<std::pair<RefPtr<API::WebsitePolicies>, ProcessSwapRequestedByClient>> m_policyResult;
std::optional<Vector<SafeBrowsingResult>> m_safeBrowsingResults;
Reply m_reply;
};
Modified: trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp (235558 => 235559)
--- trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp 2018-08-31 17:12:32 UTC (rev 235558)
+++ trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp 2018-08-31 17:41:32 UTC (rev 235559)
@@ -177,12 +177,12 @@
m_title = title;
}
-WebFramePolicyListenerProxy& WebFrameProxy::setUpPolicyListenerProxy(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible, Vector<SafeBrowsingResult>&&)>&& completionHandler, ShouldExpectSafeBrowsingResult expect)
+WebFramePolicyListenerProxy& WebFrameProxy::setUpPolicyListenerProxy(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, Vector<SafeBrowsingResult>&&)>&& completionHandler, ShouldExpectSafeBrowsingResult expect)
{
if (m_activeListener)
m_activeListener->ignore();
- m_activeListener = WebFramePolicyListenerProxy::create([this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)] (WebCore::PolicyAction action, API::WebsitePolicies* policies, ShouldProcessSwapIfPossible swap, Vector<SafeBrowsingResult>&& safeBrowsingResults) mutable {
- completionHandler(action, policies, swap, WTFMove(safeBrowsingResults));
+ m_activeListener = WebFramePolicyListenerProxy::create([this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)] (WebCore::PolicyAction action, API::WebsitePolicies* policies, ProcessSwapRequestedByClient processSwapRequestedByClient, Vector<SafeBrowsingResult>&& safeBrowsingResults) mutable {
+ completionHandler(action, policies, processSwapRequestedByClient, WTFMove(safeBrowsingResults));
m_activeListener = nullptr;
}, expect);
return *m_activeListener;
Modified: trunk/Source/WebKit/UIProcess/WebFrameProxy.h (235558 => 235559)
--- trunk/Source/WebKit/UIProcess/WebFrameProxy.h 2018-08-31 17:12:32 UTC (rev 235558)
+++ trunk/Source/WebKit/UIProcess/WebFrameProxy.h 2018-08-31 17:41:32 UTC (rev 235559)
@@ -54,7 +54,7 @@
class WebPageProxy;
class WebsiteDataStore;
enum class ShouldExpectSafeBrowsingResult;
-enum class ShouldProcessSwapIfPossible;
+enum class ProcessSwapRequestedByClient;
struct WebsitePoliciesData;
typedef GenericCallback<API::Data*> DataCallback;
@@ -117,7 +117,7 @@
void didSameDocumentNavigation(const WebCore::URL&); // eg. anchor navigation, session state change.
void didChangeTitle(const String&);
- WebFramePolicyListenerProxy& setUpPolicyListenerProxy(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible, Vector<SafeBrowsingResult>&&)>&&, ShouldExpectSafeBrowsingResult);
+ WebFramePolicyListenerProxy& setUpPolicyListenerProxy(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, Vector<SafeBrowsingResult>&&)>&&, ShouldExpectSafeBrowsingResult);
#if ENABLE(CONTENT_FILTERING)
void contentFilterDidBlockLoad(WebCore::ContentFilterUnblockHandler contentFilterUnblockHandler) { m_contentFilterUnblockHandler = WTFMove(contentFilterUnblockHandler); }
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (235558 => 235559)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-08-31 17:12:32 UTC (rev 235558)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-08-31 17:41:32 UTC (rev 235559)
@@ -4013,7 +4013,7 @@
UNUSED_PARAM(newNavigationID);
#endif
- auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frame = makeRef(*frame), sender = sender.copyRef(), navigation] (WebCore::PolicyAction policyAction, API::WebsitePolicies* policies, ShouldProcessSwapIfPossible swap, Vector<SafeBrowsingResult>&&) mutable {
+ auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frame = makeRef(*frame), sender = sender.copyRef(), navigation] (WebCore::PolicyAction policyAction, API::WebsitePolicies* policies, ProcessSwapRequestedByClient processSwapRequestedByClient, Vector<SafeBrowsingResult>&&) mutable {
// FIXME: do something with the SafeBrowsingResults.
std::optional<WebsitePoliciesData> data;
@@ -4024,7 +4024,7 @@
}
if (policyAction == PolicyAction::Use && frame->isMainFrame()) {
- auto proposedProcess = process().processPool().processForNavigation(*this, *navigation, swap, policyAction);
+ auto proposedProcess = process().processPool().processForNavigation(*this, *navigation, processSwapRequestedByClient, policyAction);
if (proposedProcess.ptr() != &process()) {
LOG(ProcessSwapping, "(ProcessSwapping) Switching from process %i to new process (%i) for navigation %" PRIu64 " '%s'", processIdentifier(), proposedProcess->processIdentifier(), navigation->navigationID(), navigation->loggingString());
@@ -4084,9 +4084,9 @@
MESSAGE_CHECK(frame);
MESSAGE_CHECK_URL(request.url());
- auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), listenerID, frameID] (WebCore::PolicyAction policyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible swap, Vector<SafeBrowsingResult>&& safeBrowsingResults) mutable {
+ auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), listenerID, frameID] (WebCore::PolicyAction policyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient processSwapRequestedByClient, Vector<SafeBrowsingResult>&& safeBrowsingResults) mutable {
// FIXME: Assert the API::WebsitePolicies* is nullptr here once clients of WKFramePolicyListenerUseWithPolicies go away.
- RELEASE_ASSERT(swap == ShouldProcessSwapIfPossible::No);
+ RELEASE_ASSERT(processSwapRequestedByClient == ProcessSwapRequestedByClient::No);
ASSERT_UNUSED(safeBrowsingResults, safeBrowsingResults.isEmpty());
receivedPolicyDecision(policyAction, nullptr, std::nullopt, PolicyDecisionSender::create([this, protectedThis = WTFMove(protectedThis), frameID, listenerID] (auto... args) {
m_process->send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, args...), m_pageID);
@@ -4120,9 +4120,9 @@
MESSAGE_CHECK_URL(response.url());
RefPtr<API::Navigation> navigation = navigationID ? &m_navigationState->navigation(navigationID) : nullptr;
- auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frameID, listenerID, navigation = WTFMove(navigation)] (WebCore::PolicyAction policyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible swap, Vector<SafeBrowsingResult>&& safeBrowsingResults) mutable {
+ auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frameID, listenerID, navigation = WTFMove(navigation)] (WebCore::PolicyAction policyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient processSwapRequestedByClient, Vector<SafeBrowsingResult>&& safeBrowsingResults) mutable {
// FIXME: Assert the API::WebsitePolicies* is nullptr here once clients of WKFramePolicyListenerUseWithPolicies go away.
- RELEASE_ASSERT(swap == ShouldProcessSwapIfPossible::No);
+ RELEASE_ASSERT(processSwapRequestedByClient == ProcessSwapRequestedByClient::No);
ASSERT_UNUSED(safeBrowsingResults, safeBrowsingResults.isEmpty());
receivedPolicyDecision(policyAction, navigation.get(), std::nullopt, PolicyDecisionSender::create([this, protectedThis = WTFMove(protectedThis), frameID, listenerID] (auto... args) {
m_process->send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, args...), m_pageID);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (235558 => 235559)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-08-31 17:12:32 UTC (rev 235558)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-08-31 17:41:32 UTC (rev 235559)
@@ -258,7 +258,7 @@
struct WebPopupItem;
struct URLSchemeTaskParameters;
-enum class ShouldProcessSwapIfPossible;
+enum class ProcessSwapRequestedByClient;
enum class UndoOrRedo;
#if USE(QUICK_LOOK)
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (235558 => 235559)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2018-08-31 17:12:32 UTC (rev 235558)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2018-08-31 17:41:32 UTC (rev 235559)
@@ -2126,9 +2126,9 @@
m_swappedProcessesPerRegistrableDomain.remove(registrableDomain);
}
-Ref<WebProcessProxy> WebProcessPool::processForNavigation(WebPageProxy& page, const API::Navigation& navigation, ShouldProcessSwapIfPossible shouldProcessSwapIfPossible, PolicyAction& action)
+Ref<WebProcessProxy> WebProcessPool::processForNavigation(WebPageProxy& page, const API::Navigation& navigation, ProcessSwapRequestedByClient processSwapRequestedByClient, PolicyAction& action)
{
- auto process = processForNavigationInternal(page, navigation, shouldProcessSwapIfPossible, action);
+ auto process = processForNavigationInternal(page, navigation, processSwapRequestedByClient, action);
if (m_configuration->alwaysKeepAndReuseSwappedProcesses() && process.ptr() != &page.process()) {
static std::once_flag onceFlag;
@@ -2144,9 +2144,9 @@
return process;
}
-Ref<WebProcessProxy> WebProcessPool::processForNavigationInternal(WebPageProxy& page, const API::Navigation& navigation, ShouldProcessSwapIfPossible shouldProcessSwapIfPossible, PolicyAction& action)
+Ref<WebProcessProxy> WebProcessPool::processForNavigationInternal(WebPageProxy& page, const API::Navigation& navigation, ProcessSwapRequestedByClient processSwapRequestedByClient, PolicyAction& action)
{
- if (!m_configuration->processSwapsOnNavigation() && shouldProcessSwapIfPossible == ShouldProcessSwapIfPossible::No)
+ if (!m_configuration->processSwapsOnNavigation() && processSwapRequestedByClient == ProcessSwapRequestedByClient::No)
return page.process();
if (page.inspectorFrontendCount() > 0)
@@ -2190,7 +2190,7 @@
}
auto targetURL = navigation.currentRequest().url();
- if (shouldProcessSwapIfPossible == ShouldProcessSwapIfPossible::No) {
+ if (processSwapRequestedByClient == ProcessSwapRequestedByClient::No) {
if (navigation.treatAsSameOriginNavigation())
return page.process();
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (235558 => 235559)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.h 2018-08-31 17:12:32 UTC (rev 235558)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h 2018-08-31 17:41:32 UTC (rev 235559)
@@ -110,7 +110,7 @@
int webProcessThroughputQOS();
#endif
-enum class ShouldProcessSwapIfPossible;
+enum class ProcessSwapRequestedByClient;
class WebProcessPool final : public API::ObjectImpl<API::Object::Type::ProcessPool>, public CanMakeWeakPtr<WebProcessPool>, private IPC::MessageReceiver {
public:
@@ -450,7 +450,7 @@
BackgroundWebProcessToken backgroundWebProcessToken() const { return BackgroundWebProcessToken(m_backgroundWebProcessCounter.count()); }
#endif
- Ref<WebProcessProxy> processForNavigation(WebPageProxy&, const API::Navigation&, ShouldProcessSwapIfPossible, WebCore::PolicyAction&);
+ Ref<WebProcessProxy> processForNavigation(WebPageProxy&, const API::Navigation&, ProcessSwapRequestedByClient, WebCore::PolicyAction&);
void registerSuspendedPageProxy(SuspendedPageProxy&);
void unregisterSuspendedPageProxy(SuspendedPageProxy&);
void didReachGoodTimeToPrewarm();
@@ -470,7 +470,7 @@
void platformInitializeWebProcess(WebProcessCreationParameters&);
void platformInvalidateContext();
- Ref<WebProcessProxy> processForNavigationInternal(WebPageProxy&, const API::Navigation&, ShouldProcessSwapIfPossible, WebCore::PolicyAction&);
+ Ref<WebProcessProxy> processForNavigationInternal(WebPageProxy&, const API::Navigation&, ProcessSwapRequestedByClient, WebCore::PolicyAction&);
RefPtr<WebProcessProxy> tryTakePrewarmedProcess(WebsiteDataStore&);