Backed out changeset 86cd5f375c7d (Bug 762620)

This commit is contained in:
Gian-Carlo Pascutto 2012-06-13 09:40:06 +02:00
parent fb3f522c64
commit a5e0f1888e

View File

@ -17,10 +17,6 @@
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#ifdef ANDROID
#include <android/log.h>
#endif
using namespace mozilla;
// observer topics used:
@ -78,10 +74,6 @@ nsIdleServiceDaily::Observe(nsISupports *,
}
MOZ_ASSERT(strcmp(aTopic, OBSERVER_TOPIC_IDLE) == 0);
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService", "Notifying idle-daily observers");
#endif
// Notify anyone who cares.
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
@ -104,11 +96,6 @@ nsIdleServiceDaily::Observe(nsISupports *,
PRInt32 nowSec = static_cast<PRInt32>(PR_Now() / PR_USEC_PER_SEC);
Preferences::SetInt(PREF_LAST_DAILY, nowSec);
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService", "Storing last idle time as %d",
nowSec);
#endif
// Start timer for the next check in one day.
(void)mTimer->InitWithFuncCallback(DailyCallback,
this,
@ -140,16 +127,10 @@ nsIdleServiceDaily::Init()
// Check if it has been a day since the last notification.
if (nowSec - lastDaily > SECONDS_PER_DAY) {
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService", "DailyCallback started");
#endif
// Wait for the user to become idle, so we can do todays idle tasks.
DailyCallback(nsnull, this);
}
else {
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService", "Setting timer a day from now");
#endif
// Start timer for the next check in one day.
(void)mTimer->InitWithFuncCallback(DailyCallback,
this,
@ -286,10 +267,6 @@ nsIdleService::AddIdleObserver(nsIObserver* aObserver, PRUint32 aIdleTimeInS)
PR_LOG(sLog, PR_LOG_DEBUG,
("idleService: Register idle observer %x for %d seconds",
aObserver, aIdleTimeInS));
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService", "Register idle observer %x for %d seconds",
aObserver, aIdleTimeInS);
#endif
NS_ENSURE_ARG_POINTER(aObserver);
// We don't accept idle time at 0, and we can't handle idle time that are too
@ -318,12 +295,6 @@ nsIdleService::AddIdleObserver(nsIObserver* aObserver, PRUint32 aIdleTimeInS)
PR_LOG(sLog, PR_LOG_DEBUG,
("idleService: Register: adjusting next switch from %d to %d seconds",
mDeltaToNextIdleSwitchInS, aIdleTimeInS));
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService",
"Register: adjusting next switch from %d to %d seconds",
mDeltaToNextIdleSwitchInS, aIdleTimeInS);
#endif
mDeltaToNextIdleSwitchInS = aIdleTimeInS;
}
@ -349,11 +320,6 @@ nsIdleService::RemoveIdleObserver(nsIObserver* aObserver, PRUint32 aTimeInS)
PR_LOG(sLog, PR_LOG_DEBUG,
("idleService: Remove idle observer %x (%d seconds)",
aObserver, aTimeInS));
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService",
"Remove idle observer %x (%d seconds)",
aObserver, aTimeInS);
#endif
return NS_OK;
}
@ -361,11 +327,6 @@ nsIdleService::RemoveIdleObserver(nsIObserver* aObserver, PRUint32 aTimeInS)
PR_LOG(sLog, PR_LOG_WARNING,
("idleService: Failed to remove idle observer %x (%d seconds)",
aObserver, aTimeInS));
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService",
"Failed to remove idle observer %x (%d seconds)",
aObserver, aTimeInS);
#endif
return NS_ERROR_FAILURE;
}
@ -434,11 +395,6 @@ nsIdleService::ResetIdleTimeOut(PRUint32 idleDeltaInMS)
PR_LOG(sLog, PR_LOG_DEBUG,
("idleService: Reset idle timeout: tell observer %x user is back",
notifyList[numberOfPendingNotifications]));
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService",
"Reset idle timeout: tell observer %x user is back",
notifyList[numberOfPendingNotifications]);
#endif
notifyList[numberOfPendingNotifications]->Observe(this,
OBSERVER_TOPIC_BACK,
timeStr.get());
@ -470,11 +426,6 @@ nsIdleService::GetIdleTime(PRUint32* idleTime)
PR_LOG(sLog, PR_LOG_DEBUG,
("idleService: Get idle time: time since reset %u msec",
timeSinceResetInMS));
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService",
"Get idle time: time since reset %u msec",
timeSinceResetInMS);
#endif
// If we did't get pulled data, return the time since last idle reset.
if (!polledIdleTimeIsValid) {
@ -522,21 +473,12 @@ nsIdleService::IdleTimerCallback(void)
if (NS_FAILED(GetIdleTime(&currentIdleTimeInMS))) {
PR_LOG(sLog, PR_LOG_ALWAYS,
("idleService: Idle timer callback: failed to get idle time"));
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService",
"Idle timer callback: failed to get idle time");
#endif
return;
}
PR_LOG(sLog, PR_LOG_DEBUG,
("idleService: Idle timer callback: current idle time %u msec",
currentIdleTimeInMS));
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService",
"Idle timer callback: current idle time %u msec",
currentIdleTimeInMS);
#endif
// Check if we have had some user interaction we didn't handle previously
// we do the calculation in ms to lessen the chance for rounding errors to
@ -616,11 +558,6 @@ nsIdleService::IdleTimerCallback(void)
PR_LOG(sLog, PR_LOG_DEBUG,
("idleService: Idle timer callback: tell observer %x user is idle",
notifyList[numberOfPendingNotifications]));
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService",
"Idle timer callback: tell observer %x user is idle",
notifyList[numberOfPendingNotifications]);
#endif
notifyList[numberOfPendingNotifications]->Observe(this,
OBSERVER_TOPIC_IDLE,
timeStr.get());
@ -633,11 +570,6 @@ nsIdleService::SetTimerExpiryIfBefore(PRTime aNextTimeoutInPR)
PR_LOG(sLog, PR_LOG_DEBUG,
("idleService: SetTimerExpiryIfBefore: next timeout %lld usec",
aNextTimeoutInPR));
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService",
"SetTimerExpiryIfBefore: next timeout %lld usec",
aNextTimeoutInPR);
#endif
// Bail if we don't have a timer service.
if (!mTimer) {
@ -670,11 +602,6 @@ nsIdleService::SetTimerExpiryIfBefore(PRTime aNextTimeoutInPR)
PR_LOG(sLog, PR_LOG_DEBUG,
("idleService: reset timer expiry from %lld usec to %lld usec",
oldTimeout, mCurrentlySetToTimeoutAtInPR));
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService",
"reset timer expiry from %lld usec to %lld usec",
oldTimeout, mCurrentlySetToTimeoutAtInPR);
#endif
// Start the timer
mTimer->InitWithFuncCallback(StaticIdleTimerCallback,
@ -696,10 +623,6 @@ nsIdleService::ReconfigureTimer(void)
// And bail out.
PR_LOG(sLog, PR_LOG_DEBUG,
("idleService: ReconfigureTimer: no idle or waiting observers"));
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService",
"ReconfigureTimer: no idle or waiting observers");
#endif
return;
}
@ -717,12 +640,6 @@ nsIdleService::ReconfigureTimer(void)
("idleService: next timeout %lld usec (%u msec from now)",
nextTimeoutAtInPR,
(PRUint32)((nextTimeoutAtInPR - curTimeInPR) / PR_USEC_PER_MSEC)));
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService",
"next timeout %lld usec (%lld msec from now)",
nextTimeoutAtInPR,
((nextTimeoutAtInPR - curTimeInPR) / PR_USEC_PER_MSEC));
#endif
// Check if we should correct the timeout time because we should poll before.
if (mAnyObserverIdle && UsePollMode()) {
PRTime pollTimeout = curTimeInPR +
@ -732,11 +649,6 @@ nsIdleService::ReconfigureTimer(void)
PR_LOG(sLog, PR_LOG_DEBUG,
("idleService: idle observers, reducing timeout to %u msec from now",
MIN_IDLE_POLL_INTERVAL_MSEC));
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "IdleService",
"idle observers, reducing timeout to %u msec from now",
MIN_IDLE_POLL_INTERVAL_MSEC);
#endif
nextTimeoutAtInPR = pollTimeout;
}
}