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

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

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 12 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/fake_connection.h" 5 #include "components/proximity_auth/fake_connection.h"
6 6
7 #include <utility>
8
7 #include "components/proximity_auth/wire_message.h" 9 #include "components/proximity_auth/wire_message.h"
8 10
9 namespace proximity_auth { 11 namespace proximity_auth {
10 12
11 FakeConnection::FakeConnection(const RemoteDevice& remote_device) 13 FakeConnection::FakeConnection(const RemoteDevice& remote_device)
12 : Connection(remote_device) { 14 : Connection(remote_device) {
13 Connect(); 15 Connect();
14 } 16 }
15 17
16 FakeConnection::~FakeConnection() { 18 FakeConnection::~FakeConnection() {
17 Disconnect(); 19 Disconnect();
18 } 20 }
19 21
20 void FakeConnection::Connect() { 22 void FakeConnection::Connect() {
21 SetStatus(CONNECTED); 23 SetStatus(CONNECTED);
22 } 24 }
23 25
24 void FakeConnection::Disconnect() { 26 void FakeConnection::Disconnect() {
25 SetStatus(DISCONNECTED); 27 SetStatus(DISCONNECTED);
26 } 28 }
27 29
28 void FakeConnection::FinishSendingMessageWithSuccess(bool success) { 30 void FakeConnection::FinishSendingMessageWithSuccess(bool success) {
29 CHECK(current_message_); 31 CHECK(current_message_);
30 // Capture a copy of the message, as OnDidSendMessage() might reentrantly 32 // Capture a copy of the message, as OnDidSendMessage() might reentrantly
31 // call SendMessage(). 33 // call SendMessage().
32 scoped_ptr<WireMessage> sent_message = current_message_.Pass(); 34 scoped_ptr<WireMessage> sent_message = std::move(current_message_);
33 OnDidSendMessage(*sent_message, success); 35 OnDidSendMessage(*sent_message, success);
34 } 36 }
35 37
36 void FakeConnection::ReceiveMessageWithPayload(const std::string& payload) { 38 void FakeConnection::ReceiveMessageWithPayload(const std::string& payload) {
37 pending_payload_ = payload; 39 pending_payload_ = payload;
38 OnBytesReceived(std::string()); 40 OnBytesReceived(std::string());
39 pending_payload_.clear(); 41 pending_payload_.clear();
40 } 42 }
41 43
42 void FakeConnection::SendMessageImpl(scoped_ptr<WireMessage> message) { 44 void FakeConnection::SendMessageImpl(scoped_ptr<WireMessage> message) {
43 CHECK(!current_message_); 45 CHECK(!current_message_);
44 current_message_ = message.Pass(); 46 current_message_ = std::move(message);
45 } 47 }
46 48
47 scoped_ptr<WireMessage> FakeConnection::DeserializeWireMessage( 49 scoped_ptr<WireMessage> FakeConnection::DeserializeWireMessage(
48 bool* is_incomplete_message) { 50 bool* is_incomplete_message) {
49 *is_incomplete_message = false; 51 *is_incomplete_message = false;
50 return make_scoped_ptr(new WireMessage(pending_payload_)); 52 return make_scoped_ptr(new WireMessage(pending_payload_));
51 } 53 }
52 54
53 } // namespace proximity_auth 55 } // namespace proximity_auth
OLDNEW
« no previous file with comments | « components/proximity_auth/device_to_device_secure_context.cc ('k') | components/proximity_auth/messenger_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698