Texture share releases waiting for the worker that made the shares. More...
#include "donner/gpu/browser/BrowserShareReleaseQueue.h"
Classes | |
| struct | Release |
| A release to run on the owner. More... | |
Public Member Functions | |
| bool | post (const Release &release, const std::function< void()> ¬ify={}) |
Queues release for the owner, unless the queue is closed. | |
| std::vector< Release > | takeAll () |
| Takes every queued release, oldest first. Owner only. | |
| void | close () |
| Refuses every later post and drops what is still queued, because the owner is going. Owner only; waits for a post in progress to finish. | |
| bool | closed () const |
| Whether close has run. | |
Static Public Member Functions | |
| static std::shared_ptr< BrowserShareReleaseQueue > | ForThisThread () |
| The calling thread's queue, for a share made on this thread to post its release into from elsewhere. | |
| static void | DrainThisThread (const std::function< void(const Release &)> &run) |
Runs run for each release posted to the calling thread's queue, oldest first. | |
Texture share releases waiting for the worker that made the shares.
The last holder of a share may be let go on any thread, because an export token may be, but only the worker that made a share can tell its browser side to let the texture go. A holder let go on another thread posts its release here instead, and the owner runs what is posted the next time it drains the queue. A queue whose owner has gone is closed: a post is then refused and does nothing, and whatever was still waiting is dropped with the worker's browser state.
Any thread may post; only the owner drains or closes.
| struct donner::gpu::browser::BrowserShareReleaseQueue::Release |
A release to run on the owner.
| Class Members | ||
|---|---|---|
| uint32_t | producer = 0 | Logical device that made the share. |
| BrowserTextureShareId | share = 0 | Share to release. |
|
static |
Runs run for each release posted to the calling thread's queue, oldest first.
Does nothing once that queue has gone with its thread: it was closed then, and held nothing to run.
| run | Runs one release on this thread. |
|
static |
The calling thread's queue, for a share made on this thread to post its release into from elsewhere.
Made on the thread's first use and closed when the thread exits.
| bool donner::gpu::browser::BrowserShareReleaseQueue::post | ( | const Release & | release, |
| const std::function< void()> & | notify = {} ) |
Queues release for the owner, unless the queue is closed.
| release | Release to queue. |
| notify | Run, while the owner cannot close the queue, once the release is queued, so a caller can wake the owner knowing it has not gone; not run when the queue is closed. May be empty. |