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

Unified Diff: net/url_request/sdch_dictionary_fetcher.cc

Issue 864923002: In SdchDictionaryFetcher, don't set state when scheduling if loop is active. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Result of git cl format. 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 side-by-side diff with in-line comments
Download patch
Index: net/url_request/sdch_dictionary_fetcher.cc
diff --git a/net/url_request/sdch_dictionary_fetcher.cc b/net/url_request/sdch_dictionary_fetcher.cc
index 450a60822353be756024a88b720b36ddd3ecf05a..fada65255dd333ff7a3a126ef320f6e338b3f3bd 100644
--- a/net/url_request/sdch_dictionary_fetcher.cc
+++ b/net/url_request/sdch_dictionary_fetcher.cc
@@ -60,12 +60,16 @@ void SdchDictionaryFetcher::Schedule(const GURL& dictionary_url) {
attempted_load_.insert(dictionary_url);
fetch_queue_.push(dictionary_url);
- next_state_ = STATE_IDLE;
+ // If the loop is already processing, it'll pick up the above in the
+ // normal course of events. If it isn't processing, we kick it off.
+ if (next_state_ == STATE_NONE) {
mmenke 2015/01/21 21:33:57 I think an early return is cleaner here.
Randy Smith (Not in Mondays) 2015/01/22 19:04:39 Right you are. Done.
+ next_state_ = STATE_IDLE;
mmenke 2015/01/21 21:33:57 It's a bit tangential to this CL, but while we're
Randy Smith (Not in Mondays) 2015/01/22 19:04:39 Naming changes, while they touch a lot of lines, d
mmenke 2015/01/22 19:58:32 I'd go with: STATE_IDLE => STATE_SEND_REQUEST / D
mmenke 2015/01/24 17:01:24 And a quick followup about my reasoning: I think
Randy Smith (Not in Mondays) 2015/01/24 23:21:01 Yes, that makes sense to me (and was appealing to
- // There are no callbacks to user code from the dictionary fetcher,
- // and Schedule() is only called from user code, so this call to DoLoop()
- // does not require an |if (in_loop_) return;| guard.
- DoLoop(OK);
+ // There are no callbacks to user code from the dictionary fetcher,
+ // and Schedule() is only called from user code, so this call to DoLoop()
+ // does not require an |if (in_loop_) return;| guard.
+ DoLoop(OK);
+ }
}
void SdchDictionaryFetcher::Cancel() {

Powered by Google App Engine
This is Rietveld 408576698