Changeset 50538 in vbox for trunk/src/VBox/Main
- Timestamp:
- Feb 21, 2014 12:12:46 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-all/EventImpl.cpp
r48295 r50538 5 5 6 6 /* 7 * Copyright (C) 2010-201 2Oracle Corporation7 * Copyright (C) 2010-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 121 121 if (RT_FAILURE(vrc)) 122 122 { 123 AssertFailed 123 AssertFailed(); 124 124 return setError(E_FAIL, 125 125 tr("Internal error (%Rrc)"), vrc); … … 156 156 157 157 AutoCaller autoCaller(this); 158 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 159 160 // never changes till event alive, no locking? 158 if (FAILED(autoCaller.rc())) 159 return autoCaller.rc(); 160 161 // never changes while event alive, no locking 161 162 *aType = m->mType; 162 163 return S_OK; 163 164 } 164 165 165 STDMETHODIMP VBoxEvent::COMGETTER(Source)(IEventSource **aSource)166 STDMETHODIMP VBoxEvent::COMGETTER(Source)(IEventSource **aSource) 166 167 { 167 168 CheckComArgOutPointerValid(aSource); 168 169 169 170 AutoCaller autoCaller(this); 170 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 171 if (FAILED(autoCaller.rc())) 172 return autoCaller.rc(); 171 173 172 174 m->mSource.queryInterfaceTo(aSource); … … 179 181 180 182 AutoCaller autoCaller(this); 181 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 182 183 // never changes till event alive, no locking? 183 if (FAILED(autoCaller.rc())) 184 return autoCaller.rc(); 185 186 // never changes while event alive, no locking 184 187 *aWaitable = m->mWaitable; 185 188 return S_OK; … … 190 193 { 191 194 AutoCaller autoCaller(this); 192 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 195 if (FAILED(autoCaller.rc())) 196 return autoCaller.rc(); 193 197 194 198 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 210 214 211 215 AutoCaller autoCaller(this); 212 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 216 if (FAILED(autoCaller.rc())) 217 return autoCaller.rc(); 213 218 214 219 { … … 250 255 struct VBoxVetoEvent::Data 251 256 { 252 Data() 253 : 257 Data() : 254 258 mVetoed(FALSE) 255 259 {} … … 282 286 // all veto events are waitable 283 287 rc = VBoxEvent::init(aSource, aType, TRUE); 284 if (FAILED(rc)) return rc; 288 if (FAILED(rc)) 289 return rc; 285 290 286 291 m->mVetoed = FALSE; … … 301 306 { 302 307 AutoCaller autoCaller(this); 303 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 308 if (FAILED(autoCaller.rc())) 309 return autoCaller.rc(); 304 310 305 311 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 313 319 } 314 320 315 STDMETHODIMP VBoxVetoEvent::IsVetoed(BOOL * 321 STDMETHODIMP VBoxVetoEvent::IsVetoed(BOOL *aResult) 316 322 { 317 323 CheckComArgOutPointerValid(aResult); 318 324 319 325 AutoCaller autoCaller(this); 320 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 326 if (FAILED(autoCaller.rc())) 327 return autoCaller.rc(); 321 328 322 329 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 327 334 } 328 335 329 STDMETHODIMP 336 STDMETHODIMP VBoxVetoEvent::GetVetos(ComSafeArrayOut(BSTR, aVetos)) 330 337 { 331 338 if (ComSafeArrayOutIsNull(aVetos)) … … 333 340 334 341 AutoCaller autoCaller(this); 335 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 342 if (FAILED(autoCaller.rc())) 343 return autoCaller.rc(); 336 344 337 345 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 352 360 353 361 static const int FirstEvent = (int)VBoxEventType_LastWildcard + 1; 354 static const int LastEvent 355 static const int NumEvents 362 static const int LastEvent = (int)VBoxEventType_Last; 363 static const int NumEvents = LastEvent - FirstEvent; 356 364 357 365 /** … … 368 376 * till element removed, so we have to know our previous one to update its next 369 377 */ 370 EventMapRecord *mNext;378 EventMapRecord *mNext; 371 379 bool mAlive; 372 380 private: 373 EventMapRecord *mPrev;374 ListenerRecord *mRef; /* must be weak reference */381 EventMapRecord *mPrev; 382 ListenerRecord *mRef; /* must be weak reference */ 375 383 int32_t mRefCnt; 376 384 377 385 public: 378 EventMapRecord(ListenerRecord* aRef) 379 : 380 mNext(0), 381 mAlive(true), 382 mPrev(0), 383 mRef(aRef), 384 mRefCnt(1) 386 EventMapRecord(ListenerRecord *aRef) : 387 mNext(0), mAlive(true), mPrev(0), mRef(aRef), mRefCnt(1) 385 388 {} 386 389 387 EventMapRecord(EventMapRecord &aOther)390 EventMapRecord(EventMapRecord &aOther) 388 391 { 389 392 mNext = aOther.mNext; … … 419 422 } 420 423 421 ListenerRecord *ref()424 ListenerRecord *ref() 422 425 { 423 426 return mAlive ? mRef : 0; … … 474 477 while (pCur) 475 478 { 476 EventMapRecord *aNext = pCur->mNext;479 EventMapRecord *aNext = pCur->mNext; 477 480 if (pCur->ref() == aRec) 478 481 { … … 496 499 EventMapRecord *mCur; 497 500 498 iterator() 499 :mCur(0)501 iterator() : 502 mCur(0) 500 503 {} 501 504 502 505 explicit 503 iterator(EventMapRecord *aCur) 504 :mCur(aCur)506 iterator(EventMapRecord *aCur) : 507 mCur(aCur) 505 508 { 506 509 // Prevent element removal, till we're at it … … 540 543 541 544 bool 542 operator==(const EventMapList::iterator &aOther) const545 operator==(const EventMapList::iterator &aOther) const 543 546 { 544 547 return mCur == aOther.mCur; … … 546 549 547 550 bool 548 operator!=(const EventMapList::iterator &aOther) const551 operator!=(const EventMapList::iterator &aOther) const 549 552 { 550 553 return mCur != aOther.mCur; … … 564 567 565 568 typedef EventMapList EventMap[NumEvents]; 566 typedef std::map<IEvent *, int32_t> PendingEventsMap;569 typedef std::map<IEvent *, int32_t> PendingEventsMap; 567 570 typedef std::deque<ComPtr<IEvent> > PassiveQueue; 568 571 … … 572 575 ComPtr<IEventListener> mListener; 573 576 BOOL mActive; 574 EventSource *mOwner;577 EventSource *mOwner; 575 578 576 579 RTSEMEVENT mQEvent; … … 581 584 582 585 public: 583 ListenerRecord(IEventListener *aListener,584 com::SafeArray<VBoxEventType_T> &aInterested,585 BOOL 586 EventSource *aOwner);586 ListenerRecord(IEventListener *aListener, 587 com::SafeArray<VBoxEventType_T> &aInterested, 588 BOOL aActive, 589 EventSource *aOwner); 587 590 ~ListenerRecord(); 588 591 589 HRESULT process(IEvent * aEvent, BOOL aWaitable, PendingEventsMap::iterator& pit, AutoLockBase&alock);590 HRESULT enqueue(IEvent *aEvent);591 HRESULT dequeue(IEvent * *aEvent, LONG aTimeout, AutoLockBase&aAlock);592 HRESULT eventProcessed(IEvent * aEvent, PendingEventsMap::iterator&pit);592 HRESULT process(IEvent *aEvent, BOOL aWaitable, PendingEventsMap::iterator &pit, AutoLockBase &alock); 593 HRESULT enqueue(IEvent *aEvent); 594 HRESULT dequeue(IEvent **aEvent, LONG aTimeout, AutoLockBase &aAlock); 595 HRESULT eventProcessed(IEvent *aEvent, PendingEventsMap::iterator &pit); 593 596 void addRef() 594 597 { … … 597 600 void release() 598 601 { 599 if (ASMAtomicDecS32(&mRefCnt) <= 0) delete this; 602 if (ASMAtomicDecS32(&mRefCnt) <= 0) 603 delete this; 600 604 } 601 605 BOOL isActive() … … 612 616 { 613 617 public: 614 RecordHolder(Held* lr) 615 : 616 held(lr) 618 RecordHolder(Held *lr) : 619 held(lr) 617 620 { 618 621 addref(); 619 622 } 620 RecordHolder(const RecordHolder& that) 621 : 622 held(that.held) 623 RecordHolder(const RecordHolder &that) : 624 held(that.held) 623 625 { 624 626 addref(); … … 634 636 } 635 637 636 Held *obj()638 Held *obj() 637 639 { 638 640 return held; … … 645 647 } 646 648 private: 647 Held *held;649 Held *held; 648 650 649 651 void addref() … … 657 659 held->release(); 658 660 } 659 void safe_assign 661 void safe_assign(Held *that_p) 660 662 { 661 663 if (that_p) … … 666 668 }; 667 669 668 typedef std::map<IEventListener *, RecordHolder<ListenerRecord> >Listeners;670 typedef std::map<IEventListener *, RecordHolder<ListenerRecord> > Listeners; 669 671 670 672 struct EventSource::Data … … 686 688 return TRUE; 687 689 case VBoxEventType_Vetoable: 688 return 689 690 return (what == VBoxEventType_OnExtraDataCanChange) 691 || (what == VBoxEventType_OnCanShowWindow); 690 692 case VBoxEventType_MachineEvent: 691 return 692 693 694 695 693 return (what == VBoxEventType_OnMachineStateChanged) 694 || (what == VBoxEventType_OnMachineDataChanged) 695 || (what == VBoxEventType_OnMachineRegistered) 696 || (what == VBoxEventType_OnSessionStateChanged) 697 || (what == VBoxEventType_OnGuestPropertyChanged); 696 698 case VBoxEventType_SnapshotEvent: 697 return (what == VBoxEventType_OnSnapshotTaken) 698 || (what == VBoxEventType_OnSnapshotDeleted) 699 || (what == VBoxEventType_OnSnapshotChanged) 700 ; 699 return (what == VBoxEventType_OnSnapshotTaken) 700 || (what == VBoxEventType_OnSnapshotDeleted) 701 || (what == VBoxEventType_OnSnapshotChanged) ; 701 702 case VBoxEventType_InputEvent: 702 return (what == VBoxEventType_OnKeyboardLedsChanged) 703 || (what == VBoxEventType_OnMousePointerShapeChanged) 704 || (what == VBoxEventType_OnMouseCapabilityChanged) 705 ; 703 return (what == VBoxEventType_OnKeyboardLedsChanged) 704 || (what == VBoxEventType_OnMousePointerShapeChanged) 705 || (what == VBoxEventType_OnMouseCapabilityChanged); 706 706 case VBoxEventType_Invalid: 707 707 return FALSE; … … 713 713 } 714 714 715 ListenerRecord::ListenerRecord(IEventListener* aListener, 716 com::SafeArray<VBoxEventType_T>& aInterested, 717 BOOL aActive, 718 EventSource* aOwner) 719 : 720 mActive(aActive), 721 mOwner(aOwner), 722 mRefCnt(0) 715 ListenerRecord::ListenerRecord(IEventListener *aListener, 716 com::SafeArray<VBoxEventType_T> &aInterested, 717 BOOL aActive, 718 EventSource *aOwner) : 719 mActive(aActive), mOwner(aOwner), mRefCnt(0) 723 720 { 724 721 mListener = aListener; 725 EventMap *aEvMap = &aOwner->m->mEvMap;722 EventMap *aEvMap = &aOwner->m->mEvMap; 726 723 727 724 for (size_t i = 0; i < aInterested.size(); ++i) … … 741 738 { 742 739 ::RTCritSectInit(&mcsQLock); 743 ::RTSemEventCreate 740 ::RTSemEventCreate(&mQEvent); 744 741 mLastRead = RTTimeMilliTS(); 745 742 } … … 755 752 { 756 753 /* Remove references to us from the event map */ 757 EventMap *aEvMap = &mOwner->m->mEvMap;754 EventMap *aEvMap = &mOwner->m->mEvMap; 758 755 for (int j = FirstEvent; j < LastEvent; j++) 759 756 { … … 765 762 // at this moment nobody could add elements to our queue, so we can safely 766 763 // clean it up, otherwise there will be pending events map elements 767 PendingEventsMap *aPem = &mOwner->m->mPendingMap;764 PendingEventsMap *aPem = &mOwner->m->mPendingMap; 768 765 while (true) 769 766 { … … 791 788 } 792 789 793 HRESULT ListenerRecord::process(IEvent *aEvent,794 BOOL 795 PendingEventsMap::iterator &pit,796 AutoLockBase &aAlock)790 HRESULT ListenerRecord::process(IEvent *aEvent, 791 BOOL aWaitable, 792 PendingEventsMap::iterator &pit, 793 AutoLockBase &aAlock) 797 794 { 798 795 if (mActive) … … 801 798 * We release lock here to allow modifying ops on EventSource inside callback. 802 799 */ 803 HRESULT rc = 800 HRESULT rc = S_OK; 804 801 if (mListener) 805 802 { … … 819 816 820 817 821 HRESULT ListenerRecord::enqueue (IEvent*aEvent)818 HRESULT ListenerRecord::enqueue(IEvent *aEvent) 822 819 { 823 820 AssertMsg(!mActive, ("must be passive\n")); … … 830 827 uint64_t sinceRead = RTTimeMilliTS() - mLastRead; 831 828 size_t queueSize = mQueue.size(); 832 if ( 829 if ((queueSize > 1000) || ((queueSize > 500) && (sinceRead > 60 * 1000))) 833 830 { 834 831 ::RTCritSectLeave(&mcsQLock); … … 846 843 ::RTCritSectLeave(&mcsQLock); 847 844 848 845 // notify waiters 849 846 ::RTSemEventSignal(mQEvent); 850 847 … … 852 849 } 853 850 854 HRESULT ListenerRecord::dequeue (IEvent**aEvent,855 LONGaTimeout,856 AutoLockBase&aAlock)851 HRESULT ListenerRecord::dequeue(IEvent **aEvent, 852 LONG aTimeout, 853 AutoLockBase &aAlock) 857 854 { 858 855 if (mActive) … … 866 863 mLastRead = RTTimeMilliTS(); 867 864 868 if (mQueue.empty()) { 865 if (mQueue.empty()) 866 { 869 867 ::RTCritSectLeave(&mcsQLock); 870 868 // Speed up common case … … 894 892 } 895 893 896 HRESULT ListenerRecord::eventProcessed (IEvent* aEvent, PendingEventsMap::iterator&pit)894 HRESULT ListenerRecord::eventProcessed(IEvent *aEvent, PendingEventsMap::iterator &pit) 897 895 { 898 896 if (--pit->second == 0) … … 946 944 } 947 945 948 STDMETHODIMP EventSource::RegisterListener(IEventListener * 946 STDMETHODIMP EventSource::RegisterListener(IEventListener *aListener, 949 947 ComSafeArrayIn(VBoxEventType_T, aInterested), 950 BOOL 948 BOOL aActive) 951 949 { 952 950 CheckComArgNotNull(aListener); … … 954 952 955 953 AutoCaller autoCaller(this); 956 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 954 if (FAILED(autoCaller.rc())) 955 return autoCaller.rc(); 957 956 958 957 { … … 964 963 tr("This listener already registered")); 965 964 966 com::SafeArray<VBoxEventType_T> interested(ComSafeArrayInArg 965 com::SafeArray<VBoxEventType_T> interested(ComSafeArrayInArg(aInterested)); 967 966 RecordHolder<ListenerRecord> lrh(new ListenerRecord(aListener, interested, aActive, this)); 968 967 m->mListeners.insert(Listeners::value_type(aListener, lrh)); … … 976 975 } 977 976 978 STDMETHODIMP EventSource::UnregisterListener(IEventListener * 977 STDMETHODIMP EventSource::UnregisterListener(IEventListener *aListener) 979 978 { 980 979 CheckComArgNotNull(aListener); 981 980 982 981 AutoCaller autoCaller(this); 983 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 982 if (FAILED(autoCaller.rc())) 983 return autoCaller.rc(); 984 984 985 985 HRESULT rc; … … 1012 1012 } 1013 1013 1014 STDMETHODIMP EventSource::FireEvent(IEvent * 1015 LONG 1016 BOOL 1014 STDMETHODIMP EventSource::FireEvent(IEvent *aEvent, 1015 LONG aTimeout, 1016 BOOL *aProcessed) 1017 1017 { 1018 1018 CheckComArgNotNull(aEvent); … … 1020 1020 1021 1021 AutoCaller autoCaller(this); 1022 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1022 if (FAILED(autoCaller.rc())) 1023 return autoCaller.rc(); 1023 1024 1024 1025 HRESULT hrc; … … 1091 1092 1092 1093 1093 STDMETHODIMP EventSource::GetEvent(IEventListener * 1094 LONG 1095 IEvent **aEvent)1094 STDMETHODIMP EventSource::GetEvent(IEventListener *aListener, 1095 LONG aTimeout, 1096 IEvent **aEvent) 1096 1097 { 1097 1098 … … 1099 1100 1100 1101 AutoCaller autoCaller(this); 1101 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1102 if (FAILED(autoCaller.rc())) 1103 return autoCaller.rc(); 1102 1104 1103 1105 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 1118 1120 } 1119 1121 1120 STDMETHODIMP EventSource::EventProcessed(IEventListener * 1121 IEvent * 1122 STDMETHODIMP EventSource::EventProcessed(IEventListener *aListener, 1123 IEvent *aEvent) 1122 1124 { 1123 1125 CheckComArgNotNull(aListener); … … 1125 1127 1126 1128 AutoCaller autoCaller(this); 1127 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1129 if (FAILED(autoCaller.rc())) 1130 return autoCaller.rc(); 1128 1131 1129 1132 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 1137 1140 if (it != m->mListeners.end()) 1138 1141 { 1139 ListenerRecord *aRecord = it->second.obj();1142 ListenerRecord *aRecord = it->second.obj(); 1140 1143 1141 1144 if (aRecord->isActive()) 1142 1145 return setError(E_INVALIDARG, 1143 tr("Only applicable to passive listeners"));1146 tr("Only applicable to passive listeners")); 1144 1147 1145 1148 if (aWaitable) … … 1247 1250 } 1248 1251 1249 HRESULT init(IEventSource *aSource)1252 HRESULT init(IEventSource *aSource) 1250 1253 { 1251 1254 mSource = aSource; … … 1254 1257 1255 1258 // IEventListener methods 1256 STDMETHOD(HandleEvent)(IEvent * 1259 STDMETHOD(HandleEvent)(IEvent *aEvent) 1257 1260 { 1258 1261 BOOL fProcessed = FALSE; … … 1270 1273 typedef std::list <ComPtr<IEventSource> > EventSourceList; 1271 1274 /* key is weak reference */ 1272 typedef std::map<IEventListener *, ComPtr<IEventListener> > ProxyListenerMap;1275 typedef std::map<IEventListener *, ComPtr<IEventListener> > ProxyListenerMap; 1273 1276 1274 1277 EventSourceList mEventSources; … … 1309 1312 1310 1313 // IEventSource methods 1311 STDMETHOD(CreateListener)(IEventListener ** 1312 STDMETHOD(CreateAggregator)(ComSafeArrayIn(IEventSource *, aSubordinates),1313 IEventSource ** 1314 STDMETHOD(RegisterListener)(IEventListener * 1314 STDMETHOD(CreateListener)(IEventListener **aListener); 1315 STDMETHOD(CreateAggregator)(ComSafeArrayIn(IEventSource *, aSubordinates), 1316 IEventSource **aAggregator); 1317 STDMETHOD(RegisterListener)(IEventListener *aListener, 1315 1318 ComSafeArrayIn(VBoxEventType_T, aInterested), 1316 BOOL 1317 STDMETHOD(UnregisterListener)(IEventListener * 1318 STDMETHOD(FireEvent)(IEvent * 1319 LONG 1320 BOOL 1321 STDMETHOD(GetEvent)(IEventListener * 1322 LONG 1323 IEvent **aEvent);1324 STDMETHOD(EventProcessed)(IEventListener * 1325 IEvent * 1319 BOOL aActive); 1320 STDMETHOD(UnregisterListener)(IEventListener *aListener); 1321 STDMETHOD(FireEvent)(IEvent *aEvent, 1322 LONG aTimeout, 1323 BOOL *aProcessed); 1324 STDMETHOD(GetEvent)(IEventListener *aListener, 1325 LONG aTimeout, 1326 IEvent **aEvent); 1327 STDMETHOD(EventProcessed)(IEventListener *aListener, 1328 IEvent *aEvent); 1326 1329 1327 1330 protected: 1328 HRESULT createProxyListener(IEventListener * 1329 IEventListener * 1330 HRESULT getProxyListener (IEventListener *aListener,1331 IEventListener **aProxy);1332 HRESULT removeProxyListener(IEventListener * 1331 HRESULT createProxyListener(IEventListener *aListener, 1332 IEventListener **aProxy); 1333 HRESULT getProxyListener(IEventListener *aListener, 1334 IEventListener **aProxy); 1335 HRESULT removeProxyListener(IEventListener *aListener); 1333 1336 }; 1334 1337 … … 1349 1352 1350 1353 1351 STDMETHODIMP EventSource::CreateListener(IEventListener ** 1354 STDMETHODIMP EventSource::CreateListener(IEventListener **aListener) 1352 1355 { 1353 1356 CheckComArgOutPointerValid(aListener); 1354 1357 1355 1358 AutoCaller autoCaller(this); 1356 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1359 if (FAILED(autoCaller.rc())) 1360 return autoCaller.rc(); 1357 1361 1358 1362 ComObjPtr<PassiveEventListener> listener; … … 1366 1370 1367 1371 1368 STDMETHODIMP EventSource::CreateAggregator(ComSafeArrayIn(IEventSource *, aSubordinates),1369 IEventSource ** 1372 STDMETHODIMP EventSource::CreateAggregator(ComSafeArrayIn(IEventSource *, aSubordinates), 1373 IEventSource **aResult) 1370 1374 { 1371 1375 CheckComArgOutPointerValid(aResult); 1372 1376 1373 1377 AutoCaller autoCaller(this); 1374 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1378 if (FAILED(autoCaller.rc())) 1379 return autoCaller.rc(); 1375 1380 1376 1381 ComObjPtr<EventSourceAggregator> agg; … … 1384 1389 return rc; 1385 1390 1386 1387 1391 agg.queryInterfaceTo(aResult); 1388 1392 return S_OK; 1389 1393 } 1390 1394 1391 HRESULT EventSourceAggregator::init(ComSafeArrayIn(IEventSource*, aSourcesIn))1395 HRESULT EventSourceAggregator::init(ComSafeArrayIn(IEventSource *, aSourcesIn)) 1392 1396 { 1393 1397 HRESULT rc; … … 1399 1403 ComAssertMsgRet(SUCCEEDED(rc), ("Could not create source (%Rhrc)", rc), 1400 1404 E_FAIL); 1401 rc = mSource->init((IEventSource *)this);1405 rc = mSource->init((IEventSource *)this); 1402 1406 ComAssertMsgRet(SUCCEEDED(rc), ("Could not init source (%Rhrc)", rc), 1403 1407 E_FAIL); … … 1419 1423 } 1420 1424 1421 STDMETHODIMP EventSourceAggregator::CreateListener(IEventListener ** 1425 STDMETHODIMP EventSourceAggregator::CreateListener(IEventListener **aListener) 1422 1426 { 1423 1427 return mSource->CreateListener(aListener); 1424 1428 } 1425 1429 1426 STDMETHODIMP EventSourceAggregator::CreateAggregator(ComSafeArrayIn(IEventSource *, aSubordinates),1427 IEventSource ** 1430 STDMETHODIMP EventSourceAggregator::CreateAggregator(ComSafeArrayIn(IEventSource *, aSubordinates), 1431 IEventSource **aResult) 1428 1432 { 1429 1433 return mSource->CreateAggregator(ComSafeArrayInArg(aSubordinates), aResult); 1430 1434 } 1431 1435 1432 STDMETHODIMP EventSourceAggregator::RegisterListener(IEventListener * 1436 STDMETHODIMP EventSourceAggregator::RegisterListener(IEventListener *aListener, 1433 1437 ComSafeArrayIn(VBoxEventType_T, aInterested), 1434 BOOL 1438 BOOL aActive) 1435 1439 { 1436 1440 CheckComArgNotNull(aListener); … … 1438 1442 1439 1443 AutoCaller autoCaller(this); 1440 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1444 if (FAILED(autoCaller.rc())) 1445 return autoCaller.rc(); 1441 1446 1442 1447 HRESULT rc; … … 1463 1468 } 1464 1469 1465 STDMETHODIMP EventSourceAggregator::UnregisterListener(IEventListener * 1470 STDMETHODIMP EventSourceAggregator::UnregisterListener(IEventListener *aListener) 1466 1471 { 1467 1472 CheckComArgNotNull(aListener); 1468 1473 1469 1474 AutoCaller autoCaller(this); 1470 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1475 if (FAILED(autoCaller.rc())) 1476 return autoCaller.rc(); 1471 1477 1472 1478 HRESULT rc = S_OK; … … 1491 1497 } 1492 1498 1493 STDMETHODIMP EventSourceAggregator::FireEvent(IEvent * 1494 LONG 1495 BOOL 1499 STDMETHODIMP EventSourceAggregator::FireEvent(IEvent *aEvent, 1500 LONG aTimeout, 1501 BOOL *aProcessed) 1496 1502 { 1497 1503 CheckComArgNotNull(aEvent); … … 1499 1505 1500 1506 AutoCaller autoCaller(this); 1501 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1507 if (FAILED(autoCaller.rc())) 1508 return autoCaller.rc(); 1502 1509 1503 1510 HRESULT rc = S_OK; 1504 1511 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1505 /* Aggre sgator event source shalln't have direct event firing, but we may1512 /* Aggregator event source shall not have direct event firing, but we may 1506 1513 wish to support aggregation chains */ 1507 1514 for (EventSourceList::const_iterator it = mEventSources.begin(); it != mEventSources.end(); … … 1518 1525 } 1519 1526 1520 STDMETHODIMP EventSourceAggregator::GetEvent(IEventListener * 1521 LONG 1522 IEvent **aEvent)1527 STDMETHODIMP EventSourceAggregator::GetEvent(IEventListener *aListener, 1528 LONG aTimeout, 1529 IEvent **aEvent) 1523 1530 { 1524 1531 return mSource->GetEvent(aListener, aTimeout, aEvent); 1525 1532 } 1526 1533 1527 STDMETHODIMP EventSourceAggregator::EventProcessed(IEventListener * 1528 IEvent * 1534 STDMETHODIMP EventSourceAggregator::EventProcessed(IEventListener *aListener, 1535 IEvent *aEvent) 1529 1536 { 1530 1537 return mSource->EventProcessed(aListener, aEvent); 1531 1538 } 1532 1539 1533 HRESULT EventSourceAggregator::createProxyListener(IEventListener * 1534 IEventListener * 1540 HRESULT EventSourceAggregator::createProxyListener(IEventListener *aListener, 1541 IEventListener **aProxy) 1535 1542 { 1536 1543 ComObjPtr<ProxyEventListener> proxy; … … 1555 1562 } 1556 1563 1557 HRESULT EventSourceAggregator::getProxyListener(IEventListener * 1558 IEventListener * 1564 HRESULT EventSourceAggregator::getProxyListener(IEventListener *aListener, 1565 IEventListener **aProxy) 1559 1566 { 1560 1567 ProxyListenerMap::const_iterator it = mListenerProxies.find(aListener); … … 1567 1574 } 1568 1575 1569 HRESULT EventSourceAggregator::removeProxyListener(IEventListener * 1576 HRESULT EventSourceAggregator::removeProxyListener(IEventListener *aListener) 1570 1577 { 1571 1578 ProxyListenerMap::iterator it = mListenerProxies.find(aListener);
Note:
See TracChangeset
for help on using the changeset viewer.