mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1165982 - part 1 - provide fallible initialization of nsDOMIterator from an nsRange; r=ehsan (e8f817ee7) - Bug 1165982 - part 2 - validate an nsRange::SelectNode call in nsHTMLTMLEditRules::Init; r=ehsan (182e07bf6) - Bug 1180118 - Part 1: Add a method to match a single nsCSSSelector (without pseudo-elements) against an Element. r=bzbarsky (26f9fe8c3) - Partial port of Bug 1151829 - Unbreak build on non-SPS platforms after bug 1093934 (a9414f6b3) - Bug 1180118 - Part 2: Add eRestyle_SomeDescendants restyle hint and pass associated restyle hint data into restyle methods. r=bzbarsky (7a6fc4bd2) - Bug 1180118 - Part 3: Convert eRestyle_SomeDescendants into eRestyle_Self for elements that match selectors. r=bzbarsky (d4581f146) - Bug 1180118 - Part 4: Store pointer to the rightmost selector for class, ID and attribute selectors in the rule cascade. r=bzbarsky (aca8878f8) - Bug 1164366 - Need to fix an issue on unified build in dom/base. r=ehsan (8fcfb182f) - Bug 1121760 (part 2) - Remove PL_DHashTableAdd(). r=poiru. (e9d140a4b) - Bug 1121760 (part 3) - Remove PL_DHashTableRemove(). r=poiru. (588aeeaae) - Bug 1181445 (part 1) - Implement iterators for nsTHashtable and nsBaseHashtable. r=froydnj. (55a19598d) - Bug 1154053 - Limit concurrency of e10s memory reporting. r=erahm (88530ebb2) - Bug 1181445 (part 2) - Use nsTHashTable::Iterator in nsMemoryReporterManager. r=froydnj. (70df14b26) - Bug 1150916 - Be sure we aren't iterating over a hashtable while it is modified in nsObserverService::UnmarkGrayStrongObservers(). r=froydnj (572b31ed2) - Bug 1153373 - Move AppendStrongObservers() function definition behind #ifndef MOZILLA_XPCOMRT_API. r=froydnj (cebafb6b7) - Bug 1181445 (part 3) - Use nsTHashTable::Iterator in nsObserverService. r=froydnj. (1018c3526) - Bug 1181445 (part 4) - Use nsTHashTable::Iterator in nsCategoryManager. r=froydnj. (a04fcf96b) - Bug 1181445 (part 5) - Use nsTHashTable::Iterator in nsTHashtable.h. r=mccr8. (51bf669a0) - Bug 1181445 (part 6) - Use nsBaseHashTable::Iterator in xpcom/components/. r=froydnj. (e2e75de6c) - Bug 1167378 - Mark ArrayAndPrefix as MOZ_STACK_CLASS and array member as MOZ_NON_OWNING_REF. r=froydnj (e2d727c94) - Bug 1181445 (part 7) - Use nsBaseHashTable::Iterator in xpcom/reflect/. r=froydnj. (f6b9290a0) - Bug 1181445 (part 8) - Use nsBaseHashTable::Iterator in SystemMemoryReporter. r=froydnj. (69b81c209) - Bug 1181445 (part 9) - Use nsBaseHashTable::Iterator in nsConsoleService. r=froydnj. (ce4183330) - Bug 1154403 - Reduce incremental finalize slice time to 5ms. r=smaug (edbfd02e0) - Bug 1181445 (part 10) - Use nsBaseHashTable::Iterator in CycleCollectedJSRuntime. r=mccr8. (35d9be72e) - Bug 1181445 (part 11) - Use nsBaseHashTable::Iterator in xpcom/glue/. r=froydnj. (a08b703fe) - Backout change 39e167bbd14c, a80140872ea5, adae9be2294d and b71ccef9c674 (bug 970307). (9ce474689) - Bug 1158320 - rename nsThread::mRunningEvent to mNestedEventLoopDepth; r=bsmedberg (06d59a7e2) - Bug 1181445 (part 12) - Use nsBaseHashTable::Iterator in xpcom/threads/. r=froydnj. (48edb8226) - Bug 1181445 (part 13) - Use nsBaseHashTable::Iterator in xpcom/ds/. r=froydnj. (6d16d7670) - Bug 1173634 - Report pending async shutdowns in shutdown hangs. r=cpearce (c806e4b3f) - Bug 1183433 - Implement centralized crash report annotations, so that all async-shutdown hangs use only one key, and keeping track of all states each plugin has been through. r=cpearce (1d0284c70) - Bug 1184432 - Use nsClassHashtable::ConstIter in GeckoMediaPluginServiceParent::AsyncShutdownPluginStates. r=cpearce (7c92e3363) - Bug 1182318 - Part 1: Remove Closure::mCb. r=smaug (f28311ccd) - Bug 1182318 - Part 2: Remove Closure from CycleCollectedJSRuntime. r=smaug (454f3b85b) - Bug 1185470: Remove 'Get' prefixes from hashtable iterator methods. r (8ce896a26)
This commit is contained in:
+18
-74
@@ -15,6 +15,7 @@
|
||||
#undef LOG
|
||||
#endif
|
||||
|
||||
#include "mozilla/ReentrantMonitor.h"
|
||||
#include "nsMemoryPressure.h"
|
||||
#include "nsThreadManager.h"
|
||||
#include "nsIClassInfoImpl.h"
|
||||
@@ -325,10 +326,6 @@ nsThread::ThreadFunc(void* aArg)
|
||||
|
||||
// Inform the ThreadManager
|
||||
nsThreadManager::get()->RegisterCurrentThread(self);
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
self->mThreadStatusInfo =
|
||||
static_cast<void*>(nsThreadManager::get()->GetCurrentThreadStatusInfo());
|
||||
#endif
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
mozilla::IOInterposer::RegisterCurrentThread();
|
||||
@@ -412,16 +409,12 @@ nsThread::nsThread(MainThreadFlag aMainThread, uint32_t aStackSize)
|
||||
, mEvents(&mEventsRoot)
|
||||
, mPriority(PRIORITY_NORMAL)
|
||||
, mThread(nullptr)
|
||||
, mRunningEvent(0)
|
||||
, mNestedEventLoopDepth(0)
|
||||
, mStackSize(aStackSize)
|
||||
, mShutdownContext(nullptr)
|
||||
, mShutdownRequired(false)
|
||||
, mEventsAreDoomed(false)
|
||||
, mIsMainThread(aMainThread)
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
, mThreadStatusMonitor("nsThread.mThreadStatusLock")
|
||||
, mThreadStatusInfo(nullptr)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
@@ -469,11 +462,6 @@ nsThread::InitCurrentThread()
|
||||
SetupCurrentThreadForChaosMode();
|
||||
|
||||
nsThreadManager::get()->RegisterCurrentThread(this);
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
mThreadStatusInfo =
|
||||
static_cast<void*>(nsThreadManager::get()->GetCurrentThreadStatusInfo());
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -489,15 +477,7 @@ nsThread::PutEvent(nsIRunnable* aEvent, nsNestedEventTarget* aTarget)
|
||||
NS_WARNING("An event was posted to a thread that will never run it (rejected)");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mThreadStatusMonitor);
|
||||
SetWorking();
|
||||
#endif // MOZ_NUWA_PROCESS
|
||||
queue->PutEvent(aEvent);
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
}
|
||||
#endif // MOZ_NUWA_PROCESS
|
||||
queue->PutEvent(aEvent);
|
||||
|
||||
// Make sure to grab the observer before dropping the lock, otherwise the
|
||||
// event that we just placed into the queue could run and eventually delete
|
||||
@@ -718,7 +698,8 @@ void canary_alarm_handler(int signum)
|
||||
NS_IMETHODIMP
|
||||
nsThread::ProcessNextEvent(bool aMayWait, bool* aResult)
|
||||
{
|
||||
LOG(("THRD(%p) ProcessNextEvent [%u %u]\n", this, aMayWait, mRunningEvent));
|
||||
LOG(("THRD(%p) ProcessNextEvent [%u %u]\n", this, aMayWait,
|
||||
mNestedEventLoopDepth));
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
// If we're on the main thread, we shouldn't be dispatching CPOWs.
|
||||
@@ -738,7 +719,7 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult)
|
||||
// to block even if something has requested shutdown of the thread. Otherwise
|
||||
// we'll just busywait as we endlessly look for an event, fail to find one,
|
||||
// and repeat the nested event loop since its state change hasn't happened yet.
|
||||
bool reallyWait = aMayWait && (mRunningEvent > 0 || !ShuttingDown());
|
||||
bool reallyWait = aMayWait && (mNestedEventLoopDepth > 0 || !ShuttingDown());
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
if (MAIN_THREAD == mIsMainThread && reallyWait) {
|
||||
@@ -771,18 +752,19 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult)
|
||||
bool notifyMainThreadObserver =
|
||||
(MAIN_THREAD == mIsMainThread) && sMainThreadObserver;
|
||||
if (notifyMainThreadObserver) {
|
||||
sMainThreadObserver->OnProcessNextEvent(this, reallyWait, mRunningEvent);
|
||||
sMainThreadObserver->OnProcessNextEvent(this, reallyWait,
|
||||
mNestedEventLoopDepth);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIThreadObserver> obs = mObserver;
|
||||
if (obs) {
|
||||
obs->OnProcessNextEvent(this, reallyWait, mRunningEvent);
|
||||
obs->OnProcessNextEvent(this, reallyWait, mNestedEventLoopDepth);
|
||||
}
|
||||
|
||||
NOTIFY_EVENT_OBSERVERS(OnProcessNextEvent,
|
||||
(this, reallyWait, mRunningEvent));
|
||||
(this, reallyWait, mNestedEventLoopDepth));
|
||||
|
||||
++mRunningEvent;
|
||||
++mNestedEventLoopDepth;
|
||||
|
||||
#ifdef MOZ_CANARY
|
||||
Canary canary;
|
||||
@@ -791,7 +773,7 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult)
|
||||
|
||||
{
|
||||
// Scope for |event| to make sure that its destructor fires while
|
||||
// mRunningEvent has been incremented, since that destructor can
|
||||
// mNestedEventLoopDepth has been incremented, since that destructor can
|
||||
// also do work.
|
||||
|
||||
// If we are shutting down, then do not wait for new events.
|
||||
@@ -815,38 +797,18 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult)
|
||||
}
|
||||
}
|
||||
|
||||
--mRunningEvent;
|
||||
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
nsCOMPtr<nsIRunnable> notifyAllIdleRunnable;
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mThreadStatusMonitor);
|
||||
if ((!mEvents->GetEvent(false, nullptr)) && (mRunningEvent == 0)) {
|
||||
nsThreadManager::get()->SetThreadIsWorking(
|
||||
static_cast<nsThreadManager::ThreadStatusInfo*>(mThreadStatusInfo),
|
||||
false, getter_AddRefs(notifyAllIdleRunnable));
|
||||
}
|
||||
}
|
||||
if (notifyAllIdleRunnable) {
|
||||
// Dispatching a task leads us to acquire |mLock| of the thread. If we
|
||||
// dispatch to main thread while holding main thread's
|
||||
// |mThreadStatusMonitor|, deadlock could happen if other thread is
|
||||
// blocked by main thread's |mThreadStatusMonitor| and is holding
|
||||
// main thread's |mLock|.
|
||||
Dispatch(notifyAllIdleRunnable, NS_DISPATCH_NORMAL);
|
||||
nsThreadManager::get()->ResetIsDispatchingToMainThread();
|
||||
}
|
||||
#endif // MOZ_NUWA_PROCESS
|
||||
--mNestedEventLoopDepth;
|
||||
|
||||
NOTIFY_EVENT_OBSERVERS(AfterProcessNextEvent,
|
||||
(this, mRunningEvent, *aResult));
|
||||
(this, mNestedEventLoopDepth, *aResult));
|
||||
|
||||
if (obs) {
|
||||
obs->AfterProcessNextEvent(this, mRunningEvent, *aResult);
|
||||
obs->AfterProcessNextEvent(this, mNestedEventLoopDepth, *aResult);
|
||||
}
|
||||
|
||||
if (notifyMainThreadObserver && sMainThreadObserver) {
|
||||
sMainThreadObserver->AfterProcessNextEvent(this, mRunningEvent, *aResult);
|
||||
sMainThreadObserver->AfterProcessNextEvent(this, mNestedEventLoopDepth,
|
||||
*aResult);
|
||||
}
|
||||
|
||||
return rv;
|
||||
@@ -932,7 +894,7 @@ nsThread::GetRecursionDepth(uint32_t* aDepth)
|
||||
return NS_ERROR_NOT_SAME_THREAD;
|
||||
}
|
||||
|
||||
*aDepth = mRunningEvent;
|
||||
*aDepth = mNestedEventLoopDepth;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1047,24 +1009,6 @@ nsThread::SetMainThreadObserver(nsIThreadObserver* aObserver)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
void
|
||||
nsThread::SetWorking()
|
||||
{
|
||||
nsThreadManager::get()->SetThreadIsWorking(
|
||||
static_cast<nsThreadManager::ThreadStatusInfo*>(mThreadStatusInfo),
|
||||
true, nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
nsThread::SetIdle()
|
||||
{
|
||||
nsThreadManager::get()->SetThreadIsWorking(
|
||||
static_cast<nsThreadManager::ThreadStatusInfo*>(mThreadStatusInfo),
|
||||
false, nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
||||
Reference in New Issue
Block a user