Changeset 107254 in vbox
- Timestamp:
- Dec 9, 2024 1:09:34 PM (7 weeks ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ObjectsTracker.h
r107240 r107254 145 145 } 146 146 147 inline bool isIdleTimeStarted() const 148 { 149 return m_fIdleTimeStart; 150 } 151 152 inline bool isLifeTimeExpired() const 153 { 154 return m_fLifeTimeExpired; 155 } 156 147 157 com::Utf8Str updateLastAccessTime(); 148 158 com::Utf8Str initIdleTime(); … … 156 166 com::Utf8Str m_componentName; 157 167 RTTIMESPEC m_creationTime;//creation time 168 RTTIMESPEC m_deletionTime;//deletion time (m_creationTime + m_lifeTime + m_idleTime) 158 169 RTTIMESPEC m_idleTimeStart;//idle time beginning (ref counter is 1) 159 RTTIMESPEC m_deletionTime;//deletion time (m_creationTime + m_lifeTime + m_idleTime)160 170 RTTIMESPEC m_lastAccessTime;//last access time 161 171 uint64_t m_lifeTime;//lifetime after creation in seconds, 0 - live till the VBoxSVC lives 162 172 uint64_t m_idleTime;//lifetime after out of usage in seconds, 0 - keep forever 163 173 bool m_fIdleTimeStart;//when ref counter of m_pIface is 1 or m_lifeTime exceeded 174 bool m_fLifeTimeExpired;//set to True only one time during the whole object life 164 175 TrackedObjectState_T m_state; 165 176 ComPtr<IUnknown> m_pIface;//keeps a reference to a tracked object … … 200 211 uint64_t afterLifeTime, 201 212 IUnknown* ptrIface); 213 214 HRESULT updateObj (const TrackedObjectData& aObjData); 202 215 203 216 HRESULT getObj (const com::Utf8Str &aObjId, -
trunk/src/VBox/Main/src-all/ObjectsTracker.cpp
r107240 r107254 64 64 m_idleTime(aIdleTime), 65 65 m_fIdleTimeStart(false), 66 m_fLifeTimeExpired(false), 66 67 m_pIface(aPtr) 67 68 { … … 87 88 m_idleTimeStart = that.m_idleTimeStart; 88 89 m_fIdleTimeStart = that.m_fIdleTimeStart; 90 m_fLifeTimeExpired = that.m_fLifeTimeExpired; 89 91 m_state = that.m_state; 90 92 } … … 116 118 m_idleTimeStart = that.m_idleTimeStart; 117 119 m_fIdleTimeStart = that.m_fIdleTimeStart; 120 m_fLifeTimeExpired = that.m_fLifeTimeExpired; 118 121 m_state = that.m_state; 119 122 } … … 140 143 RTTimeNow(unconst(&m_idleTimeStart)); 141 144 m_fIdleTimeStart = true; 145 m_fLifeTimeExpired = true; 142 146 } 143 147 … … 325 329 /* increase the counter */ 326 330 ++m_Added; 331 332 /* Leave critical section here */ 333 RTCritSectLeave(&m_CritSectData); 334 335 return hrc; 336 } 337 338 339 HRESULT TrackedObjectsCollector::updateObj (const TrackedObjectData& aObjData) 340 { 341 LogFlowFuncEnter(); 342 343 HRESULT hrc = S_OK; 344 int vrc = i_checkInitialization(); 345 if (RT_FAILURE(vrc)) 346 return VBOX_E_INVALID_OBJECT_STATE; 347 348 /* Enter critical section here */ 349 RTCritSectEnter(&m_CritSectData); 350 351 std::pair < std::set<com::Utf8Str>::iterator, bool > opRes = m_trackedObjectIds.insert(aObjData.objectIdStr()); 352 353 /* 354 * The case for updating the tracked object data. 355 * The Id is presented in the m_trackedObjectIds. The original object is removed from m_trackedObjectsData. 356 */ 357 if (!opRes.second) 358 { 359 Log2(("UPDATING TrackedObjectData:\n state %i\n object Id %s\n class IID %s\n life time %i\n idle time %i" 360 "\n life time expired - %s\n idle time started - %s\n", 361 aObjData.state(), 362 aObjData.objectIdStr().c_str(), 363 aObjData.classIIDStr().c_str(), 364 aObjData.lifeTime(), 365 aObjData.idleTime(), 366 (aObjData.isLifeTimeExpired() == true ? "True" : "False"), 367 (aObjData.isIdleTimeStarted() == true ? "True" : "False"))); 368 369 m_trackedObjectsData.erase(aObjData.objectIdStr().c_str()); 370 /* decrease the counter */ 371 --m_Added; 372 373 /* Data is stored in the m_trackedObjectsData under the passed Id. */ 374 m_trackedObjectsData.insert(std::make_pair(aObjData.objectIdStr(), aObjData)); 375 376 /* increase the counter */ 377 ++m_Added; 378 } 379 else 380 { 381 Log2(("UPDATING failed because the object Id %s hasn't existed.\n", aObjData.objectIdStr().c_str())); 382 m_trackedObjectIds.erase(aObjData.objectIdStr()); 383 } 327 384 328 385 /* Leave critical section here */
Note:
See TracChangeset
for help on using the changeset viewer.