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

Unified Diff: net/server/http_server.cc

Issue 668053003: Finish gracefully on stop events, but not on pause events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/server/http_server.cc
diff --git a/net/server/http_server.cc b/net/server/http_server.cc
index 6c7ee52f31b3ed4c7ae8076cbcf063aec87d1491..a3f25ef911aa0bed72a8fb37352487a98afaf795 100644
--- a/net/server/http_server.cc
+++ b/net/server/http_server.cc
@@ -4,8 +4,11 @@
#include "net/server/http_server.h"
+#include "base/bind.h"
#include "base/compiler_specific.h"
+#include "base/location.h"
#include "base/logging.h"
+#include "base/message_loop/message_loop_proxy.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -30,7 +33,11 @@ HttpServer::HttpServer(scoped_ptr<ServerSocket> server_socket,
last_id_(0),
weak_ptr_factory_(this) {
DCHECK(server_socket_);
- DoAcceptLoop();
+ // Start accepting connections in next run loop in case when delegate is not
+ // ready to get callbacks.
+ base::MessageLoopProxy::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&HttpServer::DoAcceptLoop, weak_ptr_factory_.GetWeakPtr()));
}
HttpServer::~HttpServer() {
« 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