Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Unified Diff: net/base/prioritized_dispatcher.h

Issue 22909037: [net/dns] Reland of 218616 (Simultaneous A/AAAA queries). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix printing unsigned Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/net/dns_probe_test_util.cc ('k') | net/base/prioritized_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/prioritized_dispatcher.h
===================================================================
--- net/base/prioritized_dispatcher.h (revision 219192)
+++ net/base/prioritized_dispatcher.h (working copy)
@@ -78,6 +78,10 @@
// it is queued in the dispatcher.
Handle Add(Job* job, Priority priority);
+ // Just like Add, except that it adds Job at the font of queue of jobs with
+ // priorities of |priority|.
+ Handle AddAtHead(Job* job, Priority priority);
+
// Removes the job with |handle| from the queue. Invalidates |handle|.
// Note: a Handle is valid iff the job is in the queue, i.e. has not Started.
void Cancel(const Handle& handle);
@@ -94,12 +98,29 @@
// Notifies the dispatcher that a running job has finished. Could start a job.
void OnJobFinished();
+ // Retrieves the Limits that |this| is currently using. This may not exactly
+ // match the Limits this was created with. In particular, the number of slots
+ // reserved for the lowest priority will always be 0, even if it was non-zero
+ // in the Limits passed to the constructor or to SetLimits.
+ Limits GetLimits() const;
+
+ // Updates |max_running_jobs_| to match |limits|. Starts jobs if new limit
+ // allows. Does not stop jobs if the new limits are lower than the old ones.
+ void SetLimits(const Limits& limits);
+
+ // Set the limits to zero for all priorities, allowing no new jobs to start.
+ void SetLimitsToZero();
+
private:
// Attempts to dispatch the job with |handle| at priority |priority| (might be
// different than |handle.priority()|. Returns true if successful. If so
// the |handle| becomes invalid.
bool MaybeDispatchJob(const Handle& handle, Priority priority);
+ // Attempts to dispatch the next highest priority job in the queue. Returns
+ // true if successful, and all handles to that job become invalid.
+ bool MaybeDispatchNextJob();
+
// Queue for jobs that need to wait for a spare slot.
PriorityQueue<Job*> queue_;
// Maximum total number of running jobs allowed after a job at a particular
« no previous file with comments | « chrome/browser/net/dns_probe_test_util.cc ('k') | net/base/prioritized_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698