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

Unified Diff: trunk/src/chrome/utility/local_discovery/service_discovery_message_handler.cc

Issue 191403002: Revert 255311 "Bind before sandbox lockdown on Windows." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 9 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 | trunk/src/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/chrome/utility/local_discovery/service_discovery_message_handler.cc
===================================================================
--- trunk/src/chrome/utility/local_discovery/service_discovery_message_handler.cc (revision 255683)
+++ trunk/src/chrome/utility/local_discovery/service_discovery_message_handler.cc (working copy)
@@ -72,28 +72,32 @@
// net::MDnsSocketFactory implementation:
virtual void CreateSockets(
ScopedVector<net::DatagramServerSocket>* sockets) OVERRIDE {
- sockets->swap(sockets_);
- Reset();
+ for (size_t i = 0; i < sockets_.size(); ++i) {
+ // Takes ownership of sockets_[i].socket;
+ ScopedSocketFactory platform_factory(sockets_[i].socket);
+ scoped_ptr<net::DatagramServerSocket> socket(
+ net::CreateAndBindMDnsSocket(sockets_[i].address_family,
+ sockets_[i].interface_index));
+ if (socket)
+ sockets->push_back(socket.release());
+ }
+ sockets_.clear();
}
- void AddSocket(const SocketInfo& socket_info) {
- // Takes ownership of socket_info.socket;
- ScopedSocketFactory platform_factory(socket_info.socket);
- scoped_ptr<net::DatagramServerSocket> socket(
- net::CreateAndBindMDnsSocket(socket_info.address_family,
- socket_info.interface_index));
- if (socket) {
- socket->DetachFromThread();
- sockets_.push_back(socket.release());
- }
+ void AddSocket(const SocketInfo& socket) {
+ sockets_.push_back(socket);
}
void Reset() {
+ for (size_t i = 0; i < sockets_.size(); ++i) {
+ if (sockets_[i].socket != net::kInvalidSocket)
+ ClosePlatformSocket(sockets_[i].socket);
+ }
sockets_.clear();
}
private:
- ScopedVector<net::DatagramServerSocket> sockets_;
+ std::vector<SocketInfo> sockets_;
DISALLOW_COPY_AND_ASSIGN(PreCreatedMDnsSocketFactory);
};
« no previous file with comments | « no previous file | trunk/src/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698