[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-browser/tor-browser-68.1.0esr-9.0-2] Bug 1578075 - Increase stack size of paint thread/workers on OSX Catalina or higher to workaround crash from recursion in CoreText. r=jrmuizel, a=RyanVM
commit 632458daf11b954319219ea62e259f50b4fd9ed3
Author: Ryan Hunt <rhunt@xxxxxxxxxx>
Date: Tue Sep 10 15:20:34 2019 +0000
Bug 1578075 - Increase stack size of paint thread/workers on OSX Catalina or higher to workaround crash from recursion in CoreText. r=jrmuizel, a=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D45370
--HG--
extra : source : cd0ea6dafa051426035949cfbbfdeb04c1c05661
extra : intermediate-source : ffefc518e569164c2c2e62258504bdc69d111bb3
---
gfx/layers/PaintThread.cpp | 24 +++++++++++++++++++++++-
widget/cocoa/nsCocoaFeatures.h | 1 +
widget/cocoa/nsCocoaFeatures.mm | 5 +++++
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
index 3ee7c86760ea..c35bf472d682 100644
--- a/gfx/layers/PaintThread.cpp
+++ b/gfx/layers/PaintThread.cpp
@@ -19,7 +19,11 @@
#include "mozilla/Preferences.h"
#include "mozilla/SharedThreadPool.h"
#include "mozilla/SyncRunnable.h"
+#ifdef XP_MACOSX
+#include "nsCocoaFeatures.h"
+#endif
#include "nsIPropertyBag2.h"
+#include "nsIThreadManager.h"
#include "nsServiceManagerUtils.h"
#include "prsystem.h"
@@ -69,11 +73,28 @@ void PaintThread::Start() {
}
}
+static uint32_t GetPaintThreadStackSize() {
+#ifndef XP_MACOSX
+ return nsIThreadManager::DEFAULT_STACK_SIZE;
+#else
+ // Workaround bug 1578075 by increasing the stack size of paint threads
+ if (nsCocoaFeatures::OnCatalinaOrLater()) {
+ static const uint32_t kCatalinaPaintThreadStackSize = 512 * 1024;
+ static_assert(kCatalinaPaintThreadStackSize >= nsIThreadManager::DEFAULT_STACK_SIZE,
+ "update default stack size of paint "
+ "workers");
+ return kCatalinaPaintThreadStackSize;
+ }
+ return nsIThreadManager::DEFAULT_STACK_SIZE;
+#endif
+}
+
bool PaintThread::Init() {
MOZ_ASSERT(NS_IsMainThread());
RefPtr<nsIThread> thread;
- nsresult rv = NS_NewNamedThread("PaintThread", getter_AddRefs(thread));
+ nsresult rv = NS_NewNamedThread("PaintThread", getter_AddRefs(thread),
+ nullptr, GetPaintThreadStackSize());
if (NS_FAILED(rv)) {
return false;
}
@@ -102,6 +123,7 @@ void PaintThread::InitPaintWorkers() {
if (count != 1) {
mPaintWorkers =
SharedThreadPool::Get(NS_LITERAL_CSTRING("PaintWorker"), count);
+ mPaintWorkers->SetThreadStackSize(GetPaintThreadStackSize());
}
}
diff --git a/widget/cocoa/nsCocoaFeatures.h b/widget/cocoa/nsCocoaFeatures.h
index a4581c4d3195..0cc5a2d5c165 100644
--- a/widget/cocoa/nsCocoaFeatures.h
+++ b/widget/cocoa/nsCocoaFeatures.h
@@ -24,6 +24,7 @@ class nsCocoaFeatures {
static bool OnSierraOrLater();
static bool OnHighSierraOrLater();
static bool OnMojaveOrLater();
+ static bool OnCatalinaOrLater();
static bool IsAtLeastVersion(int32_t aMajor, int32_t aMinor,
int32_t aBugFix = 0);
diff --git a/widget/cocoa/nsCocoaFeatures.mm b/widget/cocoa/nsCocoaFeatures.mm
index 77bd3507e35f..41ca60e3b721 100644
--- a/widget/cocoa/nsCocoaFeatures.mm
+++ b/widget/cocoa/nsCocoaFeatures.mm
@@ -21,6 +21,7 @@
#define MAC_OS_X_VERSION_10_12_HEX 0x000010C0
#define MAC_OS_X_VERSION_10_13_HEX 0x000010D0
#define MAC_OS_X_VERSION_10_14_HEX 0x000010E0
+#define MAC_OS_X_VERSION_10_15_HEX 0x000010F0
#include "nsCocoaFeatures.h"
#include "nsCocoaUtils.h"
@@ -165,6 +166,10 @@ bool Gecko_OnHighSierraOrLater() { return nsCocoaFeatures::OnHighSierraOrLater()
return (OSXVersion() >= MAC_OS_X_VERSION_10_14_HEX);
}
+/* static */ bool nsCocoaFeatures::OnCatalinaOrLater() {
+ return (OSXVersion() >= MAC_OS_X_VERSION_10_15_HEX);
+}
+
/* static */ bool nsCocoaFeatures::IsAtLeastVersion(int32_t aMajor, int32_t aMinor,
int32_t aBugFix) {
return OSXVersion() >= GetVersion(aMajor, aMinor, aBugFix);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits