VirtualBox

Changeset 42382 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 25, 2012 9:35:56 AM (12 years ago)
Author:
vboxsync
Message:

Main/Session+Console+Machine: minimal change to reduce the overhead of normal API client sessions, because they don't need a full Console object with all sub-objects associated with them. Much more work todo if we want to completely eliminate all VM machinery dependency since the methods of Console are a wild mix of VM related and unrelated.

Location:
trunk/src/VBox/Frontends
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp

    r41959 r42382  
    4343#include <VBox/VBoxVideo.h>
    4444
    45 #ifdef VBOX_WITH_VIDEO_REC 
     45#ifdef VBOX_WITH_VIDEO_REC
    4646#include <cstdlib>
    4747#include <cerrno>
     
    827827
    828828        // open a session
    829         CHECK_ERROR_BREAK(m, LockMachine(session, LockType_Write));
     829        CHECK_ERROR_BREAK(m, LockMachine(session, LockType_VM));
    830830        fSessionOpened = true;
    831831
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    r42248 r42382  
    14151415    AssertReleaseRC(vrc);
    14161416
    1417     rc = pMachine->LockMachine(pSession, LockType_Write);
     1417    rc = pMachine->LockMachine(pSession, LockType_VM);
    14181418    if (FAILED(rc))
    14191419    {
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.cpp

    r41610 r42382  
    112112
    113113    /* We need a session when we manipulate the snapshot data of a machine. */
    114     CSession session = vboxGlobal().openSession(mSnapshot.GetMachine().GetId(), true);
     114    CSession session = vboxGlobal().openExistingSession(mSnapshot.GetMachine().GetId());
    115115    if (session.isNull())
    116116        return;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r42209 r42382  
    469469    AssertMsg(!m_pVirtualMachine, ("Machine already started"));
    470470
    471     /* Create session: */
    472     CSession session = vboxGlobal().openSession(strMachineId);
     471    /* Create VM session: */
     472    CSession session = vboxGlobal().openSession(strMachineId, KLockType_VM);
    473473    if (session.isNull())
    474474        return false;
     
    18131813 *
    18141814 *  @param aId          Machine ID.
    1815  *  @param aExisting    @c true to open an existing session with the machine
    1816  *                      which is already running, @c false to open a new direct
    1817  *                      session.
    1818  */
    1819 CSession VBoxGlobal::openSession(const QString &aId, bool aExisting /* = false */)
     1815 *  @param aLockType    @c KLockType_Shared to open an existing session with
     1816 *                      the machine which is already running, @c KLockType_Write
     1817 *                      to open a new direct session, @c KLockType_VM to open
     1818 *                      a new session for running a VM in this process.
     1819 */
     1820CSession VBoxGlobal::openSession(const QString &aId, KLockType aLockType /* = KLockType_Shared */)
    18201821{
    18211822    CSession session;
     
    18301831    if (!foundMachine.isNull())
    18311832    {
    1832         foundMachine.LockMachine(session,
    1833                                  (aExisting) ? KLockType_Shared : KLockType_Write);
     1833        foundMachine.LockMachine(session, aLockType);
    18341834        if (session.GetType() == KSessionType_Shared)
    18351835        {
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r42209 r42382  
    239239#endif
    240240
    241     CSession openSession(const QString &aId, bool aExisting = false);
     241    CSession openSession(const QString &aId, KLockType aLockType = KLockType_Write);
    242242
    243243    /** Shortcut to openSession (aId, true). */
    244     CSession openExistingSession(const QString &aId) { return openSession (aId, true); }
     244    CSession openExistingSession(const QString &aId) { return openSession(aId, KLockType_Shared); }
    245245
    246246    void startEnumeratingMedia();
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp

    r41819 r42382  
    645645    /* Open a direct session (this call will handle all errors) */
    646646    bool busy = mSessionState != KSessionState_Unlocked;
    647     CSession session = vboxGlobal().openSession (mMachineId, busy /* aExisting */);
     647    CSession session;
     648    if (busy)
     649        session = vboxGlobal().openExistingSession(mMachineId);
     650    else
     651        session = vboxGlobal().openSession(mMachineId);
    648652    if (session.isNull())
    649653        return;
     
    779783
    780784    /* Open a session to work with corresponding VM: */
    781     CSession session = vboxGlobal().openSession(mMachineId,
    782                                                 mSessionState != KSessionState_Unlocked /* connect to existing */);
     785    CSession session;
     786    if (mSessionState != KSessionState_Unlocked)
     787        session = vboxGlobal().openExistingSession(mMachineId);
     788    else
     789        session = vboxGlobal().openSession(mMachineId);
    783790    fIsValid = !session.isNull();
    784791
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp

    r41689 r42382  
    748748
    749749    /* Prepare session: */
    750     m_session = dialogType() == SettingsDialogType_Wrong ? CSession() : vboxGlobal().openSession(m_strMachineId, true /* shared */);
     750    m_session = dialogType() == SettingsDialogType_Wrong ? CSession() : vboxGlobal().openExistingSession(m_strMachineId);
    751751    /* Check that session was created: */
    752752    if (m_session.isNull())
     
    787787
    788788    /* Prepare session: */
    789     bool fSessionShared = dialogType() != SettingsDialogType_Offline;
    790     m_session = dialogType() == SettingsDialogType_Wrong ? CSession() : vboxGlobal().openSession(m_strMachineId, fSessionShared);
     789    if (dialogType() == SettingsDialogType_Wrong)
     790        m_session = CSession();
     791    else if (dialogType() != SettingsDialogType_Offline)
     792        m_session = vboxGlobal().openExistingSession(m_strMachineId);
     793    else
     794        m_session = vboxGlobal().openSession(m_strMachineId);
    791795    /* Check that session was created: */
    792796    if (m_session.isNull())
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