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

Unified Diff: chrome/browser/chromeos/drive/job_queue.cc

Issue 1138883004: Revert of Revert of Drive: Let DriveUploader use batch request API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | chrome/browser/chromeos/drive/job_scheduler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/job_queue.cc
diff --git a/chrome/browser/chromeos/drive/job_queue.cc b/chrome/browser/chromeos/drive/job_queue.cc
index e1ea3174020f53f526ee12a43f6af13ffd9610eb..f6070b1dc91a83259bd32af164e91a76ff0f1d87 100644
--- a/chrome/browser/chromeos/drive/job_queue.cc
+++ b/chrome/browser/chromeos/drive/job_queue.cc
@@ -41,22 +41,18 @@
return;
// Looks up the queue in the order of priority upto |accepted_priority|.
- bool processing_batch_request = false;
- int64 total_size = 0;
+ uint64 total_size = 0;
+ bool batchable = true;
for (int priority = 0; priority <= accepted_priority; ++priority) {
- auto it = queue_[priority].begin();
- while (it != queue_[priority].end()) {
- if (!processing_batch_request ||
- (it->batchable && total_size + it->size <= max_batch_size_)) {
- total_size += it->size;
- processing_batch_request = it->batchable;
- jobs->push_back(it->id);
- running_.insert(it->id);
- it = queue_[priority].erase(it);
- if (processing_batch_request)
- continue;
- }
- return;
+ while (!queue_[priority].empty()) {
+ const auto& item = queue_[priority].front();
+ total_size += item.size;
+ batchable = batchable && item.batchable && total_size <= max_batch_size_;
+ if (!(jobs->empty() || batchable))
+ return;
+ jobs->push_back(item.id);
+ running_.insert(item.id);
+ queue_[priority].pop_front();
}
}
}
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/job_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698