зеркало из https://github.com/mozilla/pjs.git
Backout 8cf563a575fd (bug 734015) due to random Moth orange.
This commit is contained in:
Родитель
a323320685
Коммит
c1c3609b34
|
@ -92,8 +92,8 @@ class Element;
|
|||
} // namespace mozilla
|
||||
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0x8c6a1e62, 0xd5ad, 0x4297, \
|
||||
{ 0xb9, 0x41, 0x64, 0x49, 0x22, 0x2e, 0xc4, 0xf0 } }
|
||||
{ 0x88d887da, 0xd228, 0x41c2, \
|
||||
{ 0xb8, 0x0a, 0x42, 0xec, 0xf0, 0xcb, 0xce, 0x37 } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
|
@ -674,12 +674,6 @@ public:
|
|||
return mWindow ? mWindow->GetOuterWindow() : GetWindowInternal();
|
||||
}
|
||||
|
||||
bool IsInBackgroundWindow() const
|
||||
{
|
||||
nsPIDOMWindow* outer = mWindow ? mWindow->GetOuterWindow() : nsnull;
|
||||
return outer && outer->IsBackground();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the inner window used as the script compilation scope for
|
||||
* this document. If you're not absolutely sure you need this, use
|
||||
|
|
|
@ -1547,9 +1547,8 @@ nsContentSink::WillParseImpl(void)
|
|||
vm->GetLastUserEventTime(lastEventTime);
|
||||
|
||||
bool newDynLower =
|
||||
mDocument->IsInBackgroundWindow() ||
|
||||
((currentTime - mBeginLoadTime) > PRUint32(sInitialPerfTime) &&
|
||||
(currentTime - lastEventTime) < PRUint32(sInteractiveTime));
|
||||
(currentTime - mBeginLoadTime) > PRUint32(sInitialPerfTime) &&
|
||||
(currentTime - lastEventTime) < PRUint32(sInteractiveTime);
|
||||
|
||||
if (mDynamicLowerValue != newDynLower) {
|
||||
FavorPerformanceHint(!newDynLower, 0);
|
||||
|
|
|
@ -157,9 +157,7 @@ class nsHtml5ExecutorFlusher : public nsRunnable
|
|||
{}
|
||||
NS_IMETHODIMP Run()
|
||||
{
|
||||
if (!mExecutor->isInList()) {
|
||||
mExecutor->RunFlushLoop();
|
||||
}
|
||||
mExecutor->RunFlushLoop();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -99,9 +99,6 @@ class nsHtml5ExecutorReflusher : public nsRunnable
|
|||
}
|
||||
};
|
||||
|
||||
static mozilla::LinkedList<nsHtml5TreeOpExecutor>* gBackgroundFlushList = nsnull;
|
||||
static nsITimer* gFlushTimer = nsnull;
|
||||
|
||||
nsHtml5TreeOpExecutor::nsHtml5TreeOpExecutor(bool aRunsToCompletion)
|
||||
{
|
||||
mRunsToCompletion = aRunsToCompletion;
|
||||
|
@ -112,18 +109,6 @@ nsHtml5TreeOpExecutor::nsHtml5TreeOpExecutor(bool aRunsToCompletion)
|
|||
nsHtml5TreeOpExecutor::~nsHtml5TreeOpExecutor()
|
||||
{
|
||||
NS_ASSERTION(mOpQueue.IsEmpty(), "Somehow there's stuff in the op queue.");
|
||||
|
||||
if (gBackgroundFlushList && isInList()) {
|
||||
remove();
|
||||
if (gBackgroundFlushList->isEmpty()) {
|
||||
delete gBackgroundFlushList;
|
||||
gBackgroundFlushList = nsnull;
|
||||
if (gFlushTimer) {
|
||||
gFlushTimer->Cancel();
|
||||
NS_RELEASE(gFlushTimer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// nsIContentSink
|
||||
|
@ -336,46 +321,13 @@ nsHtml5TreeOpExecutor::FlushTags()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
FlushTimerCallback(nsITimer* aTimer, void* aClosure)
|
||||
{
|
||||
nsRefPtr<nsHtml5TreeOpExecutor> ex = gBackgroundFlushList->popFirst();
|
||||
if (ex) {
|
||||
ex->RunFlushLoop();
|
||||
}
|
||||
if (gBackgroundFlushList && gBackgroundFlushList->isEmpty()) {
|
||||
delete gBackgroundFlushList;
|
||||
gBackgroundFlushList = nsnull;
|
||||
gFlushTimer->Cancel();
|
||||
NS_RELEASE(gFlushTimer);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeOpExecutor::ContinueInterruptedParsingAsync()
|
||||
{
|
||||
if (!mDocument || !mDocument->IsInBackgroundWindow()) {
|
||||
nsCOMPtr<nsIRunnable> flusher = new nsHtml5ExecutorReflusher(this);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(flusher))) {
|
||||
NS_WARNING("failed to dispatch executor flush event");
|
||||
}
|
||||
} else {
|
||||
if (!gBackgroundFlushList) {
|
||||
gBackgroundFlushList = new mozilla::LinkedList<nsHtml5TreeOpExecutor>();
|
||||
}
|
||||
if (!isInList()) {
|
||||
gBackgroundFlushList->insertBack(this);
|
||||
}
|
||||
if (!gFlushTimer) {
|
||||
nsCOMPtr<nsITimer> t = do_CreateInstance("@mozilla.org/timer;1");
|
||||
t.swap(gFlushTimer);
|
||||
// The timer value 50 should not hopefully slow down background pages too
|
||||
// much, yet lets event loop to process enough between ticks.
|
||||
// See bug 734015.
|
||||
gFlushTimer->InitWithFuncCallback(FlushTimerCallback, nsnull,
|
||||
50, nsITimer::TYPE_REPEATING_SLACK);
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIRunnable> flusher = new nsHtml5ExecutorReflusher(this);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(flusher))) {
|
||||
NS_WARNING("failed to dispatch executor flush event");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -58,7 +58,6 @@
|
|||
#include "nsIURI.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
|
||||
class nsHtml5Parser;
|
||||
class nsHtml5TreeBuilder;
|
||||
|
@ -76,8 +75,7 @@ enum eHtml5FlushState {
|
|||
|
||||
class nsHtml5TreeOpExecutor : public nsContentSink,
|
||||
public nsIContentSink,
|
||||
public nsAHtml5TreeOpSink,
|
||||
public mozilla::LinkedListElement<nsHtml5TreeOpExecutor>
|
||||
public nsAHtml5TreeOpSink
|
||||
{
|
||||
friend class nsHtml5FlushLoopGuard;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче