[tor-commits] [tor-browser] 13/14: Bug 1767920 - Increase thread stack size on windows (for ESR 102), r=#necko, a=dmeehan
gitolite role
git at cupani.torproject.org
Thu Nov 17 14:03:52 UTC 2022
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.13.0esr-11.5-1
in repository tor-browser.
commit 676b50fef91c9c2c4b560f85d8e313b3d045bb18
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 b87714065456..f9f31be1fe4c 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -9896,6 +9896,11 @@
value: true
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 3cad25875445..bedaaadae860 100644
--- a/netwerk/base/nsSocketTransportService2.cpp
+++ b/netwerk/base/nsSocketTransportService2.cpp
@@ -716,6 +716,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() {
@@ -733,8 +748,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 tor-commits
mailing list