Changeset 85286 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Jul 12, 2020 11:08:50 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139263
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r85262 r85286 90 90 #include "CloudProviderManagerImpl.h" 91 91 #include "ThreadTask.h" 92 #include "VBoxEvents.h" 92 93 93 94 #include <QMTranslator.h> … … 135 136 136 137 138 #if 0 /* obsoleted by AsyncEvent */ 137 139 //////////////////////////////////////////////////////////////////////////////// 138 140 // … … 173 175 protected: 174 176 VBoxEventType_T mWhat; 177 }; 178 #endif 179 180 //////////////////////////////////////////////////////////////////////////////// 181 // 182 // AsyncEvent class 183 // 184 //////////////////////////////////////////////////////////////////////////////// 185 186 /** 187 * For firing off an event on asynchronously on an event thread. 188 */ 189 class VirtualBox::AsyncEvent : public Event 190 { 191 public: 192 AsyncEvent(VirtualBox *a_pVirtualBox, ComPtr<IEvent> const &a_rEvent) 193 : mVirtualBox(a_pVirtualBox), mEvent(a_rEvent) 194 { 195 Assert(a_pVirtualBox); 196 } 197 198 void *handler() RT_OVERRIDE; 199 200 private: 201 /** 202 * @note This is a weak ref -- the CallbackEvent handler thread is bound to the 203 * lifetime of the VirtualBox instance, so it's safe. 204 */ 205 VirtualBox *mVirtualBox; 206 /** The event. */ 207 ComPtr<IEvent> mEvent; 175 208 }; 176 209 … … 556 589 try 557 590 { 591 /* Create the event source early as we may fire async event during settings loading (media). */ 592 rc = unconst(m->pEventSource).createObject(); 593 if (FAILED(rc)) throw rc; 594 rc = m->pEventSource->init(); 595 if (FAILED(rc)) throw rc; 596 597 558 598 /* Get the VirtualBox home directory. */ 559 599 { … … 718 758 } 719 759 #endif /* VBOX_WITH_CLOUD_NET */ 720 721 /* events */722 if (SUCCEEDED(rc = unconst(m->pEventSource).createObject()))723 rc = m->pEventSource->init();724 if (FAILED(rc)) throw rc;725 760 726 761 /* cloud provider manager */ … … 3188 3223 } 3189 3224 3190 /** Event for onMachineStateChange(), onMachineDataChange(), onMachineRegistered() */3191 struct MachineEvent : public VirtualBox::CallbackEvent3192 {3193 MachineEvent(VirtualBox *aVB, VBoxEventType_T aWhat, const Guid &aId, BOOL aBool)3194 : CallbackEvent(aVB, aWhat), id(aId.toUtf16())3195 , mBool(aBool)3196 { }3197 3198 MachineEvent(VirtualBox *aVB, VBoxEventType_T aWhat, const Guid &aId, MachineState_T aState)3199 : CallbackEvent(aVB, aWhat), id(aId.toUtf16())3200 , mState(aState)3201 {}3202 3203 virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc)3204 {3205 switch (mWhat)3206 {3207 case VBoxEventType_OnMachineDataChanged:3208 aEvDesc.init(aSource, mWhat, id.raw(), mBool);3209 break;3210 3211 case VBoxEventType_OnMachineStateChanged:3212 aEvDesc.init(aSource, mWhat, id.raw(), mState);3213 break;3214 3215 case VBoxEventType_OnMachineRegistered:3216 aEvDesc.init(aSource, mWhat, id.raw(), mBool);3217 break;3218 3219 default:3220 AssertFailedReturn(S_OK);3221 }3222 return S_OK;3223 }3224 3225 Bstr id;3226 MachineState_T mState;3227 BOOL mBool;3228 };3229 3230 3231 3225 /** 3232 3226 * VD plugin load … … 3245 3239 } 3246 3240 3247 3248 /** Event for onMediumRegistered() */3249 struct MediumRegisteredEventStruct : public VirtualBox::CallbackEvent3250 {3251 MediumRegisteredEventStruct(VirtualBox *aVB, const Guid &aMediumId,3252 const DeviceType_T aDevType, const BOOL aRegistered)3253 : CallbackEvent(aVB, VBoxEventType_OnMediumRegistered)3254 , mMediumId(aMediumId.toUtf16()), mDevType(aDevType), mRegistered(aRegistered)3255 {}3256 3257 virtual HRESULT prepareEventDesc(IEventSource *aSource, VBoxEventDesc &aEvDesc)3258 {3259 return aEvDesc.init(aSource, VBoxEventType_OnMediumRegistered, mMediumId.raw(), mDevType, mRegistered);3260 }3261 3262 Bstr mMediumId;3263 DeviceType_T mDevType;3264 BOOL mRegistered;3265 };3266 3267 3241 /** 3268 3242 * @note Doesn't lock any object. … … 3270 3244 void VirtualBox::i_onMediumRegistered(const Guid &aMediumId, const DeviceType_T aDevType, const BOOL aRegistered) 3271 3245 { 3272 i_postEvent(new MediumRegisteredEventStruct(this, aMediumId, aDevType, aRegistered)); 3273 } 3274 3275 /** Event for onMediumConfigChanged() */ 3276 struct MediumConfigChangedEventStruct : public VirtualBox::CallbackEvent 3277 { 3278 MediumConfigChangedEventStruct(VirtualBox *aVB, IMedium *aMedium) 3279 : CallbackEvent(aVB, VBoxEventType_OnMediumConfigChanged) 3280 , mMedium(aMedium) 3281 {} 3282 3283 virtual HRESULT prepareEventDesc(IEventSource *aSource, VBoxEventDesc &aEvDesc) 3284 { 3285 return aEvDesc.init(aSource, VBoxEventType_OnMediumConfigChanged, mMedium); 3286 } 3287 3288 IMedium* mMedium; 3289 }; 3246 ComPtr<IEvent> ptrEvent; 3247 HRESULT hrc = CreateMediumRegisteredEvent(ptrEvent.asOutParam(), m->pEventSource, 3248 aMediumId.toUtf16().raw(), aDevType, aRegistered); 3249 AssertComRCReturnVoid(hrc); 3250 i_postEvent(new AsyncEvent(this, ptrEvent)); 3251 } 3290 3252 3291 3253 void VirtualBox::i_onMediumConfigChanged(IMedium *aMedium) 3292 3254 { 3293 i_postEvent(new MediumConfigChangedEventStruct(this, aMedium)); 3294 } 3295 3296 /** Event for onMediumChanged() */ 3297 struct MediumChangedEventStruct : public VirtualBox::CallbackEvent 3298 { 3299 MediumChangedEventStruct(VirtualBox *aVB, IMediumAttachment *aMediumAttachment) 3300 : CallbackEvent(aVB, VBoxEventType_OnMediumChanged) 3301 , mMediumAttachment(aMediumAttachment) 3302 {} 3303 3304 virtual HRESULT prepareEventDesc(IEventSource *aSource, VBoxEventDesc &aEvDesc) 3305 { 3306 return aEvDesc.init(aSource, VBoxEventType_OnMediumChanged, mMediumAttachment); 3307 } 3308 3309 IMediumAttachment* mMediumAttachment; 3310 }; 3255 ComPtr<IEvent> ptrEvent; 3256 HRESULT hrc = CreateMediumConfigChangedEvent(ptrEvent.asOutParam(), m->pEventSource, aMedium); 3257 AssertComRCReturnVoid(hrc); 3258 i_postEvent(new AsyncEvent(this, ptrEvent)); 3259 } 3311 3260 3312 3261 void VirtualBox::i_onMediumChanged(IMediumAttachment *aMediumAttachment) 3313 3262 { 3314 i_postEvent(new MediumChangedEventStruct(this, aMediumAttachment)); 3315 } 3316 3317 /** Event for onStorageControllerChanged() */ 3318 struct StorageControllerChangedEventStruct : public VirtualBox::CallbackEvent 3319 { 3320 StorageControllerChangedEventStruct(VirtualBox *aVB, const Guid &aMachineId, 3321 const com::Utf8Str &aControllerName) 3322 : CallbackEvent(aVB, VBoxEventType_OnStorageControllerChanged) 3323 , mMachineId(aMachineId.toUtf16()), mControllerName(aControllerName) 3324 {} 3325 3326 virtual HRESULT prepareEventDesc(IEventSource *aSource, VBoxEventDesc &aEvDesc) 3327 { 3328 return aEvDesc.init(aSource, VBoxEventType_OnStorageControllerChanged, mMachineId.raw(), mControllerName.raw()); 3329 } 3330 3331 Bstr mMachineId; 3332 Bstr mControllerName; 3333 }; 3263 ComPtr<IEvent> ptrEvent; 3264 HRESULT hrc = CreateMediumChangedEvent(ptrEvent.asOutParam(), m->pEventSource, aMediumAttachment); 3265 AssertComRCReturnVoid(hrc); 3266 i_postEvent(new AsyncEvent(this, ptrEvent)); 3267 } 3334 3268 3335 3269 /** … … 3338 3272 void VirtualBox::i_onStorageControllerChanged(const Guid &aMachineId, const com::Utf8Str &aControllerName) 3339 3273 { 3340 i_postEvent(new StorageControllerChangedEventStruct(this, aMachineId, aControllerName)); 3341 } 3342 3343 /** Event for onStorageDeviceChanged() */ 3344 struct StorageDeviceChangedEventStruct : public VirtualBox::CallbackEvent 3345 { 3346 StorageDeviceChangedEventStruct(VirtualBox *aVB, IMediumAttachment *aStorageDevice, BOOL fRemoved, BOOL fSilent) 3347 : CallbackEvent(aVB, VBoxEventType_OnStorageDeviceChanged) 3348 , mStorageDevice(aStorageDevice) 3349 , mRemoved(fRemoved) 3350 , mSilent(fSilent) 3351 {} 3352 3353 virtual HRESULT prepareEventDesc(IEventSource *aSource, VBoxEventDesc &aEvDesc) 3354 { 3355 return aEvDesc.init(aSource, VBoxEventType_OnStorageDeviceChanged, mStorageDevice, mRemoved, mSilent); 3356 } 3357 3358 IMediumAttachment* mStorageDevice; 3359 BOOL mRemoved; 3360 BOOL mSilent; 3361 }; 3274 ComPtr<IEvent> ptrEvent; 3275 HRESULT hrc = CreateStorageControllerChangedEvent(ptrEvent.asOutParam(), m->pEventSource, 3276 aMachineId.toUtf16().raw(), Bstr(aControllerName).raw()); 3277 AssertComRCReturnVoid(hrc); 3278 i_postEvent(new AsyncEvent(this, ptrEvent)); 3279 } 3362 3280 3363 3281 void VirtualBox::i_onStorageDeviceChanged(IMediumAttachment *aStorageDevice, const BOOL fRemoved, const BOOL fSilent) 3364 3282 { 3365 i_postEvent(new StorageDeviceChangedEventStruct(this, aStorageDevice, fRemoved, fSilent)); 3283 ComPtr<IEvent> ptrEvent; 3284 HRESULT hrc = CreateStorageDeviceChangedEvent(ptrEvent.asOutParam(), m->pEventSource, aStorageDevice, fRemoved, fSilent); 3285 AssertComRCReturnVoid(hrc); 3286 i_postEvent(new AsyncEvent(this, ptrEvent)); 3366 3287 } 3367 3288 … … 3371 3292 void VirtualBox::i_onMachineStateChange(const Guid &aId, MachineState_T aState) 3372 3293 { 3373 i_postEvent(new MachineEvent(this, VBoxEventType_OnMachineStateChanged, aId, aState)); 3294 ComPtr<IEvent> ptrEvent; 3295 HRESULT hrc = CreateMachineStateChangedEvent(ptrEvent.asOutParam(), m->pEventSource, aId.toUtf16().raw(), aState); 3296 AssertComRCReturnVoid(hrc); 3297 i_postEvent(new AsyncEvent(this, ptrEvent)); 3374 3298 } 3375 3299 … … 3379 3303 void VirtualBox::i_onMachineDataChange(const Guid &aId, BOOL aTemporary) 3380 3304 { 3381 i_postEvent(new MachineEvent(this, VBoxEventType_OnMachineDataChanged, aId, aTemporary)); 3305 ComPtr<IEvent> ptrEvent; 3306 HRESULT hrc = CreateMachineDataChangedEvent(ptrEvent.asOutParam(), m->pEventSource, aId.toUtf16().raw(), aTemporary); 3307 AssertComRCReturnVoid(hrc); 3308 i_postEvent(new AsyncEvent(this, ptrEvent)); 3382 3309 } 3383 3310 … … 3388 3315 Bstr &aError) 3389 3316 { 3390 LogFlowThisFunc(("machine={%s} aKey={%ls} aValue={%ls}\n", 3391 aId.toString().c_str(), aKey, aValue)); 3317 LogFlowThisFunc(("machine={%RTuuid} aKey={%ls} aValue={%ls}\n", aId.raw(), aKey, aValue)); 3392 3318 3393 3319 AutoCaller autoCaller(this); 3394 3320 AssertComRCReturn(autoCaller.rc(), FALSE); 3395 3321 3396 BOOL allowChange = TRUE; 3397 Bstr id = aId.toUtf16(); 3398 3399 VBoxEventDesc evDesc; 3400 evDesc.init(m->pEventSource, VBoxEventType_OnExtraDataCanChange, id.raw(), aKey, aValue); 3401 BOOL fDelivered = evDesc.fire(3000); /* Wait up to 3 secs for delivery */ 3322 ComPtr<IEvent> ptrEvent; 3323 HRESULT hrc = CreateExtraDataCanChangeEvent(ptrEvent.asOutParam(), m->pEventSource, aId.toUtf16().raw(), aKey, aValue); 3324 AssertComRCReturn(hrc, TRUE); 3325 i_postEvent(new AsyncEvent(this, ptrEvent)); 3326 3327 VBoxEventDesc EvtDesc(ptrEvent, m->pEventSource); 3328 BOOL fDelivered = EvtDesc.fire(3000); /* Wait up to 3 secs for delivery */ 3402 3329 //Assert(fDelivered); 3330 BOOL fAllowChange = TRUE; 3403 3331 if (fDelivered) 3404 3332 { 3405 ComPtr<IEvent> aEvent; 3406 evDesc.getEvent(aEvent.asOutParam()); 3407 ComPtr<IExtraDataCanChangeEvent> aCanChangeEvent = aEvent; 3408 Assert(aCanChangeEvent); 3333 ComPtr<IExtraDataCanChangeEvent> ptrCanChangeEvent = ptrEvent; 3334 Assert(ptrCanChangeEvent); 3335 3409 3336 BOOL fVetoed = FALSE; 3410 aCanChangeEvent->IsVetoed(&fVetoed);3411 allowChange = !fVetoed;3412 3413 if (! allowChange)3337 ptrCanChangeEvent->IsVetoed(&fVetoed); 3338 fAllowChange = !fVetoed; 3339 3340 if (!fAllowChange) 3414 3341 { 3415 3342 SafeArray<BSTR> aVetos; 3416 aCanChangeEvent->GetVetos(ComSafeArrayAsOutParam(aVetos));3343 ptrCanChangeEvent->GetVetos(ComSafeArrayAsOutParam(aVetos)); 3417 3344 if (aVetos.size() > 0) 3418 3345 aError = aVetos[0]; 3419 3346 } 3420 3347 } 3421 else 3422 allowChange = TRUE; 3423 3424 LogFlowThisFunc(("allowChange=%RTbool\n", allowChange)); 3425 return allowChange; 3426 } 3427 3428 /** Event for onExtraDataChange() */ 3429 struct ExtraDataEvent : public VirtualBox::CallbackEvent 3430 { 3431 ExtraDataEvent(VirtualBox *aVB, const Guid &aMachineId, 3432 IN_BSTR aKey, IN_BSTR aVal) 3433 : CallbackEvent(aVB, VBoxEventType_OnExtraDataChanged) 3434 , machineId(aMachineId.toUtf16()), key(aKey), val(aVal) 3435 {} 3436 3437 virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc) 3438 { 3439 return aEvDesc.init(aSource, VBoxEventType_OnExtraDataChanged, machineId.raw(), key.raw(), val.raw()); 3440 } 3441 3442 Bstr machineId, key, val; 3443 }; 3348 3349 LogFlowThisFunc(("fAllowChange=%RTbool\n", fAllowChange)); 3350 return fAllowChange; 3351 } 3444 3352 3445 3353 /** 3446 3354 * @note Doesn't lock any object. 3355 * @todo +d 3447 3356 */ 3448 3357 void VirtualBox::i_onExtraDataChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue) 3449 3358 { 3450 i_postEvent(new ExtraDataEvent(this, aId, aKey, aValue)); 3359 ComPtr<IEvent> ptrEvent; 3360 HRESULT hrc = CreateExtraDataChangedEvent(ptrEvent.asOutParam(), m->pEventSource, aId.toUtf16().raw(), aKey, aValue); 3361 AssertComRCReturnVoid(hrc); 3362 i_postEvent(new AsyncEvent(this, ptrEvent)); 3451 3363 } 3452 3364 … … 3456 3368 void VirtualBox::i_onMachineRegistered(const Guid &aId, BOOL aRegistered) 3457 3369 { 3458 i_postEvent(new MachineEvent(this, VBoxEventType_OnMachineRegistered, aId, aRegistered)); 3459 } 3460 3461 /** Event for onSessionStateChange() */ 3462 struct SessionEvent : public VirtualBox::CallbackEvent 3463 { 3464 SessionEvent(VirtualBox *aVB, const Guid &aMachineId, SessionState_T aState) 3465 : CallbackEvent(aVB, VBoxEventType_OnSessionStateChanged) 3466 , machineId(aMachineId.toUtf16()), sessionState(aState) 3467 {} 3468 3469 virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc) 3470 { 3471 return aEvDesc.init(aSource, VBoxEventType_OnSessionStateChanged, machineId.raw(), sessionState); 3472 } 3473 Bstr machineId; 3474 SessionState_T sessionState; 3475 }; 3370 ComPtr<IEvent> ptrEvent; 3371 HRESULT hrc = CreateMachineRegisteredEvent(ptrEvent.asOutParam(), m->pEventSource, aId.toUtf16().raw(), aRegistered); 3372 AssertComRCReturnVoid(hrc); 3373 i_postEvent(new AsyncEvent(this, ptrEvent)); 3374 } 3476 3375 3477 3376 /** 3478 3377 * @note Doesn't lock any object. 3378 * @todo +d 3479 3379 */ 3480 3380 void VirtualBox::i_onSessionStateChange(const Guid &aId, SessionState_T aState) 3481 3381 { 3482 i_postEvent(new SessionEvent(this, aId, aState)); 3483 } 3484 3485 /** Event for i_onSnapshotTaken(), i_onSnapshotDeleted(), i_onSnapshotRestored() and i_onSnapshotChange() */ 3486 struct SnapshotEvent : public VirtualBox::CallbackEvent 3487 { 3488 SnapshotEvent(VirtualBox *aVB, const Guid &aMachineId, const Guid &aSnapshotId, 3489 VBoxEventType_T aWhat) 3490 : CallbackEvent(aVB, aWhat) 3491 , machineId(aMachineId), snapshotId(aSnapshotId) 3492 {} 3493 3494 virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc) 3495 { 3496 return aEvDesc.init(aSource, mWhat, machineId.toUtf16().raw(), 3497 snapshotId.toUtf16().raw()); 3498 } 3499 3500 Guid machineId; 3501 Guid snapshotId; 3502 }; 3382 ComPtr<IEvent> ptrEvent; 3383 HRESULT hrc = CreateSessionStateChangedEvent(ptrEvent.asOutParam(), m->pEventSource, aId.toUtf16().raw(), aState); 3384 AssertComRCReturnVoid(hrc); 3385 i_postEvent(new AsyncEvent(this, ptrEvent)); 3386 } 3503 3387 3504 3388 /** … … 3507 3391 void VirtualBox::i_onSnapshotTaken(const Guid &aMachineId, const Guid &aSnapshotId) 3508 3392 { 3509 i_postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId, 3510 VBoxEventType_OnSnapshotTaken)); 3393 ComPtr<IEvent> ptrEvent; 3394 HRESULT hrc = CreateSnapshotTakenEvent(ptrEvent.asOutParam(), m->pEventSource, 3395 aMachineId.toUtf16().raw(), aSnapshotId.toUtf16().raw()); 3396 AssertComRCReturnVoid(hrc); 3397 i_postEvent(new AsyncEvent(this, ptrEvent)); 3511 3398 } 3512 3399 … … 3516 3403 void VirtualBox::i_onSnapshotDeleted(const Guid &aMachineId, const Guid &aSnapshotId) 3517 3404 { 3518 i_postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId, 3519 VBoxEventType_OnSnapshotDeleted)); 3405 ComPtr<IEvent> ptrEvent; 3406 HRESULT hrc = CreateSnapshotDeletedEvent(ptrEvent.asOutParam(), m->pEventSource, 3407 aMachineId.toUtf16().raw(), aSnapshotId.toUtf16().raw()); 3408 AssertComRCReturnVoid(hrc); 3409 i_postEvent(new AsyncEvent(this, ptrEvent)); 3520 3410 } 3521 3411 … … 3525 3415 void VirtualBox::i_onSnapshotRestored(const Guid &aMachineId, const Guid &aSnapshotId) 3526 3416 { 3527 i_postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId, 3528 VBoxEventType_OnSnapshotRestored)); 3417 ComPtr<IEvent> ptrEvent; 3418 HRESULT hrc = CreateSnapshotRestoredEvent(ptrEvent.asOutParam(), m->pEventSource, 3419 aMachineId.toUtf16().raw(), aSnapshotId.toUtf16().raw()); 3420 AssertComRCReturnVoid(hrc); 3421 i_postEvent(new AsyncEvent(this, ptrEvent)); 3529 3422 } 3530 3423 3531 3424 /** 3532 3425 * @note Doesn't lock any object. 3426 * @todo +d 3533 3427 */ 3534 3428 void VirtualBox::i_onSnapshotChange(const Guid &aMachineId, const Guid &aSnapshotId) 3535 3429 { 3536 i_postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId, 3537 VBoxEventType_OnSnapshotChanged)); 3538 } 3539 3540 /** Event for onGuestPropertyChange() */ 3541 struct GuestPropertyEvent : public VirtualBox::CallbackEvent 3542 { 3543 GuestPropertyEvent(VirtualBox *aVBox, const Guid &aMachineId, 3544 IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags) 3545 : CallbackEvent(aVBox, VBoxEventType_OnGuestPropertyChanged), 3546 machineId(aMachineId), 3547 name(aName), 3548 value(aValue), 3549 flags(aFlags) 3550 {} 3551 3552 virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc) 3553 { 3554 return aEvDesc.init(aSource, VBoxEventType_OnGuestPropertyChanged, 3555 machineId.toUtf16().raw(), name.raw(), value.raw(), flags.raw()); 3556 } 3557 3558 Guid machineId; 3559 Bstr name, value, flags; 3560 }; 3561 3562 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 3430 ComPtr<IEvent> ptrEvent; 3431 HRESULT hrc = CreateSnapshotChangedEvent(ptrEvent.asOutParam(), m->pEventSource, 3432 aMachineId.toUtf16().raw(), aSnapshotId.toUtf16().raw()); 3433 AssertComRCReturnVoid(hrc); 3434 i_postEvent(new AsyncEvent(this, ptrEvent)); 3435 } 3436 3437 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS /** @todo r=bird: Why is this still here? */ 3438 3563 3439 /** 3564 3440 * Generates a new clipboard area on the host by opening (and locking) a new, temporary directory. … … 3833 3709 return cRefCount; 3834 3710 } 3711 3835 3712 #endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */ 3836 3713 3837 3714 /** 3838 3715 * @note Doesn't lock any object. 3716 * @todo +d 3839 3717 */ 3840 3718 void VirtualBox::i_onGuestPropertyChange(const Guid &aMachineId, IN_BSTR aName, 3841 3719 IN_BSTR aValue, IN_BSTR aFlags) 3842 3720 { 3843 i_postEvent(new GuestPropertyEvent(this, aMachineId, aName, aValue, aFlags)); 3721 ComPtr<IEvent> ptrEvent; 3722 HRESULT hrc = CreateGuestPropertyChangedEvent(ptrEvent.asOutParam(), m->pEventSource, 3723 aMachineId.toUtf16().raw(), aName, aValue, aFlags); 3724 AssertComRCReturnVoid(hrc); 3725 i_postEvent(new AsyncEvent(this, ptrEvent)); 3844 3726 } 3845 3727 3846 3728 /** 3847 3729 * @note Doesn't lock any object. 3730 * @todo +d 3848 3731 */ 3849 3732 void VirtualBox::i_onNatRedirectChange(const Guid &aMachineId, ULONG ulSlot, bool fRemove, IN_BSTR aName, … … 3855 3738 } 3856 3739 3740 /** @todo +d */ 3857 3741 void VirtualBox::i_onNATNetworkChange(IN_BSTR aName) 3858 3742 { … … 5802 5686 //////////////////////////////////////////////////////////////////////////////// 5803 5687 5688 #if 0 /* obsoleted by AsyncEvent */ 5804 5689 /** 5805 5690 * Prepare the event using the overwritten #prepareEventDesc method and fire. … … 5831 5716 5832 5717 mVirtualBox = NULL; /* Not needed any longer. Still make sense to do this? */ 5718 return NULL; 5719 } 5720 #endif 5721 5722 /** 5723 * Called on the event handler thread. 5724 * 5725 * @note Locks the managed VirtualBox object for reading but leaves the lock 5726 * before iterating over callbacks and calling their methods. 5727 */ 5728 void *VirtualBox::AsyncEvent::handler() 5729 { 5730 if (mVirtualBox) 5731 { 5732 AutoCaller autoCaller(mVirtualBox); 5733 if (autoCaller.isOk()) 5734 { 5735 VBoxEventDesc EvtDesc(mEvent, mVirtualBox->m->pEventSource); 5736 EvtDesc.fire(/* don't wait for delivery */0); 5737 } 5738 else 5739 Log1WarningFunc(("VirtualBox has been uninitialized (state=%d), the callback event is discarded!\n", 5740 mVirtualBox->getObjectState().getState())); 5741 mVirtualBox = NULL; /* Old code did this, not really necessary, but whatever. */ 5742 } 5743 mEvent.setNull(); 5833 5744 return NULL; 5834 5745 }
Note:
See TracChangeset
for help on using the changeset viewer.