When I fixed the XP timer code, I forgot to update the OS/2 timers. Duh.
This commit is contained in:
mkaply%us.ibm.com 2000-10-21 02:44:30 +00:00
Родитель 5fa536e789
Коммит fa4ea3d368
5 изменённых файлов: 18 добавлений и 104 удалений

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

@ -87,13 +87,13 @@ void CALLBACK FireTimeout(HWND aWindow,
if (!sTimerQueue) return;
QMSG wmsg;
bool eventQueueEmpty = !(WinPeekMsg(NULLHANDLE, &wmsg, NULLHANDLE,
BOOL eventQueueEmpty = !(WinPeekMsg(NULLHANDLE, &wmsg, NULLHANDLE,
0, WM_TIMER-1, PM_NOREMOVE) ||
WinPeekMsg(NULLHANDLE, &wmsg, NULLHANDLE,
WM_TIMER+1, WM_USER-1, PM_NOREMOVE));
if (aTimerID != HEARTBEATTIMERID) {
bool timerQueueEmpty = !sTimerQueue->HasReadyTimers(NS_PRIORITY_LOWEST);
BOOL timerQueueEmpty = !sTimerQueue->HasReadyTimers(NS_PRIORITY_LOWEST);
if ((timerQueueEmpty && eventQueueEmpty) ||
timer->GetPriority() >= NS_PRIORITY_IMMEDIATE) {
@ -130,7 +130,7 @@ nsTimer::nsTimer() : nsITimer()
mCallback = nsnull;
mClosure = nsnull;
mTimerID = 0;
mTimerRunning = false;
mTimerRunning = PR_FALSE;
static int cachedService = 0;
if (cachedService == 0) {
@ -195,7 +195,7 @@ nsresult nsTimer::Init(PRUint32 aDelay,
// prevent timer being released before
// it has fired or is canceled
NS_ADDREF_THIS();
mTimerRunning = true;
mTimerRunning = PR_TRUE;
mDelay = aDelay;
@ -212,7 +212,7 @@ void nsTimer::Fire()
{
// prevent a canceled timer which is
// already in ready queue from firing
if (mTimerRunning == false) return;
if (mTimerRunning == PR_FALSE) return;
// prevent notification routine
// from releasing timer by canceling it
@ -233,8 +233,8 @@ void nsTimer::Fire()
} else if (GetType() == NS_TYPE_ONE_SHOT) {
// timer finished
if (mTimerRunning == true) {
mTimerRunning = false;
if (mTimerRunning == PR_TRUE) {
mTimerRunning = PR_FALSE;
NS_RELEASE_THIS();
}
@ -249,8 +249,8 @@ NS_IMETHODIMP_(void) nsTimer::Cancel()
KillOSTimer();
// timer finished
if (mTimerRunning == true) {
mTimerRunning = false;
if (mTimerRunning == PR_TRUE) {
mTimerRunning = PR_FALSE;
NS_RELEASE_THIS();
}

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

@ -73,14 +73,14 @@ nsresult nsTimerManager::Init()
}
NS_IMETHODIMP_(bool) nsTimerManager::IsTimerInQueue(nsITimer* timer)
NS_IMETHODIMP_(PRBool) nsTimerManager::IsTimerInQueue(nsITimer* timer)
{
if (mReadyQueue == nsnull) return false;
if (mReadyQueue == nsnull) return PR_FALSE;
for (int i=0; i<mReadyQueue->Count(); i++) {
if (mReadyQueue->ElementAt(i) == timer) return true;
if (mReadyQueue->ElementAt(i) == timer) return PR_TRUE;
}
return false;
return PR_FALSE;
}
@ -100,12 +100,12 @@ NS_IMETHODIMP_(void) nsTimerManager::AddReadyQueue(nsITimer* timer)
}
NS_IMETHODIMP_(bool) nsTimerManager::HasReadyTimers(PRUint32 minTimerPriority)
NS_IMETHODIMP_(PRBool) nsTimerManager::HasReadyTimers(PRUint32 minTimerPriority)
{
if (mReadyQueue == nsnull || mReadyQueue->Count() == 0) return false;
if (mReadyQueue == nsnull || mReadyQueue->Count() == 0) return PR_FALSE;
nsTimer* timer = (nsTimer*) mReadyQueue->ElementAt(0);
if (timer == nsnull) return false;
if (timer == nsnull) return PR_FALSE;
return timer->GetPriority() >= minTimerPriority;
}
@ -113,7 +113,7 @@ NS_IMETHODIMP_(bool) nsTimerManager::HasReadyTimers(PRUint32 minTimerPriority)
NS_IMETHODIMP_(void) nsTimerManager::FireNextReadyTimer(PRUint32 minTimerPriority)
{
PR_ASSERT(HasReadyTimers(minTimerPriority) == true);
PR_ASSERT(HasReadyTimers(minTimerPriority) == PR_TRUE);
if (mReadyQueue == nsnull) return;

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

@ -1,83 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Michael Lowe <michael.lowe@bigfoot.com>
*
* This Original Code has been modified by IBM Corporation.
* Modifications made by IBM described herein are
* Copyright (c) International Business Machines
* Corporation, 2000
*
* Modifications to Mozilla code or documentation
* identified per MPL Section 3.3
*
* Date Modified by Description of modification
* 05/31/2000 IBM Corp. Including os2TimerGlue.h instead of windows.h
*/
#ifndef __nsTimerManager_h
#define __nsTimerManager_h
#include "nsITimerQueue.h"
#include "nsIWindowsTimerMap.h"
#include "nsCRT.h"
//#include "prlog.h"
//#include <stdio.h>
#include "os2TimerGlue.h"
//#include <limits.h>
#include "nsHashtable.h"
#include "nsVoidArray.h"
class nsTimer;
class nsTimerManager : public nsITimerQueue, nsIWindowsTimerMap {
private:
// pending timers
nsHashtable* mTimers;
// ready timers
nsVoidArray* mReadyQueue;
nsresult Init();
public:
nsTimerManager();
virtual ~nsTimerManager();
NS_DECL_ISUPPORTS
// --- manage map of Windows timer id's to Timer objects ---
NS_IMETHOD_(nsTimer*) GetTimer(UINT id);
NS_IMETHOD_(void) AddTimer(UINT timerID, nsTimer* timer);
NS_IMETHOD_(void) RemoveTimer(UINT timerID);
// --- manage priority queue of ready timers ---
NS_IMETHOD_(void) AddReadyQueue(nsITimer* timer);
// is this timer in the ready queue?
NS_IMETHOD_(bool) IsTimerInQueue(nsITimer* timer);
// does a timer above a priority level exist in the ready queue?
NS_IMETHOD_(bool) HasReadyTimers(PRUint32 minTimerPriority);
// fire the next timer above a priority level in the ready queue
NS_IMETHOD_(void) FireNextReadyTimer(PRUint32 minTimerPriority);
};
#endif // __nsTimerManager_h

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

@ -94,7 +94,7 @@ private:
UINT mTimerID;
bool mTimerRunning;
PRBool mTimerRunning;
};
#endif // __nsTimer_h

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

@ -58,9 +58,6 @@ extern TID QueryCurrentTID(void);
#define TIMERCLASS ("WarpzillaTimerClass")
#define CALLBACK _System
typedef ULONG DWORD;
typedef BOOL bool;
#define true TRUE
#define false FALSE
#define HEARTBEATTIMEOUT 50
#define HEARTBEATTIMERID 0x7ffe