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

Side by Side Diff: components/proximity_auth/fake_connection.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
« no previous file with comments | « components/proximity_auth/fake_connection.h ('k') | components/proximity_auth/messenger_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/fake_connection.h" 5 #include "components/proximity_auth/fake_connection.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h"
9 #include "components/proximity_auth/wire_message.h" 10 #include "components/proximity_auth/wire_message.h"
10 11
11 namespace proximity_auth { 12 namespace proximity_auth {
12 13
13 FakeConnection::FakeConnection(const RemoteDevice& remote_device) 14 FakeConnection::FakeConnection(const RemoteDevice& remote_device)
14 : Connection(remote_device) { 15 : Connection(remote_device) {
15 Connect(); 16 Connect();
16 } 17 }
17 18
18 FakeConnection::~FakeConnection() { 19 FakeConnection::~FakeConnection() {
19 Disconnect(); 20 Disconnect();
20 } 21 }
21 22
22 void FakeConnection::Connect() { 23 void FakeConnection::Connect() {
23 SetStatus(CONNECTED); 24 SetStatus(CONNECTED);
24 } 25 }
25 26
26 void FakeConnection::Disconnect() { 27 void FakeConnection::Disconnect() {
27 SetStatus(DISCONNECTED); 28 SetStatus(DISCONNECTED);
28 } 29 }
29 30
30 void FakeConnection::FinishSendingMessageWithSuccess(bool success) { 31 void FakeConnection::FinishSendingMessageWithSuccess(bool success) {
31 CHECK(current_message_); 32 CHECK(current_message_);
32 // Capture a copy of the message, as OnDidSendMessage() might reentrantly 33 // Capture a copy of the message, as OnDidSendMessage() might reentrantly
33 // call SendMessage(). 34 // call SendMessage().
34 scoped_ptr<WireMessage> sent_message = std::move(current_message_); 35 std::unique_ptr<WireMessage> sent_message = std::move(current_message_);
35 OnDidSendMessage(*sent_message, success); 36 OnDidSendMessage(*sent_message, success);
36 } 37 }
37 38
38 void FakeConnection::ReceiveMessageWithPayload(const std::string& payload) { 39 void FakeConnection::ReceiveMessageWithPayload(const std::string& payload) {
39 pending_payload_ = payload; 40 pending_payload_ = payload;
40 OnBytesReceived(std::string()); 41 OnBytesReceived(std::string());
41 pending_payload_.clear(); 42 pending_payload_.clear();
42 } 43 }
43 44
44 void FakeConnection::SendMessageImpl(scoped_ptr<WireMessage> message) { 45 void FakeConnection::SendMessageImpl(std::unique_ptr<WireMessage> message) {
45 CHECK(!current_message_); 46 CHECK(!current_message_);
46 current_message_ = std::move(message); 47 current_message_ = std::move(message);
47 } 48 }
48 49
49 scoped_ptr<WireMessage> FakeConnection::DeserializeWireMessage( 50 std::unique_ptr<WireMessage> FakeConnection::DeserializeWireMessage(
50 bool* is_incomplete_message) { 51 bool* is_incomplete_message) {
51 *is_incomplete_message = false; 52 *is_incomplete_message = false;
52 return make_scoped_ptr(new WireMessage(pending_payload_)); 53 return base::WrapUnique(new WireMessage(pending_payload_));
53 } 54 }
54 55
55 } // namespace proximity_auth 56 } // namespace proximity_auth
OLDNEW
« no previous file with comments | « components/proximity_auth/fake_connection.h ('k') | components/proximity_auth/messenger_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698