VirtualBox

Ignore:
Timestamp:
Sep 28, 2009 5:24:04 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
52924
Message:

Main/MediumAttachment: cleanup, much more logging, some preparation for settings handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MediumAttachmentImpl.cpp

    r23269 r23394  
    3232HRESULT MediumAttachment::FinalConstruct()
    3333{
     34    LogFlowThisFunc(("\n"));
    3435    return S_OK;
    3536}
     
    3738void MediumAttachment::FinalRelease()
    3839{
     40    LogFlowThisFuncEnter();
    3941    uninit();
     42    LogFlowThisFuncLeave();
    4043}
    4144
     
    4649 * Initializes the medium attachment object.
    4750 *
    48  * @param aMachine    Machine object.
     51 * @param aParent     Machine object.
    4952 * @param aMedium     Medium object.
    5053 * @param aController Controller the hard disk is attached to.
     
    5356 * @param aImplicit   Wether the attachment contains an implicitly created diff.
    5457 */
    55 HRESULT MediumAttachment::init(Machine *aMachine,
     58HRESULT MediumAttachment::init(Machine *aParent,
    5659                               Medium *aMedium,
    5760                               CBSTR aController,
     
    6164                               bool aImplicit /*= false*/)
    6265{
     66    LogFlowThisFuncEnter();
     67    LogFlowThisFunc(("aParent=%p aMedium=%p aController=%ls aPort=%d aDevice=%d aType=%d aImplicit=%d\n", aParent, aMedium, aController, aPort, aDevice, aType, aImplicit));
     68
    6369    if (aType == DeviceType_HardDisk)
    6470        AssertReturn(aMedium, E_INVALIDARG);
     
    6874    AssertReturn(autoInitSpan.isOk(), E_FAIL);
    6975
    70     unconst(mMachine) = aMachine;
     76    unconst(mParent) = aParent;
     77
    7178    m.allocate();
    7279    m->medium = aMedium;
     
    8289    autoInitSpan.setSucceeded();
    8390
     91    LogFlowThisFuncLeave();
    8492    return S_OK;
    8593}
     
    9199void MediumAttachment::uninit()
    92100{
     101    LogFlowThisFuncEnter();
     102
    93103    /* Enclose the state transition Ready->InUninit->NotReady */
    94104    AutoUninitSpan autoUninitSpan(this);
    95105    if (autoUninitSpan.uninitDone())
    96106        return;
     107
     108    m.free();
     109
     110    unconst(mParent).setNull();
     111
     112    LogFlowThisFuncLeave();
    97113}
    98114
     
    102118bool MediumAttachment::rollback()
    103119{
     120    LogFlowThisFuncEnter();
     121
    104122    /* sanity */
    105123    AutoCaller autoCaller(this);
     
    118136    }
    119137
     138    LogFlowThisFuncLeave();
    120139    return changed;
    121140}
     
    126145void MediumAttachment::commit()
    127146{
     147    LogFlowThisFuncEnter();
     148
    128149    /* sanity */
    129150    AutoCaller autoCaller(this);
     
    134155    if (m.isBackedUp())
    135156        m.commit();
     157
     158    LogFlowThisFuncLeave();
    136159}
    137160
     
    142165STDMETHODIMP MediumAttachment::COMGETTER(Medium)(IMedium **aHardDisk)
    143166{
     167    LogFlowThisFuncEnter();
     168
    144169    CheckComArgOutPointerValid(aHardDisk);
    145170
     
    151176    m->medium.queryInterfaceTo(aHardDisk);
    152177
     178    LogFlowThisFuncLeave();
    153179    return S_OK;
    154180}
     
    156182STDMETHODIMP MediumAttachment::COMGETTER(Controller)(BSTR *aController)
    157183{
     184    LogFlowThisFuncEnter();
     185
    158186    CheckComArgOutPointerValid(aController);
    159187
     
    164192    m->controller.cloneTo(aController);
    165193
     194    LogFlowThisFuncLeave();
    166195    return S_OK;
    167196}
     
    169198STDMETHODIMP MediumAttachment::COMGETTER(Port)(LONG *aPort)
    170199{
     200    LogFlowThisFuncEnter();
     201
    171202    CheckComArgOutPointerValid(aPort);
    172203
     
    177208    *aPort = m->port;
    178209
     210    LogFlowThisFuncLeave();
    179211    return S_OK;
    180212}
     
    182214STDMETHODIMP MediumAttachment::COMGETTER(Device)(LONG *aDevice)
    183215{
     216    LogFlowThisFuncEnter();
     217
    184218    CheckComArgOutPointerValid(aDevice);
    185219
     
    190224    *aDevice = m->device;
    191225
     226    LogFlowThisFuncLeave();
    192227    return S_OK;
    193228}
     
    195230STDMETHODIMP MediumAttachment::COMGETTER(Type)(DeviceType_T *aType)
    196231{
     232    LogFlowThisFuncEnter();
     233
    197234    CheckComArgOutPointerValid(aType);
    198235
     
    203240    *aType = m->type;
    204241
     242    LogFlowThisFuncLeave();
    205243    return S_OK;
    206244}
     
    208246STDMETHODIMP MediumAttachment::COMSETTER(Passthrough)(BOOL aPassthrough)
    209247{
     248    LogFlowThisFuncEnter();
     249
    210250    AutoCaller autoCaller(this);
    211251    CheckComRCReturnRC(autoCaller.rc());
    212252
    213253    /* the machine need to be mutable */
    214     Machine::AutoMutableStateDependency adep(mMachine);
     254    Machine::AutoMutableStateDependency adep(mParent);
    215255    CheckComRCReturnRC(adep.rc());
    216256
     
    223263    }
    224264
     265    LogFlowThisFuncLeave();
    225266    return S_OK;
    226267}
     
    228269STDMETHODIMP MediumAttachment::COMGETTER(Passthrough)(BOOL *aPassthrough)
    229270{
     271    LogFlowThisFuncEnter();
     272
    230273    CheckComArgOutPointerValid(aPassthrough);
    231274
     
    236279
    237280    *aPassthrough = m->passthrough;
    238     return S_OK;
    239 }
    240 
     281
     282    LogFlowThisFuncLeave();
     283    return S_OK;
     284}
     285
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