cohtml::IAsyncResourceResponse
Response that the application should use when the resource has been loaded You can keep a reference to this object as long as needed and call Finish afterwards.
#include <ResourceHandler.h>
Public Classes
Section titled “Public Classes”| Name | |
|---|---|
| struct | UserImageData Description of the properties of the user provided image. |
Public Types
Section titled “Public Types”| Name | |
|---|---|
| enum | Status { Success, Failure} |
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| virtual | ~IAsyncResourceResponse() |
| virtual void * | GetSpace(unsigned long long size) =0 Allocates more space where to put the data read. NB: You can call the function multiple times and it’ll allocate more space if needed. The space requested MUST be the SUM of all space required. Already copied data will be still available in the buffer - it works the same way as “realloc”. |
| virtual void | ReceiveUserImage(const UserImageData & userImageData) =0 Passes data about a user image that is ready to be used by the UI system. This lets Cohtml use textures that are already on the GPU and the void* is interpreted by the backend. |
| virtual void | ReceiveOptimizedData(const DataBuffer * optimizedData) =0 Passes optimized data that speeds up the resource processing. |
| virtual void | SignalProgress() =0 Can be called when part of the response is ready and can be used by the backend. Calling this is optional. Note that the pointer returned by GetSpace will not be valid anymore. The user will have to request some more memory for the fresh data after this call. |
| virtual void | SetStatus(unsigned short status) =0 Additional API used for complex responses like HTTP. Setting these fields is not required for local “coui” loads. |
| virtual void | SetResponseURL(const char * responseURL) =0 The URL of the response (can change from the request due to redirects) |
| virtual void | SetHeader(const char * name, const char * value) =0 Set a response header. |
| virtual void | SetStreamReader(ISyncStreamReader * reader) =0 Set the ISyncStreamReader instance for the requested resource. |
| virtual void | Finish(Status status) =0 Call when the resource has been loaded or the load failed. After this call the object is invalidated. NB: It’s not safe to call any methods on this interface after Finish. |
Protected Functions
Section titled “Protected Functions”| Name | |
|---|---|
| IAsyncResourceResponse() |
Public Types Documentation
Section titled “Public Types Documentation”enum Status
Section titled “enum Status”| Enumerator | Value | Description |
|---|---|---|
| Success | ||
| Failure |
Public Functions Documentation
Section titled “Public Functions Documentation”function ~IAsyncResourceResponse
Section titled “function ~IAsyncResourceResponse”virtual ~IAsyncResourceResponse()function GetSpace
Section titled “function GetSpace”virtual void * GetSpace( unsigned long long size) =0Allocates more space where to put the data read. NB: You can call the function multiple times and it’ll allocate more space if needed. The space requested MUST be the SUM of all space required. Already copied data will be still available in the buffer - it works the same way as “realloc”.
Note: The pointer returned will always point to the beginning of the data array. Users have to keep an offset counter themselves if they plan to call GetSpace() multiple times.
function ReceiveUserImage
Section titled “function ReceiveUserImage”virtual void ReceiveUserImage( const UserImageData & userImageData) =0Passes data about a user image that is ready to be used by the UI system. This lets Cohtml use textures that are already on the GPU and the void* is interpreted by the backend.
Parameters:
- userImageData information about the user image
function ReceiveOptimizedData
Section titled “function ReceiveOptimizedData”virtual void ReceiveOptimizedData( const DataBuffer * optimizedData) =0Passes optimized data that speeds up the resource processing.
Parameters:
- optimizedData is a data, produced by doing resource processing ahead of time and can be easily cached, serialized and deserialized.
Note: Currently, this can speed up the JavaScript compilation and run times, the optimizedData can be obtained using the cohtml::ScriptCompiler::Compile.
function SignalProgress
Section titled “function SignalProgress”virtual void SignalProgress() =0Can be called when part of the response is ready and can be used by the backend. Calling this is optional. Note that the pointer returned by GetSpace will not be valid anymore. The user will have to request some more memory for the fresh data after this call.
function SetStatus
Section titled “function SetStatus”virtual void SetStatus( unsigned short status) =0Additional API used for complex responses like HTTP. Setting these fields is not required for local “coui” loads.
function SetResponseURL
Section titled “function SetResponseURL”virtual void SetResponseURL( const char * responseURL) =0The URL of the response (can change from the request due to redirects)
function SetHeader
Section titled “function SetHeader”virtual void SetHeader( const char * name, const char * value) =0Set a response header.
function SetStreamReader
Section titled “function SetStreamReader”virtual void SetStreamReader( ISyncStreamReader * reader) =0Set the ISyncStreamReader instance for the requested resource.
function Finish
Section titled “function Finish”virtual void Finish( Status status) =0Call when the resource has been loaded or the load failed. After this call the object is invalidated. NB: It’s not safe to call any methods on this interface after Finish.
Protected Functions Documentation
Section titled “Protected Functions Documentation”function IAsyncResourceResponse
Section titled “function IAsyncResourceResponse”IAsyncResourceResponse()© 2026 Coherent Labs. All rights reserved.