import changes from `dev' branch of rmottola/Arctic-Fox:

- Bug 1159409 - (Part 1-) - Remove Init() from the Image interface. r=tn (0b663ee45)
- Bug 1159409 - (Part 2) - Remove ProgressTrackerInit and register Images with a ProgressTracker in ImageFactory. r=tn (a24d4e849)
- Bug 1179909: Refactor stable state handling. r=smaug This is motivated by three separate but related problems: (0ead73dbd)
- remove mPreemptingRunnableInfos of PM which I couldn't trace in FF (96474c90a)
- Bug 1179909: Build fix. r=me CLOSED TREE (5d35a65d5)
- Bug 1144418 - target events for text nodes in shadow dom to the nearest element in the flattened tree. r=wchen (26c0eb8b2)
- Bug 853889 - Check single-box orientaton in _cairo_bentley_ottmann_tessellate_rectangular_traps and _cairo_bentley_ottmann_tessellate_boxes. r=jmuizelaar (a13abee2f)
- Bug 1143303 - extend D2D circle workaround to work for small circles. r=bas (1ccb1c0c1)
This commit is contained in:
2021-07-22 10:47:48 +08:00
parent 9d8e58858d
commit b9cfdbdbdc
64 changed files with 626 additions and 763 deletions
+26 -38
View File
@@ -22,6 +22,7 @@
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "pratom.h"
#include "mozilla/CycleCollectedJSRuntime.h"
#include "mozilla/Logging.h"
#include "nsIObserverService.h"
#if !defined(MOZILLA_XPCOMRT_API)
@@ -89,8 +90,6 @@ GetThreadLog()
NS_DECL_CI_INTERFACE_GETTER(nsThread)
nsIThreadObserver* nsThread::sMainThreadObserver = nullptr;
//-----------------------------------------------------------------------------
// Because we do not have our own nsIFactory, we have to implement nsIClassInfo
// somewhat manually.
@@ -407,6 +406,7 @@ int sCanaryOutputFD = -1;
nsThread::nsThread(MainThreadFlag aMainThread, uint32_t aStackSize)
: mLock("nsThread.mLock")
, mScriptObserver(nullptr)
, mEvents(&mEventsRoot)
, mPriority(PRIORITY_NORMAL)
, mThread(nullptr)
@@ -791,22 +791,19 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult)
}
#endif
bool notifyMainThreadObserver =
(MAIN_THREAD == mIsMainThread) && sMainThreadObserver;
if (notifyMainThreadObserver) {
sMainThreadObserver->OnProcessNextEvent(this, reallyWait,
mNestedEventLoopDepth);
++mNestedEventLoopDepth;
bool callScriptObserver = !!mScriptObserver;
if (callScriptObserver) {
mScriptObserver->BeforeProcessTask(reallyWait);
}
nsCOMPtr<nsIThreadObserver> obs = mObserver;
if (obs) {
obs->OnProcessNextEvent(this, reallyWait, mNestedEventLoopDepth);
obs->OnProcessNextEvent(this, reallyWait);
}
NOTIFY_EVENT_OBSERVERS(OnProcessNextEvent,
(this, reallyWait, mNestedEventLoopDepth));
++mNestedEventLoopDepth;
NOTIFY_EVENT_OBSERVERS(OnProcessNextEvent, (this, reallyWait));
#ifdef MOZ_CANARY
Canary canary;
@@ -839,20 +836,18 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult)
}
}
--mNestedEventLoopDepth;
NOTIFY_EVENT_OBSERVERS(AfterProcessNextEvent,
(this, mNestedEventLoopDepth, *aResult));
NOTIFY_EVENT_OBSERVERS(AfterProcessNextEvent, (this, *aResult));
if (obs) {
obs->AfterProcessNextEvent(this, mNestedEventLoopDepth, *aResult);
obs->AfterProcessNextEvent(this, *aResult);
}
if (notifyMainThreadObserver && sMainThreadObserver) {
sMainThreadObserver->AfterProcessNextEvent(this, mNestedEventLoopDepth,
*aResult);
if (callScriptObserver && mScriptObserver) {
mScriptObserver->AfterProcessTask(mNestedEventLoopDepth);
}
--mNestedEventLoopDepth;
return rv;
}
@@ -929,15 +924,11 @@ nsThread::SetObserver(nsIThreadObserver* aObs)
return NS_OK;
}
NS_IMETHODIMP
nsThread::GetRecursionDepth(uint32_t* aDepth)
uint32_t
nsThread::RecursionDepth() const
{
if (NS_WARN_IF(PR_GetCurrentThread() != mThread)) {
return NS_ERROR_NOT_SAME_THREAD;
}
*aDepth = mNestedEventLoopDepth;
return NS_OK;
MOZ_ASSERT(PR_GetCurrentThread() == mThread);
return mNestedEventLoopDepth;
}
NS_IMETHODIMP
@@ -1036,19 +1027,16 @@ nsThread::PopEventQueue(nsIEventTarget* aInnermostTarget)
return NS_OK;
}
nsresult
nsThread::SetMainThreadObserver(nsIThreadObserver* aObserver)
void
nsThread::SetScriptObserver(mozilla::CycleCollectedJSRuntime* aScriptObserver)
{
if (aObserver && nsThread::sMainThreadObserver) {
return NS_ERROR_NOT_AVAILABLE;
if (!aScriptObserver) {
mScriptObserver = nullptr;
return;
}
if (!NS_IsMainThread()) {
return NS_ERROR_UNEXPECTED;
}
nsThread::sMainThreadObserver = aObserver;
return NS_OK;
MOZ_ASSERT(!mScriptObserver);
mScriptObserver = aScriptObserver;
}
//-----------------------------------------------------------------------------