Make cocoa as fast as macho. Not part of build.

This commit is contained in:
hyatt%netscape.com 2002-02-14 02:36:19 +00:00
Родитель 993e97c4e8
Коммит 05ada4384a
1 изменённых файлов: 9 добавлений и 3 удалений

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

@ -96,7 +96,7 @@ static PRUintn gToolkitTLSIndex = 0;
mEventQueueService = service.get();
NS_IF_ADDREF(mEventQueueService);
mEventTimer = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(eventTimer:) userInfo:nil
mEventTimer = [NSTimer scheduledTimerWithTimeInterval:0.005 target:self selector:@selector(eventTimer:) userInfo:nil
repeats:YES];
NS_ASSERTION(mEventTimer, "UH OH! couldn't create periodic event processing timer");
@ -129,14 +129,20 @@ printf("shutting down event queue\n");
//
// Called periodically to process PLEvents from the queue on the current thread
//
#define LOOP_THRESHOLD 10
- (void)eventTimer:(NSTimer *)theTimer
{
if ( mEventQueueService ) {
nsCOMPtr<nsIEventQueue> queue;
mEventQueueService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(queue));
if (queue) {
nsresult rv = queue->ProcessPendingEvents();
NS_ASSERTION(NS_SUCCEEDED(rv), "Error processing PLEvents");
nsresult rv = NS_OK;
for (PRInt32 i = 0; i < LOOP_THRESHOLD; i++) {
queue->ProcessPendingEvents();
NS_ASSERTION(NS_SUCCEEDED(rv), "Error processing PLEvents");
}
}
}