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

Unified Diff: chrome/browser/safe_browsing/client_side_model_loader.cc

Issue 2665653002: Make ModelLoader to release URLFeatcher once fetching is done. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/client_side_model_loader.cc
diff --git a/chrome/browser/safe_browsing/client_side_model_loader.cc b/chrome/browser/safe_browsing/client_side_model_loader.cc
index 5519b4108b0cdf907a65ff6815bc52de9dc30a40..9be0e957eed2b1af11825631ed3459471c292646 100644
--- a/chrome/browser/safe_browsing/client_side_model_loader.cc
+++ b/chrome/browser/safe_browsing/client_side_model_loader.cc
@@ -189,14 +189,19 @@ void ModelLoader::EndFetch(ClientModelStatus status, base::TimeDelta max_age) {
delay_ms = max_age.InMilliseconds();
}
+ // Reset |fetcher_| as long as it will be re-created on next fetch.
mattm 2017/01/30 20:23:13 Wording is a little confusing, I'd remove the "as
maksims (do not use this acc) 2017/01/31 05:50:28 Done.
+ fetcher_.reset();
+
// Schedule the next model reload.
ScheduleFetch(delay_ms);
}
void ModelLoader::ScheduleFetch(int64_t delay_ms) {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- safe_browsing::switches::kSbDisableAutoUpdate))
+ safe_browsing::switches::kSbDisableAutoUpdate)) {
+ CancelFetcher();
mattm 2017/01/30 20:23:13 This seems unnecessary, can you explain when this
maksims (do not use this acc) 2017/01/31 05:50:28 I thought it would be necessary if fetch had been
return;
+ }
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
base::Bind(&ModelLoader::StartFetch, weak_factory_.GetWeakPtr()),
@@ -207,7 +212,8 @@ void ModelLoader::CancelFetcher() {
// Invalidate any scheduled request.
weak_factory_.InvalidateWeakPtrs();
// Cancel any request in progress.
- fetcher_.reset();
+ if (fetcher_)
mattm 2017/01/30 20:23:13 unnecessary
maksims (do not use this acc) 2017/01/31 05:50:28 Done.
+ fetcher_.reset();
}
} // namespace safe_browsing
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698