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

Side by Side Diff: chrome/browser/extensions/api/dial/dial_service.cc

Issue 2352853002: Disallow redundant Bind calls. (Closed)
Patch Set: static_assert message tweak 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 unified diff | Download patch
« no previous file with comments | « base/bind_unittest.nc ('k') | chrome/browser/extensions/api/file_system/file_system_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/dial/dial_service.h" 5 #include "chrome/browser/extensions/api/dial/dial_service.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 net::IPAddressList chrome_os_address_list; 442 net::IPAddressList chrome_os_address_list;
443 InsertBestBindAddressChromeOS(chromeos::NetworkTypePattern::Ethernet(), 443 InsertBestBindAddressChromeOS(chromeos::NetworkTypePattern::Ethernet(),
444 &chrome_os_address_list); 444 &chrome_os_address_list);
445 InsertBestBindAddressChromeOS(chromeos::NetworkTypePattern::WiFi(), 445 InsertBestBindAddressChromeOS(chromeos::NetworkTypePattern::WiFi(),
446 &chrome_os_address_list); 446 &chrome_os_address_list);
447 DiscoverOnAddresses(chrome_os_address_list); 447 DiscoverOnAddresses(chrome_os_address_list);
448 448
449 #else 449 #else
450 BrowserThread::PostTaskAndReplyWithResult( 450 BrowserThread::PostTaskAndReplyWithResult(
451 BrowserThread::FILE, FROM_HERE, base::Bind(&GetNetworkListOnFileThread), 451 BrowserThread::FILE, FROM_HERE, base::Bind(&GetNetworkListOnFileThread),
452 base::Bind(base::Bind(&DialServiceImpl::SendNetworkList, 452 base::Bind(&DialServiceImpl::SendNetworkList,
453 weak_factory_.GetWeakPtr()))); 453 weak_factory_.GetWeakPtr()));
454 #endif 454 #endif
455 } 455 }
456 456
457 void DialServiceImpl::SendNetworkList(const NetworkInterfaceList& networks) { 457 void DialServiceImpl::SendNetworkList(const NetworkInterfaceList& networks) {
458 DCHECK_CURRENTLY_ON(BrowserThread::IO); 458 DCHECK_CURRENTLY_ON(BrowserThread::IO);
459 using InterfaceIndexAddressFamily = std::pair<uint32_t, net::AddressFamily>; 459 using InterfaceIndexAddressFamily = std::pair<uint32_t, net::AddressFamily>;
460 std::set<InterfaceIndexAddressFamily> interface_index_addr_family_seen; 460 std::set<InterfaceIndexAddressFamily> interface_index_addr_family_seen;
461 net::IPAddressList ip_addresses; 461 net::IPAddressList ip_addresses;
462 462
463 // Binds a socket to each IPv4 network interface found. Note that 463 // Binds a socket to each IPv4 network interface found. Note that
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 610
611 bool DialServiceImpl::HasOpenSockets() { 611 bool DialServiceImpl::HasOpenSockets() {
612 for (const auto& socket : dial_sockets_) { 612 for (const auto& socket : dial_sockets_) {
613 if (!socket->IsClosed()) 613 if (!socket->IsClosed())
614 return true; 614 return true;
615 } 615 }
616 return false; 616 return false;
617 } 617 }
618 618
619 } // namespace extensions 619 } // namespace extensions
OLDNEW
« no previous file with comments | « base/bind_unittest.nc ('k') | chrome/browser/extensions/api/file_system/file_system_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698