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

Unified Diff: content/browser/devtools/devtools_http_handler_impl.cc

Issue 666673007: [DevTools] Keep IP address of HttpServer as a member of DevToolsHttpHandlerImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move server_ip_address_.reset() to ResetHandlerThread() 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 | « content/browser/devtools/devtools_http_handler_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/devtools/devtools_http_handler_impl.cc
diff --git a/content/browser/devtools/devtools_http_handler_impl.cc b/content/browser/devtools/devtools_http_handler_impl.cc
index 014032dee8456bc88e42701874c768f4d07e5130..e7b7fb9b99e68f17eff500742b76addccf88e3e3 100644
--- a/content/browser/devtools/devtools_http_handler_impl.cc
+++ b/content/browser/devtools/devtools_http_handler_impl.cc
@@ -318,6 +318,7 @@ void DevToolsHttpHandlerImpl::StartHandlerThread() {
void DevToolsHttpHandlerImpl::ResetHandlerThread() {
thread_.reset();
+ server_ip_address_.reset();
}
void DevToolsHttpHandlerImpl::ResetHandlerThreadAndRelease() {
@@ -344,10 +345,9 @@ void DevToolsHttpHandlerImpl::StopWithoutRelease() {
}
GURL DevToolsHttpHandlerImpl::GetFrontendURL() {
- net::IPEndPoint ip_address;
- if (server_ && server_->GetLocalAddress(&ip_address))
+ if (!server_ip_address_)
return GURL();
- return GURL(std::string("http://") + ip_address.ToString() + frontend_url_);
+ return GURL(std::string("http://") + server_ip_address_->ToString() + frontend_url_);
}
static std::string PathWithoutParams(const std::string& path) {
@@ -776,6 +776,11 @@ void DevToolsHttpHandlerImpl::OnCloseUI(int connection_id) {
}
}
+void DevToolsHttpHandlerImpl::OnHttpServerInitialized(
+ const net::IPEndPoint& ip_address) {
+ server_ip_address_.reset(new net::IPEndPoint(ip_address));
+}
+
DevToolsHttpHandlerImpl::DevToolsHttpHandlerImpl(
scoped_ptr<ServerSocketFactory> server_socket_factory,
const std::string& frontend_url,
@@ -805,13 +810,19 @@ void DevToolsHttpHandlerImpl::Init() {
}
server_.reset(new net::HttpServer(server_socket.Pass(), this));
+ net::IPEndPoint ip_address;
+ server_->GetLocalAddress(&ip_address);
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&DevToolsHttpHandlerImpl::OnHttpServerInitialized,
+ this, ip_address));
if (!active_port_output_directory_.empty())
WriteActivePortToUserProfile();
}
// Runs on the handler thread
void DevToolsHttpHandlerImpl::Teardown() {
- server_.reset(NULL);
+ server_.reset();
}
// Runs on FILE thread to make sure that it is serialized against
« no previous file with comments | « content/browser/devtools/devtools_http_handler_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698