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

Unified Diff: components/cryptauth/bluetooth_throttler_impl.cc

Issue 2805113002: [CrOS Tether] Make BluetoothThrottler a singleton which can be easily shared between EasyUnlock and… (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: components/cryptauth/bluetooth_throttler_impl.cc
diff --git a/components/cryptauth/bluetooth_throttler_impl.cc b/components/cryptauth/bluetooth_throttler_impl.cc
index d72337ef5936650a6cdadd8a73261892114af8e3..239528a863230b56e369e234bc32cd0e239350a0 100644
--- a/components/cryptauth/bluetooth_throttler_impl.cc
+++ b/components/cryptauth/bluetooth_throttler_impl.cc
@@ -6,7 +6,9 @@
#include <utility>
+#include "base/memory/ptr_util.h"
#include "base/stl_util.h"
+#include "base/time/default_tick_clock.h"
#include "base/time/tick_clock.h"
#include "components/cryptauth/connection.h"
@@ -18,6 +20,14 @@ const int kCooldownTimeSecs = 7;
} // namespace
+// static
+BluetoothThrottlerImpl* BluetoothThrottlerImpl::GetInstance() {
+ return base::Singleton<BluetoothThrottlerImpl>::get();
+}
+
+BluetoothThrottlerImpl::BluetoothThrottlerImpl()
+ : BluetoothThrottlerImpl(base::MakeUnique<base::DefaultTickClock>()) {}
+
BluetoothThrottlerImpl::BluetoothThrottlerImpl(
std::unique_ptr<base::TickClock> clock)
: clock_(std::move(clock)) {}

Powered by Google App Engine
This is Rietveld 408576698