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

Side by Side Diff: net/base/network_change_notifier.h

Issue 2893943002: [NetworkChangeNotifier] Run Windows connection type computation on other thread (Closed)
Patch Set: Nit Created 3 years, 7 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 (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 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ 5 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_H_
6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 // will be successfully. 351 // will be successfully.
352 static bool IsOffline(); 352 static bool IsOffline();
353 353
354 // Returns true if |type| is a cellular connection. 354 // Returns true if |type| is a cellular connection.
355 // Returns false if |type| is CONNECTION_UNKNOWN, and thus, depending on the 355 // Returns false if |type| is CONNECTION_UNKNOWN, and thus, depending on the
356 // implementation of GetConnectionType(), it is possible that 356 // implementation of GetConnectionType(), it is possible that
357 // IsConnectionCellular(GetConnectionType()) returns false even if the 357 // IsConnectionCellular(GetConnectionType()) returns false even if the
358 // current connection is cellular. 358 // current connection is cellular.
359 static bool IsConnectionCellular(ConnectionType type); 359 static bool IsConnectionCellular(ConnectionType type);
360 360
361 // Infer connection type from |GetNetworkList|. If all network interfaces
362 // have the same type, return it, otherwise return CONNECTION_UNKNOWN.
363 static ConnectionType ConnectionTypeFromInterfaces();
pauljensen 2017/05/22 18:01:51 Can we move this protected again? You can make Re
jkarlin 2017/05/23 11:44:38 Done.
364
361 // Gets the current connection type based on |interfaces|. Returns 365 // Gets the current connection type based on |interfaces|. Returns
362 // CONNECTION_NONE if there are no interfaces, CONNECTION_UNKNOWN if two 366 // CONNECTION_NONE if there are no interfaces, CONNECTION_UNKNOWN if two
363 // interfaces have different connection types or the connection type of all 367 // interfaces have different connection types or the connection type of all
364 // interfaces if they have the same interface type. 368 // interfaces if they have the same interface type.
365 static ConnectionType ConnectionTypeFromInterfaceList( 369 static ConnectionType ConnectionTypeFromInterfaceList(
366 const NetworkInterfaceList& interfaces); 370 const NetworkInterfaceList& interfaces);
367 371
368 // Like Create(), but for use in tests. The mock object doesn't monitor any 372 // Like Create(), but for use in tests. The mock object doesn't monitor any
369 // events, it merely rebroadcasts notifications when requested. 373 // events, it merely rebroadcasts notifications when requested.
370 static NetworkChangeNotifier* CreateMock(); 374 static NetworkChangeNotifier* CreateMock();
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 ConnectionType type); 535 ConnectionType type);
532 static void NotifyObserversOfSpecificNetworkChange(NetworkChangeType type, 536 static void NotifyObserversOfSpecificNetworkChange(NetworkChangeType type,
533 NetworkHandle network); 537 NetworkHandle network);
534 538
535 // Stores |config| in NetworkState and notifies OnDNSChanged observers. 539 // Stores |config| in NetworkState and notifies OnDNSChanged observers.
536 static void SetDnsConfig(const DnsConfig& config); 540 static void SetDnsConfig(const DnsConfig& config);
537 // Stores |config| in NetworkState and notifies OnInitialDNSConfigRead 541 // Stores |config| in NetworkState and notifies OnInitialDNSConfigRead
538 // observers. 542 // observers.
539 static void SetInitialDnsConfig(const DnsConfig& config); 543 static void SetInitialDnsConfig(const DnsConfig& config);
540 544
541 // Infer connection type from |GetNetworkList|. If all network interfaces
542 // have the same type, return it, otherwise return CONNECTION_UNKNOWN.
543 static ConnectionType ConnectionTypeFromInterfaces();
544
545 private: 545 private:
546 friend class HostResolverImplDnsTest; 546 friend class HostResolverImplDnsTest;
547 friend class NetworkChangeNotifierAndroidTest; 547 friend class NetworkChangeNotifierAndroidTest;
548 friend class NetworkChangeNotifierLinuxTest; 548 friend class NetworkChangeNotifierLinuxTest;
549 friend class NetworkChangeNotifierWinTest; 549 friend class NetworkChangeNotifierWinTest;
550 550
551 class NetworkState; 551 class NetworkState;
552 class NetworkChangeCalculator; 552 class NetworkChangeCalculator;
553 553
554 void NotifyObserversOfIPAddressChangeImpl(); 554 void NotifyObserversOfIPAddressChangeImpl();
(...skipping 30 matching lines...) Expand all
585 585
586 // Set true to disable non-test notifications (to prevent flakes in tests). 586 // Set true to disable non-test notifications (to prevent flakes in tests).
587 static bool test_notifications_only_; 587 static bool test_notifications_only_;
588 588
589 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); 589 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier);
590 }; 590 };
591 591
592 } // namespace net 592 } // namespace net
593 593
594 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ 594 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_
OLDNEW
« no previous file with comments | « no previous file | net/base/network_change_notifier_win.h » ('j') | net/base/network_change_notifier_win.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698