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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/queue.h

Issue 813403005: [fsp] Fix unhappy MSAN build bots. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/file_system_provider/queue.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // to remove the task from the queue if it hasn't been aborted earlier. 65 // to remove the task from the queue if it hasn't been aborted earlier.
66 // It must not be called more than one, nor for aborted tasks. 66 // It must not be called more than one, nor for aborted tasks.
67 void Complete(size_t token); 67 void Complete(size_t token);
68 68
69 // Removes the previously enqueued and completed task from the queue. Must not 69 // Removes the previously enqueued and completed task from the queue. Must not
70 // be called for aborted, or not completed tasks. Must not be called more than 70 // be called for aborted, or not completed tasks. Must not be called more than
71 // once. 71 // once.
72 void Remove(size_t token); 72 void Remove(size_t token);
73 73
74 private: 74 private:
75 struct Task; 75 // Information about an enqueued task which hasn't been removed, nor aborted.
76 struct Task {
77 Task();
78 Task(size_t token, const AbortableCallback& callback);
79 ~Task();
80
81 size_t token;
82 bool completed;
83 AbortableCallback callback;
84 AbortCallback abort_callback;
85 };
76 86
77 // Runs the next task from the pending queue if there is less than 87 // Runs the next task from the pending queue if there is less than
78 // |max_in_parallel_| tasks running at once. 88 // |max_in_parallel_| tasks running at once.
79 void MaybeRun(); 89 void MaybeRun();
80 90
81 // Aborts a previously enqueued task. Returns the result asynchronously via 91 // Aborts a previously enqueued task. Returns the result asynchronously via
82 // |callback|. May be called at any time, but if already completed then 92 // |callback|. May be called at any time, but if already completed then
83 // FILE_ERROR_INVALID_OPERATION error code will be returned. 93 // FILE_ERROR_INVALID_OPERATION error code will be returned.
84 void Abort(size_t token, 94 void Abort(size_t token,
85 const storage::AsyncFileUtil::StatusCallback& callback); 95 const storage::AsyncFileUtil::StatusCallback& callback);
86 96
87 const size_t max_in_parallel_; 97 const size_t max_in_parallel_;
88 size_t next_token_; 98 size_t next_token_;
89 std::deque<Task> pending_; 99 std::deque<Task> pending_;
90 std::map<int, Task> executed_; 100 std::map<int, Task> executed_;
91 101
92 base::WeakPtrFactory<Queue> weak_ptr_factory_; 102 base::WeakPtrFactory<Queue> weak_ptr_factory_;
93 DISALLOW_COPY_AND_ASSIGN(Queue); 103 DISALLOW_COPY_AND_ASSIGN(Queue);
94 }; 104 };
95 105
96 } // namespace file_system_provider 106 } // namespace file_system_provider
97 } // namespace chromeos 107 } // namespace chromeos
98 108
99 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_QUEUE_H_ 109 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_QUEUE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/file_system_provider/queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698