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

Unified Diff: net/udp/udp_socket_posix.cc

Issue 2104533002: Ensure native library isn't actually loaded, and no IO on net thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bug link Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/udp/udp_socket_posix.cc
diff --git a/net/udp/udp_socket_posix.cc b/net/udp/udp_socket_posix.cc
index f869256ca547b912ddd5853cbbdf0949f3e1db85..6b047f5c03c9e5131f347ea636489c72dcc90a29 100644
--- a/net/udp/udp_socket_posix.cc
+++ b/net/udp/udp_socket_posix.cc
@@ -20,6 +20,7 @@
#include "base/metrics/sparse_histogram.h"
#include "base/posix/eintr_wrapper.h"
#include "base/rand_util.h"
+#include "base/threading/thread_restrictions.h"
#include "base/trace_event/trace_event.h"
#include "net/base/io_buffer.h"
#include "net/base/ip_address.h"
@@ -352,6 +353,10 @@ int UDPSocketPosix::BindToNetwork(
// space as it shims libc functions like connect().
base::FilePath file(base::FilePath::FromUTF16Unsafe(
base::GetNativeLibraryName(base::ASCIIToUTF16("netd_client"))));
xunjieli 2016/06/27 18:54:16 If we already have netd_client loaded in Chromium'
pauljensen 2016/06/27 19:07:10 setNetworkForSocket is nullptr when the executable
+ // Disable IO assertion in LoadNativeLibrary as the library will already
+ // be loaded by the socket() call (which goes through libnetd_client) that
+ // created |socket_|, so no IO will actually be performed. crbug.com/623555
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
base::NativeLibrary lib = base::LoadNativeLibrary(file, nullptr);
setNetworkForSocket = reinterpret_cast<SetNetworkForSocket>(
base::GetFunctionPointerFromNativeLibrary(lib, "setNetworkForSocket"));
« 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