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

Side by Side Diff: components/network_time/network_time_tracker.cc

Issue 2082333002: Remove calls to deprecated MessageLoop methods in components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "components/network_time/network_time_tracker.h" 5 #include "components/network_time/network_time_tracker.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/feature_list.h" 11 #include "base/feature_list.h"
12 #include "base/i18n/time_formatting.h" 12 #include "base/i18n/time_formatting.h"
13 #include "base/json/json_reader.h" 13 #include "base/json/json_reader.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/rand_util.h" 16 #include "base/rand_util.h"
17 #include "base/run_loop.h"
17 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
19 #include "base/time/tick_clock.h" 20 #include "base/time/tick_clock.h"
20 #include "build/build_config.h" 21 #include "build/build_config.h"
21 #include "components/client_update_protocol/ecdsa.h" 22 #include "components/client_update_protocol/ecdsa.h"
22 #include "components/network_time/network_time_pref_names.h" 23 #include "components/network_time/network_time_pref_names.h"
23 #include "components/prefs/pref_registry_simple.h" 24 #include "components/prefs/pref_registry_simple.h"
24 #include "components/prefs/pref_service.h" 25 #include "components/prefs/pref_service.h"
25 #include "components/variations/variations_associated_data.h" 26 #include "components/variations/variations_associated_data.h"
26 #include "net/base/load_flags.h" 27 #include "net/base/load_flags.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 } 285 }
285 286
286 bool NetworkTimeTracker::QueryTimeServiceForTesting() { 287 bool NetworkTimeTracker::QueryTimeServiceForTesting() {
287 CheckTime(); 288 CheckTime();
288 loop_ = base::MessageLoop::current(); // Gets Quit on completion. 289 loop_ = base::MessageLoop::current(); // Gets Quit on completion.
289 return time_fetcher_ != nullptr; 290 return time_fetcher_ != nullptr;
290 } 291 }
291 292
292 void NetworkTimeTracker::WaitForFetchForTesting(uint32_t nonce) { 293 void NetworkTimeTracker::WaitForFetchForTesting(uint32_t nonce) {
293 query_signer_->OverrideNonceForTesting(kKeyVersion, nonce); 294 query_signer_->OverrideNonceForTesting(kKeyVersion, nonce);
294 base::MessageLoop::current()->Run(); 295 base::RunLoop().Run();
295 } 296 }
296 297
297 base::TimeDelta NetworkTimeTracker::GetTimerDelayForTesting() const { 298 base::TimeDelta NetworkTimeTracker::GetTimerDelayForTesting() const {
298 DCHECK(timer_.IsRunning()); 299 DCHECK(timer_.IsRunning());
299 return timer_.GetCurrentDelay(); 300 return timer_.GetCurrentDelay();
300 } 301 }
301 302
302 bool NetworkTimeTracker::GetNetworkTime(base::Time* network_time, 303 bool NetworkTimeTracker::GetNetworkTime(base::Time* network_time,
303 base::TimeDelta* uncertainty) const { 304 base::TimeDelta* uncertainty) const {
304 DCHECK(thread_checker_.CalledOnValidThread()); 305 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 base::Time network_time; 456 base::Time network_time;
456 if (!GetNetworkTime(&network_time, nullptr)) { 457 if (!GetNetworkTime(&network_time, nullptr)) {
457 return true; 458 return true;
458 } 459 }
459 460
460 // Otherwise, make the decision at random. 461 // Otherwise, make the decision at random.
461 return base::RandDouble() < RandomQueryProbability(); 462 return base::RandDouble() < RandomQueryProbability();
462 } 463 }
463 464
464 } // namespace network_time 465 } // namespace network_time
OLDNEW
« no previous file with comments | « components/nacl/loader/nacl_listener.cc ('k') | components/omnibox/browser/autocomplete_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698