Bug 1404198: Part 2d - Switch to NS_NewTimer* in widget. r=njn

MozReview-Commit-ID: G4S8q9DYPS0

--HG--
extra : rebase_source : 9c6da05bf2ef3cfee551879879330a85688b1f5d
This commit is contained in:
Kris Maglione 2017-10-15 23:12:54 -07:00
Родитель d1f06996d7
Коммит c2da8a30a3
7 изменённых файлов: 17 добавлений и 19 удалений

Просмотреть файл

@ -2916,7 +2916,7 @@ IMEInputHandler::ResetTimer()
if (mTimer) {
mTimer->Cancel();
} else {
mTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
mTimer = NS_NewTimer();
NS_ENSURE_TRUE(mTimer, );
}
mTimer->InitWithNamedFuncCallback(FlushPendingMethods, this, 0,

Просмотреть файл

@ -17,7 +17,7 @@ nsMacDockSupport::nsMacDockSupport()
, mProgressState(STATE_NO_PROGRESS)
, mProgressFraction(0.0)
{
mProgressTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
mProgressTimer = NS_NewTimer();
}
nsMacDockSupport::~nsMacDockSupport()
@ -133,7 +133,7 @@ bool nsMacDockSupport::InitProgress()
}
if (!mAppIcon) {
mProgressTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
mProgressTimer = NS_NewTimer();
mAppIcon = [[NSImage imageNamed:@"NSApplicationIcon"] retain];
mProgressBackground = [mAppIcon copyWithZone:nil];
mTheme = new nsNativeThemeCocoa();

Просмотреть файл

@ -1992,8 +1992,8 @@ nsIWidget::SynthesizeNativeTouchTap(LayoutDeviceIntPoint aPoint, bool aLongTap,
int elapse = Preferences::GetInt("ui.click_hold_context_menus.delay",
TOUCH_INJECT_LONG_TAP_DEFAULT_MSEC);
if (!mLongTapTimer) {
mLongTapTimer = do_CreateInstance(NS_TIMER_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
mLongTapTimer = NS_NewTimer();
if (!mLongTapTimer) {
SynthesizeNativeTouchPoint(pointerId, TOUCH_CANCEL,
aPoint, 0, 0, nullptr);
return NS_ERROR_UNEXPECTED;

Просмотреть файл

@ -154,7 +154,7 @@ nsIdleServiceDaily::Observe(nsISupports *,
nsIdleServiceDaily::nsIdleServiceDaily(nsIIdleService* aIdleService)
: mIdleService(aIdleService)
, mTimer(do_CreateInstance(NS_TIMER_CONTRACTID))
, mTimer(NS_NewTimer())
, mCategoryObservers(OBSERVER_TOPIC_IDLE_DAILY)
, mShutdownInProgress(false)
, mExpectedTriggerTime(0)
@ -451,9 +451,8 @@ nsIdleService::AddIdleObserver(nsIObserver* aObserver, uint32_t aIdleTimeInS)
// Create our timer callback if it's not there already.
if (!mTimer) {
nsresult rv;
mTimer = do_CreateInstance(NS_TIMER_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
mTimer = NS_NewTimer();
NS_ENSURE_TRUE(mTimer, NS_ERROR_OUT_OF_MEMORY);
}
// Check if the newly added observer has a smaller wait time than what we

Просмотреть файл

@ -636,7 +636,7 @@ nsNativeTheme::QueueAnimatedContentForRefresh(nsIContent* aContent,
timeout = std::min(mAnimatedContentTimeout, timeout);
if (!mAnimatedContentTimer) {
mAnimatedContentTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
mAnimatedContentTimer = NS_NewTimer();
NS_ENSURE_TRUE(mAnimatedContentTimer, false);
}

Просмотреть файл

@ -455,11 +455,11 @@ public:
// We need to listen to both the xpcom shutdown message and our timer, and
// fire when the first of either of these two messages is received.
nsresult rv;
mTimer = do_CreateInstance(NS_TIMER_CONTRACTID, &rv);
rv = NS_NewTimerWithObserver(getter_AddRefs(mTimer),
this, 500, nsITimer::TYPE_ONE_SHOT);
if (NS_WARN_IF(NS_FAILED(rv))) {
return;
}
mTimer->Init(this, 500, nsITimer::TYPE_ONE_SHOT);
nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1");

Просмотреть файл

@ -159,16 +159,15 @@ private:
nsTimerCallbackFunc aCallbackFunc,
const char* aName)
{
mPickerCallbackTimer = do_CreateInstance("@mozilla.org/timer;1");
NS_NewTimerWithFuncCallback(getter_AddRefs(mPickerCallbackTimer),
aCallbackFunc,
aTarget,
kDialogTimerTimeout,
nsITimer::TYPE_REPEATING_SLACK,
aName);
if (!mPickerCallbackTimer) {
NS_WARNING("do_CreateInstance for timer failed??");
return;
}
mPickerCallbackTimer->InitWithNamedFuncCallback(aCallbackFunc,
aTarget,
kDialogTimerTimeout,
nsITimer::TYPE_REPEATING_SLACK,
aName);
}
nsCOMPtr<nsITimer> mPickerCallbackTimer;
};