OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_DNS_ADDRESS_SORTER_H_ |
| 6 #define NET_DNS_ADDRESS_SORTER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "net/base/net_export.h" |
| 12 |
| 13 namespace net { |
| 14 |
| 15 class AddressList; |
| 16 |
| 17 // Sorts AddressList according to RFC3484. Depending on the platform, the sort |
| 18 // could be performed asynchronously by the OS, or synchronously by local |
| 19 // implementation. AddressSorter does not necessarily preserve port numbers on |
| 20 // the sorted list. |
| 21 class NET_EXPORT AddressSorter { |
| 22 public: |
| 23 typedef base::Callback<void(bool success, |
| 24 const AddressList& list)> CallbackType; |
| 25 |
| 26 virtual ~AddressSorter() {} |
| 27 |
| 28 // Calls |callback| upon completion. Could complete synchronously. Could |
| 29 // complete after this AddressSorter is destroyed. |
| 30 virtual void Sort(const AddressList& list, |
| 31 const CallbackType& callback) const = 0; |
| 32 |
| 33 // Creates platform-dependent AddressSorter. |
| 34 static scoped_ptr<AddressSorter> CreateAddressSorter(); |
| 35 }; |
| 36 |
| 37 } // namespace net |
| 38 |
| 39 #endif // NET_DNS_ADDRESS_SORTER_H_ |
OLD | NEW |