<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[260856] trunk/Source/WebKit</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/260856">260856</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2020-04-28 17:03:23 -0700 (Tue, 28 Apr 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS][WK2] Drop process assertion logic for holding locked files
https://bugs.webkit.org/show_bug.cgi?id=206910

Reviewed by Alex Christensen.

Drop process assertion logic for holding locked files as it is causing issues and
should no longer be needed.

The intention of this code was that the Network Process would send a
SetIsHoldingLockedFiles(bool) IPC to the UIProcess whenever there are pending
SQLite transactions and the UIProcess would then take a process assertion on behalf
of the WebProcess (or release it) to prevent / allow suspension.

This approach has some issues:
1. It was noisy in terms of IPC
2. Because it relies on an IPC to the UIProcess to keep running, it was inherently
   racy
3. We already have logic to deal with suspension in the network / web processes.
   The UIProcess sends a PrepareForSuspension IPC to its child processes. In turn,
   those processes will make sure to suspend their database threads to prevent any
   further database work. The child processes would then respond to the
   PrepareForSuspension IPC to let the UIProcess know they are ready to suspend.
   The 2 approaches were conflicting, because after the PrepareForSuspension IPC is
   sent, the child process could process a transaction and send the
   SetIsHoldingLockedFiles() IPC to the UIProcess which would incorrectly cancel the
   suspension.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::NetworkProcess):
(WebKit::m_messagePortChannelRegistry): Deleted.
* NetworkProcess/NetworkProcess.h:
* Shared/WebSQLiteDatabaseTracker.cpp: Removed.
* Shared/WebSQLiteDatabaseTracker.h: Removed.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didClose):
(WebKit::NetworkProcessProxy::didSetAssertionState):
(WebKit::NetworkProcessProxy::setIsHoldingLockedFiles): Deleted.
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::shutDown):
(WebKit::WebProcessProxy::setIsHoldingLockedFiles): Deleted.
* UIProcess/WebProcessProxy.h:
* UIProcess/WebProcessProxy.messages.in:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebProcess.cpp:
(WebKit::m_nonVisibleProcessCleanupTimer):
(WebKit::m_webSQLiteDatabaseTracker): Deleted.
* WebProcess/WebProcess.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkProcesscpp">trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkProcessh">trunk/Source/WebKit/NetworkProcess/NetworkProcess.h</a></li>
<li><a href="#trunkSourceWebKitSourcesCocoatxt">trunk/Source/WebKit/SourcesCocoa.txt</a></li>
<li><a href="#trunkSourceWebKitUIProcessNetworkNetworkProcessProxycpp">trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessNetworkNetworkProcessProxyh">trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessNetworkNetworkProcessProxymessagesin">trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessProxycpp">trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessProxyh">trunk/Source/WebKit/UIProcess/WebProcessProxy.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessProxymessagesin">trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKitWebKitxcodeprojprojectpbxproj">trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebProcesscpp">trunk/Source/WebKit/WebProcess/WebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebProcessh">trunk/Source/WebKit/WebProcess/WebProcess.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitSharedWebSQLiteDatabaseTrackercpp">trunk/Source/WebKit/Shared/WebSQLiteDatabaseTracker.cpp</a></li>
<li><a href="#trunkSourceWebKitSharedWebSQLiteDatabaseTrackerh">trunk/Source/WebKit/Shared/WebSQLiteDatabaseTracker.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (260855 => 260856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2020-04-28 23:37:20 UTC (rev 260855)
+++ trunk/Source/WebKit/ChangeLog       2020-04-29 00:03:23 UTC (rev 260856)
</span><span class="lines">@@ -1,3 +1,55 @@
</span><ins>+2020-04-28  Chris Dumez  <cdumez@apple.com>
+
+        [iOS][WK2] Drop process assertion logic for holding locked files
+        https://bugs.webkit.org/show_bug.cgi?id=206910
+
+        Reviewed by Alex Christensen.
+
+        Drop process assertion logic for holding locked files as it is causing issues and
+        should no longer be needed.
+
+        The intention of this code was that the Network Process would send a
+        SetIsHoldingLockedFiles(bool) IPC to the UIProcess whenever there are pending
+        SQLite transactions and the UIProcess would then take a process assertion on behalf
+        of the WebProcess (or release it) to prevent / allow suspension.
+
+        This approach has some issues:
+        1. It was noisy in terms of IPC
+        2. Because it relies on an IPC to the UIProcess to keep running, it was inherently
+           racy
+        3. We already have logic to deal with suspension in the network / web processes.
+           The UIProcess sends a PrepareForSuspension IPC to its child processes. In turn,
+           those processes will make sure to suspend their database threads to prevent any
+           further database work. The child processes would then respond to the
+           PrepareForSuspension IPC to let the UIProcess know they are ready to suspend.
+           The 2 approaches were conflicting, because after the PrepareForSuspension IPC is
+           sent, the child process could process a transaction and send the
+           SetIsHoldingLockedFiles() IPC to the UIProcess which would incorrectly cancel the
+           suspension.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::NetworkProcess):
+        (WebKit::m_messagePortChannelRegistry): Deleted.
+        * NetworkProcess/NetworkProcess.h:
+        * Shared/WebSQLiteDatabaseTracker.cpp: Removed.
+        * Shared/WebSQLiteDatabaseTracker.h: Removed.
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::didClose):
+        (WebKit::NetworkProcessProxy::didSetAssertionState):
+        (WebKit::NetworkProcessProxy::setIsHoldingLockedFiles): Deleted.
+        * UIProcess/Network/NetworkProcessProxy.h:
+        * UIProcess/Network/NetworkProcessProxy.messages.in:
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::shutDown):
+        (WebKit::WebProcessProxy::setIsHoldingLockedFiles): Deleted.
+        * UIProcess/WebProcessProxy.h:
+        * UIProcess/WebProcessProxy.messages.in:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::m_nonVisibleProcessCleanupTimer):
+        (WebKit::m_webSQLiteDatabaseTracker): Deleted.
+        * WebProcess/WebProcess.h:
+
</ins><span class="cx"> 2020-04-28  Noam Rosenthal  <noam@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         Implement FCP (first contentful paint)
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (260855 => 260856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp    2020-04-28 23:37:20 UTC (rev 260855)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp       2020-04-29 00:03:23 UTC (rev 260856)
</span><span class="lines">@@ -151,9 +151,6 @@
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><span class="cx">     , m_networkContentRuleListManager(*this)
</span><span class="cx"> #endif
</span><del>-#if PLATFORM(IOS_FAMILY)
-    , m_webSQLiteDatabaseTracker([this](bool isHoldingLockedFiles) { parentProcessConnection()->send(Messages::NetworkProcessProxy::SetIsHoldingLockedFiles(isHoldingLockedFiles), 0); })
-#endif
</del><span class="cx">     , m_messagePortChannelRegistry(createMessagePortChannelRegistry(*this))
</span><span class="cx"> {
</span><span class="cx">     NetworkProcessPlatformStrategies::initialize();
</span><span class="lines">@@ -2210,13 +2207,9 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS_FAMILY) && ENABLE(INDEXED_DATABASE)
</span><span class="cx">     for (auto& server : m_webIDBServers.values())
</span><del>-        server->suspend(isSuspensionImminent ? WebIDBServer::ShouldForceStop::Yes : WebIDBServer::ShouldForceStop::No);
</del><ins>+        server->suspend(WebIDBServer::ShouldForceStop::Yes);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS_FAMILY)
-    m_webSQLiteDatabaseTracker.setIsSuspended(true);
-#endif
-
</del><span class="cx">     lowMemoryHandler(Critical::Yes);
</span><span class="cx"> 
</span><span class="cx">     RefPtr<CallbackAggregator> callbackAggregator = CallbackAggregator::create([this, completionHandler = WTFMove(completionHandler)]() mutable {
</span><span class="lines">@@ -2267,10 +2260,6 @@
</span><span class="cx"> 
</span><span class="cx"> void NetworkProcess::resume()
</span><span class="cx"> {
</span><del>-#if PLATFORM(IOS_FAMILY)
-    m_webSQLiteDatabaseTracker.setIsSuspended(false);
-#endif
-
</del><span class="cx">     platformProcessDidResume();
</span><span class="cx">     for (auto& connection : m_webProcessConnections.values())
</span><span class="cx">         connection->endSuspension();
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (260855 => 260856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h      2020-04-28 23:37:20 UTC (rev 260855)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2020-04-29 00:03:23 UTC (rev 260856)
</span><span class="lines">@@ -58,10 +58,6 @@
</span><span class="cx"> #include <wtf/RetainPtr.h>
</span><span class="cx"> #include <wtf/WeakPtr.h>
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS_FAMILY)
-#include "WebSQLiteDatabaseTracker.h"
-#endif
-
</del><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx"> typedef struct OpaqueCFHTTPCookieStorage*  CFHTTPCookieStorageRef;
</span><span class="cx"> #endif
</span><span class="lines">@@ -553,10 +549,6 @@
</span><span class="cx">     NetworkContentRuleListManager m_networkContentRuleListManager;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS_FAMILY)
-    WebSQLiteDatabaseTracker m_webSQLiteDatabaseTracker;
-#endif
-
</del><span class="cx">     Ref<WorkQueue> m_storageTaskQueue { WorkQueue::create("com.apple.WebKit.StorageTask") };
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebKitSharedWebSQLiteDatabaseTrackercpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit/Shared/WebSQLiteDatabaseTracker.cpp (260855 => 260856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/WebSQLiteDatabaseTracker.cpp  2020-04-28 23:37:20 UTC (rev 260855)
+++ trunk/Source/WebKit/Shared/WebSQLiteDatabaseTracker.cpp     2020-04-29 00:03:23 UTC (rev 260856)
</span><span class="lines">@@ -1,87 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WebSQLiteDatabaseTracker.h"
-
-#include "NetworkProcess.h"
-#include "NetworkProcessProxyMessages.h"
-#include "WebProcess.h"
-#include "WebProcessProxyMessages.h"
-#include <WebCore/SQLiteDatabaseTracker.h>
-
-namespace WebKit {
-using namespace WebCore;
-
-WebSQLiteDatabaseTracker::WebSQLiteDatabaseTracker(IsHoldingLockedFilesHandler&& isHoldingLockedFilesHandler)
-    : m_isHoldingLockedFilesHandler(WTFMove(isHoldingLockedFilesHandler))
-    , m_hysteresis([this](PAL::HysteresisState state) { setIsHoldingLockedFiles(state == PAL::HysteresisState::Started); })
-{
-    ASSERT(RunLoop::isMain());
-    SQLiteDatabaseTracker::setClient(this);
-}
-
-WebSQLiteDatabaseTracker::~WebSQLiteDatabaseTracker()
-{
-    ASSERT(RunLoop::isMain());
-    SQLiteDatabaseTracker::setClient(nullptr);
-
-    if (m_hysteresis.state() == PAL::HysteresisState::Started)
-        setIsHoldingLockedFiles(false);
-}
-
-void WebSQLiteDatabaseTracker::setIsSuspended(bool isSuspended)
-{
-    ASSERT(RunLoop::isMain());
-    m_isSuspended = isSuspended;
-}
-
-void WebSQLiteDatabaseTracker::willBeginFirstTransaction()
-{
-    RunLoop::main().dispatch([weakThis = makeWeakPtr(*this)] {
-        if (weakThis)
-            weakThis->m_hysteresis.start();
-    });
-}
-
-void WebSQLiteDatabaseTracker::didFinishLastTransaction()
-{
-    RunLoop::main().dispatch([weakThis = makeWeakPtr(*this)] {
-        if (weakThis)
-            weakThis->m_hysteresis.stop();
-    });
-}
-
-void WebSQLiteDatabaseTracker::setIsHoldingLockedFiles(bool isHoldingLockedFiles)
-{
-    ASSERT(RunLoop::isMain());
-
-    if (m_isSuspended)
-        return;
-
-    m_isHoldingLockedFilesHandler(isHoldingLockedFiles);
-}
-
-} // namespace WebKit
</del></span></pre></div>
<a id="trunkSourceWebKitSharedWebSQLiteDatabaseTrackerh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit/Shared/WebSQLiteDatabaseTracker.h (260855 => 260856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/WebSQLiteDatabaseTracker.h    2020-04-28 23:37:20 UTC (rev 260855)
+++ trunk/Source/WebKit/Shared/WebSQLiteDatabaseTracker.h       2020-04-29 00:03:23 UTC (rev 260856)
</span><span class="lines">@@ -1,58 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <WebCore/SQLiteDatabaseTrackerClient.h>
-#include <pal/HysteresisActivity.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/WeakPtr.h>
-
-namespace WebKit {
-
-// Use eager initialization for the WeakPtrFactory since we call makeWeakPtr() from a non-main thread.
-class WebSQLiteDatabaseTracker final : public WebCore::SQLiteDatabaseTrackerClient, public CanMakeWeakPtr<WebSQLiteDatabaseTracker, WeakPtrFactoryInitialization::Eager> {
-    WTF_MAKE_NONCOPYABLE(WebSQLiteDatabaseTracker)
-public:
-    using IsHoldingLockedFilesHandler = Function<void(bool)>;
-    explicit WebSQLiteDatabaseTracker(IsHoldingLockedFilesHandler&&);
-
-    ~WebSQLiteDatabaseTracker();
-
-    void setIsSuspended(bool);
-
-private:
-    void setIsHoldingLockedFiles(bool);
-
-    // WebCore::SQLiteDatabaseTrackerClient.
-    void willBeginFirstTransaction() final;
-    void didFinishLastTransaction() final;
-
-    IsHoldingLockedFilesHandler m_isHoldingLockedFilesHandler;
-    PAL::HysteresisActivity m_hysteresis;
-    bool m_isSuspended { false };
-};
-
-} // namespace WebKit
</del></span></pre></div>
<a id="trunkSourceWebKitSourcesCocoatxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/SourcesCocoa.txt (260855 => 260856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/SourcesCocoa.txt     2020-04-28 23:37:20 UTC (rev 260855)
+++ trunk/Source/WebKit/SourcesCocoa.txt        2020-04-29 00:03:23 UTC (rev 260856)
</span><span class="lines">@@ -134,7 +134,6 @@
</span><span class="cx"> Shared/DocumentEditingContext.mm
</span><span class="cx"> Shared/FocusedElementInformation.cpp
</span><span class="cx"> Shared/VisibleContentRectUpdateInfo.cpp
</span><del>-Shared/WebSQLiteDatabaseTracker.cpp
</del><span class="cx"> 
</span><span class="cx"> Shared/cf/ArgumentCodersCF.cpp @no-unify
</span><span class="cx"> Shared/cf/CookieStorageUtilsCF.mm
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessNetworkNetworkProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (260855 => 260856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp    2020-04-28 23:37:20 UTC (rev 260855)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp       2020-04-29 00:03:23 UTC (rev 260856)
</span><span class="lines">@@ -265,8 +265,6 @@
</span><span class="cx"> #if ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER)
</span><span class="cx">     m_customProtocolManagerProxy.invalidate();
</span><span class="cx"> #endif
</span><del>-
-    m_activityForHoldingLockedFiles = nullptr;
</del><span class="cx">     
</span><span class="cx">     m_syncAllCookiesActivity = nullptr;
</span><span class="cx">     m_syncAllCookiesCounter = 0;
</span><span class="lines">@@ -1180,19 +1178,6 @@
</span><span class="cx">     if (canSendMessage())
</span><span class="cx">         send(Messages::NetworkProcess::ProcessDidResume(), 0);
</span><span class="cx"> }
</span><del>-    
-void NetworkProcessProxy::setIsHoldingLockedFiles(bool isHoldingLockedFiles)
-{
-    if (!isHoldingLockedFiles) {
-        RELEASE_LOG(ProcessSuspension, "UIProcess is releasing a background assertion because the Network process is no longer holding locked files");
-        m_activityForHoldingLockedFiles = nullptr;
-        return;
-    }
-    if (!m_activityForHoldingLockedFiles) {
-        RELEASE_LOG(ProcessSuspension, "UIProcess is taking a background assertion because the Network process is holding locked files");
-        m_activityForHoldingLockedFiles = m_throttler.backgroundActivity("Holding locked files"_s).moveToUniquePtr();
-    }
-}
</del><span class="cx"> 
</span><span class="cx"> void NetworkProcessProxy::syncAllCookies()
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessNetworkNetworkProcessProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (260855 => 260856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h      2020-04-28 23:37:20 UTC (rev 260855)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2020-04-29 00:03:23 UTC (rev 260856)
</span><span class="lines">@@ -183,8 +183,6 @@
</span><span class="cx">     
</span><span class="cx">     void synthesizeAppIsBackground(bool background);
</span><span class="cx"> 
</span><del>-    void setIsHoldingLockedFiles(bool);
-
</del><span class="cx">     void syncAllCookies();
</span><span class="cx">     void didSyncAllCookies();
</span><span class="cx"> 
</span><span class="lines">@@ -303,7 +301,6 @@
</span><span class="cx">     LegacyCustomProtocolManagerProxy m_customProtocolManagerProxy;
</span><span class="cx"> #endif
</span><span class="cx">     ProcessThrottler m_throttler;
</span><del>-    std::unique_ptr<ProcessThrottler::BackgroundActivity> m_activityForHoldingLockedFiles;
</del><span class="cx">     std::unique_ptr<ProcessThrottler::BackgroundActivity> m_syncAllCookiesActivity;
</span><span class="cx">     ProcessThrottler::ActivityVariant m_activityFromWebProcesses;
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessNetworkNetworkProcessProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in (260855 => 260856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in    2020-04-28 23:37:20 UTC (rev 260855)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in       2020-04-29 00:03:23 UTC (rev 260856)
</span><span class="lines">@@ -34,8 +34,6 @@
</span><span class="cx">     TestProcessIncomingSyncMessagesWhenWaitingForSyncReply(WebKit::WebPageProxyIdentifier pageID) -> (bool handled) Synchronous
</span><span class="cx">     TerminateUnresponsiveServiceWorkerProcesses(WebCore::ProcessIdentifier processIdentifier)
</span><span class="cx"> 
</span><del>-    SetIsHoldingLockedFiles(bool isHoldingLockedFiles)
-
</del><span class="cx">     # Diagnostic messages logging
</span><span class="cx">     LogDiagnosticMessage(WebKit::WebPageProxyIdentifier pageID, String message, String description, enum:bool WebCore::ShouldSample shouldSample)
</span><span class="cx">     LogDiagnosticMessageWithResult(WebKit::WebPageProxyIdentifier pageID, String message, String description, uint32_t result, enum:bool WebCore::ShouldSample shouldSample)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (260855 => 260856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp        2020-04-28 23:37:20 UTC (rev 260855)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp   2020-04-29 00:03:23 UTC (rev 260856)
</span><span class="lines">@@ -413,7 +413,6 @@
</span><span class="cx"> 
</span><span class="cx">     m_responsivenessTimer.invalidate();
</span><span class="cx">     m_backgroundResponsivenessTimer.invalidate();
</span><del>-    m_activityForHoldingLockedFiles = nullptr;
</del><span class="cx">     m_audibleMediaActivity = WTF::nullopt;
</span><span class="cx"> 
</span><span class="cx">     for (auto& frame : copyToVector(m_frameMap.values()))
</span><span class="lines">@@ -1402,19 +1401,6 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebProcessProxy::setIsHoldingLockedFiles(bool isHoldingLockedFiles)
-{
-    if (!isHoldingLockedFiles) {
-        RELEASE_LOG(ProcessSuspension, "UIProcess is releasing a background assertion because the WebContent process is no longer holding locked files");
-        m_activityForHoldingLockedFiles = nullptr;
-        return;
-    }
-    if (!m_activityForHoldingLockedFiles) {
-        RELEASE_LOG(ProcessSuspension, "UIProcess is taking a background assertion because the WebContent process is holding locked files");
-        m_activityForHoldingLockedFiles = m_throttler.backgroundActivity("Holding locked files"_s).moveToUniquePtr();
-    }
-}
-
</del><span class="cx"> void WebProcessProxy::isResponsive(CompletionHandler<void(bool isWebProcessResponsive)>&& callback)
</span><span class="cx"> {
</span><span class="cx">     if (m_isResponsive == NoOrMaybe::No) {
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.h (260855 => 260856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessProxy.h  2020-04-28 23:37:20 UTC (rev 260855)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.h     2020-04-29 00:03:23 UTC (rev 260856)
</span><span class="lines">@@ -242,8 +242,6 @@
</span><span class="cx"> 
</span><span class="cx">     void windowServerConnectionStateChanged();
</span><span class="cx"> 
</span><del>-    void setIsHoldingLockedFiles(bool);
-
</del><span class="cx">     ProcessThrottler& throttler() { return m_throttler; }
</span><span class="cx"> 
</span><span class="cx">     void isResponsive(CompletionHandler<void(bool isWebProcessResponsive)>&&);
</span><span class="lines">@@ -537,7 +535,6 @@
</span><span class="cx"> 
</span><span class="cx">     int m_numberOfTimesSuddenTerminationWasDisabled;
</span><span class="cx">     ProcessThrottler m_throttler;
</span><del>-    std::unique_ptr<ProcessThrottler::BackgroundActivity> m_activityForHoldingLockedFiles;
</del><span class="cx">     ForegroundWebProcessToken m_foregroundToken;
</span><span class="cx">     BackgroundWebProcessToken m_backgroundToken;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in (260855 => 260856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in        2020-04-28 23:37:20 UTC (rev 260855)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in   2020-04-29 00:03:23 UTC (rev 260856)
</span><span class="lines">@@ -42,8 +42,6 @@
</span><span class="cx">     GetGPUProcessConnection() -> (struct WebKit::GPUProcessConnectionInfo connectionInfo) Synchronous
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    SetIsHoldingLockedFiles(bool isHoldingLockedFiles)
-
</del><span class="cx">     DidExceedActiveMemoryLimit()
</span><span class="cx">     DidExceedInactiveMemoryLimit()
</span><span class="cx">     DidExceedCPULimit()
</span></span></pre></div>
<a id="trunkSourceWebKitWebKitxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (260855 => 260856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj     2020-04-28 23:37:20 UTC (rev 260855)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj        2020-04-29 00:03:23 UTC (rev 260856)
</span><span class="lines">@@ -1324,7 +1324,6 @@
</span><span class="cx">          832AE2521BE2E8CD00FAAE10 /* NetworkCacheSpeculativeLoadManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 832AE2501BE2E8CD00FAAE10 /* NetworkCacheSpeculativeLoadManager.h */; };
</span><span class="cx">          832ED18C1E2FE157006BA64A /* PerActivityStateCPUUsageSampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 832ED18A1E2FE13B006BA64A /* PerActivityStateCPUUsageSampler.h */; };
</span><span class="cx">          834B250F1A831A8D00CFB150 /* NetworkCacheFileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 834B250E1A831A8D00CFB150 /* NetworkCacheFileSystem.h */; };
</span><del>-               836034A01ACB34D600626549 /* WebSQLiteDatabaseTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 8360349E1ACB34D600626549 /* WebSQLiteDatabaseTracker.h */; };
</del><span class="cx">           8372DB251A674C8F00C697C5 /* WKPageDiagnosticLoggingClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 8372DB241A674C8F00C697C5 /* WKPageDiagnosticLoggingClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          8372DB291A67562800C697C5 /* WebPageDiagnosticLoggingClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 8372DB271A67562800C697C5 /* WebPageDiagnosticLoggingClient.h */; };
</span><span class="cx">          8372DB2F1A677D4A00C697C5 /* WKDiagnosticLoggingResultType.h in Headers */ = {isa = PBXBuildFile; fileRef = 8372DB2E1A677D4A00C697C5 /* WKDiagnosticLoggingResultType.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -4324,8 +4323,6 @@
</span><span class="cx">          83397C6622124BD100B62388 /* WebProcessCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessCache.cpp; sourceTree = "<group>"; };
</span><span class="cx">          83397C6722124BD100B62388 /* WebProcessCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessCache.h; sourceTree = "<group>"; };
</span><span class="cx">          834B250E1A831A8D00CFB150 /* NetworkCacheFileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkCacheFileSystem.h; sourceTree = "<group>"; };
</span><del>-               8360349D1ACB34D600626549 /* WebSQLiteDatabaseTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSQLiteDatabaseTracker.cpp; sourceTree = "<group>"; };
-               8360349E1ACB34D600626549 /* WebSQLiteDatabaseTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSQLiteDatabaseTracker.h; sourceTree = "<group>"; };
</del><span class="cx">           8372DB241A674C8F00C697C5 /* WKPageDiagnosticLoggingClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageDiagnosticLoggingClient.h; sourceTree = "<group>"; };
</span><span class="cx">          8372DB261A67562800C697C5 /* WebPageDiagnosticLoggingClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageDiagnosticLoggingClient.cpp; sourceTree = "<group>"; };
</span><span class="cx">          8372DB271A67562800C697C5 /* WebPageDiagnosticLoggingClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageDiagnosticLoggingClient.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -6174,8 +6171,6 @@
</span><span class="cx">                          5C13024A1FE341A7000D9B31 /* WebsitePoliciesData.h */,
</span><span class="cx">                          0EDE85022004E74900030560 /* WebsitePopUpPolicy.h */,
</span><span class="cx">                          71FB810A2260627A00323677 /* WebsiteSimulatedMouseEventsDispatchPolicy.h */,
</span><del>-                               8360349D1ACB34D600626549 /* WebSQLiteDatabaseTracker.cpp */,
-                               8360349E1ACB34D600626549 /* WebSQLiteDatabaseTracker.h */,
</del><span class="cx">                           C0337DD7127A51B6008FF4F4 /* WebTouchEvent.cpp */,
</span><span class="cx">                          7C065F291C8CD95F00C2D950 /* WebUserContentControllerDataTypes.cpp */,
</span><span class="cx">                          7C065F2A1C8CD95F00C2D950 /* WebUserContentControllerDataTypes.h */,
</span><span class="lines">@@ -11370,7 +11365,6 @@
</span><span class="cx">                          417915AF2256BB7500D6F97E /* WebSocketChannel.h in Headers */,
</span><span class="cx">                          417915B12256C0D600D6F97E /* WebSocketChannelManager.h in Headers */,
</span><span class="cx">                          C149380922347104000CD707 /* WebSpeechSynthesisClient.h in Headers */,
</span><del>-                               836034A01ACB34D600626549 /* WebSQLiteDatabaseTracker.h in Headers */,
</del><span class="cx">                           1A52C0F81A38CDC70016160A /* WebStorageNamespaceProvider.h in Headers */,
</span><span class="cx">                          9356F2DC2152B6B500E6D5DF /* WebSWClientConnection.h in Headers */,
</span><span class="cx">                          517A53101F47A86200DCDC0A /* WebSWClientConnectionMessages.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (260855 => 260856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebProcess.cpp    2020-04-28 23:37:20 UTC (rev 260855)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp       2020-04-29 00:03:23 UTC (rev 260856)
</span><span class="lines">@@ -146,10 +146,6 @@
</span><span class="cx"> #include "UserMediaCaptureManager.h"
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS_FAMILY)
-#include "WebSQLiteDatabaseTracker.h"
-#endif
-
</del><span class="cx"> #if ENABLE(SEC_ITEM_SHIM)
</span><span class="cx"> #include "SecItemShim.h"
</span><span class="cx"> #endif
</span><span class="lines">@@ -227,9 +223,6 @@
</span><span class="cx">     , m_pluginProcessConnectionManager(PluginProcessConnectionManager::create())
</span><span class="cx"> #endif
</span><span class="cx">     , m_nonVisibleProcessCleanupTimer(*this, &WebProcess::nonVisibleProcessCleanupTimerFired)
</span><del>-#if PLATFORM(IOS_FAMILY)
-    , m_webSQLiteDatabaseTracker([this](bool isHoldingLockedFiles) { parentProcessConnection()->send(Messages::WebProcessProxy::SetIsHoldingLockedFiles(isHoldingLockedFiles), 0); })
-#endif
</del><span class="cx"> {
</span><span class="cx">     // Initialize our platform strategies.
</span><span class="cx">     WebPlatformStrategies::initialize();
</span><span class="lines">@@ -1439,7 +1432,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS_FAMILY)
</span><del>-    m_webSQLiteDatabaseTracker.setIsSuspended(true);
</del><span class="cx">     SQLiteDatabase::setIsDatabaseOpeningForbidden(true);
</span><span class="cx">     if (DatabaseTracker::isInitialized())
</span><span class="cx">         DatabaseTracker::singleton().closeAllDatabases(CurrentQueryBehavior::Interrupt);
</span><span class="lines">@@ -1518,7 +1510,6 @@
</span><span class="cx">     unfreezeAllLayerTrees();
</span><span class="cx">     
</span><span class="cx"> #if PLATFORM(IOS_FAMILY)
</span><del>-    m_webSQLiteDatabaseTracker.setIsSuspended(false);
</del><span class="cx">     SQLiteDatabase::setIsDatabaseOpeningForbidden(false);
</span><span class="cx">     accessibilityProcessSuspendedNotification(false);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (260855 => 260856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebProcess.h      2020-04-28 23:37:20 UTC (rev 260855)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h 2020-04-29 00:03:23 UTC (rev 260856)
</span><span class="lines">@@ -39,7 +39,6 @@
</span><span class="cx"> #include "WebInspectorInterruptDispatcher.h"
</span><span class="cx"> #include "WebPageProxyIdentifier.h"
</span><span class="cx"> #include "WebProcessCreationParameters.h"
</span><del>-#include "WebSQLiteDatabaseTracker.h"
</del><span class="cx"> #include "WebSocketChannelManager.h"
</span><span class="cx"> #include <WebCore/ActivityState.h>
</span><span class="cx"> #include <WebCore/FrameIdentifier.h>
</span><span class="lines">@@ -579,7 +578,6 @@
</span><span class="cx">     RefPtr<WebCore::ApplicationCacheStorage> m_applicationCacheStorage;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS_FAMILY)
</span><del>-    WebSQLiteDatabaseTracker m_webSQLiteDatabaseTracker;
</del><span class="cx">     std::unique_ptr<ProcessAssertion> m_uiProcessDependencyProcessAssertion;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>