Changeset 29900 in vbox for trunk/src/VBox/HostServices/GuestControl
- Timestamp:
- May 31, 2010 12:41:27 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 62166
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/GuestControl/service.cpp
r29898 r29900 100 100 101 101 /** 102 * Structure for holding a buffered host command.103 */104 struct HostCmd105 {106 /** The context ID this command belongs to. Will be extracted107 * from the HGCM parameters. */108 uint32_t mContextID;109 /** Dynamic structure for holding the HGCM parms */110 VBOXGUESTCTRPARAMBUFFER mParmBuf;111 112 /** The standard contructor. */113 HostCmd() : mContextID(0) {}114 };115 /** The host cmd list + iterator type */116 typedef std::list< HostCmd > HostCmdList;117 typedef std::list< HostCmd >::iterator HostCmdListIter;118 typedef std::list< HostCmd >::const_iterator HostCmdListIterConst;119 120 /**121 102 * Structure for holding an uncompleted guest call. 122 103 */ 123 struct GuestCall104 struct ClientWaiter 124 105 { 125 106 /** Client ID; a client can have multiple handles! */ … … 133 114 134 115 /** The standard contructor. */ 135 GuestCall() : mClientID(0), mHandle(0), mParms(NULL), mNumParms(0) {}116 ClientWaiter() : mClientID(0), mHandle(0), mParms(NULL), mNumParms(0) {} 136 117 /** The normal contructor. */ 137 GuestCall(uint32_t aClientID, VBOXHGCMCALLHANDLE aHandle,118 ClientWaiter(uint32_t aClientID, VBOXHGCMCALLHANDLE aHandle, 138 119 VBOXHGCMSVCPARM aParms[], uint32_t cParms) 139 120 : mClientID(aClientID), mHandle(aHandle), mParms(aParms), mNumParms(cParms) {} 140 121 }; 141 122 /** The guest call list type */ 142 typedef std::list< GuestCall > CallList; 143 typedef std::list< GuestCall >::iterator CallListIter; 144 typedef std::list< GuestCall >::const_iterator CallListIterConst; 123 typedef std::list< ClientWaiter > ClientWaiterList; 124 typedef std::list< ClientWaiter >::iterator CallListIter; 125 typedef std::list< ClientWaiter >::const_iterator CallListIterConst; 126 127 /** 128 * Structure for holding a buffered host command. 129 */ 130 struct HostCmd 131 { 132 /** The context ID this command belongs to. Will be extracted 133 * from the HGCM parameters. */ 134 uint32_t mContextID; 135 /** Dynamic structure for holding the HGCM parms */ 136 VBOXGUESTCTRPARAMBUFFER mParmBuf; 137 138 /** The standard contructor. */ 139 HostCmd() : mContextID(0) {} 140 }; 141 /** The host cmd list + iterator type */ 142 typedef std::list< HostCmd > HostCmdList; 143 typedef std::list< HostCmd >::iterator HostCmdListIter; 144 typedef std::list< HostCmd >::const_iterator HostCmdListIterConst; 145 145 146 146 /** … … 162 162 void *mpvHostData; 163 163 /** The deferred calls list. */ 164 C allList mClientList;164 ClientWaiterList mClientWaiterList; 165 165 /** The host command list. */ 166 166 HostCmdList mHostCmds; … … 436 436 int rc = VINF_SUCCESS; 437 437 438 CallListIter itCall = mClient List.begin();439 while (itCall != mClient List.end())438 CallListIter itCall = mClientWaiterList.begin(); 439 while (itCall != mClientWaiterList.end()) 440 440 { 441 441 if (itCall->mClientID == u32ClientID) 442 442 { 443 itCall = mClient List.erase(itCall);443 itCall = mClientWaiterList.erase(itCall); 444 444 } 445 445 else … … 543 543 if (mHostCmds.empty()) /* If command list is empty, defer ... */ 544 544 { 545 mClient List.push_back(GuestCall(u32ClientID, callHandle, paParms, cParms));545 mClientWaiterList.push_back(ClientWaiter(u32ClientID, callHandle, paParms, cParms)); 546 546 rc = VINF_HGCM_ASYNC_EXECUTE; 547 547 } … … 576 576 { 577 577 int rc = VINF_SUCCESS; 578 CallListIter it = mClient List.begin();579 while (it != mClient List.end())578 CallListIter it = mClientWaiterList.begin(); 579 while (it != mClientWaiterList.end()) 580 580 { 581 581 if (it->mClientID == u32ClientID) … … 588 588 if (mpHelpers) 589 589 mpHelpers->pfnCallComplete(it->mHandle, rc); 590 it = mClient List.erase(it);590 it = mClientWaiterList.erase(it); 591 591 } 592 592 else … … 660 660 { 661 661 /* Can we wake up a waiting client on guest? */ 662 if (!mClient List.empty())663 { 664 GuestCall guest = mClientList.front();662 if (!mClientWaiterList.empty()) 663 { 664 ClientWaiter guest = mClientWaiterList.front(); 665 665 rc = sendHostCmdToGuest(&newCmd, 666 666 guest.mHandle, guest.mNumParms, guest.mParms); … … 669 669 AssertPtr(mpHelpers); 670 670 mpHelpers->pfnCallComplete(guest.mHandle, rc); 671 mClient List.pop_front();671 mClientWaiterList.pop_front(); 672 672 673 673 /* If we got VERR_TOO_MUCH_DATA we buffer the host command in the next block
Note:
See TracChangeset
for help on using the changeset viewer.