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

Side by Side Diff: content/browser/devtools/protocol/tethering_handler.cc

Issue 2390883003: Fix crash in Android DevTools port forwarding handler. (Closed)
Patch Set: Fix crash in Android DevTools port forwarding handler. Created 4 years, 2 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/devtools/protocol/tethering_handler.h" 5 #include "content/browser/devtools/protocol/tethering_handler.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/ip_address.h" 10 #include "net/base/ip_address.h"
(...skipping 22 matching lines...) Expand all
33 public: 33 public:
34 SocketPump(net::StreamSocket* client_socket) 34 SocketPump(net::StreamSocket* client_socket)
35 : client_socket_(client_socket), 35 : client_socket_(client_socket),
36 pending_writes_(0), 36 pending_writes_(0),
37 pending_destruction_(false) { 37 pending_destruction_(false) {
38 } 38 }
39 39
40 std::string Init(const CreateServerSocketCallback& socket_callback) { 40 std::string Init(const CreateServerSocketCallback& socket_callback) {
41 std::string channel_name; 41 std::string channel_name;
42 server_socket_ = socket_callback.Run(&channel_name); 42 server_socket_ = socket_callback.Run(&channel_name);
43 if (!server_socket_.get() || channel_name.empty()) 43 if (!server_socket_.get() || channel_name.empty()) {
44 SelfDestruct(); 44 SelfDestruct();
45 channel_name.clear();
46 return channel_name;
pfeldman 2016/10/04 01:23:42 nit: return std::string();
pwnall 2016/10/04 01:30:50 Done. FWIW, I was (over-)thinking about RVO.
47 }
45 48
46 int result = server_socket_->Accept( 49 int result = server_socket_->Accept(
47 &accepted_socket_, 50 &accepted_socket_,
48 base::Bind(&SocketPump::OnAccepted, base::Unretained(this))); 51 base::Bind(&SocketPump::OnAccepted, base::Unretained(this)));
49 if (result != net::ERR_IO_PENDING) 52 if (result != net::ERR_IO_PENDING)
50 OnAccepted(result); 53 OnAccepted(result);
51 return channel_name; 54 return channel_name;
52 } 55 }
53 56
54 private: 57 private:
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 394 }
392 395
393 void TetheringHandler::SendInternalError(DevToolsCommandId command_id, 396 void TetheringHandler::SendInternalError(DevToolsCommandId command_id,
394 const std::string& message) { 397 const std::string& message) {
395 client_->SendError(command_id, Response::InternalError(message)); 398 client_->SendError(command_id, Response::InternalError(message));
396 } 399 }
397 400
398 } // namespace tethering 401 } // namespace tethering
399 } // namespace devtools 402 } // namespace devtools
400 } // namespace content 403 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698