Skip to content
Permalink
Browse files
[PSON] SuspendedPageProxy fails to release its process assertion if t…
…he WebPage fails to enter PageCache

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

Reviewed by Antti Koivisto.

SuspendedPageProxy fails to release its process assertion if the WebPage fails to enter PageCache, preventing
the process from suspending on iOS.

* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
(WebKit::SuspendedPageProxy::didReceiveMessage):
(WebKit::SuspendedPageProxy::didSuspend): Deleted.
(WebKit::SuspendedPageProxy::didFailToSuspend): Deleted.
* UIProcess/SuspendedPageProxy.h:


Canonical link: https://commits.webkit.org/207478@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239437 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed Dec 20, 2018
1 parent e2e0ce3 commit 4c3e1c3d91b20fa3c0ec351c4885e6e95c311d8e
Showing with 25 additions and 16 deletions.
  1. +17 −0 Source/WebKit/ChangeLog
  2. +6 −13 Source/WebKit/UIProcess/SuspendedPageProxy.cpp
  3. +2 −3 Source/WebKit/UIProcess/SuspendedPageProxy.h
@@ -1,3 +1,20 @@
2018-12-20 Chris Dumez <cdumez@apple.com>

[PSON] SuspendedPageProxy fails to release its process assertion if the WebPage fails to enter PageCache
https://bugs.webkit.org/show_bug.cgi?id=192873

Reviewed by Antti Koivisto.

SuspendedPageProxy fails to release its process assertion if the WebPage fails to enter PageCache, preventing
the process from suspending on iOS.

* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
(WebKit::SuspendedPageProxy::didReceiveMessage):
(WebKit::SuspendedPageProxy::didSuspend): Deleted.
(WebKit::SuspendedPageProxy::didFailToSuspend): Deleted.
* UIProcess/SuspendedPageProxy.h:

2018-12-19 Chris Dumez <cdumez@apple.com>

wtf/Optional.h: move-constructor and move-assignment operator should disengage the value being moved from
@@ -138,12 +138,14 @@ void SuspendedPageProxy::unsuspend()
m_process->send(Messages::WebPage::SetIsSuspended(false), m_page.pageID());
}

void SuspendedPageProxy::didSuspend()
void SuspendedPageProxy::didProcessRequestToSuspend(SuspensionState newSuspensionState)
{
LOG(ProcessSwapping, "SuspendedPageProxy %s from process %i finished transition to suspended", loggingString(), m_process->processIdentifier());

ASSERT(m_suspensionState == SuspensionState::Suspending);
m_suspensionState = SuspensionState::Suspended;
ASSERT(newSuspensionState == SuspensionState::Suspended || newSuspensionState == SuspensionState::FailedToSuspend);

m_suspensionState = newSuspensionState;

#if PLATFORM(IOS_FAMILY)
m_suspensionToken = nullptr;
@@ -153,26 +155,17 @@ void SuspendedPageProxy::didSuspend()
m_readyToUnsuspendHandler(this);
}

void SuspendedPageProxy::didFailToSuspend()
{
ASSERT(m_suspensionState == SuspensionState::Suspending);
m_suspensionState = SuspensionState::FailedToSuspend;

if (m_readyToUnsuspendHandler)
m_readyToUnsuspendHandler(this);
}

void SuspendedPageProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder& decoder)
{
ASSERT(decoder.messageReceiverName() == Messages::WebPageProxy::messageReceiverName());

if (decoder.messageName() == Messages::WebPageProxy::DidSuspendAfterProcessSwap::name()) {
didSuspend();
didProcessRequestToSuspend(SuspensionState::Suspended);
return;
}

if (decoder.messageName() == Messages::WebPageProxy::DidFailToSuspendAfterProcessSwap::name()) {
didFailToSuspend();
didProcessRequestToSuspend(SuspensionState::FailedToSuspend);
return;
}

@@ -57,8 +57,8 @@ class SuspendedPageProxy final: public IPC::MessageReceiver, public CanMakeWeakP
#endif

private:
void didSuspend();
void didFailToSuspend();
enum class SuspensionState : uint8_t { Suspending, FailedToSuspend, Suspended, Resumed };
void didProcessRequestToSuspend(SuspensionState);

// IPC::MessageReceiver
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
@@ -69,7 +69,6 @@ class SuspendedPageProxy final: public IPC::MessageReceiver, public CanMakeWeakP
uint64_t m_mainFrameID;
String m_registrableDomain;

enum class SuspensionState : uint8_t { Suspending, FailedToSuspend, Suspended, Resumed };
SuspensionState m_suspensionState { SuspensionState::Suspending };
CompletionHandler<void(SuspendedPageProxy*)> m_readyToUnsuspendHandler;
#if PLATFORM(IOS_FAMILY)

0 comments on commit 4c3e1c3

Please sign in to comment.