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

Side by Side Diff: chrome/browser/local_discovery/service_discovery_client_impl.cc

Issue 2828663002: Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/{i,l,m,n,p,r}* (Closed)
Patch Set: Created 3 years, 8 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 <utility> 5 #include <utility>
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 if (it != services_.end()) 257 if (it != services_.end())
258 it->second->set_has_srv(true); 258 it->second->set_has_srv(true);
259 } 259 }
260 260
261 void ServiceWatcherImpl::DeferUpdate(ServiceWatcher::UpdateType update_type, 261 void ServiceWatcherImpl::DeferUpdate(ServiceWatcher::UpdateType update_type,
262 const std::string& service_name) { 262 const std::string& service_name) {
263 ServiceListenersMap::iterator it = services_.find(service_name); 263 ServiceListenersMap::iterator it = services_.find(service_name);
264 if (it != services_.end() && !it->second->update_pending()) { 264 if (it != services_.end() && !it->second->update_pending()) {
265 it->second->set_update_pending(true); 265 it->second->set_update_pending(true);
266 base::ThreadTaskRunnerHandle::Get()->PostTask( 266 base::ThreadTaskRunnerHandle::Get()->PostTask(
267 FROM_HERE, base::Bind(&ServiceWatcherImpl::DeliverDeferredUpdate, 267 FROM_HERE, base::BindOnce(&ServiceWatcherImpl::DeliverDeferredUpdate,
268 AsWeakPtr(), update_type, service_name)); 268 AsWeakPtr(), update_type, service_name));
269 } 269 }
270 } 270 }
271 271
272 void ServiceWatcherImpl::DeliverDeferredUpdate( 272 void ServiceWatcherImpl::DeliverDeferredUpdate(
273 ServiceWatcher::UpdateType update_type, const std::string& service_name) { 273 ServiceWatcher::UpdateType update_type, const std::string& service_name) {
274 ServiceListenersMap::iterator it = services_.find(service_name); 274 ServiceListenersMap::iterator it = services_.find(service_name);
275 if (it != services_.end()) { 275 if (it != services_.end()) {
276 it->second->set_update_pending(false); 276 it->second->set_update_pending(false);
277 if (!callback_.is_null()) 277 if (!callback_.is_null())
278 callback_.Run(update_type, service_name); 278 callback_.Run(update_type, service_name);
(...skipping 30 matching lines...) Expand all
309 309
310 void ServiceWatcherImpl::OnNsecRecord(const std::string& name, 310 void ServiceWatcherImpl::OnNsecRecord(const std::string& name,
311 unsigned rrtype) { 311 unsigned rrtype) {
312 // Do nothing. It is an error for hosts to broadcast an NSEC record for PTR 312 // Do nothing. It is an error for hosts to broadcast an NSEC record for PTR
313 // on any name. 313 // on any name.
314 } 314 }
315 315
316 void ServiceWatcherImpl::ScheduleQuery(int timeout_seconds) { 316 void ServiceWatcherImpl::ScheduleQuery(int timeout_seconds) {
317 if (timeout_seconds <= kMaxRequeryTimeSeconds) { 317 if (timeout_seconds <= kMaxRequeryTimeSeconds) {
318 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 318 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
319 FROM_HERE, base::Bind(&ServiceWatcherImpl::SendQuery, AsWeakPtr(), 319 FROM_HERE,
320 timeout_seconds * 2 /*next_timeout_seconds*/, 320 base::BindOnce(&ServiceWatcherImpl::SendQuery, AsWeakPtr(),
321 false /*force_update*/), 321 timeout_seconds * 2 /*next_timeout_seconds*/,
322 false /*force_update*/),
322 base::TimeDelta::FromSeconds(timeout_seconds)); 323 base::TimeDelta::FromSeconds(timeout_seconds));
323 } 324 }
324 } 325 }
325 326
326 void ServiceWatcherImpl::SendQuery(int next_timeout_seconds, 327 void ServiceWatcherImpl::SendQuery(int next_timeout_seconds,
327 bool force_update) { 328 bool force_update) {
328 CreateTransaction(true /*network*/, false /*cache*/, force_update, 329 CreateTransaction(true /*network*/, false /*cache*/, force_update,
329 &transaction_network_); 330 &transaction_network_);
330 ScheduleQuery(next_timeout_seconds); 331 ScheduleQuery(next_timeout_seconds);
331 } 332 }
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 } 556 }
556 557
557 void LocalDomainResolverImpl::SendResolvedAddresses() { 558 void LocalDomainResolverImpl::SendResolvedAddresses() {
558 transaction_a_.reset(); 559 transaction_a_.reset();
559 transaction_aaaa_.reset(); 560 transaction_aaaa_.reset();
560 timeout_callback_.Cancel(); 561 timeout_callback_.Cancel();
561 callback_.Run(IsSuccess(), address_ipv4_, address_ipv6_); 562 callback_.Run(IsSuccess(), address_ipv4_, address_ipv6_);
562 } 563 }
563 564
564 } // namespace local_discovery 565 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698