|
@@ -1,43 +1,44 @@
|
|
|
# HG changeset patch
|
|
|
# User Ryan Hunt <rhunt@eqrion.net>
|
|
|
# Date 1568128834 0
|
|
|
-# Node ID ffefc518e569164c2c2e62258504bdc69d111bb3
|
|
|
-# Parent 1cd680a6eb289d89e9b169b0cae744ab0dfc536b
|
|
|
-Bug 1578075 - Increase stack size of paint thread/workers on OSX Catalina or higher to workaround crash from recursion in CoreText. r=jrmuizel a=lizzard
|
|
|
+# Node ID cd0ea6dafa051426035949cfbbfdeb04c1c05661
|
|
|
+# Parent 043288bd5362454f19d0103347fc40937213b777
|
|
|
+Bug 1578075 - Increase stack size of paint thread/workers on OSX Catalina or higher to workaround crash from recursion in CoreText. r=jrmuizel
|
|
|
|
|
|
Differential Revision: https://phabricator.services.mozilla.com/D45370
|
|
|
|
|
|
diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
|
|
|
--- a/gfx/layers/PaintThread.cpp
|
|
|
+++ b/gfx/layers/PaintThread.cpp
|
|
|
-@@ -7,16 +7,20 @@
|
|
|
- #include "PaintThread.h"
|
|
|
-
|
|
|
- #include "base/task.h"
|
|
|
- #include "gfxPrefs.h"
|
|
|
+@@ -14,17 +14,21 @@
|
|
|
+ #include "GeckoProfiler.h"
|
|
|
#include "mozilla/layers/CompositorBridgeChild.h"
|
|
|
+ #include "mozilla/layers/ShadowLayers.h"
|
|
|
+ #include "mozilla/layers/SyncObject.h"
|
|
|
#include "mozilla/gfx/2D.h"
|
|
|
#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"
|
|
|
|
|
|
- namespace mozilla {
|
|
|
- namespace layers {
|
|
|
-
|
|
|
- using namespace gfx;
|
|
|
+ // Uncomment the following line to dispatch sync runnables when
|
|
|
+ // painting so that rasterization happens synchronously from
|
|
|
+ // the perspective of the main thread
|
|
|
+ // #define OMTP_FORCE_SYNC
|
|
|
|
|
|
- StaticAutoPtr<PaintThread> PaintThread::sSingleton;
|
|
|
- StaticRefPtr<nsIThread> PaintThread::sThread;
|
|
|
-@@ -34,23 +38,40 @@ PaintThread::AddRef()
|
|
|
+@@ -117,21 +121,38 @@ void PaintThread::AddRef() {}
|
|
|
+ PaintThread::sSingleton = new PaintThread();
|
|
|
|
|
|
- void
|
|
|
- PaintThread::InitOnPaintThread()
|
|
|
- {
|
|
|
- MOZ_ASSERT(!NS_IsMainThread());
|
|
|
- sThreadId = PlatformThread::CurrentId();
|
|
|
+ if (!PaintThread::sSingleton->Init()) {
|
|
|
+ gfxCriticalNote << "Unable to start paint thread";
|
|
|
+ PaintThread::sSingleton = nullptr;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+static uint32_t GetPaintThreadStackSize() {
|
|
@@ -56,9 +57,7 @@ diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
- bool
|
|
|
- PaintThread::Init()
|
|
|
- {
|
|
|
+ bool PaintThread::Init() {
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
|
|
RefPtr<nsIThread> thread;
|
|
@@ -70,40 +69,31 @@ diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
|
|
|
}
|
|
|
sThread = thread;
|
|
|
|
|
|
- nsCOMPtr<nsIRunnable> paintInitTask =
|
|
|
- NewRunnableMethod("PaintThread::InitOnPaintThread",
|
|
|
- this, &PaintThread::InitOnPaintThread);
|
|
|
-@@ -71,16 +92,26 @@ PaintThread::Start()
|
|
|
+ // Only create paint workers for tiling if we are using tiling or could
|
|
|
+ // expect to dynamically switch to tiling in the future
|
|
|
+ if (gfxPlatform::GetPlatform()->UsesTiling()) {
|
|
|
+@@ -150,16 +171,17 @@ void PaintThread::InitOnPaintThread() {
|
|
|
+ }
|
|
|
|
|
|
- /* static */ PaintThread*
|
|
|
- PaintThread::Get()
|
|
|
- {
|
|
|
+ void PaintThread::InitPaintWorkers() {
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
- return PaintThread::sSingleton.get();
|
|
|
+ int32_t count = PaintThread::CalculatePaintWorkerCount();
|
|
|
+ if (count != 1) {
|
|
|
+ mPaintWorkers = SharedThreadPool::Get(NS_LITERAL_CSTRING("PaintWorker"),
|
|
|
+ count);
|
|
|
++ mPaintWorkers->SetThreadStackSize(GetPaintThreadStackSize());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-+// void PaintThread::InitPaintWorkers() {
|
|
|
-+// MOZ_ASSERT(NS_IsMainThread());
|
|
|
-+// int32_t count = PaintThread::CalculatePaintWorkerCount();
|
|
|
-+// if (count != 1) {
|
|
|
-+// mPaintWorkers =
|
|
|
-+// SharedThreadPool::Get(NS_LITERAL_CSTRING("PaintWorker"), count);
|
|
|
-+// + mPaintWorkers->SetThreadStackSize(GetPaintThreadStackSize());
|
|
|
-+// }
|
|
|
-+// }
|
|
|
-+
|
|
|
- void
|
|
|
- DestroyPaintThread(UniquePtr<PaintThread>&& pt)
|
|
|
- {
|
|
|
+ void DestroyPaintThread(UniquePtr<PaintThread>&& pt) {
|
|
|
MOZ_ASSERT(PaintThread::IsOnPaintThread());
|
|
|
pt->ShutdownOnPaintThread();
|
|
|
}
|
|
|
|
|
|
- /* static */ void
|
|
|
diff --git a/widget/cocoa/nsCocoaFeatures.h b/widget/cocoa/nsCocoaFeatures.h
|
|
|
--- a/widget/cocoa/nsCocoaFeatures.h
|
|
|
+++ b/widget/cocoa/nsCocoaFeatures.h
|
|
|
-@@ -18,16 +18,17 @@ public:
|
|
|
+@@ -18,16 +18,17 @@ class nsCocoaFeatures {
|
|
|
static int32_t OSXVersionMajor();
|
|
|
static int32_t OSXVersionMinor();
|
|
|
static int32_t OSXVersionBugFix();
|
|
@@ -114,13 +104,13 @@ diff --git a/widget/cocoa/nsCocoaFeatures.h b/widget/cocoa/nsCocoaFeatures.h
|
|
|
static bool OnMojaveOrLater();
|
|
|
+ static bool OnCatalinaOrLater();
|
|
|
|
|
|
- static bool IsAtLeastVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFix=0);
|
|
|
+ static bool IsAtLeastVersion(int32_t aMajor, int32_t aMinor,
|
|
|
+ int32_t aBugFix = 0);
|
|
|
|
|
|
- // These are utilities that do not change or depend on the value of mOSXVersion
|
|
|
- // and instead just encapsulate the encoding algorithm. Note that GetVersion
|
|
|
- // actually adjusts to the lowest supported OS, so it will always return
|
|
|
- // a "supported" version. GetSystemVersion does not make any modifications.
|
|
|
- static void GetSystemVersion(int &aMajor, int &aMinor, int &aBugFix);
|
|
|
+ // These are utilities that do not change or depend on the value of
|
|
|
+ // mOSXVersion and instead just encapsulate the encoding algorithm. Note that
|
|
|
+ // GetVersion actually adjusts to the lowest supported OS, so it will always
|
|
|
+ // return a "supported" version. GetSystemVersion does not make any
|
|
|
diff --git a/widget/cocoa/nsCocoaFeatures.mm b/widget/cocoa/nsCocoaFeatures.mm
|
|
|
--- a/widget/cocoa/nsCocoaFeatures.mm
|
|
|
+++ b/widget/cocoa/nsCocoaFeatures.mm
|
|
@@ -142,8 +132,7 @@ diff --git a/widget/cocoa/nsCocoaFeatures.mm b/widget/cocoa/nsCocoaFeatures.mm
|
|
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
|
|
-@@ -183,13 +184,17 @@ Gecko_OnSierraOrLater()
|
|
|
- }
|
|
|
+@@ -184,12 +185,18 @@ Gecko_OnSierraOrLater()
|
|
|
|
|
|
/* static */ bool
|
|
|
nsCocoaFeatures::OnMojaveOrLater()
|
|
@@ -151,11 +140,13 @@ diff --git a/widget/cocoa/nsCocoaFeatures.mm b/widget/cocoa/nsCocoaFeatures.mm
|
|
|
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::OnCatalinaOrLater()
|
|
|
++{
|
|
|
++ return (OSXVersion() >= MAC_OS_X_VERSION_10_15_HEX);
|
|
|
+}
|
|
|
+
|
|
|
- /* static */ bool
|
|
|
++/* static */ bool
|
|
|
nsCocoaFeatures::IsAtLeastVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFix)
|
|
|
{
|
|
|
return OSXVersion() >= GetVersion(aMajor, aMinor, aBugFix);
|