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

Side by Side Diff: extensions/browser/api/socket/tcp_socket.cc

Issue 296053012: Replace StreamListenSocket with StreamSocket in HttpServer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use base::StringPiece in some places not to copy data. Created 6 years, 6 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 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 "extensions/browser/api/socket/tcp_socket.h" 5 #include "extensions/browser/api/socket/tcp_socket.h"
6 6
7 #include "extensions/browser/api/api_resource.h" 7 #include "extensions/browser/api/api_resource.h"
8 #include "net/base/address_list.h" 8 #include "net/base/address_list.h"
9 #include "net/base/ip_endpoint.h" 9 #include "net/base/ip_endpoint.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 int port, 189 int port,
190 int backlog, 190 int backlog,
191 std::string* error_msg) { 191 std::string* error_msg) {
192 if (socket_mode_ == CLIENT) { 192 if (socket_mode_ == CLIENT) {
193 *error_msg = kTCPSocketTypeInvalidError; 193 *error_msg = kTCPSocketTypeInvalidError;
194 return net::ERR_NOT_IMPLEMENTED; 194 return net::ERR_NOT_IMPLEMENTED;
195 } 195 }
196 DCHECK(!socket_.get()); 196 DCHECK(!socket_.get());
197 socket_mode_ = SERVER; 197 socket_mode_ = SERVER;
198 198
199 // TODO(byungchul): Use ServerSocketFactory.
199 scoped_ptr<net::IPEndPoint> bind_address(new net::IPEndPoint()); 200 scoped_ptr<net::IPEndPoint> bind_address(new net::IPEndPoint());
200 if (!StringAndPortToIPEndPoint(address, port, bind_address.get())) 201 if (!StringAndPortToIPEndPoint(address, port, bind_address.get()))
201 return net::ERR_INVALID_ARGUMENT; 202 return net::ERR_INVALID_ARGUMENT;
202 203
203 if (!server_socket_.get()) { 204 if (!server_socket_.get()) {
204 server_socket_.reset(new net::TCPServerSocket(NULL, net::NetLog::Source())); 205 server_socket_.reset(new net::TCPServerSocket(NULL, net::NetLog::Source()));
205 } 206 }
206 int result = server_socket_->Listen(*bind_address, backlog); 207 int result = server_socket_->Listen(*bind_address, backlog);
207 if (result) 208 if (result)
208 *error_msg = kSocketListenError; 209 *error_msg = kSocketListenError;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 321
321 bool ResumableTCPSocket::IsPersistent() const { return persistent(); } 322 bool ResumableTCPSocket::IsPersistent() const { return persistent(); }
322 323
323 ResumableTCPServerSocket::ResumableTCPServerSocket( 324 ResumableTCPServerSocket::ResumableTCPServerSocket(
324 const std::string& owner_extension_id) 325 const std::string& owner_extension_id)
325 : TCPSocket(owner_extension_id), persistent_(false), paused_(false) {} 326 : TCPSocket(owner_extension_id), persistent_(false), paused_(false) {}
326 327
327 bool ResumableTCPServerSocket::IsPersistent() const { return persistent(); } 328 bool ResumableTCPServerSocket::IsPersistent() const { return persistent(); }
328 329
329 } // namespace extensions 330 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698