VirtualBox

Changeset 55800 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
May 11, 2015 2:09:09 PM (10 years ago)
Author:
vboxsync
Message:

Main/Session+Machine: small API cleanup, introducing explicit session names and eliminating some terminology confusion (it never was a session type, which is a totally different thing)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r55769 r55800  
    26742674HRESULT Machine::getSessionState(SessionState_T *aSessionState)
    26752675{
    2676 
    26772676    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    26782677
     
    26822681}
    26832682
    2684 HRESULT Machine::getSessionType(com::Utf8Str &aSessionType)
     2683HRESULT Machine::getSessionName(com::Utf8Str &aSessionName)
    26852684{
    26862685    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    26872686
    2688     aSessionType = mData->mSession.mType;
     2687    aSessionName = mData->mSession.mName;
    26892688
    26902689    return S_OK;
     
    32233222                    E_INVALIDARG);
    32243223
     3224    // session name (only used in some code paths)
     3225    Utf8Str strSessionName;
     3226
    32253227    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    32263228
     
    34373439                         tr("Failed to assign the machine to the session (%Rhrc)"), rc);
    34383440
     3441            // get session name, either to remember or to compare against
     3442            // the already known session name.
     3443            {
     3444                Bstr bstrSessionName;
     3445                HRESULT rc2 = aSession->COMGETTER(Name)(bstrSessionName.asOutParam());
     3446                if (SUCCEEDED(rc2))
     3447                    strSessionName = bstrSessionName;
     3448            }
     3449
    34393450            if (    SUCCEEDED(rc)
    34403451                 && fLaunchingVMProcess
     
    34853496        if (fLaunchingVMProcess)
    34863497        {
     3498            Assert(mData->mSession.mName == strSessionName);
    34873499            /* Note that the progress object is finalized later */
    34883500            /** @todo Consider checking mData->mSession.mProgress for cancellation
     
    35223534            mData->mSession.mDirectControl = pSessionControl;
    35233535            mData->mSession.mState = SessionState_Locked;
     3536            if (!fLaunchingVMProcess)
     3537                mData->mSession.mName = strSessionName;
    35243538            /* associate the SessionMachine with this Machine */
    35253539            mData->mSession.mMachine = sessionMachine;
     
    35613575 */
    35623576HRESULT Machine::launchVMProcess(const ComPtr<ISession> &aSession,
    3563                                  const com::Utf8Str &aType,
     3577                                 const com::Utf8Str &aName,
    35643578                                 const com::Utf8Str &aEnvironment,
    35653579                                 ComPtr<IProgress> &aProgress)
    35663580{
    3567     Utf8Str strFrontend(aType);
     3581    Utf8Str strFrontend(aName);
    35683582    /* "emergencystop" doesn't need the session, so skip the checks/interface
    35693583     * retrieval. This code doesn't quite fit in here, but introducing a
     
    74307444    if (fSeparate)
    74317445    {
    7432         if (mData->mSession.mState != SessionState_Unlocked && mData->mSession.mType.compare("headless", Utf8Str::CaseInsensitive))
     7446        if (mData->mSession.mState != SessionState_Unlocked && mData->mSession.mName == "headless")
    74337447            return setError(VBOX_E_INVALID_OBJECT_STATE,
    74347448                            tr("The machine '%s' is in a state which is incompatible with launching a separate UI process"),
     
    75317545#endif
    75327546
     7547    Utf8Str strCanonicalName;
    75337548
    75347549#ifdef VBOX_WITH_QTGUI
     
    75397554        || !strFrontend.compare("GUI/Qt/separate", Utf8Str::CaseInsensitive))
    75407555    {
     7556        strCanonicalName = "GUI/Qt";
    75417557# ifdef RT_OS_DARWIN /* Avoid Launch Services confusing this with the selector by using a helper app. */
    75427558        /* Modify the base path so that we don't need to use ".." below. */
     
    76077623        || !strFrontend.compare("GUI/SDL/separate", Utf8Str::CaseInsensitive))
    76087624    {
     7625        strCanonicalName = "GUI/SDL";
    76097626        static const char s_szVBoxSDL_exe[] = "VBoxSDL" HOSTSUFF_EXE;
    76107627        Assert(cchBufLeft >= sizeof(s_szVBoxSDL_exe));
     
    76417658       )
    76427659    {
     7660        strCanonicalName = "headless";
    76437661        /* On pre-4.0 the "headless" type was used for passing "--vrdp off" to VBoxHeadless to let it work in OSE,
    76447662         * which did not contain VRDP server. In VBox 4.0 the remote desktop server (VRDE) is optional,
     
    77327750        mData->mSession.mPID = pid;
    77337751        mData->mSession.mState = SessionState_Spawning;
    7734         mData->mSession.mType = strFrontend;
     7752        Assert(strCanonicalName.isNotEmpty());
     7753        mData->mSession.mName = strCanonicalName;
    77357754    }
    77367755    else
     
    1265412673    mData->mSession.mMachine.setNull();
    1265512674    mData->mSession.mState = SessionState_Unlocked;
    12656     mData->mSession.mType.setNull();
     12675    mData->mSession.mName.setNull();
    1265712676
    1265812677    /* destroy the machine client token before leaving the exclusive lock */
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