Lines Matching refs:job
180 // Parameters associated with the creation of a HostResolverImpl::Job.
277 void set_job(Job* job) {
278 DCHECK(job != NULL);
279 // Identify which job the request is waiting on.
280 job_ = job;
295 Job* job() const {
325 // The resolve job (running in worker pool) that this request is dependent on.
326 Job* job_;
346 class HostResolverImpl::Job
347 : public base::RefCountedThreadSafe<HostResolverImpl::Job> {
349 Job(int id,
370 // Attaches a request to this job. The job takes ownership of |req| and will
389 // Dispatch the job to a worker thread.
391 NewRunnableMethod(this, &Job::DoLookup), true)) {
399 FROM_HERE, NewRunnableMethod(this, &Job::OnLookupComplete));
403 // Cancels the current job. Callable from origin thread.
410 // Mark the job as cancelled, so when worker thread completes it will
417 // End here to prevent issues when a Job outlives the HostResolver that
454 // Returns the first request attached to the job.
461 // Returns true if |req_info| can be fulfilled by this job.
467 friend class base::RefCountedThreadSafe<HostResolverImpl::Job>;
469 ~Job() {
470 // Free the requests attached to this job.
493 NewRunnableMethod(this, &Job::OnLookupComplete));
524 // End here to prevent issues when a Job outlives the HostResolver that
608 RequestsList requests_; // The requests waiting on this job.
624 // True if a non-speculative request was ever attached to this job
632 // The time when the job was started.
637 DISALLOW_COPY_AND_ASSIGN(Job);
662 // Cancels the current job.
772 // A pending request is one waiting to be attached to a job.
847 // Keeps track of a job that was just added/removed, and belongs to this pool.
857 // Returns true if a new job can be created for this pool.
863 // same (hostname / effective address-family) as |job|, and attaches them to
864 // |job|.
865 void MoveRequestsToJob(Job* job) {
871 if (job->CanServiceRequest(req->info())) {
872 // Job takes ownership of |req|.
873 job->AddRequest(req);
893 // The maximum number of requests we allow to be waiting on a job,
947 // Delete the job pools.
1076 // Next we need to attach our request to a "job". This job is responsible for
1078 scoped_refptr<Job> job;
1080 // If there is already an outstanding job to resolve |key|, use
1082 job = FindOutstandingJob(key);
1083 if (job) {
1084 job->AddRequest(req);
1094 // Completion happens during OnJobComplete(Job*).
1098 // See OnJobComplete(Job*) for why it is important not to clean out
1099 // cancelled requests from Job::requests_.
1115 if (!req->job()) {
1116 // If the request was not attached to a job yet, it must have been
1118 // Otherwise if it was attached to a job, the job is responsible for
1175 void HostResolverImpl::AddOutstandingJob(Job* job) {
1176 scoped_refptr<Job>& found_job = jobs_[job->key()];
1178 found_job = job;
1180 JobPool* pool = GetPoolForRequest(job->initial_request());
1184 HostResolverImpl::Job* HostResolverImpl::FindOutstandingJob(const Key& key) {
1191 void HostResolverImpl::RemoveOutstandingJob(Job* job) {
1192 JobMap::iterator it = jobs_.find(job->key());
1194 DCHECK_EQ(it->second.get(), job);
1197 JobPool* pool = GetPoolForRequest(job->initial_request());
1201 void HostResolverImpl::OnJobComplete(Job* job,
1205 RemoveOutstandingJob(job);
1209 cache_->Set(job->key(), net_error, addrlist, base::TimeTicks::Now());
1211 OnJobCompleteInternal(job, net_error, os_error, addrlist);
1214 void HostResolverImpl::AbortJob(Job* job) {
1215 OnJobCompleteInternal(job, ERR_ABORTED, 0 /* no os_error */, AddressList());
1219 Job* job,
1226 cur_completing_job_ = job;
1228 // Try to start any queued requests now that a job-slot has freed up.
1231 // Complete all of the requests that were attached to the job.
1232 for (RequestsList::const_iterator it = job->requests().begin();
1233 it != job->requests().end(); ++it) {
1236 DCHECK_EQ(job, req->job());
1246 // Check if the job was cancelled as a result of running the callback.
1248 if (job->was_cancelled())
1340 // Drop reference since the job has called us back.
1347 // We can't create another job if it would exceed the global total.
1375 scoped_refptr<Job> job(CreateAndStartJob(top_req));
1377 // Search for any other pending request which can piggy-back off this job.
1380 pool->MoveRequestsToJob(job);
1398 HostResolverImpl::Job* HostResolverImpl::CreateAndStartJob(Request* req) {
1405 scoped_refptr<Job> job(new Job(next_job_id_++, this, key,
1407 job->AddRequest(req);
1408 AddOutstandingJob(job);
1409 job->Start();
1411 return job.get();