| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_THROTTLER_IMPL_H | 5 #ifndef COMPONENTS_CRYPTAUTH_BLUETOOTH_THROTTLER_IMPL_H |
| 6 #define COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_THROTTLER_IMPL_H | 6 #define COMPONENTS_CRYPTAUTH_BLUETOOTH_THROTTLER_IMPL_H |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "components/proximity_auth/bluetooth_throttler.h" | 13 #include "components/cryptauth/bluetooth_throttler.h" |
| 14 #include "components/proximity_auth/connection_observer.h" | 14 #include "components/cryptauth/connection_observer.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class TickClock; | 17 class TickClock; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace proximity_auth { | 20 namespace cryptauth { |
| 21 | 21 |
| 22 class Connection; | 22 class Connection; |
| 23 | 23 |
| 24 // This class throttles repeated connection attempts to the same device. This | 24 // This class throttles repeated connection attempts to the same device. This |
| 25 // throttling is necessary to prevent a kernel race condition when connecting | 25 // throttling is necessary to prevent a kernel race condition when connecting |
| 26 // before the previous connection fully closes, putting the connection in a | 26 // before the previous connection fully closes, putting the connection in a |
| 27 // corrupted, and unrecoverable state. http://crbug.com/345232 | 27 // corrupted, and unrecoverable state. http://crbug.com/345232 |
| 28 class BluetoothThrottlerImpl : public BluetoothThrottler, | 28 class BluetoothThrottlerImpl : public BluetoothThrottler, |
| 29 public ConnectionObserver { | 29 public ConnectionObserver { |
| 30 public: | 30 public: |
| (...skipping 26 matching lines...) Expand all Loading... |
| 57 // The currently connected connections. | 57 // The currently connected connections. |
| 58 // Each connection is stored as a weak reference, which is safe because |this| | 58 // Each connection is stored as a weak reference, which is safe because |this| |
| 59 // instance is registered as an observer, and will unregister when the | 59 // instance is registered as an observer, and will unregister when the |
| 60 // connection disconnects, which is guaranteed to occur before the connection | 60 // connection disconnects, which is guaranteed to occur before the connection |
| 61 // is destroyed. | 61 // is destroyed. |
| 62 std::set<Connection*> connections_; | 62 std::set<Connection*> connections_; |
| 63 | 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(BluetoothThrottlerImpl); | 64 DISALLOW_COPY_AND_ASSIGN(BluetoothThrottlerImpl); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 } // namespace proximity_auth | 67 } // namespace cryptauth |
| 68 | 68 |
| 69 #endif // COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_THROTTLER_IMPL_H | 69 #endif // COMPONENTS_CRYPTAUTH_BLUETOOTH_THROTTLER_IMPL_H |
| OLD | NEW |