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

Side by Side Diff: net/base/prioritized_dispatcher.h

Issue 19498003: [net/dns] Perform A/AAAA queries for AF_UNSPEC resolutions in parallel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Add at front, more unit tests Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_BASE_PRIORITIZED_DISPATCHER_H_ 5 #ifndef NET_BASE_PRIORITIZED_DISPATCHER_H_
6 #define NET_BASE_PRIORITIZED_DISPATCHER_H_ 6 #define NET_BASE_PRIORITIZED_DISPATCHER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "net/base/net_export.h" 10 #include "net/base/net_export.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 size_t num_running_jobs() const { return num_running_jobs_; } 71 size_t num_running_jobs() const { return num_running_jobs_; }
72 size_t num_queued_jobs() const { return queue_.size(); } 72 size_t num_queued_jobs() const { return queue_.size(); }
73 size_t num_priorities() const { return max_running_jobs_.size(); } 73 size_t num_priorities() const { return max_running_jobs_.size(); }
74 74
75 // Adds |job| with |priority| to the dispatcher. If limits permit, |job| is 75 // Adds |job| with |priority| to the dispatcher. If limits permit, |job| is
76 // started immediately. Returns handle to the job or null-handle if the job is 76 // started immediately. Returns handle to the job or null-handle if the job is
77 // started. The dispatcher does not own |job|, but |job| must live as long as 77 // started. The dispatcher does not own |job|, but |job| must live as long as
78 // it is queued in the dispatcher. 78 // it is queued in the dispatcher.
79 Handle Add(Job* job, Priority priority); 79 Handle Add(Job* job, Priority priority);
80 80
81 Handle AddAtHead(Job* job, Priority priority);
82
81 // Removes the job with |handle| from the queue. Invalidates |handle|. 83 // Removes the job with |handle| from the queue. Invalidates |handle|.
82 // Note: a Handle is valid iff the job is in the queue, i.e. has not Started. 84 // Note: a Handle is valid iff the job is in the queue, i.e. has not Started.
83 void Cancel(const Handle& handle); 85 void Cancel(const Handle& handle);
84 86
85 // Cancels and returns the oldest-lowest-priority Job invalidating any 87 // Cancels and returns the oldest-lowest-priority Job invalidating any
86 // handles to it. Returns NULL if the queue is empty. 88 // handles to it. Returns NULL if the queue is empty.
87 Job* EvictOldestLowest(); 89 Job* EvictOldestLowest();
88 90
89 // Moves the queued job with |handle| to the end of all values with priority 91 // Moves the queued job with |handle| to the end of all values with priority
90 // |priority| and returns the updated handle, or null-handle if it starts the 92 // |priority| and returns the updated handle, or null-handle if it starts the
(...skipping 17 matching lines...) Expand all
108 std::vector<size_t> max_running_jobs_; 110 std::vector<size_t> max_running_jobs_;
109 // Total number of running jobs. 111 // Total number of running jobs.
110 size_t num_running_jobs_; 112 size_t num_running_jobs_;
111 113
112 DISALLOW_COPY_AND_ASSIGN(PrioritizedDispatcher); 114 DISALLOW_COPY_AND_ASSIGN(PrioritizedDispatcher);
113 }; 115 };
114 116
115 } // namespace net 117 } // namespace net
116 118
117 #endif // NET_BASE_PRIORITIZED_DISPATCHER_H_ 119 #endif // NET_BASE_PRIORITIZED_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698