OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_THROTTLER_H |
| 6 #define COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_THROTTLER_H |
| 7 |
| 8 namespace base { |
| 9 class TimeDelta; |
| 10 } |
| 11 |
| 12 namespace proximity_auth { |
| 13 |
| 14 // An interface for throttling repeated connection attempts to the same device. |
| 15 // This throttling is necessary to prevent a kernel race condition when |
| 16 // connecting before the previous connection fully closes, putting the |
| 17 // connection in a corrupted, and unrecoverable state. http://crbug.com/345232 |
| 18 class BluetoothThrottler { |
| 19 public: |
| 20 virtual ~BluetoothThrottler() {} |
| 21 |
| 22 // Returns the current delay that must be respected prior to reattempting to |
| 23 // establish a connection with the remote device. The returned value is 0 if |
| 24 // no delay is needed. |
| 25 virtual base::TimeDelta GetDelay() const = 0; |
| 26 |
| 27 // Should be called when a connection to the remote device is closed. |
| 28 virtual void OnConnectionClosed() = 0; |
| 29 }; |
| 30 |
| 31 } // namespace proximity_auth |
| 32 |
| 33 #endif // COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_THROTTLER_H |
OLD | NEW |