- Timestamp:
- Sep 12, 2018 9:22:06 AM (6 years ago)
- Location:
- trunk/src/VBox/HostServices
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/DragAndDrop/Makefile.kmk
r69111 r74205 5 5 6 6 # 7 # Copyright (C) 2011-201 7Oracle Corporation7 # Copyright (C) 2011-2018 Oracle Corporation 8 8 # 9 9 # This file is part of VirtualBox Open Source Edition (OSE), as … … 39 39 dndmanager.cpp 40 40 41 VBoxDragAndDropSvc_SOURCES += \ 42 ../common/client.cpp \ 43 ../common/message.cpp 44 41 45 VBoxDragAndDropSvc_SOURCES.win = \ 42 46 VBoxDragAndDropSvc.rc -
trunk/src/VBox/HostServices/DragAndDrop/service.cpp
r73939 r74205 5 5 6 6 /* 7 * Copyright (C) 2011-201 7Oracle Corporation7 * Copyright (C) 2011-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 51 51 public: 52 52 53 DragAndDropClient(uint32_t uClientId, VBOXHGCMCALLHANDLE hHandle = NULL, 54 uint32_t uMsg = 0, uint32_t cParms = 0, VBOXHGCMSVCPARM aParms[] = NULL) 55 : HGCM::Client(uClientId, hHandle, uMsg, cParms, aParms) 56 , m_fDeferred(false) 53 DragAndDropClient(uint32_t uClientID) 54 : HGCM::Client(uClientID) 57 55 { 58 56 RT_ZERO(m_SvcCtx); … … 66 64 public: 67 65 68 void complete(VBOXHGCMCALLHANDLE hHandle, int rcOp);69 void completeDeferred(int rcOp);70 66 void disconnect(void); 71 bool isDeferred(void) const { return m_fDeferred; }72 void setDeferred(VBOXHGCMCALLHANDLE hHandle, uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);73 void setSvcContext(const HGCM::VBOXHGCMSVCTX &SvcCtx) { m_SvcCtx = SvcCtx; }74 75 protected:76 77 /** The HGCM service context this client is bound to. */78 HGCM::VBOXHGCMSVCTX m_SvcCtx;79 /** Flag indicating whether this client currently is deferred mode,80 * meaning that it did not return to the caller yet. */81 bool m_fDeferred;82 67 }; 83 68 … … 137 122 138 123 /** 139 * Completes the call by returning the control back to the guest140 * side code.141 */142 void DragAndDropClient::complete(VBOXHGCMCALLHANDLE hHandle, int rcOp)143 {144 LogFlowThisFunc(("uClientID=%RU32\n", m_uClientId));145 146 if ( m_SvcCtx.pHelpers147 && m_SvcCtx.pHelpers->pfnCallComplete)148 {149 m_SvcCtx.pHelpers->pfnCallComplete(hHandle, rcOp);150 }151 }152 153 /**154 * Completes a deferred call by returning the control back to the guest155 * side code.156 */157 void DragAndDropClient::completeDeferred(int rcOp)158 {159 AssertMsg(m_fDeferred, ("Client %RU32 is not in deferred mode\n", m_uClientId));160 Assert(m_hHandle != NULL);161 162 LogFlowThisFunc(("uClientID=%RU32\n", m_uClientId));163 164 complete(m_hHandle, rcOp);165 m_fDeferred = false;166 }167 168 /**169 124 * Called when the HGCM client disconnected on the guest side. 170 125 * This function takes care of the client's data cleanup and also lets the host … … 174 129 void DragAndDropClient::disconnect(void) 175 130 { 176 LogFlowThisFunc(("uClient=%RU32\n", m_uClientI d));177 178 if ( isDeferred())179 completeDeferred(VERR_INTERRUPTED);131 LogFlowThisFunc(("uClient=%RU32\n", m_uClientID)); 132 133 if (IsDeferred()) 134 CompleteDeferred(VERR_INTERRUPTED); 180 135 181 136 /* … … 191 146 int rc2 = m_SvcCtx.pfnHostCallback(m_SvcCtx.pvHostData, GUEST_DND_DISCONNECT, &data, sizeof(data)); 192 147 if (RT_FAILURE(rc2)) 193 LogFlowFunc(("Warning: Unable to notify host about client %RU32 disconnect, rc=%Rrc\n", m_uClientI d, rc2));148 LogFlowFunc(("Warning: Unable to notify host about client %RU32 disconnect, rc=%Rrc\n", m_uClientID, rc2)); 194 149 /* Not fatal. */ 195 150 } 196 151 } 197 198 /**199 * Set the client's status to deferred, meaning that it does not return to the caller200 * on the guest side yet.201 */202 void DragAndDropClient::setDeferred(VBOXHGCMCALLHANDLE hHandle, uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[])203 {204 LogFlowThisFunc(("uClient=%RU32\n", m_uClientId));205 206 AssertMsg(m_fDeferred == false, ("Client already in deferred mode\n"));207 m_fDeferred = true;208 209 m_hHandle = hHandle;210 m_uMsg = u32Function;211 m_cParms = cParms;212 m_paParms = paParms;213 }214 215 152 216 153 /********************************************************************************************************************************* … … 288 225 { 289 226 DragAndDropClient *pClient = new DragAndDropClient(u32ClientID); 290 pClient-> setSvcContext(m_SvcCtx);227 pClient->SetSvcContext(m_SvcCtx); 291 228 m_clientMap[u32ClientID] = pClient; 292 229 } … … 553 490 rc = paParms[idxProto + 1].getUInt32(&data.uFlags); 554 491 if (RT_SUCCESS(rc)) 555 rc =pClient->SetProtocolVer(data.uProtocol);492 pClient->SetProtocolVer(data.uProtocol); 556 493 if (RT_SUCCESS(rc)) 557 494 { … … 1088 1025 { 1089 1026 AssertPtr(pClient); 1090 pClient-> setDeferred(callHandle, u32Function, cParms, paParms);1027 pClient->SetDeferred(callHandle, u32Function, cParms, paParms); 1091 1028 m_clientQueue.push_back(u32ClientID); 1092 1029 } … … 1098 1035 } 1099 1036 else if (pClient) 1100 pClient-> complete(callHandle, rc);1037 pClient->Complete(callHandle, rc); 1101 1038 else 1102 1039 { … … 1163 1100 AssertPtr(pClient); 1164 1101 1165 int rc2 = pClient-> addMessageInfo(HOST_DND_HG_EVT_CANCEL,1166 /* Protocol v3+ also contains the context ID. */1167 pClient->GetProtocolVer() >= 3 ? 1 : 0);1168 pClient-> completeDeferred(rc2);1102 int rc2 = pClient->SetDeferredMsgInfo(HOST_DND_HG_EVT_CANCEL, 1103 /* Protocol v3+ also contains the context ID. */ 1104 pClient->GetProtocolVer() >= 3 ? 1 : 0); 1105 pClient->CompleteDeferred(rc2); 1169 1106 1170 1107 m_clientQueue.erase(itQueue); … … 1246 1183 if (uMsgClient == GUEST_DND_GET_NEXT_HOST_MSG) 1247 1184 { 1248 rc = pClient-> addMessageInfo(uMsgNext, cParmsNext);1185 rc = pClient->SetDeferredMsgInfo(uMsgNext, cParmsNext); 1249 1186 1250 1187 /* Note: Report the current rc back to the guest. */ 1251 pClient-> completeDeferred(rc);1188 pClient->CompleteDeferred(rc); 1252 1189 } 1253 1190 /* … … 1260 1197 1261 1198 /* Note: Report the current rc back to the guest. */ 1262 pClient-> completeDeferred(rc);1199 pClient->CompleteDeferred(rc); 1263 1200 } 1264 1201 else /* Should not happen; cancel the operation on the guest. */ … … 1267 1204 pClient->GetClientID(), uMsgClient, uMsgNext)); 1268 1205 1269 pClient-> completeDeferred(VERR_CANCELLED);1206 pClient->CompleteDeferred(VERR_CANCELLED); 1270 1207 } 1271 1208
Note:
See TracChangeset
for help on using the changeset viewer.