summaryrefslogtreecommitdiffstats
path: root/net/server/http_server.cc
diff options
context:
space:
mode:
authorbyungchul <byungchul@chromium.org>2014-10-31 12:38:09 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-31 19:39:21 +0000
commitbaa7546a8bef46c86c875084dd11517a3c19bf3d (patch)
tree0e8dc2da954d6df38a5c0505fc51eb2d0e374674 /net/server/http_server.cc
parentcbdaf76256d60e43e0859ad6e3d893e879610df2 (diff)
downloadchromium_src-baa7546a8bef46c86c875084dd11517a3c19bf3d.zip
chromium_src-baa7546a8bef46c86c875084dd11517a3c19bf3d.tar.gz
chromium_src-baa7546a8bef46c86c875084dd11517a3c19bf3d.tar.bz2
Start accepting http connections in next run loop.
Devtools is not ready to get callbacks if accept returns connections synchronously. BUG=428389 Review URL: https://codereview.chromium.org/683733006 Cr-Commit-Position: refs/heads/master@{#302309}
Diffstat (limited to 'net/server/http_server.cc')
-rw-r--r--net/server/http_server.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/net/server/http_server.cc b/net/server/http_server.cc
index 6c7ee52..a3f25ef 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() {