当前位置: 首页>>代码示例>>C++>>正文


C++ TSharedPtr::CancelRequest方法代码示例

本文整理汇总了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;
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:58,代码来源:BuildPatchHTTP.cpp


注:本文中的TSharedPtr::CancelRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。