Backout Bug 508518, a=dromaeo-dom-regression

This commit is contained in:
Olli Pettay 2010-10-25 00:52:17 +03:00
parent 5e2afd7e37
commit c4214860e8
6 changed files with 17 additions and 65 deletions

View File

@ -290,13 +290,8 @@ nsUITimerCallback::Notify(nsITimer* aTimer)
if ((gMouseOrKeyboardEventCounter == mPreviousCount) || !aTimer) {
gMouseOrKeyboardEventCounter = 0;
obs->NotifyObservers(nsnull, "user-interaction-inactive", nsnull);
if (gUserInteractionTimer) {
gUserInteractionTimer->Cancel();
NS_RELEASE(gUserInteractionTimer);
}
} else {
obs->NotifyObservers(nsnull, "user-interaction-active", nsnull);
nsEventStateManager::UpdateUserActivityTimer();
}
mPreviousCount = gMouseOrKeyboardEventCounter;
return NS_OK;
@ -789,28 +784,17 @@ nsEventStateManager::nsEventStateManager()
{
if (sESMInstanceCount == 0) {
gUserInteractionTimerCallback = new nsUITimerCallback();
if (gUserInteractionTimerCallback)
if (gUserInteractionTimerCallback) {
NS_ADDREF(gUserInteractionTimerCallback);
UpdateUserActivityTimer();
}
++sESMInstanceCount;
}
nsresult
nsEventStateManager::UpdateUserActivityTimer(void)
{
if (!gUserInteractionTimerCallback)
return NS_OK;
if (!gUserInteractionTimer)
CallCreateInstance("@mozilla.org/timer;1", &gUserInteractionTimer);
if (gUserInteractionTimer) {
gUserInteractionTimer->InitWithCallback(gUserInteractionTimerCallback,
NS_USER_INTERACTION_INTERVAL,
nsITimer::TYPE_ONE_SHOT);
nsITimer::TYPE_REPEATING_SLACK);
}
return NS_OK;
}
}
++sESMInstanceCount;
}
NS_IMETHODIMP
@ -1087,7 +1071,6 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
mozilla::services::GetObserverService();
if (obs) {
obs->NotifyObservers(nsnull, "user-interaction-active", nsnull);
UpdateUserActivityTimer();
}
}
++gMouseOrKeyboardEventCounter;

View File

@ -402,9 +402,6 @@ protected:
PRPackedBool m_haveShutdown;
public:
static nsresult UpdateUserActivityTimer(void);
// Array for accesskey support
nsCOMArray<nsIContent> mAccessKeys;

View File

@ -177,9 +177,6 @@ static PRLogModuleInfo* gJSDiagnostics;
// CC will be called if there are at least NS_MAX_SUSPECT_CHANGES new suspected
// objects.
#define NS_MAX_SUSPECT_CHANGES 100
// When CCIfUserInactive(PR_FALSE, PR_TRUE) is called, CC is called
// if there are at least NS_MIN_INACTIVE_SUSPECT_CHANGES new suspected objects.
#define NS_MIN_INACTIVE_SUSPECT_CHANGES 5
// if you add statics here, add them to the list in nsJSRuntime::Startup
@ -3620,14 +3617,10 @@ nsJSContext::CC(nsICycleCollectorListener *aListener)
sCCSuspectChanges = 0;
// nsCycleCollector_collect() no longer forces a JS garbage collection,
// so we have to do it ourselves here.
if (nsContentUtils::XPConnect()) {
nsContentUtils::XPConnect()->GarbageCollect();
}
sCollectedObjectsCounts = nsCycleCollector_collect(aListener);
sCCSuspectedCount = nsCycleCollector_suspectedCount();
if (nsJSRuntime::sRuntime) {
sSavedGCCount = JS_GetGCParameter(nsJSRuntime::sRuntime, JSGC_NUMBER);
}
#ifdef DEBUG_smaug
printf("Collected %u objects, %u suspected objects, took %lldms\n",
sCollectedObjectsCounts, sCCSuspectedCount,
@ -3698,22 +3691,11 @@ nsJSContext::MaybeCC(PRBool aHigherProbability)
//static
void
nsJSContext::CCIfUserInactive(PRBool aOrMaybeCC,
PRBool aOnlyIfNewSuspectedObjects)
nsJSContext::CCIfUserInactive()
{
if (sUserIsActive) {
if (aOrMaybeCC) {
MaybeCC(PR_TRUE);
}
} else if (!aOnlyIfNewSuspectedObjects ||
((nsCycleCollector_suspectedCount() - sCCSuspectedCount) >
NS_MIN_INACTIVE_SUSPECT_CHANGES)) {
#ifdef DEBUG_smaug
if (aOnlyIfNewSuspectedObjects) {
printf("CCIfUserInactive, %u suspected changes\n",
nsCycleCollector_suspectedCount() - sCCSuspectedCount);
}
#endif
} else {
IntervalCC();
}
}
@ -3925,7 +3907,7 @@ nsJSRuntime::Startup()
sDelayedCCollectCount = 0;
sCCollectCount = 0;
sUserIsActive = PR_FALSE;
sPreviousCCTime = PR_Now();
sPreviousCCTime = 0;
sCollectedObjectsCounts = 0;
sSavedGCCount = 0;
sCCSuspectChanges = 0;

View File

@ -210,13 +210,8 @@ public:
// elapsed since the previous cycle collector call.
static PRBool IntervalCC();
// Calls IntervalCC() if user is currently inactive.
// If user is active and aOrMaybeCC PR_TRUE, this calls MaybeCC(PR_TRUE)
// If aOnlyIfNewSuspectedObjects is PR_TRUE, CC is called only if
// user is inactive and there are some new suspected objects.
static void CCIfUserInactive(PRBool aOrMaybeCC = PR_TRUE,
PRBool aOnlyIfNewSuspectedObjects = PR_FALSE);
// Calls IntervalCC() if user is currently inactive, otherwise MaybeCC(PR_TRUE)
static void CCIfUserInactive();
static void FireGCTimer(PRBool aLoadInProgress);

View File

@ -123,7 +123,6 @@ LOCAL_INCLUDES = \
-I$(topsrcdir)/content/svg/content/src \
-I$(topsrcdir)/layout/style \
-I$(topsrcdir)/layout/base \
-I$(topsrcdir)/dom/base \
$(NULL)
EXTRA_DSO_LDOPTS += \

View File

@ -54,7 +54,7 @@
#include "dom_quickstubs.h"
#include "nsNullPrincipal.h"
#include "nsIURI.h"
#include "nsJSEnvironment.h"
#include "jstypedarray.h"
#include "XrayWrapper.h"
@ -2242,10 +2242,6 @@ NS_IMETHODIMP
nsXPConnect::AfterProcessNextEvent(nsIThreadInternal *aThread,
PRUint32 aRecursionDepth)
{
if (NS_IsMainThread()) {
nsJSContext::CCIfUserInactive(PR_FALSE, PR_TRUE);
}
return Pop(nsnull);
}