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

Side by Side Diff: components/proximity_auth/bluetooth_throttler_impl.cc

Issue 1912433002: Convert //components/proximity_auth from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 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 unified diff | Download patch
OLDNEW
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 #include "components/proximity_auth/bluetooth_throttler_impl.h" 5 #include "components/proximity_auth/bluetooth_throttler_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/time/tick_clock.h" 10 #include "base/time/tick_clock.h"
11 #include "components/proximity_auth/connection.h" 11 #include "components/proximity_auth/connection.h"
12 12
13 namespace proximity_auth { 13 namespace proximity_auth {
14 namespace { 14 namespace {
15 15
16 // Time to wait after disconnect before reconnecting. 16 // Time to wait after disconnect before reconnecting.
17 const int kCooldownTimeSecs = 7; 17 const int kCooldownTimeSecs = 7;
18 18
19 } // namespace 19 } // namespace
20 20
21 BluetoothThrottlerImpl::BluetoothThrottlerImpl( 21 BluetoothThrottlerImpl::BluetoothThrottlerImpl(
22 scoped_ptr<base::TickClock> clock) 22 std::unique_ptr<base::TickClock> clock)
23 : clock_(std::move(clock)) {} 23 : clock_(std::move(clock)) {}
24 24
25 BluetoothThrottlerImpl::~BluetoothThrottlerImpl() { 25 BluetoothThrottlerImpl::~BluetoothThrottlerImpl() {
26 for (Connection* connection : connections_) { 26 for (Connection* connection : connections_) {
27 connection->RemoveObserver(this); 27 connection->RemoveObserver(this);
28 } 28 }
29 } 29 }
30 30
31 base::TimeDelta BluetoothThrottlerImpl::GetDelay() const { 31 base::TimeDelta BluetoothThrottlerImpl::GetDelay() const {
32 if (last_disconnect_time_.is_null()) 32 if (last_disconnect_time_.is_null())
(...skipping 24 matching lines...) Expand all
57 Connection::Status new_status) { 57 Connection::Status new_status) {
58 DCHECK(ContainsKey(connections_, connection)); 58 DCHECK(ContainsKey(connections_, connection));
59 if (new_status == Connection::DISCONNECTED) { 59 if (new_status == Connection::DISCONNECTED) {
60 last_disconnect_time_ = clock_->NowTicks(); 60 last_disconnect_time_ = clock_->NowTicks();
61 connection->RemoveObserver(this); 61 connection->RemoveObserver(this);
62 connections_.erase(connection); 62 connections_.erase(connection);
63 } 63 }
64 } 64 }
65 65
66 } // namespace proximity_auth 66 } // namespace proximity_auth
OLDNEW
« no previous file with comments | « components/proximity_auth/bluetooth_throttler_impl.h ('k') | components/proximity_auth/bluetooth_throttler_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698