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

Unified Diff: net/socket/udp_socket_posix.cc

Issue 2905183002: Remove deprecated NonThreadSafe usage in net\socket. (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/udp_socket_posix.h ('k') | net/socket/udp_socket_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/udp_socket_posix.cc
diff --git a/net/socket/udp_socket_posix.cc b/net/socket/udp_socket_posix.cc
index 66f037b40ec00124032791140c7aa957d981d731..a120014842a11a761fba09563877293b4ff34bcd 100644
--- a/net/socket/udp_socket_posix.cc
+++ b/net/socket/udp_socket_posix.cc
@@ -179,12 +179,13 @@ UDPSocketPosix::UDPSocketPosix(DatagramSocket::BindType bind_type,
}
UDPSocketPosix::~UDPSocketPosix() {
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
Close();
net_log_.EndEvent(NetLogEventType::SOCKET_ALIVE);
}
int UDPSocketPosix::Open(AddressFamily address_family) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK_EQ(socket_, kInvalidSocket);
addr_family_ = ConvertAddressFamily(address_family);
@@ -204,7 +205,7 @@ int UDPSocketPosix::Open(AddressFamily address_family) {
}
void UDPSocketPosix::Close() {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (socket_ == kInvalidSocket)
return;
@@ -236,7 +237,7 @@ void UDPSocketPosix::Close() {
}
int UDPSocketPosix::GetPeerAddress(IPEndPoint* address) const {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(address);
if (!is_connected())
return ERR_SOCKET_NOT_CONNECTED;
@@ -256,7 +257,7 @@ int UDPSocketPosix::GetPeerAddress(IPEndPoint* address) const {
}
int UDPSocketPosix::GetLocalAddress(IPEndPoint* address) const {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(address);
if (!is_connected())
return ERR_SOCKET_NOT_CONNECTED;
@@ -288,7 +289,7 @@ int UDPSocketPosix::RecvFrom(IOBuffer* buf,
int buf_len,
IPEndPoint* address,
const CompletionCallback& callback) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK_NE(kInvalidSocket, socket_);
CHECK(read_callback_.is_null());
DCHECK(!recv_from_address_);
@@ -332,7 +333,7 @@ int UDPSocketPosix::SendToOrWrite(IOBuffer* buf,
int buf_len,
const IPEndPoint* address,
const CompletionCallback& callback) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK_NE(kInvalidSocket, socket_);
CHECK(write_callback_.is_null());
DCHECK(!callback.is_null()); // Synchronous operation not supported
@@ -372,7 +373,7 @@ int UDPSocketPosix::Connect(const IPEndPoint& address) {
}
int UDPSocketPosix::InternalConnect(const IPEndPoint& address) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!is_connected());
DCHECK(!remote_address_.get());
@@ -406,7 +407,7 @@ int UDPSocketPosix::InternalConnect(const IPEndPoint& address) {
int UDPSocketPosix::Bind(const IPEndPoint& address) {
DCHECK_NE(socket_, kInvalidSocket);
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!is_connected());
int rv = SetMulticastOptions();
@@ -425,7 +426,7 @@ int UDPSocketPosix::Bind(const IPEndPoint& address) {
int UDPSocketPosix::BindToNetwork(
NetworkChangeNotifier::NetworkHandle network) {
DCHECK_NE(socket_, kInvalidSocket);
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!is_connected());
if (network == NetworkChangeNotifier::kInvalidNetworkHandle)
return ERR_INVALID_ARGUMENT;
@@ -501,19 +502,19 @@ int UDPSocketPosix::BindToNetwork(
int UDPSocketPosix::SetReceiveBufferSize(int32_t size) {
DCHECK_NE(socket_, kInvalidSocket);
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return SetSocketReceiveBufferSize(socket_, size);
}
int UDPSocketPosix::SetSendBufferSize(int32_t size) {
DCHECK_NE(socket_, kInvalidSocket);
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return SetSocketSendBufferSize(socket_, size);
}
int UDPSocketPosix::SetDoNotFragment() {
DCHECK_NE(socket_, kInvalidSocket);
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
#if !defined(IP_PMTUDISC_DO)
return ERR_NOT_IMPLEMENTED;
@@ -544,14 +545,14 @@ int UDPSocketPosix::SetDoNotFragment() {
int UDPSocketPosix::AllowAddressReuse() {
DCHECK_NE(socket_, kInvalidSocket);
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!is_connected());
return SetReuseAddr(socket_, true);
}
int UDPSocketPosix::SetBroadcast(bool broadcast) {
DCHECK_NE(socket_, kInvalidSocket);
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
int value = broadcast ? 1 : 0;
int rv;
#if defined(OS_MACOSX)
@@ -825,7 +826,7 @@ int UDPSocketPosix::RandomBind(const IPAddress& address) {
}
int UDPSocketPosix::JoinGroup(const IPAddress& group_address) const {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (!is_connected())
return ERR_SOCKET_NOT_CONNECTED;
@@ -873,7 +874,7 @@ int UDPSocketPosix::JoinGroup(const IPAddress& group_address) const {
}
int UDPSocketPosix::LeaveGroup(const IPAddress& group_address) const {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (!is_connected())
return ERR_SOCKET_NOT_CONNECTED;
@@ -912,7 +913,7 @@ int UDPSocketPosix::LeaveGroup(const IPAddress& group_address) const {
}
int UDPSocketPosix::SetMulticastInterface(uint32_t interface_index) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (is_connected())
return ERR_SOCKET_IS_CONNECTED;
multicast_interface_ = interface_index;
@@ -920,7 +921,7 @@ int UDPSocketPosix::SetMulticastInterface(uint32_t interface_index) {
}
int UDPSocketPosix::SetMulticastTimeToLive(int time_to_live) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (is_connected())
return ERR_SOCKET_IS_CONNECTED;
@@ -931,7 +932,7 @@ int UDPSocketPosix::SetMulticastTimeToLive(int time_to_live) {
}
int UDPSocketPosix::SetMulticastLoopbackMode(bool loopback) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (is_connected())
return ERR_SOCKET_IS_CONNECTED;
@@ -962,7 +963,7 @@ int UDPSocketPosix::SetDiffServCodePoint(DiffServCodePoint dscp) {
}
void UDPSocketPosix::DetachFromThread() {
- base::NonThreadSafe::DetachFromThread();
+ DETACH_FROM_THREAD(thread_checker_);
}
} // namespace net
« no previous file with comments | « net/socket/udp_socket_posix.h ('k') | net/socket/udp_socket_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698