OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_CHROMEOS_DRIVE_JOB_QUEUE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_JOB_QUEUE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_JOB_QUEUE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_JOB_QUEUE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 28 matching lines...) Expand all Loading... |
39 // Marks a running job |id| as finished running. This decreases the count | 39 // Marks a running job |id| as finished running. This decreases the count |
40 // of running parallel jobs and makes room for other jobs to be popped. | 40 // of running parallel jobs and makes room for other jobs to be popped. |
41 void MarkFinished(JobID id); | 41 void MarkFinished(JobID id); |
42 | 42 |
43 // Generates a string representing the internal state for logging. | 43 // Generates a string representing the internal state for logging. |
44 std::string ToString() const; | 44 std::string ToString() const; |
45 | 45 |
46 // Gets the total number of jobs in the queue. | 46 // Gets the total number of jobs in the queue. |
47 size_t GetNumberOfJobs() const; | 47 size_t GetNumberOfJobs() const; |
48 | 48 |
| 49 // Removes the job from the queue. |
| 50 void Remove(JobID id); |
| 51 |
49 private: | 52 private: |
50 size_t num_max_concurrent_jobs_; | 53 size_t num_max_concurrent_jobs_; |
51 std::vector<std::deque<JobID> > queue_; | 54 std::vector<std::deque<JobID> > queue_; |
52 std::set<JobID> running_; | 55 std::set<JobID> running_; |
53 | 56 |
54 DISALLOW_COPY_AND_ASSIGN(JobQueue); | 57 DISALLOW_COPY_AND_ASSIGN(JobQueue); |
55 }; | 58 }; |
56 | 59 |
57 } // namespace drive | 60 } // namespace drive |
58 | 61 |
59 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_JOB_QUEUE_H_ | 62 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_JOB_QUEUE_H_ |
OLD | NEW |