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

Side by Side Diff: blimp/net/tcp_engine_transport.cc

Issue 2250433006: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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 "blimp/net/tcp_engine_transport.h" 5 #include "blimp/net/tcp_engine_transport.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 server_socket_.reset(); 55 server_socket_.reset();
56 } 56 }
57 57
58 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, 58 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
59 base::Bind(callback, result)); 59 base::Bind(callback, result));
60 } 60 }
61 61
62 std::unique_ptr<BlimpConnection> TCPEngineTransport::TakeConnection() { 62 std::unique_ptr<BlimpConnection> TCPEngineTransport::TakeConnection() {
63 DCHECK(connect_callback_.is_null()); 63 DCHECK(connect_callback_.is_null());
64 DCHECK(accepted_socket_); 64 DCHECK(accepted_socket_);
65 return base::WrapUnique( 65 return base::MakeUnique<StreamSocketConnection>(std::move(accepted_socket_));
66 new StreamSocketConnection(std::move(accepted_socket_)));
67 } 66 }
68 67
69 const char* TCPEngineTransport::GetName() const { 68 const char* TCPEngineTransport::GetName() const {
70 return "TCP"; 69 return "TCP";
71 } 70 }
72 71
73 int TCPEngineTransport::GetLocalAddress(net::IPEndPoint* address) const { 72 int TCPEngineTransport::GetLocalAddress(net::IPEndPoint* address) const {
74 DCHECK(server_socket_); 73 DCHECK(server_socket_);
75 return server_socket_->GetLocalAddress(address); 74 return server_socket_->GetLocalAddress(address);
76 } 75 }
77 76
78 void TCPEngineTransport::OnTCPConnectAccepted(int result) { 77 void TCPEngineTransport::OnTCPConnectAccepted(int result) {
79 DCHECK_NE(net::ERR_IO_PENDING, result); 78 DCHECK_NE(net::ERR_IO_PENDING, result);
80 DCHECK(accepted_socket_); 79 DCHECK(accepted_socket_);
81 if (result != net::OK) { 80 if (result != net::OK) {
82 accepted_socket_.reset(); 81 accepted_socket_.reset();
83 } 82 }
84 base::ResetAndReturn(&connect_callback_).Run(result); 83 base::ResetAndReturn(&connect_callback_).Run(result);
85 } 84 }
86 85
87 } // namespace blimp 86 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/net/engine_connection_manager_unittest.cc ('k') | blimp/net/thread_pipe_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698