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

Unified Diff: components/network_time/network_time_tracker.cc

Issue 2376693002: Remove call to MessageLoop::QuitWhenIdle() in network_time_tracker.cc. (Closed)
Patch Set: self-review Created 4 years, 3 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 | « components/network_time/network_time_tracker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/network_time/network_time_tracker.cc
diff --git a/components/network_time/network_time_tracker.cc b/components/network_time/network_time_tracker.cc
index a9f9f82c89a7837939f59d6c977295bad32edfac..e299fb2672cf0f6affcbca51bf99eefa2779e168 100644
--- a/components/network_time/network_time_tracker.cc
+++ b/components/network_time/network_time_tracker.cc
@@ -12,7 +12,6 @@
#include "base/i18n/time_formatting.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
-#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h"
#include "base/rand_util.h"
@@ -189,7 +188,6 @@ NetworkTimeTracker::NetworkTimeTracker(
max_response_size_(1024),
backoff_(base::TimeDelta::FromMinutes(kBackoffMinutes)),
getter_(std::move(getter)),
- loop_(nullptr),
clock_(std::move(clock)),
tick_clock_(std::move(tick_clock)),
pref_service_(pref_service) {
@@ -292,13 +290,15 @@ void NetworkTimeTracker::SetPublicKeyForTesting(const base::StringPiece& key) {
bool NetworkTimeTracker::QueryTimeServiceForTesting() {
CheckTime();
- loop_ = base::MessageLoop::current(); // Gets Quit on completion.
return time_fetcher_ != nullptr;
}
void NetworkTimeTracker::WaitForFetchForTesting(uint32_t nonce) {
query_signer_->OverrideNonceForTesting(kKeyVersion, nonce);
- base::RunLoop().Run();
+ base::RunLoop run_loop;
+ run_loop_for_testing_ = &run_loop;
+ run_loop.Run();
+ run_loop_for_testing_ = nullptr;
}
base::TimeDelta NetworkTimeTracker::GetTimerDelayForTesting() const {
@@ -472,10 +472,8 @@ void NetworkTimeTracker::OnURLFetchComplete(const net::URLFetcher* source) {
}
QueueCheckTime(backoff_);
time_fetcher_.reset();
- if (loop_ != nullptr) {
- loop_->QuitWhenIdle();
- loop_ = nullptr;
- }
+ if (run_loop_for_testing_ != nullptr)
+ run_loop_for_testing_->QuitWhenIdle();
}
void NetworkTimeTracker::QueueCheckTime(base::TimeDelta delay) {
« no previous file with comments | « components/network_time/network_time_tracker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698