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

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

Issue 1549643002: Switch to standard integer types in extensions/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clean
Patch Set: 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
« no previous file with comments | « extensions/browser/api/socket/tcp_socket.h ('k') | extensions/browser/api/socket/tls_socket.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 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 "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "extensions/browser/api/api_resource.h" 10 #include "extensions/browser/api/api_resource.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 is_connected_ = false; 110 is_connected_ = false;
111 if (socket_.get()) 111 if (socket_.get())
112 socket_->Disconnect(); 112 socket_->Disconnect();
113 server_socket_.reset(NULL); 113 server_socket_.reset(NULL);
114 connect_callback_.Reset(); 114 connect_callback_.Reset();
115 read_callback_.Reset(); 115 read_callback_.Reset();
116 accept_callback_.Reset(); 116 accept_callback_.Reset();
117 accept_socket_.reset(NULL); 117 accept_socket_.reset(NULL);
118 } 118 }
119 119
120 int TCPSocket::Bind(const std::string& address, uint16 port) { 120 int TCPSocket::Bind(const std::string& address, uint16_t port) {
121 return net::ERR_FAILED; 121 return net::ERR_FAILED;
122 } 122 }
123 123
124 void TCPSocket::Read(int count, const ReadCompletionCallback& callback) { 124 void TCPSocket::Read(int count, const ReadCompletionCallback& callback) {
125 DCHECK(!callback.is_null()); 125 DCHECK(!callback.is_null());
126 126
127 if (socket_mode_ != CLIENT) { 127 if (socket_mode_ != CLIENT) {
128 callback.Run(net::ERR_FAILED, NULL); 128 callback.Run(net::ERR_FAILED, NULL);
129 return; 129 return;
130 } 130 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return socket_->SetKeepAlive(enable, delay); 174 return socket_->SetKeepAlive(enable, delay);
175 } 175 }
176 176
177 bool TCPSocket::SetNoDelay(bool no_delay) { 177 bool TCPSocket::SetNoDelay(bool no_delay) {
178 if (!socket_.get()) 178 if (!socket_.get())
179 return false; 179 return false;
180 return socket_->SetNoDelay(no_delay); 180 return socket_->SetNoDelay(no_delay);
181 } 181 }
182 182
183 int TCPSocket::Listen(const std::string& address, 183 int TCPSocket::Listen(const std::string& address,
184 uint16 port, 184 uint16_t port,
185 int backlog, 185 int backlog,
186 std::string* error_msg) { 186 std::string* error_msg) {
187 if (socket_mode_ == CLIENT) { 187 if (socket_mode_ == CLIENT) {
188 *error_msg = kTCPSocketTypeInvalidError; 188 *error_msg = kTCPSocketTypeInvalidError;
189 return net::ERR_NOT_IMPLEMENTED; 189 return net::ERR_NOT_IMPLEMENTED;
190 } 190 }
191 DCHECK(!socket_.get()); 191 DCHECK(!socket_.get());
192 socket_mode_ = SERVER; 192 socket_mode_ = SERVER;
193 193
194 if (!server_socket_.get()) { 194 if (!server_socket_.get()) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 344
345 bool ResumableTCPSocket::IsPersistent() const { return persistent(); } 345 bool ResumableTCPSocket::IsPersistent() const { return persistent(); }
346 346
347 ResumableTCPServerSocket::ResumableTCPServerSocket( 347 ResumableTCPServerSocket::ResumableTCPServerSocket(
348 const std::string& owner_extension_id) 348 const std::string& owner_extension_id)
349 : TCPSocket(owner_extension_id), persistent_(false), paused_(false) {} 349 : TCPSocket(owner_extension_id), persistent_(false), paused_(false) {}
350 350
351 bool ResumableTCPServerSocket::IsPersistent() const { return persistent(); } 351 bool ResumableTCPServerSocket::IsPersistent() const { return persistent(); }
352 352
353 } // namespace extensions 353 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/socket/tcp_socket.h ('k') | extensions/browser/api/socket/tls_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698