cohtml::IAsyncResourceHandler

Class that will handle all asynchronous resource requests.

#include <ResourceHandler.h>

Public Functions

Name
virtual~IAsyncResourceHandler()
virtual voidOnResourceRequest(const cohtml::IAsyncResourceRequest * request, cohtml::IAsyncResourceResponse * response) =0
Called when Cohtml needs a resource.
virtual voidOnAbortResourceRequest(unsigned id) =0
Called when a requested resource is not needed anymore.

Protected Functions

Name
IAsyncResourceHandler()

Public Functions Documentation

function ~IAsyncResourceHandler

virtual ~IAsyncResourceHandler()

function OnResourceRequest

virtual void OnResourceRequest(
    const cohtml::IAsyncResourceRequest * request,
    cohtml::IAsyncResourceResponse * response
) =0

Called when Cohtml needs a resource.

Parameters:

  • request object describing the resource requested
  • response response object for result of loading the request

Note:

  • Can be called on any thread.
  • The OnResourceRequest call happens immediately when Cohtml requests a resource. No further Cohtml work will be executed on that thread until the call returns. To avoid blocking the current thread unnecessarily, the client can respond to the request on another thread and quickly return from the OnResourceRequest call. In that case, it is up to the client to manage possible race conditions between the responses and the abort notifications.

function OnAbortResourceRequest

virtual void OnAbortResourceRequest(
    unsigned id
) =0

Called when a requested resource is not needed anymore.

Parameters:

  • id the id associated with the resource request

Note:

Protected Functions Documentation

function IAsyncResourceHandler

IAsyncResourceHandler()