OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_FILE_SYSTEM_PROVIDER_QUEUE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_QUEUE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_QUEUE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_QUEUE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // such case, Abort() must not be called. | 56 // such case, Abort() must not be called. |
57 void Enqueue(size_t token, const AbortableCallback& callback); | 57 void Enqueue(size_t token, const AbortableCallback& callback); |
58 | 58 |
59 // Forcibly aborts a previously enqueued task. May be called at any time as | 59 // Forcibly aborts a previously enqueued task. May be called at any time as |
60 // long as the task is still in the queue and is not marked as completed. | 60 // long as the task is still in the queue and is not marked as completed. |
61 // Note, that Remove() must be called in order to remove the task from the | 61 // Note, that Remove() must be called in order to remove the task from the |
62 // queue. Must not be called if the task doesn't support aborting (it's | 62 // queue. Must not be called if the task doesn't support aborting (it's |
63 // abort callback is NULL). | 63 // abort callback is NULL). |
64 void Abort(size_t token); | 64 void Abort(size_t token); |
65 | 65 |
| 66 // Returns true if the task which is in the queue with |token| has been |
| 67 // aborted. This method must not be called for tasks which are not in the |
| 68 // queue. |
| 69 bool IsAborted(size_t token); |
| 70 |
66 // Marks the previously enqueued task as complete. Must be called for each | 71 // Marks the previously enqueued task as complete. Must be called for each |
67 // enqueued task (unless aborted). Note, that Remove() must be called in order | 72 // enqueued task (unless aborted). Note, that Remove() must be called in order |
68 // to remove the task from the queue if it hasn't been aborted earlier. | 73 // to remove the task from the queue if it hasn't been aborted earlier. |
69 // It must not be called more than one, nor for aborted tasks. | 74 // It must not be called more than one, nor for aborted tasks. |
70 void Complete(size_t token); | 75 void Complete(size_t token); |
71 | 76 |
72 // Removes the previously enqueued and completed or aborted task from the | 77 // Removes the previously enqueued and completed or aborted task from the |
73 // queue. Must not be called more than once. | 78 // queue. Must not be called more than once. |
74 void Remove(size_t token); | 79 void Remove(size_t token); |
75 | 80 |
(...skipping 21 matching lines...) Expand all Loading... |
97 std::map<int, Task> aborted_; | 102 std::map<int, Task> aborted_; |
98 | 103 |
99 base::WeakPtrFactory<Queue> weak_ptr_factory_; | 104 base::WeakPtrFactory<Queue> weak_ptr_factory_; |
100 DISALLOW_COPY_AND_ASSIGN(Queue); | 105 DISALLOW_COPY_AND_ASSIGN(Queue); |
101 }; | 106 }; |
102 | 107 |
103 } // namespace file_system_provider | 108 } // namespace file_system_provider |
104 } // namespace chromeos | 109 } // namespace chromeos |
105 | 110 |
106 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_QUEUE_H_ | 111 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_QUEUE_H_ |
OLD | NEW |