Bug 201970

Summary: Introduce LegacyGlobalSettings for settings the NetworkProcess needs from a WebProcessPool
Product: WebKit Reporter: Alex Christensen <achristensen>
Component: New BugsAssignee: Alex Christensen <achristensen>
Status: RESOLVED FIXED    
Severity: Normal CC: berto, cdumez, cgarcia, ews-watchlist, ggaren, gustavo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch ggaren: review+

Alex Christensen
Reported 2019-09-18 21:08:10 PDT
Introduce LegacyGlobalSettings for settings the NetworkProcess needs from a WebProcessPool
Attachments
Patch (18.92 KB, patch)
2019-09-18 21:10 PDT, Alex Christensen
no flags
Patch (20.75 KB, patch)
2019-09-19 00:05 PDT, Alex Christensen
no flags
Patch (21.67 KB, patch)
2019-09-19 00:14 PDT, Alex Christensen
ggaren: review+
Alex Christensen
Comment 1 2019-09-18 21:10:55 PDT
Alex Christensen
Comment 2 2019-09-19 00:05:35 PDT
EWS Watchlist
Comment 3 2019-09-19 00:06:01 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Alex Christensen
Comment 4 2019-09-19 00:07:55 PDT
Note to glib API maintainers: webkit_web_context_set_cache_model and webkit_web_context_get_cache_model should be deprecated and replaced by a new value on WebsiteDataStore that is used if it is set and falls back to the legacy global value. We have found the existing users of the C API only have one context so this is not a regression, and I imagine the same is true of the glib API users. This is a necessary change moving forward.
Alex Christensen
Comment 5 2019-09-19 00:14:15 PDT
Alex Christensen
Comment 6 2019-09-19 00:15:31 PDT
Note: the WebsiteDataStore replacement should probably be more like a way to disable the memory cache and a way to disable the disk cache than something as strange as a 3-value "cache model"
Carlos Garcia Campos
Comment 7 2019-09-19 01:20:21 PDT
But the cache model is not only used to enable/disable caches, it also adjusts the capacity of the caches.
Alex Christensen
Comment 8 2019-09-19 09:58:46 PDT
I guess that’s true. We might still want a cache model based api for simplicity, but it will definitely need to be on the website data store where the cache is.
Geoffrey Garen
Comment 9 2019-09-19 15:13:34 PDT
Comment on attachment 379109 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379109&action=review > Source/WebKit/ChangeLog:9 > + I'm starting by moving the cache model to this new abstraction. > + We were using it in tests to disable the page cache, which should be done with a boolean on the pool configuration, not by changing the cache model. Longer-term, I think page caching should be a setting on the website data store. > Source/WebKit/ChangeLog:10 > + We were also using it in WKContextSetCacheModel which has several clients that won't change quickly, so this abstraction is used to maintain existing behavior. Does this patch maintain existing behavior, or does it create a new behavior where WKContextSetCacheModel is now global instead of per-context? (How do we know that it's OK to be global?)
Alex Christensen
Comment 10 2019-09-19 22:45:37 PDT
(In reply to Geoffrey Garen from comment #9) > Longer-term, I think page caching should be a setting on the website data > store. I think I agree. That detail doesn't need to be decided for this patch. It does need to be decided for the replacement for WKContextSetCacheModel. > Does this patch maintain existing behavior, or does it create a new behavior > where WKContextSetCacheModel is now global instead of per-context? (How do > we know that it's OK to be global?) This patch maintains existing behavior because every client using WKContextSetCacheModel has one WKContextRef that they use in their process for everything. This patch is necessary because we don't want the NetworkProcess to get settings from any one ProcessPool.
Alex Christensen
Comment 11 2019-09-20 01:00:49 PDT
Right now I'll also have to make hstsStorageDirectory a legacy global setting. There may be one or two more, but most of the things can move to WebsiteDataStore.
Carlos Garcia Campos
Comment 12 2019-09-20 01:01:42 PDT
(In reply to Alex Christensen from comment #10) > (In reply to Geoffrey Garen from comment #9) > > Longer-term, I think page caching should be a setting on the website data > > store. > I think I agree. That detail doesn't need to be decided for this patch. It > does need to be decided for the replacement for WKContextSetCacheModel. > > > Does this patch maintain existing behavior, or does it create a new behavior > > where WKContextSetCacheModel is now global instead of per-context? (How do > > we know that it's OK to be global?) > This patch maintains existing behavior because every client using > WKContextSetCacheModel has one WKContextRef that they use in their process > for everything. That's not necessarily true for GLib API users, though. > This patch is necessary because we don't want the > NetworkProcess to get settings from any one ProcessPool. Isn't there a network process per process pool?
Alex Christensen
Comment 13 2019-09-20 13:16:03 PDT
(In reply to Carlos Garcia Campos from comment #12) > (In reply to Alex Christensen from comment #10) > > (In reply to Geoffrey Garen from comment #9) > > > Longer-term, I think page caching should be a setting on the website data > > > store. > > I think I agree. That detail doesn't need to be decided for this patch. It > > does need to be decided for the replacement for WKContextSetCacheModel. > > > > > Does this patch maintain existing behavior, or does it create a new behavior > > > where WKContextSetCacheModel is now global instead of per-context? (How do > > > we know that it's OK to be global?) > > This patch maintains existing behavior because every client using > > WKContextSetCacheModel has one WKContextRef that they use in their process > > for everything. > > That's not necessarily true for GLib API users, though. I think it's probably a good assumption, but you're right, there could be someone with two contexts that intentionally has different cache models. I think that's unlikely in practice. In any case, the cache-determining API needs to be moved to WebsiteDataStore, where the cache is. > > > This patch is necessary because we don't want the > > NetworkProcess to get settings from any one ProcessPool. > > Isn't there a network process per process pool? I'm working to make it so there's only one network process. That's why I'm doing this.
Geoffrey Garen
Comment 14 2019-09-20 13:25:30 PDT
> > This patch maintains existing behavior because every client using > > WKContextSetCacheModel has one WKContextRef that they use in their process > > for everything. > > That's not necessarily true for GLib API users, though. What are the requirements for GLib API compatibility? What is the best way to know if GLib API users need support for WKContextSetCacheModel on multiple WKContextRefs? > > This patch is necessary because we don't want the > > NetworkProcess to get settings from any one ProcessPool. > > Isn't there a network process per process pool? The goal of this patch set is to change that behavior and establish a singleton network process per app. The WebsiteDataStore APIs are broken if you launch multiple network processes.
Geoffrey Garen
Comment 15 2019-09-20 13:29:06 PDT
Comment on attachment 379109 [details] Patch r=me If this does create a problem for Glib API users, we should discuss further how to resolve it.
Alex Christensen
Comment 16 2019-09-20 13:37:09 PDT
Radar WebKit Bug Importer
Comment 17 2019-09-20 13:38:17 PDT
Carlos Garcia Campos
Comment 18 2019-09-23 02:14:07 PDT
(In reply to Alex Christensen from comment #13) > (In reply to Carlos Garcia Campos from comment #12) > > (In reply to Alex Christensen from comment #10) > > > (In reply to Geoffrey Garen from comment #9) > > > > Longer-term, I think page caching should be a setting on the website data > > > > store. > > > I think I agree. That detail doesn't need to be decided for this patch. It > > > does need to be decided for the replacement for WKContextSetCacheModel. > > > > > > > Does this patch maintain existing behavior, or does it create a new behavior > > > > where WKContextSetCacheModel is now global instead of per-context? (How do > > > > we know that it's OK to be global?) > > > This patch maintains existing behavior because every client using > > > WKContextSetCacheModel has one WKContextRef that they use in their process > > > for everything. > > > > That's not necessarily true for GLib API users, though. > I think it's probably a good assumption, but you're right, there could be > someone with two contexts that intentionally has different cache models. I > think that's unlikely in practice. In any case, the cache-determining API > needs to be moved to WebsiteDataStore, where the cache is. Ah, no, that's not what I meant, I meant only using different contexts, I also think it's unlikely that they use a different cache model per context, though. > > > > > This patch is necessary because we don't want the > > > NetworkProcess to get settings from any one ProcessPool. > > > > Isn't there a network process per process pool? > I'm working to make it so there's only one network process. That's why I'm > doing this. Ok, now I understand. I hope we can just deprecate APIs but keeping backwards compatibility.
Carlos Garcia Campos
Comment 19 2019-09-23 02:22:25 PDT
A quick search in Debian shows only a few apps setting the cache model, and they either use a single context or the same model for all contexts.
Chris Dumez
Comment 20 2019-10-14 09:33:19 PDT
Comment on attachment 379109 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379109&action=review > Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h:74 > + bool usesPageCache() const { return m_usesPageCache; } This seems to have introduced a regression. The cacheModel was obeyed by the WebContent process and was setting the PageCache's maxSize in the WebProcess. However, this m_usesPageCache flag only controls the UIProcess (i.e. creation of SuspendedPage proxies). However, it no longer updates the size of the PageCache in the WebProcess it seems.
Chris Dumez
Comment 21 2019-10-14 09:51:01 PDT
(In reply to Chris Dumez from comment #20) > Comment on attachment 379109 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=379109&action=review > > > Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h:74 > > + bool usesPageCache() const { return m_usesPageCache; } > > This seems to have introduced a regression. The cacheModel was obeyed by the > WebContent process and was setting the PageCache's maxSize in the > WebProcess. However, this m_usesPageCache flag only controls the UIProcess > (i.e. creation of SuspendedPage proxies). However, it no longer updates the > size of the PageCache in the WebProcess it seems. Will likely deal with this at the same time as https://bugs.webkit.org/show_bug.cgi?id=202929.
Note You need to log in before you can comment on or make changes to this bug.