This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch base-browser-102.5.0esr-12.0-1 in repository tor-browser.
commit 8cf04310a80ca83d7c4586dbc2a14aabfea31141 Author: Kershaw Chang kershaw@mozilla.com AuthorDate: Wed Nov 2 18:05:44 2022 +0000
Bug 1767920 - Increase thread stack size on windows (for ESR 102), r=#necko, a=dmeehan
Differential Revision: https://phabricator.services.mozilla.com/D161059 --- modules/libpref/init/StaticPrefList.yaml | 5 +++++ netwerk/base/nsSocketTransportService2.cpp | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index c52946fe04e8..b83f961cbfbb 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -11170,6 +11170,11 @@ value: 1 mirror: always
+- name: network.allow_large_stack_size_for_socket_thread + type: RelaxedAtomicBool + value: true + mirror: always + #--------------------------------------------------------------------------- # Prefs starting with "nglayout." #--------------------------------------------------------------------------- diff --git a/netwerk/base/nsSocketTransportService2.cpp b/netwerk/base/nsSocketTransportService2.cpp index 5375a2d7c13e..ee32de10f1a4 100644 --- a/netwerk/base/nsSocketTransportService2.cpp +++ b/netwerk/base/nsSocketTransportService2.cpp @@ -751,6 +751,21 @@ void nsSocketTransportService::UpdatePrefs(const char* aPref, void* aSelf) { static_cast<nsSocketTransportService*>(aSelf)->UpdatePrefs(); }
+static uint32_t GetThreadStackSize() { +#ifdef XP_WIN + if (!StaticPrefs::network_allow_large_stack_size_for_socket_thread()) { + return nsIThreadManager::DEFAULT_STACK_SIZE; + } + + const uint32_t kWindowsThreadStackSize = 512 * 1024; + // We can remove this custom stack size when DEFAULT_STACK_SIZE is increased. + static_assert(kWindowsThreadStackSize > nsIThreadManager::DEFAULT_STACK_SIZE); + return kWindowsThreadStackSize; +#else + return nsIThreadManager::DEFAULT_STACK_SIZE; +#endif +} + // called from main thread only NS_IMETHODIMP nsSocketTransportService::Init() { @@ -768,8 +783,8 @@ nsSocketTransportService::Init() { }
nsCOMPtr<nsIThread> thread; - nsresult rv = - NS_NewNamedThread("Socket Thread", getter_AddRefs(thread), this); + nsresult rv = NS_NewNamedThread("Socket Thread", getter_AddRefs(thread), this, + GetThreadStackSize()); NS_ENSURE_SUCCESS(rv, rv);
{