27 FML_LOG(WARNING) <<
"Got multiple compile jobs for the same descriptor. "
39 Lock lock(pending_jobs_mutex_);
40 auto insertion_result = pending_jobs_.insert(std::make_pair(desc, job));
41 return insertion_result.second;
45 Lock lock(pending_jobs_mutex_);
46 return !pending_jobs_.empty();
50 Lock lock(pending_jobs_mutex_);
51 if (pending_jobs_.empty()) {
54 auto job_iterator = pending_jobs_.begin();
55 auto job = job_iterator->second;
56 pending_jobs_.erase(job_iterator);
60fml::closure PipelineCompileQueue::TakeJob(
const PipelineDescriptor& desc) {
61 Lock lock(pending_jobs_mutex_);
62 auto found = pending_jobs_.find(desc);
63 if (found == pending_jobs_.end()) {
72 priorities_elevated_++;
74 reinterpret_cast<int64_t
>(
this),
75 "PrioritiesElevated", priorities_elevated_);
76 auto job = found->second;
77 pending_jobs_.erase(found);
82 if (
auto job = TakeNextJob()) {
87void PipelineCompileQueue::FinishAllJobs() {
91 bool has_jobs =
false;
93 Lock lock(pending_jobs_mutex_);
94 has_jobs = !pending_jobs_.empty();
105 if (
auto job = TakeJob(desc)) {
virtual void PostJob(const fml::closure &job)=0
Post a compilation job to the worker task runner.
bool PostJobForDescriptor(const PipelineDescriptor &desc, const fml::closure &job)
Post a compile job for the specified descriptor.
bool AddJob(const PipelineDescriptor &desc, const fml::closure &job)
Add a compilation job to the pending queue for the specified descriptor.
void DoOneJob()
Execute one pending compilation job from the queue.
bool HasPendingJobs()
Check if there are any pending compilation jobs in the queue.
virtual void OnJobAdded()=0
Called by PostJobForDescriptor after a job has been successfully added to the queue....
virtual ~PipelineCompileQueue()
void PerformJobEagerly(const PipelineDescriptor &desc)
If the task has not yet been done, perform it eagerly on the calling thread. This can be used in lieu...
#define FML_LOG(severity)
std::function< void()> closure
#define FML_TRACE_COUNTER(category_group, name, counter_id, arg1,...)