WebKit Bugzilla
Attachment 362179 Details for
Bug 194731
: [PSON] Allow tweaking WebProcess cache parameters via user defaults
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194731-20190215162801.patch (text/plain), 8.88 KB, created by
Chris Dumez
on 2019-02-15 16:28:02 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2019-02-15 16:28:02 PST
Size:
8.88 KB
patch
obsolete
>Subversion Revision: 241626 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 61c6d316f2ca09f383acc01e93270dd8f3c8affb..73b683cd56af6125aeb690903eee9f89c1b4eefe 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,27 @@ >+2019-02-15 Chris Dumez <cdumez@apple.com> >+ >+ [PSON] Allow tweaking WebProcess cache parameters via user defaults >+ https://bugs.webkit.org/show_bug.cgi?id=194731 >+ <rdar://problem/48125377> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Allow tweaking WebProcess cache parameters via user defaults like so: >+ $ defaults write com.apple.Safari WebProcessCacheCachedProcessLifetimeInSeconds 120 >+ -> Cached processes will be evicted after 2 minutes (instead of 30) >+ >+ $ defaults write com.apple.Safari WebProcessCacheClearingDelayAfterApplicationResignsActiveInSeconds 60 >+ -> Web process cache will be cleared if Safari is no longer active for 1 minutes (instead of 5). >+ >+ * SourcesCocoa.txt: >+ * UIProcess/Cocoa/WebProcessCacheCocoa.mm: Copied from Source/WebKit/UIProcess/WebProcessCache.h. >+ (WebKit::WebProcessCache::platformInitialize): >+ * UIProcess/WebProcessCache.cpp: >+ (WebKit::WebProcessCache::WebProcessCache): >+ (WebKit::WebProcessCache::platformInitialize): >+ * UIProcess/WebProcessCache.h: >+ * WebKit.xcodeproj/project.pbxproj: >+ > 2019-02-15 Andy Estes <aestes@apple.com> > > [iOS] Stop setting a background color on the PDF host view >diff --git a/Source/WebKit/SourcesCocoa.txt b/Source/WebKit/SourcesCocoa.txt >index 6ca45ca8caaa53dd7de551f39b9a80314ec5be73..c43e4e5090bedc71c9de63f867f740a941fd0f12 100644 >--- a/Source/WebKit/SourcesCocoa.txt >+++ b/Source/WebKit/SourcesCocoa.txt >@@ -342,6 +342,7 @@ UIProcess/Cocoa/VersionChecks.mm > UIProcess/Cocoa/VideoFullscreenManagerProxy.mm > UIProcess/Cocoa/WebPageProxyCocoa.mm > UIProcess/Cocoa/WebPasteboardProxyCocoa.mm >+UIProcess/Cocoa/WebProcessCacheCocoa.mm > UIProcess/Cocoa/WebProcessPoolCocoa.mm > UIProcess/Cocoa/WebProcessProxyCocoa.mm > UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm >diff --git a/Source/WebKit/UIProcess/Cocoa/WebProcessCacheCocoa.mm b/Source/WebKit/UIProcess/Cocoa/WebProcessCacheCocoa.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..7466196a8645e59393deeb2254e03cf5717f4c19 >--- /dev/null >+++ b/Source/WebKit/UIProcess/Cocoa/WebProcessCacheCocoa.mm >@@ -0,0 +1,46 @@ >+/* >+ * Copyright (C) 2019 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. >+ */ >+ >+#import "config.h" >+#import "WebProcessCache.h" >+ >+namespace WebKit { >+ >+void WebProcessCache::platformInitialize() >+{ >+ Seconds cachedProcessLifetimeOverride([[NSUserDefaults standardUserDefaults] doubleForKey:@"WebProcessCacheCachedProcessLifetimeInSeconds"]); >+ if (cachedProcessLifetimeOverride > 0_s && cachedProcessLifetimeOverride <= 24_h) { >+ cachedProcessLifetime = cachedProcessLifetimeOverride; >+ WTFLogAlways("Warning: WebProcessCache cachedProcessLifetime was overriden via user defaults and is now %g seconds", cachedProcessLifetimeOverride.seconds()); >+ } >+ >+ Seconds clearingDelayAfterApplicationResignsActiveOverride([[NSUserDefaults standardUserDefaults] doubleForKey:@"WebProcessCacheClearingDelayAfterApplicationResignsActiveInSeconds"]); >+ if (clearingDelayAfterApplicationResignsActiveOverride > 0_s && clearingDelayAfterApplicationResignsActiveOverride <= 1_h) { >+ clearingDelayAfterApplicationResignsActive = clearingDelayAfterApplicationResignsActiveOverride; >+ WTFLogAlways("Warning: WebProcessCache clearingDelayAfterApplicationResignsActive was overriden via user defaults and is now %g seconds", clearingDelayAfterApplicationResignsActiveOverride.seconds()); >+ } >+} >+ >+} // namespace WebKit >diff --git a/Source/WebKit/UIProcess/WebProcessCache.cpp b/Source/WebKit/UIProcess/WebProcessCache.cpp >index 756cb53197a048d4b42f6db9bc30e342c8805497..7c7eb2d7b5bf7a5170abefbc1cc26a1d90da93a7 100644 >--- a/Source/WebKit/UIProcess/WebProcessCache.cpp >+++ b/Source/WebKit/UIProcess/WebProcessCache.cpp >@@ -34,13 +34,14 @@ > > namespace WebKit { > >-static Seconds cachedProcessLifetime { 30_min }; >-static Seconds clearingDelayAfterApplicationResignsActive { 5_min }; >+Seconds WebProcessCache::cachedProcessLifetime { 30_min }; >+Seconds WebProcessCache::clearingDelayAfterApplicationResignsActive { 5_min }; > > WebProcessCache::WebProcessCache(WebProcessPool& processPool) > : m_evictionTimer(RunLoop::main(), this, &WebProcessCache::clear) > { > updateCapacity(processPool); >+ platformInitialize(); > } > > bool WebProcessCache::addProcess(const String& registrableDomain, Ref<WebProcessProxy>&& process) >@@ -178,4 +179,10 @@ void WebProcessCache::CachedProcess::evictionTimerFired() > m_process->processPool().webProcessCache().evictProcess(*m_process); > } > >+#if !PLATFORM(COCOA) >+void WebProcessCache::platformInitialize() >+{ >+} >+#endif >+ > } // namespace WebKit >diff --git a/Source/WebKit/UIProcess/WebProcessCache.h b/Source/WebKit/UIProcess/WebProcessCache.h >index fdf99aa805f19fc4dbe78689f5125825f54a79eb..19adf617a73f385950cdcbbfc5519d504685e603 100644 >--- a/Source/WebKit/UIProcess/WebProcessCache.h >+++ b/Source/WebKit/UIProcess/WebProcessCache.h >@@ -53,7 +53,11 @@ public: > void setApplicationIsActive(bool); > > private: >+ static Seconds cachedProcessLifetime; >+ static Seconds clearingDelayAfterApplicationResignsActive; >+ > void evictProcess(WebProcessProxy&); >+ void platformInitialize(); > > unsigned m_capacity { 0 }; > >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index 82bb5c76899b1b81ac00544188fd46a57aea932f..9050fdad6ed169ee0846ceb980ad579e3d673c67 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -3086,6 +3086,7 @@ > 462107D71F38DBD300DD7810 /* PingLoad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PingLoad.cpp; sourceTree = "<group>"; }; > 463FD47F1EB9458400A2982C /* WKProcessTerminationReason.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKProcessTerminationReason.h; sourceTree = "<group>"; }; > 463FD4811EB94EAD00A2982C /* ProcessTerminationReason.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessTerminationReason.h; sourceTree = "<group>"; }; >+ 4651ECE622178A850067EB95 /* WebProcessCacheCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessCacheCocoa.mm; sourceTree = "<group>"; }; > 465250E51ECF52CD002025CB /* WebKit2InitializeCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKit2InitializeCocoa.mm; sourceTree = "<group>"; }; > 466BC0381FA266C9002FA9C1 /* WebSWContextManagerConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWContextManagerConnection.cpp; sourceTree = "<group>"; }; > 466BC0391FA266C9002FA9C1 /* WebSWContextManagerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWContextManagerConnection.h; sourceTree = "<group>"; }; >@@ -5332,6 +5333,7 @@ > 52D5A1AC1C57494E00DE34A3 /* VideoFullscreenManagerProxy.mm */, > 1AC0273E196622D600C12B75 /* WebPageProxyCocoa.mm */, > 7C4694CB1A4B510A00AD5845 /* WebPasteboardProxyCocoa.mm */, >+ 4651ECE622178A850067EB95 /* WebProcessCacheCocoa.mm */, > 7CE4D2151A49148400C7F152 /* WebProcessPoolCocoa.mm */, > 1A04F6171A4A3A7A00A21B6E /* WebProcessProxyCocoa.mm */, > 51D124311E6DE521002B2820 /* WebURLSchemeHandlerCocoa.h */,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194731
: 362179