Changeset 18998 in vbox for trunk/src/VBox/Main
- Timestamp:
- Apr 17, 2009 4:27:28 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 46090
- Location:
- trunk/src/VBox/Main/cbinding
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/cbinding/Makefile.kmk
r18895 r18998 34 34 XpComCSamples_SOURCES = \ 35 35 tstXPCOMCGlue.c \ 36 tstXPCOMCCall.c \ 36 37 makefile.tstXPCOMCGlue=>Makefile 37 38 -
trunk/src/VBox/Main/cbinding/VBoxXPCOMC.cpp
r18895 r18998 35 35 using namespace std; 36 36 37 static ISession *Session; 38 static IVirtualBox *Ivirtualbox; 39 static nsIServiceManager *serviceManager; 40 static nsIComponentManager *manager; 37 static ISession *Session = NULL; 38 static IVirtualBox *Ivirtualbox = NULL; 39 static nsIServiceManager *serviceManager = NULL; 40 static nsIComponentManager *manager = NULL; 41 static nsIEventQueue *eventQ = NULL; 41 42 42 43 static void VBoxComUninitialize(void); … … 98 99 { 99 100 Log(("Cbinding: Could not get component manager! rc=%Rhrc\n",rc)); 101 VBoxComUninitialize(); 102 return; 103 } 104 105 rc = NS_GetMainEventQ (&eventQ); 106 if (NS_FAILED(rc)) 107 { 108 Log(("Cbinding: Could not get xpcom event queue! rc=%Rhrc\n",rc)); 100 109 VBoxComUninitialize(); 101 110 return; … … 136 145 if (Ivirtualbox) 137 146 NS_RELEASE(Ivirtualbox); // decrement refcount 147 if (eventQ) 148 NS_RELEASE(eventQ); // decrement refcount 138 149 if (manager) 139 150 NS_RELEASE(manager); // decrement refcount … … 144 155 } 145 156 157 static void 158 VBoxGetEventQueue(nsIEventQueue **eventQueue) 159 { 160 *eventQueue = eventQ; 161 } 162 146 163 static uint32_t 147 164 VBoxVersion(void) … … 175 192 VBoxUtf8ToUtf16, 176 193 194 VBoxGetEventQueue, 195 177 196 VBOX_XPCOMC_VERSION 178 197 }; -
trunk/src/VBox/Main/cbinding/makefile.tstXPCOMCGlue
r18527 r18998 28 28 29 29 .PHONY: all 30 all: tstXPCOMCGlue 30 all: tstXPCOMCGlue tstXPCOMCCall 31 31 32 32 .PHONY: clean 33 33 clean: 34 rm -f tstXPCOMCGlue.o tstXPCOMCGlue VBoxXPCOMCGlue.o 34 rm -f tstXPCOMCGlue.o tstXPCOMCGlue VBoxXPCOMCGlue.o tstXPCOMCCall.o tstXPCOMCCall 35 35 36 36 tstXPCOMCGlue: tstXPCOMCGlue.o VBoxXPCOMCGlue.o … … 40 40 $(CC) $(CFLAGS) $(INCS_XPCOM) $(GLUE_INC) -o $@ -c $< 41 41 42 tstXPCOMCCall: tstXPCOMCCall.o VBoxXPCOMCGlue.o 43 $(CC) -o $@ $^ -ldl -lpthread 44 45 tstXPCOMCCall.o: tstXPCOMCCall.c 46 $(CC) $(CFLAGS) $(INCS_XPCOM) $(GLUE_INC) -o $@ -c $< 47 42 48 VBoxXPCOMCGlue.o: $(GLUE_DIR)/VBoxXPCOMCGlue.c 43 49 $(CC) $(CFLAGS) $(INCS_XPCOM) $(GLUE_INC) -o $@ -c $< 44 -
trunk/src/VBox/Main/cbinding/tstXPCOMCCall.c
r18891 r18998 32 32 33 33 static char *nsIDToString(nsID *guid); 34 static void listVMs(IVirtualBox *virtualBox, ISession *session); 34 static void listVMs(IVirtualBox *virtualBox, ISession *session, nsIEventQueue *queue); 35 static void registerCallBack(IVirtualBox *virtualBox, ISession *session, nsID *machineId, nsIEventQueue *queue); 36 static void startVM(IVirtualBox *virtualBox, ISession *session, nsID *id, nsIEventQueue *queue); 35 37 36 38 int volatile g_refcount = 0; … … 59 61 } 60 62 63 /** 64 * Callback functions 65 */ 61 66 static const char *GetStateName(PRUint32 machineState) 62 67 { … … 90 95 PRUint8 * shape 91 96 ) { 92 printf(" %d here\n",__LINE__);97 printf("OnMousePointerShapeChange\n"); 93 98 return 0; 94 99 } … … 99 104 PRBool needsHostCursor 100 105 ) { 101 printf(" %d here\n",__LINE__);106 printf("OnMouseCapabilityChange\n"); 102 107 return 0; 103 108 } … … 109 114 PRBool scrollLock 110 115 ) { 111 printf(" %d here\n",__LINE__);116 printf("OnMouseCapabilityChange\n"); 112 117 return 0; 113 118 } … … 117 122 PRUint32 state 118 123 ) { 119 printf("%d here\n",__LINE__);120 124 printf("OnStateChange: %s\n", GetStateName(state)); 121 125 fflush(stdout); … … 125 129 static nsresult OnAdditionsStateChange(IConsoleCallback *pThis ) 126 130 { 127 printf(" %d here\n",__LINE__);131 printf("OnAdditionsStateChange\n"); 128 132 return 0; 129 133 } … … 131 135 static nsresult OnDVDDriveChange(IConsoleCallback *pThis ) 132 136 { 133 printf(" %d here\n",__LINE__);137 printf("OnDVDDriveChange \n"); 134 138 return 0; 135 139 } … … 137 141 static nsresult OnFloppyDriveChange(IConsoleCallback *pThis ) 138 142 { 139 printf(" %d here\n",__LINE__);143 printf("OnFloppyDriveChange \n"); 140 144 return 0; 141 145 } … … 145 149 INetworkAdapter * networkAdapter 146 150 ) { 147 printf(" %d here\n",__LINE__);151 printf("OnNetworkAdapterChange\n"); 148 152 return 0; 149 153 } … … 153 157 ISerialPort * serialPort 154 158 ) { 155 printf(" %d here\n",__LINE__);159 printf("OnSerialPortChange\n"); 156 160 return 0; 157 161 } … … 161 165 IParallelPort * parallelPort 162 166 ) { 163 printf(" %d here\n",__LINE__);167 printf("OnParallelPortChange\n"); 164 168 return 0; 165 169 } … … 167 171 static nsresult OnStorageControllerChange(IConsoleCallback *pThis ) 168 172 { 169 printf(" %d here\n",__LINE__);173 printf("OnStorageControllerChange\n"); 170 174 return 0; 171 175 } … … 173 177 static nsresult OnVRDPServerChange(IConsoleCallback *pThis ) 174 178 { 175 printf(" %d here\n",__LINE__);179 printf("OnVRDPServerChange\n"); 176 180 return 0; 177 181 } … … 179 183 static nsresult OnUSBControllerChange(IConsoleCallback *pThis ) 180 184 { 181 printf(" %d here\n",__LINE__);185 printf("OnUSBControllerChange\n"); 182 186 return 0; 183 187 } … … 189 193 IVirtualBoxErrorInfo * error 190 194 ) { 191 printf(" %d here\n",__LINE__);195 printf("OnUSBDeviceStateChange\n"); 192 196 return 0; 193 197 } … … 197 201 PRUint32 scope 198 202 ) { 199 printf(" %d here\n",__LINE__);203 printf("OnSharedFolderChange\n"); 200 204 return 0; 201 205 } … … 207 211 PRUnichar * message 208 212 ) { 209 printf(" %d here\n",__LINE__);213 printf("OnRuntimeError\n"); 210 214 return 0; 211 215 } … … 215 219 PRBool * canShow 216 220 ) { 217 printf(" %d here\n",__LINE__);221 printf("OnCanShowWindow\n"); 218 222 return 0; 219 223 } … … 223 227 PRUint64 * winId 224 228 ) { 225 printf(" %d here\n",__LINE__);229 printf("OnShowWindow\n"); 226 230 return 0; 227 231 } … … 246 250 { 247 251 /* delete object */ 248 #if 1 /* test */249 252 free(pThis->vtbl); 250 253 free(pThis); 251 #endif252 254 } 253 255 return c; … … 265 267 } 266 268 267 static void registerCallBack(IVirtualBox *virtualBox, ISession *session, nsID *machineId) 269 /** 270 * Register callback functions for the selected VM. 271 * 272 * @param virtualBox ptr to IVirtualBox object 273 * @param session ptr to ISession object 274 * @param id identifies the machine to start 275 * @param queue handle to the event queue 276 */ 277 static void registerCallBack(IVirtualBox *virtualBox, ISession *session, nsID *machineId, nsIEventQueue *queue) 268 278 { 269 279 IConsole *console = NULL; … … 303 313 g_refcount = 1; 304 314 305 printf("%d here\n",__LINE__);306 315 console->vtbl->RegisterCallback(console, consoleCallback); 307 printf("%d here\n",__LINE__);308 316 309 317 { 310 int run = 10; 318 /* crude way to show how it works, but any 319 * great ideas anyone? 320 */ 321 int run = 10000000; 311 322 while (run-- > 0) { 312 sleep(1); 313 printf("waiting here:%d\n",run); 314 fflush(stdout); 323 queue->vtbl->ProcessPendingEvents(queue); 315 324 } 316 325 } 317 326 console->vtbl->UnregisterCallback(console, consoleCallback); 318 327 } 319 /*consoleCallback->vtbl->Release(consoleCallback);*/328 consoleCallback->vtbl->nsisupports.Release((nsISupports *)consoleCallback); 320 329 } 321 330 session->vtbl->Close((void *)session); … … 327 336 * @param virtualBox ptr to IVirtualBox object 328 337 * @param session ptr to ISession object 338 * @param queue handle to the event queue 329 339 */ 330 static void listVMs(IVirtualBox *virtualBox, ISession *session )340 static void listVMs(IVirtualBox *virtualBox, ISession *session, nsIEventQueue *queue) 331 341 { 332 342 nsresult rc; … … 463 473 464 474 machine->vtbl->GetId(machine, &iid); 465 /*startVM(virtualBox, session, iid);*/ 466 registerCallBack(virtualBox, session, iid); 475 startVM(virtualBox, session, iid, queue); 467 476 468 477 g_pVBoxFuncs->pfnComUnallocMem(iid); … … 491 500 * @param session ptr to ISession object 492 501 * @param id identifies the machine to start 502 * @param queue handle to the event queue 493 503 */ 494 #if 0 495 static void startVM(IVirtualBox *virtualBox, ISession *session, nsID *id )504 505 static void startVM(IVirtualBox *virtualBox, ISession *session, nsID *id, nsIEventQueue *queue) 496 506 { 497 507 nsresult rc; … … 558 568 { 559 569 fprintf(stderr, "Remote session has been successfully opened.\n"); 570 registerCallBack(virtualBox, session, id, queue); 560 571 } 561 572 progress->vtbl->nsisupports.Release((void *)progress); … … 565 576 machine->vtbl->nsisupports.Release((void *)machine); 566 577 } 567 #endif568 578 569 579 /* Main - Start the ball rolling. */ … … 571 581 int main(int argc, char **argv) 572 582 { 573 IVirtualBox *vbox = NULL;583 IVirtualBox *vbox = NULL; 574 584 ISession *session = NULL; 585 nsIEventQueue *queue = NULL; 575 586 PRUint32 revision = 0; 576 587 PRUnichar *versionUtf16 = NULL; … … 604 615 return EXIT_FAILURE; 605 616 } 617 g_pVBoxFuncs->pfnGetEventQueue(&queue); 618 printf("Got the event queue: %p\n", queue); 606 619 607 620 /* … … 660 673 } 661 674 662 listVMs(vbox, session );675 listVMs(vbox, session, queue); 663 676 session->vtbl->Close(session); 664 677 -
trunk/src/VBox/Main/cbinding/xpcidl.xsl
r18821 r18998 388 388 #define NS_SUCCEEDED(_nsresult) (NS_LIKELY(!((_nsresult) & 0x80000000))) 389 389 390 #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP 391 # define PR_IntervalNow VBoxNsprPR_IntervalNow 392 # define PR_TicksPerSecond VBoxNsprPR_TicksPerSecond 393 # define PR_SecondsToInterval VBoxNsprPR_SecondsToInterval 394 # define PR_MillisecondsToInterval VBoxNsprPR_MillisecondsToInterval 395 # define PR_MicrosecondsToInterval VBoxNsprPR_MicrosecondsToInterval 396 # define PR_IntervalToSeconds VBoxNsprPR_IntervalToSeconds 397 # define PR_IntervalToMilliseconds VBoxNsprPR_IntervalToMilliseconds 398 # define PR_IntervalToMicroseconds VBoxNsprPR_IntervalToMicroseconds 399 # define PR_EnterMonitor VBoxNsprPR_EnterMonitor 400 # define PR_ExitMonitor VBoxNsprPR_ExitMonitor 401 # define PR_Notify VBoxNsprPR_Notify 402 # define PR_NotifyAll VBoxNsprPR_NotifyAll 403 # define PR_Wait VBoxNsprPR_Wait 404 # define PR_NewMonitor VBoxNsprPR_NewMonitor 405 # define PR_DestroyMonitor VBoxNsprPR_DestroyMonitor 406 #endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */ 407 408 typedef PRUint32 PRIntervalTime; 409 410 #define PR_INTERVAL_MIN 1000UL 411 #define PR_INTERVAL_MAX 100000UL 412 #define PR_INTERVAL_NO_WAIT 0UL 413 #define PR_INTERVAL_NO_TIMEOUT 0xffffffffUL 414 415 NSPR_API(PRIntervalTime) PR_IntervalNow(void); 416 NSPR_API(PRUint32) PR_TicksPerSecond(void); 417 NSPR_API(PRIntervalTime) PR_SecondsToInterval(PRUint32 seconds); 418 NSPR_API(PRIntervalTime) PR_MillisecondsToInterval(PRUint32 milli); 419 NSPR_API(PRIntervalTime) PR_MicrosecondsToInterval(PRUint32 micro); 420 NSPR_API(PRUint32) PR_IntervalToSeconds(PRIntervalTime ticks); 421 NSPR_API(PRUint32) PR_IntervalToMilliseconds(PRIntervalTime ticks); 422 NSPR_API(PRUint32) PR_IntervalToMicroseconds(PRIntervalTime ticks); 423 424 typedef struct PRMonitor PRMonitor; 425 426 NSPR_API(PRMonitor*) PR_NewMonitor(void); 427 NSPR_API(void) PR_DestroyMonitor(PRMonitor *mon); 428 NSPR_API(void) PR_EnterMonitor(PRMonitor *mon); 429 NSPR_API(PRStatus) PR_ExitMonitor(PRMonitor *mon); 430 NSPR_API(PRStatus) PR_Wait(PRMonitor *mon, PRIntervalTime ticks); 431 NSPR_API(PRStatus) PR_Notify(PRMonitor *mon); 432 NSPR_API(PRStatus) PR_NotifyAll(PRMonitor *mon); 433 434 #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP 435 # define PR_CreateThread VBoxNsprPR_CreateThread 436 # define PR_JoinThread VBoxNsprPR_JoinThread 437 # define PR_Sleep VBoxNsprPR_Sleep 438 # define PR_GetCurrentThread VBoxNsprPR_GetCurrentThread 439 # define PR_GetThreadState VBoxNsprPR_GetThreadState 440 # define PR_SetThreadPrivate VBoxNsprPR_SetThreadPrivate 441 # define PR_GetThreadPrivate VBoxNsprPR_GetThreadPrivate 442 # define PR_NewThreadPrivateIndex VBoxNsprPR_NewThreadPrivateIndex 443 # define PR_GetThreadPriority VBoxNsprPR_GetThreadPriority 444 # define PR_SetThreadPriority VBoxNsprPR_SetThreadPriority 445 # define PR_Interrupt VBoxNsprPR_Interrupt 446 # define PR_ClearInterrupt VBoxNsprPR_ClearInterrupt 447 # define PR_BlockInterrupt VBoxNsprPR_BlockInterrupt 448 # define PR_UnblockInterrupt VBoxNsprPR_UnblockInterrupt 449 # define PR_GetThreadScope VBoxNsprPR_GetThreadScope 450 # define PR_GetThreadType VBoxNsprPR_GetThreadType 451 #endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */ 452 453 typedef struct PRThread PRThread; 454 typedef struct PRThreadStack PRThreadStack; 455 456 typedef enum PRThreadType { 457 PR_USER_THREAD, 458 PR_SYSTEM_THREAD 459 } PRThreadType; 460 461 typedef enum PRThreadScope { 462 PR_LOCAL_THREAD, 463 PR_GLOBAL_THREAD, 464 PR_GLOBAL_BOUND_THREAD 465 } PRThreadScope; 466 467 typedef enum PRThreadState { 468 PR_JOINABLE_THREAD, 469 PR_UNJOINABLE_THREAD 470 } PRThreadState; 471 472 typedef enum PRThreadPriority 473 { 474 PR_PRIORITY_FIRST = 0, /* just a placeholder */ 475 PR_PRIORITY_LOW = 0, /* the lowest possible priority */ 476 PR_PRIORITY_NORMAL = 1, /* most common expected priority */ 477 PR_PRIORITY_HIGH = 2, /* slightly more aggressive scheduling */ 478 PR_PRIORITY_URGENT = 3, /* it does little good to have more than one */ 479 PR_PRIORITY_LAST = 3 /* this is just a placeholder */ 480 } PRThreadPriority; 481 482 NSPR_API(PRThread*) PR_CreateThread(PRThreadType type, 483 void (PR_CALLBACK *start)(void *arg), 484 void *arg, 485 PRThreadPriority priority, 486 PRThreadScope scope, 487 PRThreadState state, 488 PRUint32 stackSize); 489 NSPR_API(PRStatus) PR_JoinThread(PRThread *thread); 490 NSPR_API(PRThread*) PR_GetCurrentThread(void); 491 #ifndef NO_NSPR_10_SUPPORT 492 #define PR_CurrentThread() PR_GetCurrentThread() /* for nspr1.0 compat. */ 493 #endif /* NO_NSPR_10_SUPPORT */ 494 NSPR_API(PRThreadPriority) PR_GetThreadPriority(const PRThread *thread); 495 NSPR_API(void) PR_SetThreadPriority(PRThread *thread, PRThreadPriority priority); 496 497 typedef void (PR_CALLBACK *PRThreadPrivateDTOR)(void *priv); 498 499 NSPR_API(PRStatus) PR_NewThreadPrivateIndex( 500 PRUintn *newIndex, PRThreadPrivateDTOR destructor); 501 NSPR_API(PRStatus) PR_SetThreadPrivate(PRUintn tpdIndex, void *priv); 502 NSPR_API(void*) PR_GetThreadPrivate(PRUintn tpdIndex); 503 NSPR_API(PRStatus) PR_Interrupt(PRThread *thread); 504 NSPR_API(void) PR_ClearInterrupt(void); 505 NSPR_API(void) PR_BlockInterrupt(void); 506 NSPR_API(void) PR_UnblockInterrupt(void); 507 NSPR_API(PRStatus) PR_Sleep(PRIntervalTime ticks); 508 NSPR_API(PRThreadScope) PR_GetThreadScope(const PRThread *thread); 509 NSPR_API(PRThreadType) PR_GetThreadType(const PRThread *thread); 510 NSPR_API(PRThreadState) PR_GetThreadState(const PRThread *thread); 511 512 #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP 513 # define PR_DestroyLock VBoxNsprPR_DestroyLock 514 # define PR_Lock VBoxNsprPR_Lock 515 # define PR_NewLock VBoxNsprPR_NewLock 516 # define PR_Unlock VBoxNsprPR_Unlock 517 #endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */ 518 519 typedef struct PRLock PRLock; 520 521 NSPR_API(PRLock*) PR_NewLock(void); 522 NSPR_API(void) PR_DestroyLock(PRLock *lock); 523 NSPR_API(void) PR_Lock(PRLock *lock); 524 NSPR_API(PRStatus) PR_Unlock(PRLock *lock); 525 526 #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP 527 # define PR_NewCondVar VBoxNsprPR_NewCondVar 528 # define PR_DestroyCondVar VBoxNsprPR_DestroyCondVar 529 # define PR_WaitCondVar VBoxNsprPR_WaitCondVar 530 # define PR_NotifyCondVar VBoxNsprPR_NotifyCondVar 531 # define PR_NotifyAllCondVar VBoxNsprPR_NotifyAllCondVar 532 #endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */ 533 534 typedef struct PRCondVar PRCondVar; 535 536 NSPR_API(PRCondVar*) PR_NewCondVar(PRLock *lock); 537 NSPR_API(void) PR_DestroyCondVar(PRCondVar *cvar); 538 NSPR_API(PRStatus) PR_WaitCondVar(PRCondVar *cvar, PRIntervalTime timeout); 539 NSPR_API(PRStatus) PR_NotifyCondVar(PRCondVar *cvar); 540 NSPR_API(PRStatus) PR_NotifyAllCondVar(PRCondVar *cvar); 541 542 typedef struct PRCListStr PRCList; 543 544 struct PRCListStr { 545 PRCList *next; 546 PRCList *prev; 547 }; 548 549 #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP 550 # define PL_DestroyEvent VBoxNsplPL_DestroyEvent 551 # define PL_HandleEvent VBoxNsplPL_HandleEvent 552 # define PL_InitEvent VBoxNsplPL_InitEvent 553 # define PL_CreateEventQueue VBoxNsplPL_CreateEventQueue 554 # define PL_CreateMonitoredEventQueue VBoxNsplPL_CreateMonitoredEventQueue 555 # define PL_CreateNativeEventQueue VBoxNsplPL_CreateNativeEventQueue 556 # define PL_DequeueEvent VBoxNsplPL_DequeueEvent 557 # define PL_DestroyEventQueue VBoxNsplPL_DestroyEventQueue 558 # define PL_EventAvailable VBoxNsplPL_EventAvailable 559 # define PL_EventLoop VBoxNsplPL_EventLoop 560 # define PL_GetEvent VBoxNsplPL_GetEvent 561 # define PL_GetEventOwner VBoxNsplPL_GetEventOwner 562 # define PL_GetEventQueueMonitor VBoxNsplPL_GetEventQueueMonitor 563 # define PL_GetEventQueueSelectFD VBoxNsplPL_GetEventQueueSelectFD 564 # define PL_MapEvents VBoxNsplPL_MapEvents 565 # define PL_PostEvent VBoxNsplPL_PostEvent 566 # define PL_PostSynchronousEvent VBoxNsplPL_PostSynchronousEvent 567 # define PL_ProcessEventsBeforeID VBoxNsplPL_ProcessEventsBeforeID 568 # define PL_ProcessPendingEvents VBoxNsplPL_ProcessPendingEvents 569 # define PL_RegisterEventIDFunc VBoxNsplPL_RegisterEventIDFunc 570 # define PL_RevokeEvents VBoxNsplPL_RevokeEvents 571 # define PL_UnregisterEventIDFunc VBoxNsplPL_UnregisterEventIDFunc 572 # define PL_WaitForEvent VBoxNsplPL_WaitForEvent 573 # define PL_IsQueueNative VBoxNsplPL_IsQueueNative 574 # define PL_IsQueueOnCurrentThread VBoxNsplPL_IsQueueOnCurrentThread 575 # define PL_FavorPerformanceHint VBoxNsplPL_FavorPerformanceHint 576 #endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */ 577 578 typedef struct PLEvent PLEvent; 579 typedef struct PLEventQueue PLEventQueue; 580 581 PR_EXTERN(PLEventQueue*) 582 PL_CreateEventQueue(const char* name, PRThread* handlerThread); 583 PR_EXTERN(PLEventQueue *) 584 PL_CreateNativeEventQueue( 585 const char *name, 586 PRThread *handlerThread 587 ); 588 PR_EXTERN(PLEventQueue *) 589 PL_CreateMonitoredEventQueue( 590 const char *name, 591 PRThread *handlerThread 592 ); 593 PR_EXTERN(void) 594 PL_DestroyEventQueue(PLEventQueue* self); 595 PR_EXTERN(PRMonitor*) 596 PL_GetEventQueueMonitor(PLEventQueue* self); 597 598 #define PL_ENTER_EVENT_QUEUE_MONITOR(queue) \ 599 PR_EnterMonitor(PL_GetEventQueueMonitor(queue)) 600 601 #define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \ 602 PR_ExitMonitor(PL_GetEventQueueMonitor(queue)) 603 604 PR_EXTERN(PRStatus) PL_PostEvent(PLEventQueue* self, PLEvent* event); 605 PR_EXTERN(void*) PL_PostSynchronousEvent(PLEventQueue* self, PLEvent* event); 606 PR_EXTERN(PLEvent*) PL_GetEvent(PLEventQueue* self); 607 PR_EXTERN(PRBool) PL_EventAvailable(PLEventQueue* self); 608 609 typedef void (PR_CALLBACK *PLEventFunProc)(PLEvent* event, void* data, PLEventQueue* queue); 610 611 PR_EXTERN(void) PL_MapEvents(PLEventQueue* self, PLEventFunProc fun, void* data); 612 PR_EXTERN(void) PL_RevokeEvents(PLEventQueue* self, void* owner); 613 PR_EXTERN(void) PL_ProcessPendingEvents(PLEventQueue* self); 614 PR_EXTERN(PLEvent*) PL_WaitForEvent(PLEventQueue* self); 615 PR_EXTERN(void) PL_EventLoop(PLEventQueue* self); 616 PR_EXTERN(PRInt32) PL_GetEventQueueSelectFD(PLEventQueue* self); 617 PR_EXTERN(PRBool) PL_IsQueueOnCurrentThread( PLEventQueue *queue ); 618 PR_EXTERN(PRBool) PL_IsQueueNative(PLEventQueue *queue); 619 620 typedef void* (PR_CALLBACK *PLHandleEventProc)(PLEvent* self); 621 typedef void (PR_CALLBACK *PLDestroyEventProc)(PLEvent* self); 622 PR_EXTERN(void) 623 PL_InitEvent(PLEvent* self, void* owner, 624 PLHandleEventProc handler, 625 PLDestroyEventProc destructor); 626 PR_EXTERN(void*) PL_GetEventOwner(PLEvent* self); 627 PR_EXTERN(void) PL_HandleEvent(PLEvent* self); 628 PR_EXTERN(void) PL_DestroyEvent(PLEvent* self); 629 PR_EXTERN(void) PL_DequeueEvent(PLEvent* self, PLEventQueue* queue); 630 PR_EXTERN(void) PL_FavorPerformanceHint(PRBool favorPerformanceOverEventStarvation, PRUint32 starvationDelay); 631 632 struct PLEvent { 633 PRCList link; 634 PLHandleEventProc handler; 635 PLDestroyEventProc destructor; 636 void* owner; 637 void* synchronousResult; 638 PRLock* lock; 639 PRCondVar* condVar; 640 PRBool handled; 641 #ifdef PL_POST_TIMINGS 642 PRIntervalTime postTime; 643 #endif 644 #ifdef XP_UNIX 645 unsigned long id; 646 #endif /* XP_UNIX */ 647 /* other fields follow... */ 648 }; 649 650 #if defined(XP_WIN) || defined(XP_OS2) 651 652 PR_EXTERN(HWND) 653 PL_GetNativeEventReceiverWindow( 654 PLEventQueue *eqp 655 ); 656 #endif /* XP_WIN || XP_OS2 */ 657 658 #ifdef XP_UNIX 659 660 PR_EXTERN(PRInt32) 661 PL_ProcessEventsBeforeID(PLEventQueue *aSelf, unsigned long aID); 662 663 typedef unsigned long (PR_CALLBACK *PLGetEventIDFunc)(void *aClosure); 664 665 PR_EXTERN(void) 666 PL_RegisterEventIDFunc(PLEventQueue *aSelf, PLGetEventIDFunc aFunc, 667 void *aClosure); 668 PR_EXTERN(void) PL_UnregisterEventIDFunc(PLEventQueue *aSelf); 669 670 #endif /* XP_UNIX */ 671 672 673 390 674 /** 391 675 * An "interface id" which can be used to uniquely identify a given … … 565 849 }; 566 850 851 /* starting interface: nsIEventTarget */ 852 #define NS_IEVENTTARGET_IID_STR "ea99ad5b-cc67-4efb-97c9-2ef620a59f2a" 853 854 #define NS_IEVENTTARGET_IID \ 855 {0xea99ad5b, 0xcc67, 0x4efb, \ 856 { 0x97, 0xc9, 0x2e, 0xf6, 0x20, 0xa5, 0x9f, 0x2a }} 857 858 struct nsIEventTarget; 859 typedef struct nsIEventTarget nsIEventTarget; 860 861 struct nsIEventTarget_vtbl { 862 863 struct nsISupports_vtbl nsisupports; 864 865 nsresult (*PostEvent)(nsIEventTarget *pThis, PLEvent * aEvent); 866 867 nsresult (*IsOnCurrentThread)(nsIEventTarget *pThis, PRBool *_retval); 868 869 }; 870 871 struct nsIEventTarget { 872 struct nsIEventTarget_vtbl *vtbl; 873 }; 874 875 /* starting interface: nsIEventQueue */ 876 #define NS_IEVENTQUEUE_IID_STR "176afb41-00a4-11d3-9f2a-00400553eef0" 877 878 #define NS_IEVENTQUEUE_IID \ 879 {0x176afb41, 0x00a4, 0x11d3, \ 880 { 0x9f, 0x2a, 0x00, 0x40, 0x05, 0x53, 0xee, 0xf0 }} 881 882 struct nsIEventQueue; 883 typedef struct nsIEventQueue nsIEventQueue; 884 885 struct nsIEventQueue_vtbl { 886 887 struct nsIEventTarget_vtbl nsieventtarget; 888 889 nsresult (*InitEvent)(nsIEventQueue *pThis, PLEvent * aEvent, void * owner, PLHandleEventProc handler, PLDestroyEventProc destructor); 890 891 nsresult (*PostSynchronousEvent)(nsIEventQueue *pThis, PLEvent * aEvent, void * *aResult); 892 893 nsresult (*PendingEvents)(nsIEventQueue *pThis, PRBool *_retval); 894 895 nsresult (*ProcessPendingEvents)(nsIEventQueue *pThis); 896 897 nsresult (*EventLoop)(nsIEventQueue *pThis); 898 899 nsresult (*EventAvailable)(nsIEventQueue *pThis, PRBool *aResult); 900 901 nsresult (*GetEvent)(nsIEventQueue *pThis, PLEvent * *_retval); 902 903 nsresult (*HandleEvent)(nsIEventQueue *pThis, PLEvent * aEvent); 904 905 nsresult (*WaitForEvent)(nsIEventQueue *pThis, PLEvent * *_retval); 906 907 PRInt32 (*GetEventQueueSelectFD)(nsIEventQueue *pThis); 908 909 nsresult (*Init)(nsIEventQueue *pThis, PRBool aNative); 910 911 nsresult (*InitFromPRThread)(nsIEventQueue *pThis, PRThread * thread, PRBool aNative); 912 913 nsresult (*InitFromPLQueue)(nsIEventQueue *pThis, PLEventQueue * aQueue); 914 915 nsresult (*EnterMonitor)(nsIEventQueue *pThis); 916 917 nsresult (*ExitMonitor)(nsIEventQueue *pThis); 918 919 nsresult (*RevokeEvents)(nsIEventQueue *pThis, void * owner); 920 921 nsresult (*GetPLEventQueue)(nsIEventQueue *pThis, PLEventQueue * *_retval); 922 923 nsresult (*IsQueueNative)(nsIEventQueue *pThis, PRBool *_retval); 924 925 nsresult (*StopAcceptingEvents)(nsIEventQueue *pThis); 926 927 }; 928 929 struct nsIEventQueue { 930 struct nsIEventQueue_vtbl *vtbl; 931 }; 932 567 933 </xsl:text> 568 934 <xsl:apply-templates/> … … 604 970 int (*pfnUtf8ToUtf16)(const char *pszString, PRUnichar **ppwszString); 605 971 972 void (*pfnGetEventQueue)(nsIEventQueue **eventQueue); 973 606 974 /** Tail version, same as uVersion. */ 607 975 unsigned uEndVersion; … … 613 981 * For use with VBoxGetXPCOMCFunctions and to be found in 614 982 * VBOXXPCOMC::uVersion. */ 615 #define VBOX_XPCOMC_VERSION 0x000 10000U983 #define VBOX_XPCOMC_VERSION 0x00020000U 616 984 617 985 VBOXXPCOMC_DECL(PCVBOXXPCOM) VBoxGetXPCOMCFunctions(unsigned uVersion);
Note:
See TracChangeset
for help on using the changeset viewer.