VirtualBox

Changeset 36439 in vbox for trunk


Ignore:
Timestamp:
Mar 25, 2011 4:19:12 PM (14 years ago)
Author:
vboxsync
Message:

Init COM for all EMTS and PDMThreads.

Location:
trunk/src/VBox/Main
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r36437 r36439  
    591591
    592592    static DECLCALLBACK(int)    vmm2User_SaveState(PCVMM2USERMETHODS pThis, PUVM pUVM);
     593    static DECLCALLBACK(void)   vmm2User_NotifyEmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
    593594    static DECLCALLBACK(void)   vmm2User_NotifyEmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
     595    static DECLCALLBACK(void)   vmm2User_NotifyPdmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM);
    594596    static DECLCALLBACK(void)   vmm2User_NotifyPdmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM);
    595597
  • trunk/src/VBox/Main/include/VirtualBoxBase.h

    r36411 r36439  
    754754    HRESULT setErrorNoLog(HRESULT aResultCode, const char *pcsz, ...);
    755755
     756
     757    /** Initialize COM for a new thread. */
     758    static HRESULT initializeComForThread(void)
     759    {
     760#ifndef VBOX_WITH_XPCOM
     761        HRESULT hrc = CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE | COINIT_SPEED_OVER_MEMORY);
     762        AssertComRCReturn(hrc, hrc);
     763#endif
     764        return S_OK;
     765    }
     766
     767    /** Uninitializes COM for a dying thread. */
     768    static void uninitializeComForThread(void)
     769    {
     770#ifndef VBOX_WITH_XPCOM
     771        CoUninitialize();
     772#endif
     773    }
     774
     775
    756776private:
    757777
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r36437 r36439  
    397397    pVmm2UserMethods->u32Version        = VMM2USERMETHODS_VERSION;
    398398    pVmm2UserMethods->pfnSaveState      = Console::vmm2User_SaveState;
    399     pVmm2UserMethods->pfnNotifyEmtInit  = NULL;
     399    pVmm2UserMethods->pfnNotifyEmtInit  = Console::vmm2User_NotifyEmtInit;
    400400    pVmm2UserMethods->pfnNotifyEmtTerm  = Console::vmm2User_NotifyEmtTerm;
    401     pVmm2UserMethods->pfnNotifyPdmtInit = NULL;
     401    pVmm2UserMethods->pfnNotifyPdmtInit = Console::vmm2User_NotifyPdmtInit;
    402402    pVmm2UserMethods->pfnNotifyPdmtTerm = Console::vmm2User_NotifyPdmtTerm;
    403403    pVmm2UserMethods->u32EndMagic       = VMM2USERMETHODS_MAGIC;
     
    78237823    AssertReturn(!task->mProgress.isNull(), VERR_INVALID_PARAMETER);
    78247824
    7825 #if defined(RT_OS_WINDOWS)
    7826     {
    7827         /* initialize COM */
    7828         HRESULT hrc = CoInitializeEx(NULL,
    7829                                      COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE |
    7830                                      COINIT_SPEED_OVER_MEMORY);
    7831         LogFlowFunc(("CoInitializeEx()=%Rhrc\n", hrc));
    7832     }
    7833 #endif
     7825    VirtualBoxBase::initializeComForThread();
    78347826
    78357827    HRESULT rc = S_OK;
     
    88108802
    88118803/**
     8804 * @interface_method_impl{VMM2USERMETHODS,pfnNotifyEmtInit}
     8805 */
     8806/*static*/ DECLCALLBACK(void)
     8807Console::vmm2User_NotifyEmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu)
     8808{
     8809    NOREF(pThis); NOREF(pUVM); NOREF(pUVCpu);
     8810    VirtualBoxBase::initializeComForThread();
     8811}
     8812
     8813/**
    88128814 * @interface_method_impl{VMM2USERMETHODS,pfnNotifyEmtTerm}
    88138815 */
     
    88168818{
    88178819    NOREF(pThis); NOREF(pUVM); NOREF(pUVCpu);
    8818 #ifdef RT_OS_WINDOWS
    8819     CoUninitialize();
    8820 #endif
     8820    VirtualBoxBase::uninitializeComForThread();
     8821}
     8822
     8823/**
     8824 * @interface_method_impl{VMM2USERMETHODS,pfnNotifyPdmtInit}
     8825 */
     8826/*static*/ DECLCALLBACK(void)
     8827Console::vmm2User_NotifyPdmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM)
     8828{
     8829    NOREF(pThis); NOREF(pUVM);
     8830    VirtualBoxBase::initializeComForThread();
    88218831}
    88228832
     
    88288838{
    88298839    NOREF(pThis); NOREF(pUVM);
    8830 #ifdef RT_OS_WINDOWS
    8831     CoUninitialize();
    8832 #endif
     8840    VirtualBoxBase::uninitializeComForThread();
    88338841}
    88348842
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r36434 r36439  
    585585{
    586586    LogFlowFuncEnter();
    587 
    588 #if !defined(VBOX_WITH_XPCOM)
    589     {
    590         /* initialize COM */
    591         HRESULT hrc = CoInitializeEx(NULL,
    592                                      COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE |
    593                                      COINIT_SPEED_OVER_MEMORY);
    594         LogFlow(("Console::configConstructor(): CoInitializeEx()=%08X\n", hrc));
    595         AssertComRCReturn(hrc, VERR_GENERAL_FAILURE);
    596     }
    597 #endif
    598587
    599588    AssertReturn(pvConsole, VERR_GENERAL_FAILURE);
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r36027 r36439  
    39553955    size_t cntSpawned = 0;
    39563956
     3957    VirtualBoxBase::initializeComForThread();
     3958
    39573959#if defined(RT_OS_WINDOWS)
    39583960
    3959     HRESULT hrc = CoInitializeEx(NULL,
    3960                                  COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE |
    3961                                  COINIT_SPEED_OVER_MEMORY);
    3962     AssertComRC(hrc);
     3961    HRESULT hrc;
    39633962
    39643963    /// @todo (dmik) processes reaping!
     
    44134412#endif
    44144413
     4414    VirtualBoxBase::uninitializeComForThread();
    44154415    LogFlowFuncLeave();
    44164416    return 0;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette