1.26.2.1
Gameface
cohtml::IAsyncResourceHandler Class Referenceabstract

Class that will handle all asynchronous resource requests. More...

Public Member Functions

virtual ~IAsyncResourceHandler ()
 
virtual void OnResourceRequest (const cohtml::IAsyncResourceRequest *request, cohtml::IAsyncResourceResponse *response)=0
 Called when Cohtml needs a resource. More...
 
virtual void OnResourceStreamRequest (const cohtml::IAsyncResourceRequest *request, cohtml::IAsyncResourceStreamResponse *response)=0
 Called when Cohtml needs a resource stream. More...
 
virtual void OnAbortResourceRequest (unsigned id)=0
 Called when a requested resource is not needed anymore. More...
 

Protected Member Functions

 IAsyncResourceHandler ()
 

Detailed Description

Class that will handle all asynchronous resource requests.

Constructor & Destructor Documentation

◆ IAsyncResourceHandler()

cohtml::IAsyncResourceHandler::IAsyncResourceHandler ( )
protected

◆ ~IAsyncResourceHandler()

virtual cohtml::IAsyncResourceHandler::~IAsyncResourceHandler ( )
virtual

Member Function Documentation

◆ OnAbortResourceRequest()

virtual void cohtml::IAsyncResourceHandler::OnAbortResourceRequest ( unsigned  id)
pure virtual

Called when a requested resource is not needed anymore.

Parameters
idthe id associated with the resource request
Note
This method will only be invoked when the requests are in synchronous mode which is achieved by setting SystemSettings::AsynchronousResourceRequestCalls option to false. Aborting resources in asynchronous mode is not possible due to timing issues between the callbacks of the resource handler. The client can still respond on any thread, but has to manage possible race conditions between the responses and the abort notifications. NB: The client is STILL REQUIRED to call Finish on the resource response object with the associated request.

◆ OnResourceRequest()

virtual void cohtml::IAsyncResourceHandler::OnResourceRequest ( const cohtml::IAsyncResourceRequest request,
cohtml::IAsyncResourceResponse response 
)
pure virtual

Called when Cohtml needs a resource.

Parameters
requestobject describing the resource requested
responseresponse object for result of loading the request
Note
Called on any thread by default or on the main thread when SystemSettings::AsynchronousResourceRequestCalls is set to false.

◆ OnResourceStreamRequest()

virtual void cohtml::IAsyncResourceHandler::OnResourceStreamRequest ( const cohtml::IAsyncResourceRequest request,
cohtml::IAsyncResourceStreamResponse response 
)
pure virtual

Called when Cohtml needs a resource stream.

Parameters
requestobject describing the resource requested
responseresponse object for result of loading the request
Note
Called on any thread by default or on the main thread when SystemSettings::AsynchronousResourceRequestCalls is set to false. NB: The ISyncStreamReader interface methods can still be called on any thread regardless of the SystemSettings::AsynchronousResourceRequestCalls option.