VirtualBox

Changeset 26067 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 27, 2010 1:33:54 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
56994
Message:

Main/Session+Console: By default, create a console with no sub-objects (saves resources). VM processes need to explicitly ask for a full console when before opening the session.

Location:
trunk/src/VBox
Files:
10 edited

Legend:

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

    r26034 r26067  
    99
    1010/*
    11  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     11 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    1212 *
    1313 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2727#include "Framebuffer.h"
    2828#include <getopt.h>
     29#include <VBox/version.h>
    2930#include <VBox/param.h>
    3031#include <iprt/path.h>
     
    210211        {
    211212            printf("Error: could not instantiate Session object! rc = %08X\n", rc);
     213            exit(-1);
     214        }
     215
     216        rc = session->SetFullConsole(true);
     217        if (NS_FAILED(rc))
     218        {
     219            printf("Error: could not select full VM console! rc = %08X\n", rc);
    212220            exit(-1);
    213221        }
     
    545553                            buttonState |= MouseButtonState::MiddleButton;
    546554                        mouse->PutMouseEvent(mouseXDelta, mouseYDelta, mouseZDelta,
    547                                              buttonState);
     555                                             0, buttonState);
    548556                        break;
    549557                    }
  • trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp

    r26034 r26067  
    66
    77/*
    8  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     8 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    877877              Utf8Str(id).raw()));
    878878
     879        // make sure we ge a full featured VM console
     880        CHECK_ERROR_BREAK(session, COMSETTER(FullConsole)(true));
     881
    879882        // open a session
    880883        CHECK_ERROR_BREAK(virtualBox, OpenSession (session, id));
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    r26034 r26067  
    55
    66/*
    7  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    14881488    AssertReleaseRC(vrc);
    14891489
     1490    rc = session->COMSETTER(FullConsole)(true);
     1491    if (FAILED(rc))
     1492    {
     1493        com::ErrorInfo info;
     1494        if (info.isFullAvailable())
     1495            PrintError("Could not select a full VM console",
     1496                    info.getText().raw(), info.getComponent().raw());
     1497        goto leave;
     1498    }
    14901499    rc = virtualBox->OpenSession(session, uuidVM.toUtf16());
    14911500    if (FAILED(rc))
     
    14951504            PrintError("Could not open VirtualBox session",
    14961505                    info.getText().raw(), info.getComponent().raw());
    1497         goto leave;
    1498     }
    1499     if (!session)
    1500     {
    1501         RTPrintf("Could not open VirtualBox session!\n");
    15021506        goto leave;
    15031507    }
     
    29162920    callback.setNull();
    29172921    consoleCallback.setNull();
    2918    
     2922
    29192923    LogFlow(("Uninitializing COM...\n"));
    29202924    com::Shutdown();
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r26034 r26067  
    66
    77/*
    8  * Copyright (C) 2008-2009 Sun Microsystems, Inc.
     8 * Copyright (C) 2008-2010 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    21902190 *                      which is already running, @c false to open a new direct
    21912191 *                      session.
    2192  */
    2193 CSession VBoxGlobal::openSession (const QString &aId, bool aExisting /* = false */)
     2192 *  @param aFullConsole @c true to create a full console, suitable of running
     2193 *                      a VM, @c false to create a minimal console suitable
     2194 *                      for API clients. Only significant if @a aExisting is
     2195 *                      @false.
     2196 */
     2197CSession VBoxGlobal::openSession (const QString &aId, bool aExisting /* = false */, bool aFullConsole /* = false */)
    21942198{
    21952199    CSession session;
     
    22052209    else
    22062210    {
     2211        session.SetFullConsole(aFullConsole);
    22072212        mVBox.OpenSession (session, aId);
    22082213        CMachine machine = session.GetMachine ();
     
    22312236    AssertReturn (mValid, false);
    22322237
    2233     CSession session = vboxGlobal().openSession (id);
     2238    CSession session = vboxGlobal().openSession (id, false, true);
    22342239    if (session.isNull())
    22352240        return false;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r25318 r26067  
    66
    77/*
    8  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     8 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    670670#endif
    671671
    672     CSession openSession (const QString &aId, bool aExisting = false);
     672    CSession openSession (const QString &aId, bool aExisting = false, bool aFullConsole = false);
    673673
    674674    /** Shortcut to openSession (aId, true). */
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r26030 r26067  
    55
    66/*
    7  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    308308/////////////////////////////////////////////////////////////////////////////
    309309
    310 HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl)
     310HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl,
     311                      bool aFullConsole)
    311312{
    312313    AssertReturn(aMachine && aControl, E_INVALIDARG);
     
    331332    AssertComRCReturnRC(rc);
    332333
     334    if (aFullConsole)
     335    {
    333336#ifdef VBOX_WITH_VRDP
    334     rc = mMachine->COMGETTER(VRDPServer)(unconst(mVRDPServer).asOutParam());
    335     AssertComRCReturnRC(rc);
     337        rc = mMachine->COMGETTER(VRDPServer)(unconst(mVRDPServer).asOutParam());
     338        AssertComRCReturnRC(rc);
    336339#endif
    337340
    338     /* Create associated child COM objects */
    339 
    340     unconst(mGuest).createObject();
    341     rc = mGuest->init(this);
    342     AssertComRCReturnRC(rc);
    343 
    344     unconst(mKeyboard).createObject();
    345     rc = mKeyboard->init(this);
    346     AssertComRCReturnRC(rc);
    347 
    348     unconst(mMouse).createObject();
    349     rc = mMouse->init(this);
    350     AssertComRCReturnRC(rc);
    351 
    352     unconst(mDisplay).createObject();
    353     rc = mDisplay->init(this);
    354     AssertComRCReturnRC(rc);
    355 
    356     unconst(mRemoteDisplayInfo).createObject();
    357     rc = mRemoteDisplayInfo->init(this);
    358     AssertComRCReturnRC(rc);
    359 
    360     /* Grab global and machine shared folder lists */
    361 
    362     rc = fetchSharedFolders(true /* aGlobal */);
    363     AssertComRCReturnRC(rc);
    364     rc = fetchSharedFolders(false /* aGlobal */);
    365     AssertComRCReturnRC(rc);
    366 
    367     /* Create other child objects */
    368 
    369     unconst(mConsoleVRDPServer) = new ConsoleVRDPServer(this);
    370     AssertReturn(mConsoleVRDPServer, E_FAIL);
     341        /* Create associated child COM objects */
     342
     343        unconst(mGuest).createObject();
     344        rc = mGuest->init(this);
     345        AssertComRCReturnRC(rc);
     346
     347        unconst(mKeyboard).createObject();
     348        rc = mKeyboard->init(this);
     349        AssertComRCReturnRC(rc);
     350
     351        unconst(mMouse).createObject();
     352        rc = mMouse->init(this);
     353        AssertComRCReturnRC(rc);
     354
     355        unconst(mDisplay).createObject();
     356        rc = mDisplay->init(this);
     357        AssertComRCReturnRC(rc);
     358
     359        unconst(mRemoteDisplayInfo).createObject();
     360        rc = mRemoteDisplayInfo->init(this);
     361        AssertComRCReturnRC(rc);
     362
     363        /* Grab global and machine shared folder lists */
     364
     365        rc = fetchSharedFolders(true /* aGlobal */);
     366        AssertComRCReturnRC(rc);
     367        rc = fetchSharedFolders(false /* aGlobal */);
     368        AssertComRCReturnRC(rc);
     369
     370        /* Create other child objects */
     371
     372        unconst(mConsoleVRDPServer) = new ConsoleVRDPServer(this);
     373        AssertReturn(mConsoleVRDPServer, E_FAIL);
     374
     375        unconst(mVMMDev) = new VMMDev(this);
     376        AssertReturn(mVMMDev, E_FAIL);
     377
     378        unconst(mAudioSniffer) = new AudioSniffer(this);
     379        AssertReturn(mAudioSniffer, E_FAIL);
     380    }
    371381
    372382    mcAudioRefs = 0;
    373383    mcVRDPClients = 0;
    374384    mu32SingleRDPClientId = 0;
    375 
    376     unconst(mVMMDev) = new VMMDev(this);
    377     AssertReturn(mVMMDev, E_FAIL);
    378 
    379     unconst(mAudioSniffer) = new AudioSniffer(this);
    380     AssertReturn(mAudioSniffer, E_FAIL);
    381385
    382386    /* Confirm a successful initialization when it's the case */
  • trunk/src/VBox/Main/SessionImpl.cpp

    r25901 r26067  
    55
    66/*
    7  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    8989    mState = SessionState_Closed;
    9090    mType = SessionType_Null;
     91    mFullConsole = false;
    9192
    9293#if defined(RT_OS_WINDOWS)
     
    176177}
    177178
     179STDMETHODIMP Session::COMSETTER(FullConsole) (BOOL aFullConsole)
     180{
     181    AutoCaller autoCaller(this);
     182    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     183
     184    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     185
     186    AssertReturn(mState == SessionState_Closed, VBOX_E_INVALID_VM_STATE);
     187
     188    mFullConsole = aFullConsole;
     189    return S_OK;
     190}
     191
     192STDMETHODIMP Session::COMGETTER(FullConsole) (BOOL *aFullConsole)
     193{
     194    CheckComArgOutPointerValid(aFullConsole);
     195
     196    AutoCaller autoCaller(this);
     197    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     198
     199    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     200
     201    *aFullConsole = mFullConsole;
     202    return S_OK;
     203}
     204
    178205STDMETHODIMP Session::COMGETTER(Machine) (IMachine **aMachine)
    179206{
     
    319346
    320347    rc = mConsole.createObject();
    321     AssertComRCReturn (rc, rc);
    322 
    323     rc = mConsole->init (aMachine, mControl);
    324     AssertComRCReturn (rc, rc);
     348    AssertComRCReturn(rc, rc);
     349
     350    rc = mConsole->init(aMachine, mControl, mFullConsole);
     351    AssertComRCReturn(rc, rc);
    325352
    326353    rc = grabIPCSemaphore();
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r25904 r26067  
    1296012960  <interface
    1296112961     name="ISession" extends="$dispatched"
    12962      uuid="12F4DCDB-12B2-4EC1-B7CD-DDD9F6C5BF4D"
     12962     uuid="37661fa3-385b-4b2b-8b22-93304c45f36e"
    1296312963     wsmap="managed"
    1296412964     >
     
    1301513015      is open within one process, no any other process may open another direct
    1301613016      session for the same machine. This prevents the machine from being changed
    13017       by other processes while it is running or while the machine is being configured.
     13017      by other processes while it is running or while the machine is being
     13018      configured. If the current process is should have a full Console
     13019      object with all associated sub-objects, remember to set
     13020      <link to="ISession::fullConsole"/> appropriately.
    1301813021      </li>
    1301913022      </ul>
     
    1304713050        SessionType_SessionOpen), otherwise an error will be returned.
    1304813051      </desc>
     13052    </attribute>
     13053
     13054    <attribute name="fullConsole" type="boolean">
     13055      <desc>Defines whether the console object is meant for full VMs,
     13056      which have the associated sub-objects, or if it is unnecessary to
     13057      create them. Default is @c false.</desc>
    1304913058    </attribute>
    1305013059
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r25966 r26067  
    55
    66/*
    7  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    103103
    104104    // public initializers/uninitializers for internal purposes only
    105     HRESULT init (IMachine *aMachine, IInternalMachineControl *aControl);
     105    HRESULT init (IMachine *aMachine, IInternalMachineControl *aControl,
     106                  bool aFullConsole);
    106107    void uninit();
    107108
  • trunk/src/VBox/Main/include/SessionImpl.h

    r25901 r26067  
    55
    66/*
    7  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    7878    STDMETHOD(COMGETTER(State)) (SessionState_T *aState);
    7979    STDMETHOD(COMGETTER(Type)) (SessionType_T *aType);
     80    STDMETHOD(COMSETTER(FullConsole)) (BOOL aType);
     81    STDMETHOD(COMGETTER(FullConsole)) (BOOL *aType);
    8082    STDMETHOD(COMGETTER(Machine)) (IMachine **aMachine);
    8183    STDMETHOD(COMGETTER(Console)) (IConsole **aConsole);
     
    122124    SessionState_T mState;
    123125    SessionType_T mType;
     126    bool mFullConsole;
    124127
    125128    ComPtr<IInternalMachineControl> mControl;
Note: See TracChangeset for help on using the changeset viewer.

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