[tbb-commits] [tor-browser] 30/46: Bug 1767920 - Increase thread stack size on windows (for ESR 102), r=#necko, a=dmeehan
gitolite role
git at cupani.torproject.org
Wed Nov 16 20:43:10 UTC 2022
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 at 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);
{
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the tbb-commits
mailing list