Changeset 63186 in vbox for trunk/src/VBox
- Timestamp:
- Aug 8, 2016 5:39:16 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 109805
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestProcessImpl.h
r63153 r63186 26 26 class Console; 27 27 class GuestSession; 28 class GuestProcessStartTask; 28 29 29 30 /** … … 86 87 int i_prepareExecuteEnv(const char *pszEnv, void **ppvList, ULONG *pcbList, ULONG *pcEnvVars); 87 88 int i_setProcessStatus(ProcessStatus_T procStatus, int procRc); 88 static DECLCALLBACK(int) i_startProcessThread(RTTHREAD Thread, void *pvUser);89 static void i_startProcessThreadTask(GuestProcessStartTask *pTask); 89 90 /** @} */ 90 91 -
trunk/src/VBox/Main/include/GuestSessionImpl.h
r62485 r63186 32 32 33 33 class Guest; 34 class GuestSessionTaskInternalOpen; 34 35 35 36 /** … … 48 49 49 50 virtual int Run(void) = 0; 50 virtual int RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress) = 0; 51 void handler() 52 { 53 int vrc = Run(); 54 NOREF(vrc); 55 /** @todo 56 * 57 * r=bird: what was your idea WRT to Run status code and async tasks? 58 * 59 */ 60 } 61 62 int RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress); 51 63 52 64 HRESULT Init(const Utf8Str &strTaskDesc) … … 92 104 uint32_t uFlags, 93 105 uint32_t uTimeoutMS); 94 95 106 virtual ~SessionTaskOpen(void); 96 97 public: 98 99 int Run(int *pGuestRc); 100 int RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress); 101 static DECLCALLBACK(int) taskThread(RTTHREAD Thread, void *pvUser); 102 void handler() 103 { 104 int vrc = SessionTaskOpen::taskThread(NULL, this); 105 } 107 int Run(void); 106 108 107 109 protected: … … 122 124 SessionTaskCopyTo(GuestSession *pSession, 123 125 const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags); 124 125 126 SessionTaskCopyTo(GuestSession *pSession, 126 127 PRTFILE pSourceFile, size_t cbSourceOffset, uint64_t cbSourceSize, 127 128 const Utf8Str &strDest, uint32_t uFlags); 128 129 129 virtual ~SessionTaskCopyTo(void); 130 131 public:132 133 130 int Run(void); 134 int RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress);135 static DECLCALLBACK(int) taskThread(RTTHREAD Thread, void *pvUser);136 void handler()137 {138 int vrc = SessionTaskCopyTo::taskThread(NULL, this);139 }140 131 141 132 protected: … … 158 149 SessionTaskCopyFrom(GuestSession *pSession, 159 150 const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags); 160 161 151 virtual ~SessionTaskCopyFrom(void); 162 163 public:164 165 152 int Run(void); 166 int RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress);167 static DECLCALLBACK(int) taskThread(RTTHREAD Thread, void *pvUser);168 void handler()169 {170 int vrc = SessionTaskCopyFrom::taskThread(NULL, this);171 }172 153 173 154 protected: … … 188 169 const Utf8Str &strSource, const ProcessArguments &aArguments, 189 170 uint32_t uFlags); 190 191 171 virtual ~SessionTaskUpdateAdditions(void); 192 193 public:194 195 172 int Run(void); 196 int RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress);197 static DECLCALLBACK(int) taskThread(RTTHREAD Thread, void *pvUser);198 void handler()199 {200 int vrc = SessionTaskUpdateAdditions::taskThread(NULL, this);201 }202 173 203 174 protected: … … 484 455 int i_startSessionInternal(int *pGuestRc); 485 456 int i_startSessionAsync(void); 486 static DECLCALLBACK(int) 487 i_startSessionThread(RTTHREAD Thread, void *pvUser); 457 static void i_startSessionThreadTask(GuestSessionTaskInternalOpen *pTask); 488 458 Guest *i_getParent(void) { return mParent; } 489 459 uint32_t i_getProtocolVersion(void) { return mData.mProtocolVersion; } -
trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
r63178 r63186 93 93 void handler() 94 94 { 95 int vrc = GuestProcess::i_startProcessThread(NULL,this);95 GuestProcess::i_startProcessThreadTask(this); 96 96 } 97 97 }; … … 1189 1189 1190 1190 /* static */ 1191 DECLCALLBACK(int) GuestProcess::i_startProcessThread(RTTHREAD Thread, void *pvUser) 1192 { 1193 LogFlowFunc(("pvUser=%p\n", pvUser)); 1194 1195 GuestProcessStartTask* pTask = static_cast<GuestProcessStartTask*>(pvUser); 1191 void GuestProcess::i_startProcessThreadTask(GuestProcessStartTask *pTask) 1192 { 1193 LogFlowFunc(("pTask=%p\n", pTask)); 1196 1194 1197 1195 const ComObjPtr<GuestProcess> pProcess(pTask->i_process()); … … 1199 1197 1200 1198 AutoCaller autoCaller(pProcess); 1201 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1199 if (FAILED(autoCaller.rc())) 1200 return; 1202 1201 1203 1202 int vrc = pProcess->i_startProcess(30 * 1000 /* 30s timeout */, 1204 1203 NULL /* Guest rc, ignored */); 1204 /** @todo 1205 * 1206 * r=bird: what's up with vrc here? Safe to ignore it? 1207 * 1208 */ 1209 1205 1210 /* Nothing to do here anymore. */ 1206 1211 1207 LogFlowFunc(("pProcess=%p returning rc=%Rrc\n", (GuestProcess *)pProcess, vrc));1208 return vrc;1212 LogFlowFunc(("pProcess=%p vrc=%Rrc (ignored)\n", (GuestProcess *)pProcess, vrc)); 1213 NOREF(vrc); 1209 1214 } 1210 1215 -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r63182 r63186 92 92 void handler() 93 93 { 94 int vrc = GuestSession::i_startSessionThread(NULL,this);94 GuestSession::i_startSessionThreadTask(this); 95 95 } 96 96 }; … … 1767 1767 1768 1768 /* static */ 1769 DECLCALLBACK(int) GuestSession::i_startSessionThread(RTTHREAD Thread, void *pvUser) 1770 { 1771 LogFlowFunc(("pvUser=%p\n", pvUser)); 1772 1773 1774 GuestSessionTaskInternalOpen* pTask = static_cast<GuestSessionTaskInternalOpen*>(pvUser); 1769 void GuestSession::i_startSessionThreadTask(GuestSessionTaskInternalOpen *pTask) 1770 { 1771 LogFlowFunc(("pTask=%p\n", pTask)); 1775 1772 AssertPtr(pTask); 1776 1773 … … 1779 1776 1780 1777 AutoCaller autoCaller(pSession); 1781 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1778 if (FAILED(autoCaller.rc())) 1779 return; 1782 1780 1783 1781 int vrc = pSession->i_startSessionInternal(NULL /* Guest rc, ignored */); 1782 /** @todo 1783 * 1784 * r=bird: Is it okay to ignore @a vrc here? 1785 * 1786 */ 1787 1784 1788 /* Nothing to do here anymore. */ 1785 1789 1786 1790 LogFlowFuncLeaveRC(vrc); 1787 return vrc;1791 NOREF(vrc); 1788 1792 } 1789 1793 -
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r63182 r63186 67 67 ///////////////////////////////////////////////////////////////////////////// 68 68 69 GuestSessionTask::GuestSessionTask(GuestSession *pSession):ThreadTask("GenericGuestSessionTask") 69 GuestSessionTask::GuestSessionTask(GuestSession *pSession) 70 : ThreadTask("GenericGuestSessionTask") 70 71 { 71 72 mSession = pSession; … … 99 100 return hr; 100 101 } 102 103 int GuestSessionTask::RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress) 104 { 105 LogFlowThisFunc(("strDesc=%s\n", strDesc.c_str())); 106 107 mDesc = strDesc; 108 mProgress = pProgress; 109 HRESULT hrc = createThreadWithType(RTTHREADTYPE_MAIN_HEAVY_WORKER); 110 111 LogFlowThisFunc(("Returning hrc=%Rhrc\n", hrc)); 112 return Global::vboxStatusCodeToCOM(hrc); 113 } 114 101 115 102 116 int GuestSessionTask::getGuestProperty(const ComObjPtr<Guest> &pGuest, … … 203 217 } 204 218 205 int SessionTaskOpen::Run( int *pGuestRc)219 int SessionTaskOpen::Run(void) 206 220 { 207 221 LogFlowThisFuncEnter(); … … 213 227 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 214 228 215 int vrc = pSession->i_startSessionInternal( pGuestRc);229 int vrc = pSession->i_startSessionInternal(NULL /*pvrcGuest*/); 216 230 /* Nothing to do here anymore. */ 217 231 218 232 LogFlowFuncLeaveRC(vrc); 219 233 return vrc; 220 }221 222 int SessionTaskOpen::RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress)223 {224 LogFlowThisFunc(("strDesc=%s\n", strDesc.c_str()));225 226 mDesc = strDesc;227 mProgress = pProgress;228 229 int rc = RTThreadCreate(NULL, SessionTaskOpen::taskThread, this,230 0, RTTHREADTYPE_MAIN_HEAVY_WORKER, 0,231 "gctlSesOpen");232 LogFlowFuncLeaveRC(rc);233 return rc;234 }235 236 /* static */237 DECLCALLBACK(int) SessionTaskOpen::taskThread(RTTHREAD Thread, void *pvUser)238 {239 SessionTaskOpen* task = static_cast<SessionTaskOpen*>(pvUser);240 AssertReturn(task, VERR_GENERAL_FAILURE);241 242 LogFlowFunc(("pTask=%p\n", task));243 244 return task->Run(NULL /* guestRc */);245 234 } 246 235 … … 615 604 LogFlowFuncLeaveRC(rc); 616 605 return rc; 617 }618 619 int SessionTaskCopyTo::RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress)620 {621 LogFlowThisFunc(("strDesc=%s, strSource=%s, strDest=%s, mCopyFileFlags=%x\n",622 strDesc.c_str(), mSource.c_str(), mDest.c_str(), mCopyFileFlags));623 624 mDesc = strDesc;625 mProgress = pProgress;626 627 int rc = RTThreadCreate(NULL, SessionTaskCopyTo::taskThread, this,628 0, RTTHREADTYPE_MAIN_HEAVY_WORKER, 0,629 "gctlCpyTo");630 LogFlowFuncLeaveRC(rc);631 return rc;632 }633 634 /* static */635 DECLCALLBACK(int) SessionTaskCopyTo::taskThread(RTTHREAD Thread, void *pvUser)636 {637 SessionTaskCopyTo* task = static_cast<SessionTaskCopyTo*>(pvUser);638 AssertReturn(task, VERR_GENERAL_FAILURE);639 640 LogFlowFunc(("pTask=%p\n", task));641 642 return task->Run();643 606 } 644 607 … … 920 883 LogFlowFuncLeaveRC(rc); 921 884 return rc; 922 }923 924 int SessionTaskCopyFrom::RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress)925 {926 LogFlowThisFunc(("strDesc=%s, strSource=%s, strDest=%s, uFlags=%x\n",927 strDesc.c_str(), mSource.c_str(), mDest.c_str(), mFlags));928 929 mDesc = strDesc;930 mProgress = pProgress;931 932 int rc = RTThreadCreate(NULL, SessionTaskCopyFrom::taskThread, this,933 0, RTTHREADTYPE_MAIN_HEAVY_WORKER, 0,934 "gctlCpyFrom");935 LogFlowFuncLeaveRC(rc);936 return rc;937 }938 939 /* static */940 DECLCALLBACK(int) SessionTaskCopyFrom::taskThread(RTTHREAD Thread, void *pvUser)941 {942 SessionTaskCopyFrom* task = static_cast<SessionTaskCopyFrom*>(pvUser);943 AssertReturn(task, VERR_GENERAL_FAILURE);944 945 LogFlowFunc(("pTask=%p\n", task));946 947 return task->Run();948 885 } 949 886 … … 1659 1596 } 1660 1597 1661 int SessionTaskUpdateAdditions::RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress)1662 {1663 LogFlowThisFunc(("strDesc=%s, strSource=%s, uFlags=%x\n",1664 strDesc.c_str(), mSource.c_str(), mFlags));1665 1666 mDesc = strDesc;1667 mProgress = pProgress;1668 1669 int rc = RTThreadCreate(NULL, SessionTaskUpdateAdditions::taskThread, this,1670 0, RTTHREADTYPE_MAIN_HEAVY_WORKER, 0,1671 "gctlUpGA");1672 LogFlowFuncLeaveRC(rc);1673 return rc;1674 }1675 1676 /* static */1677 DECLCALLBACK(int) SessionTaskUpdateAdditions::taskThread(RTTHREAD Thread, void *pvUser)1678 {1679 SessionTaskUpdateAdditions* task = static_cast<SessionTaskUpdateAdditions*>(pvUser);1680 AssertReturn(task, VERR_GENERAL_FAILURE);1681 1682 LogFlowFunc(("pTask=%p\n", task));1683 1684 return task->Run();1685 }1686
Note:
See TracChangeset
for help on using the changeset viewer.