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

Side by Side Diff: third_party/libaddressinput/chromium/chrome_address_validator.cc

Issue 2107163003: Remove calls to deprecated MessageLoop methods in third_party. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 "third_party/libaddressinput/chromium/chrome_address_validator.h" 5 #include "third_party/libaddressinput/chromium/chrome_address_validator.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/single_thread_task_runner.h"
13 #include "third_party/libaddressinput/chromium/addressinput_util.h" 14 #include "third_party/libaddressinput/chromium/addressinput_util.h"
14 #include "third_party/libaddressinput/chromium/input_suggester.h" 15 #include "third_party/libaddressinput/chromium/input_suggester.h"
15 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_da ta.h" 16 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_da ta.h"
16 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_no rmalizer.h" 17 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_no rmalizer.h"
17 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/source.h" 18 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/source.h"
18 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/storage.h" 19 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/storage.h"
19 20
20 namespace autofill { 21 namespace autofill {
21 namespace { 22 namespace {
22 23
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 void AddressValidator::RulesLoaded(bool success, 141 void AddressValidator::RulesLoaded(bool success,
141 const std::string& region_code, 142 const std::string& region_code,
142 int) { 143 int) {
143 if (load_rules_listener_) 144 if (load_rules_listener_)
144 load_rules_listener_->OnAddressValidationRulesLoaded(region_code, success); 145 load_rules_listener_->OnAddressValidationRulesLoaded(region_code, success);
145 146
146 // Count the first failed attempt to load rules as well. 147 // Count the first failed attempt to load rules as well.
147 if (success || attempts_number_[region_code] + 1 >= kMaxAttemptsNumber) 148 if (success || attempts_number_[region_code] + 1 >= kMaxAttemptsNumber)
148 return; 149 return;
149 150
150 base::MessageLoop::current()->PostDelayedTask( 151 base::MessageLoop::current()->task_runner()->PostDelayedTask(
151 FROM_HERE, 152 FROM_HERE, base::Bind(&AddressValidator::RetryLoadRules,
152 base::Bind(&AddressValidator::RetryLoadRules, 153 weak_factory_.GetWeakPtr(), region_code),
153 weak_factory_.GetWeakPtr(),
154 region_code),
155 GetBaseRetryPeriod() * pow(2, attempts_number_[region_code]++)); 154 GetBaseRetryPeriod() * pow(2, attempts_number_[region_code]++));
156 } 155 }
157 156
158 void AddressValidator::RetryLoadRules(const std::string& region_code) { 157 void AddressValidator::RetryLoadRules(const std::string& region_code) {
159 // Do not reset retry count. 158 // Do not reset retry count.
160 supplier_->LoadRules(region_code, *rules_loaded_); 159 supplier_->LoadRules(region_code, *rules_loaded_);
161 } 160 }
162 161
163 } // namespace autofill 162 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698