本文整理汇总了C++中TSharedPtr::CancelRequest方法的典型用法代码示例。如果您正苦于以下问题:C++ TSharedPtr::CancelRequest方法的具体用法?C++ TSharedPtr::CancelRequest怎么用?C++ TSharedPtr::CancelRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSharedPtr
的用法示例。
在下文中一共展示了TSharedPtr::CancelRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Tick
/* FBuildPatchHTTP implementation
*****************************************************************************/
bool FBuildPatchHTTP::Tick( float Delta )
{
// Process the http request and cancel queues
{
FScopeLock ScopeLock( &HttpRequestQueueCS );
if( FBuildPatchInstallError::HasFatalError() )
{
// Make sure all requests get canceled if we get fatal error
TArray< int32 > RequestKeys;
HttpRequestMap.GetKeys( RequestKeys );
CancelRequestQueue.Append( RequestKeys );
while( HttpRequestQueue.Num() > 0 )
{
FHttpRequestInfo HttpRequestInfo = HttpRequestQueue.Pop();
HttpRequestInfo.OnCompleteDelegate.ExecuteIfBound( NULL, NULL, false );
}
}
else
{
while( HttpRequestQueue.Num() > 0 )
{
FHttpRequestInfo HttpRequestInfo = HttpRequestQueue.Pop();
TSharedRef< IHttpRequest > HttpRequest = FHttpModule::Get().CreateRequest();
HttpRequest->OnProcessRequestComplete() = HttpRequestInfo.OnCompleteDelegate;
HttpRequest->OnRequestProgress() = HttpRequestInfo.OnProgressDelegate;
HttpRequest->SetURL( HttpRequestInfo.UrlRequest );
HttpRequest->ProcessRequest();
HttpRequestMap.Add( HttpRequestInfo.RequestID, HttpRequest );
}
}
while( CancelRequestQueue.Num() > 0 )
{
const int32 CancelID = CancelRequestQueue.Pop();
TWeakPtr< IHttpRequest > HttpRequest = HttpRequestMap.FindRef( CancelID );
HttpRequestMap.Remove( CancelID );
TSharedPtr< IHttpRequest > HttpRequestPinned = HttpRequest.Pin();
if( HttpRequestPinned.IsValid() )
{
HttpRequestPinned->CancelRequest();
}
}
}
// Process the Analytics Event queue
{
FScopeLock ScopeLock( &AnalyticsEventQueueCS );
while( AnalyticsEventQueue.Num() > 0 )
{
const FAnalyticsEventInfo& EventInfo = AnalyticsEventQueue[ AnalyticsEventQueue.Num() -1 ];
FBuildPatchAnalytics::RecordEvent( EventInfo.EventName, EventInfo.Attributes );
AnalyticsEventQueue.Pop();
}
}
return true;
}