Use kDefaultURL throughout SpdySessionTest.
[chromium-blink-merge.git] / components / proximity_auth / bluetooth_throttler.h
blob1e428fe23eb06e4ec9517421dd4f26d4d2658bea
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.
5 #ifndef COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_THROTTLER_H
6 #define COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_THROTTLER_H
8 namespace base {
9 class TimeDelta;
12 namespace proximity_auth {
14 class Connection;
16 // An interface for throttling repeated connection attempts to the same device.
17 // This throttling is necessary to prevent a kernel race condition when
18 // connecting before the previous connection fully closes, putting the
19 // connection in a corrupted, and unrecoverable state. http://crbug.com/345232
20 class BluetoothThrottler {
21 public:
22 virtual ~BluetoothThrottler() {}
24 // Returns the current delay that must be respected prior to reattempting to
25 // establish a connection with the remote device. The returned value is 0 if
26 // no delay is needed.
27 virtual base::TimeDelta GetDelay() const = 0;
29 // Should be called when a connection to the remote device is established.
30 // Note that the |connection| is passed as a weak reference. The throttler
31 // will ensure, by registering as an observer, that it never attempts to use
32 // the connection after it has been destroyed.
33 virtual void OnConnection(Connection* connection) = 0;
36 } // namespace proximity_auth
38 #endif // COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_THROTTLER_H