Changeset 260856 in webkit
- Timestamp:
- Apr 28, 2020, 5:03:23 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r260851 r260856 1 2020-04-28 Chris Dumez <cdumez@apple.com> 2 3 [iOS][WK2] Drop process assertion logic for holding locked files 4 https://bugs.webkit.org/show_bug.cgi?id=206910 5 6 Reviewed by Alex Christensen. 7 8 Drop process assertion logic for holding locked files as it is causing issues and 9 should no longer be needed. 10 11 The intention of this code was that the Network Process would send a 12 SetIsHoldingLockedFiles(bool) IPC to the UIProcess whenever there are pending 13 SQLite transactions and the UIProcess would then take a process assertion on behalf 14 of the WebProcess (or release it) to prevent / allow suspension. 15 16 This approach has some issues: 17 1. It was noisy in terms of IPC 18 2. Because it relies on an IPC to the UIProcess to keep running, it was inherently 19 racy 20 3. We already have logic to deal with suspension in the network / web processes. 21 The UIProcess sends a PrepareForSuspension IPC to its child processes. In turn, 22 those processes will make sure to suspend their database threads to prevent any 23 further database work. The child processes would then respond to the 24 PrepareForSuspension IPC to let the UIProcess know they are ready to suspend. 25 The 2 approaches were conflicting, because after the PrepareForSuspension IPC is 26 sent, the child process could process a transaction and send the 27 SetIsHoldingLockedFiles() IPC to the UIProcess which would incorrectly cancel the 28 suspension. 29 30 * NetworkProcess/NetworkProcess.cpp: 31 (WebKit::NetworkProcess::NetworkProcess): 32 (WebKit::m_messagePortChannelRegistry): Deleted. 33 * NetworkProcess/NetworkProcess.h: 34 * Shared/WebSQLiteDatabaseTracker.cpp: Removed. 35 * Shared/WebSQLiteDatabaseTracker.h: Removed. 36 * UIProcess/Network/NetworkProcessProxy.cpp: 37 (WebKit::NetworkProcessProxy::didClose): 38 (WebKit::NetworkProcessProxy::didSetAssertionState): 39 (WebKit::NetworkProcessProxy::setIsHoldingLockedFiles): Deleted. 40 * UIProcess/Network/NetworkProcessProxy.h: 41 * UIProcess/Network/NetworkProcessProxy.messages.in: 42 * UIProcess/WebProcessProxy.cpp: 43 (WebKit::WebProcessProxy::shutDown): 44 (WebKit::WebProcessProxy::setIsHoldingLockedFiles): Deleted. 45 * UIProcess/WebProcessProxy.h: 46 * UIProcess/WebProcessProxy.messages.in: 47 * WebKit.xcodeproj/project.pbxproj: 48 * WebProcess/WebProcess.cpp: 49 (WebKit::m_nonVisibleProcessCleanupTimer): 50 (WebKit::m_webSQLiteDatabaseTracker): Deleted. 51 * WebProcess/WebProcess.h: 52 1 53 2020-04-28 Noam Rosenthal <noam@webkit.org> 2 54 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r260841 r260856 152 152 , m_networkContentRuleListManager(*this) 153 153 #endif 154 #if PLATFORM(IOS_FAMILY)155 , m_webSQLiteDatabaseTracker([this](bool isHoldingLockedFiles) { parentProcessConnection()->send(Messages::NetworkProcessProxy::SetIsHoldingLockedFiles(isHoldingLockedFiles), 0); })156 #endif157 154 , m_messagePortChannelRegistry(createMessagePortChannelRegistry(*this)) 158 155 { … … 2211 2208 #if PLATFORM(IOS_FAMILY) && ENABLE(INDEXED_DATABASE) 2212 2209 for (auto& server : m_webIDBServers.values()) 2213 server->suspend(isSuspensionImminent ? WebIDBServer::ShouldForceStop::Yes : WebIDBServer::ShouldForceStop::No); 2214 #endif 2215 2216 #if PLATFORM(IOS_FAMILY) 2217 m_webSQLiteDatabaseTracker.setIsSuspended(true); 2210 server->suspend(WebIDBServer::ShouldForceStop::Yes); 2218 2211 #endif 2219 2212 … … 2268 2261 void NetworkProcess::resume() 2269 2262 { 2270 #if PLATFORM(IOS_FAMILY)2271 m_webSQLiteDatabaseTracker.setIsSuspended(false);2272 #endif2273 2274 2263 platformProcessDidResume(); 2275 2264 for (auto& connection : m_webProcessConnections.values()) -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
r260841 r260856 58 58 #include <wtf/RetainPtr.h> 59 59 #include <wtf/WeakPtr.h> 60 61 #if PLATFORM(IOS_FAMILY)62 #include "WebSQLiteDatabaseTracker.h"63 #endif64 60 65 61 #if PLATFORM(COCOA) … … 554 550 #endif 555 551 556 #if PLATFORM(IOS_FAMILY)557 WebSQLiteDatabaseTracker m_webSQLiteDatabaseTracker;558 #endif559 560 552 Ref<WorkQueue> m_storageTaskQueue { WorkQueue::create("com.apple.WebKit.StorageTask") }; 561 553 -
trunk/Source/WebKit/SourcesCocoa.txt
r260739 r260856 135 135 Shared/FocusedElementInformation.cpp 136 136 Shared/VisibleContentRectUpdateInfo.cpp 137 Shared/WebSQLiteDatabaseTracker.cpp138 137 139 138 Shared/cf/ArgumentCodersCF.cpp @no-unify -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
r260841 r260856 266 266 m_customProtocolManagerProxy.invalidate(); 267 267 #endif 268 269 m_activityForHoldingLockedFiles = nullptr;270 268 271 269 m_syncAllCookiesActivity = nullptr; … … 1181 1179 send(Messages::NetworkProcess::ProcessDidResume(), 0); 1182 1180 } 1183 1184 void NetworkProcessProxy::setIsHoldingLockedFiles(bool isHoldingLockedFiles)1185 {1186 if (!isHoldingLockedFiles) {1187 RELEASE_LOG(ProcessSuspension, "UIProcess is releasing a background assertion because the Network process is no longer holding locked files");1188 m_activityForHoldingLockedFiles = nullptr;1189 return;1190 }1191 if (!m_activityForHoldingLockedFiles) {1192 RELEASE_LOG(ProcessSuspension, "UIProcess is taking a background assertion because the Network process is holding locked files");1193 m_activityForHoldingLockedFiles = m_throttler.backgroundActivity("Holding locked files"_s).moveToUniquePtr();1194 }1195 }1196 1181 1197 1182 void NetworkProcessProxy::syncAllCookies() -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
r260841 r260856 184 184 void synthesizeAppIsBackground(bool background); 185 185 186 void setIsHoldingLockedFiles(bool);187 188 186 void syncAllCookies(); 189 187 void didSyncAllCookies(); … … 304 302 #endif 305 303 ProcessThrottler m_throttler; 306 std::unique_ptr<ProcessThrottler::BackgroundActivity> m_activityForHoldingLockedFiles;307 304 std::unique_ptr<ProcessThrottler::BackgroundActivity> m_syncAllCookiesActivity; 308 305 ProcessThrottler::ActivityVariant m_activityFromWebProcesses; -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in
r260658 r260856 34 34 TestProcessIncomingSyncMessagesWhenWaitingForSyncReply(WebKit::WebPageProxyIdentifier pageID) -> (bool handled) Synchronous 35 35 TerminateUnresponsiveServiceWorkerProcesses(WebCore::ProcessIdentifier processIdentifier) 36 37 SetIsHoldingLockedFiles(bool isHoldingLockedFiles)38 36 39 37 # Diagnostic messages logging -
trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp
r260707 r260856 414 414 m_responsivenessTimer.invalidate(); 415 415 m_backgroundResponsivenessTimer.invalidate(); 416 m_activityForHoldingLockedFiles = nullptr;417 416 m_audibleMediaActivity = WTF::nullopt; 418 417 … … 1403 1402 } 1404 1403 1405 void WebProcessProxy::setIsHoldingLockedFiles(bool isHoldingLockedFiles)1406 {1407 if (!isHoldingLockedFiles) {1408 RELEASE_LOG(ProcessSuspension, "UIProcess is releasing a background assertion because the WebContent process is no longer holding locked files");1409 m_activityForHoldingLockedFiles = nullptr;1410 return;1411 }1412 if (!m_activityForHoldingLockedFiles) {1413 RELEASE_LOG(ProcessSuspension, "UIProcess is taking a background assertion because the WebContent process is holding locked files");1414 m_activityForHoldingLockedFiles = m_throttler.backgroundActivity("Holding locked files"_s).moveToUniquePtr();1415 }1416 }1417 1418 1404 void WebProcessProxy::isResponsive(CompletionHandler<void(bool isWebProcessResponsive)>&& callback) 1419 1405 { -
trunk/Source/WebKit/UIProcess/WebProcessProxy.h
r260453 r260856 243 243 void windowServerConnectionStateChanged(); 244 244 245 void setIsHoldingLockedFiles(bool);246 247 245 ProcessThrottler& throttler() { return m_throttler; } 248 246 … … 538 536 int m_numberOfTimesSuddenTerminationWasDisabled; 539 537 ProcessThrottler m_throttler; 540 std::unique_ptr<ProcessThrottler::BackgroundActivity> m_activityForHoldingLockedFiles;541 538 ForegroundWebProcessToken m_foregroundToken; 542 539 BackgroundWebProcessToken m_backgroundToken; -
trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in
r259200 r260856 43 43 #endif 44 44 45 SetIsHoldingLockedFiles(bool isHoldingLockedFiles)46 47 45 DidExceedActiveMemoryLimit() 48 46 DidExceedInactiveMemoryLimit() -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r260842 r260856 1325 1325 832ED18C1E2FE157006BA64A /* PerActivityStateCPUUsageSampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 832ED18A1E2FE13B006BA64A /* PerActivityStateCPUUsageSampler.h */; }; 1326 1326 834B250F1A831A8D00CFB150 /* NetworkCacheFileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 834B250E1A831A8D00CFB150 /* NetworkCacheFileSystem.h */; }; 1327 836034A01ACB34D600626549 /* WebSQLiteDatabaseTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 8360349E1ACB34D600626549 /* WebSQLiteDatabaseTracker.h */; };1328 1327 8372DB251A674C8F00C697C5 /* WKPageDiagnosticLoggingClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 8372DB241A674C8F00C697C5 /* WKPageDiagnosticLoggingClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1329 1328 8372DB291A67562800C697C5 /* WebPageDiagnosticLoggingClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 8372DB271A67562800C697C5 /* WebPageDiagnosticLoggingClient.h */; }; … … 4325 4324 83397C6722124BD100B62388 /* WebProcessCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessCache.h; sourceTree = "<group>"; }; 4326 4325 834B250E1A831A8D00CFB150 /* NetworkCacheFileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkCacheFileSystem.h; sourceTree = "<group>"; }; 4327 8360349D1ACB34D600626549 /* WebSQLiteDatabaseTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSQLiteDatabaseTracker.cpp; sourceTree = "<group>"; };4328 8360349E1ACB34D600626549 /* WebSQLiteDatabaseTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSQLiteDatabaseTracker.h; sourceTree = "<group>"; };4329 4326 8372DB241A674C8F00C697C5 /* WKPageDiagnosticLoggingClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageDiagnosticLoggingClient.h; sourceTree = "<group>"; }; 4330 4327 8372DB261A67562800C697C5 /* WebPageDiagnosticLoggingClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageDiagnosticLoggingClient.cpp; sourceTree = "<group>"; }; … … 6175 6172 0EDE85022004E74900030560 /* WebsitePopUpPolicy.h */, 6176 6173 71FB810A2260627A00323677 /* WebsiteSimulatedMouseEventsDispatchPolicy.h */, 6177 8360349D1ACB34D600626549 /* WebSQLiteDatabaseTracker.cpp */,6178 8360349E1ACB34D600626549 /* WebSQLiteDatabaseTracker.h */,6179 6174 C0337DD7127A51B6008FF4F4 /* WebTouchEvent.cpp */, 6180 6175 7C065F291C8CD95F00C2D950 /* WebUserContentControllerDataTypes.cpp */, … … 11371 11366 417915B12256C0D600D6F97E /* WebSocketChannelManager.h in Headers */, 11372 11367 C149380922347104000CD707 /* WebSpeechSynthesisClient.h in Headers */, 11373 836034A01ACB34D600626549 /* WebSQLiteDatabaseTracker.h in Headers */,11374 11368 1A52C0F81A38CDC70016160A /* WebStorageNamespaceProvider.h in Headers */, 11375 11369 9356F2DC2152B6B500E6D5DF /* WebSWClientConnection.h in Headers */, -
trunk/Source/WebKit/WebProcess/WebProcess.cpp
r260102 r260856 147 147 #endif 148 148 149 #if PLATFORM(IOS_FAMILY)150 #include "WebSQLiteDatabaseTracker.h"151 #endif152 153 149 #if ENABLE(SEC_ITEM_SHIM) 154 150 #include "SecItemShim.h" … … 228 224 #endif 229 225 , m_nonVisibleProcessCleanupTimer(*this, &WebProcess::nonVisibleProcessCleanupTimerFired) 230 #if PLATFORM(IOS_FAMILY)231 , m_webSQLiteDatabaseTracker([this](bool isHoldingLockedFiles) { parentProcessConnection()->send(Messages::WebProcessProxy::SetIsHoldingLockedFiles(isHoldingLockedFiles), 0); })232 #endif233 226 { 234 227 // Initialize our platform strategies. … … 1440 1433 1441 1434 #if PLATFORM(IOS_FAMILY) 1442 m_webSQLiteDatabaseTracker.setIsSuspended(true);1443 1435 SQLiteDatabase::setIsDatabaseOpeningForbidden(true); 1444 1436 if (DatabaseTracker::isInitialized()) … … 1519 1511 1520 1512 #if PLATFORM(IOS_FAMILY) 1521 m_webSQLiteDatabaseTracker.setIsSuspended(false);1522 1513 SQLiteDatabase::setIsDatabaseOpeningForbidden(false); 1523 1514 accessibilityProcessSuspendedNotification(false); -
trunk/Source/WebKit/WebProcess/WebProcess.h
r260798 r260856 40 40 #include "WebPageProxyIdentifier.h" 41 41 #include "WebProcessCreationParameters.h" 42 #include "WebSQLiteDatabaseTracker.h"43 42 #include "WebSocketChannelManager.h" 44 43 #include <WebCore/ActivityState.h> … … 580 579 581 580 #if PLATFORM(IOS_FAMILY) 582 WebSQLiteDatabaseTracker m_webSQLiteDatabaseTracker;583 581 std::unique_ptr<ProcessAssertion> m_uiProcessDependencyProcessAssertion; 584 582 #endif
Note:
See TracChangeset
for help on using the changeset viewer.