| 26 | } |
| 27 | |
| 28 | void CommandBuffer::ForEachCommand(std::function<bool (std::shared_ptr<XCommand>)> func) |
| 29 | { |
| 30 | std::lock_guard<std::mutex> lock(mtx_); |
| 31 | if (last_dequeued_cmd_ != nullptr && last_dequeued_cmd_->GetState() < kCommandStateCompleted) { |
| 32 | func(last_dequeued_cmd_); |
| 33 | } |
| 34 | for (auto xcmd : cmds_) { |
| 35 | if (!func(xcmd)) break; |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | std::shared_ptr<XCommand> CommandBuffer::Dequeue() |
| 40 | { |