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

Unified Diff: components/ui_devtools/devtools_server.cc

Issue 2928603002: Create and remove |UiDevToolsServer::server_| in the same thread. (Closed)
Patch Set: . Created 3 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 | « components/ui_devtools/devtools_server.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ui_devtools/devtools_server.cc
diff --git a/components/ui_devtools/devtools_server.cc b/components/ui_devtools/devtools_server.cc
index c8fd76c15f1bbb4aa29ed94ce537c75446a43eb1..aceecaa75e3d4d88b9cf5a6968f1d71d83ee0fac 100644
--- a/components/ui_devtools/devtools_server.cc
+++ b/components/ui_devtools/devtools_server.cc
@@ -65,6 +65,12 @@ UiDevToolsServer::UiDevToolsServer(
}
UiDevToolsServer::~UiDevToolsServer() {
+ DCHECK(io_thread_task_runner_);
+ io_thread_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&UiDevToolsServer::StopServer, base::Unretained(this)));
+ if (thread_->IsRunning())
sadrul 2017/06/26 22:43:30 This will not work when |io_thread_task_runner_| h
thanhph 2017/06/27 15:02:29 To elaborate more, with current patch 1, does this
sadrul 2017/06/28 04:49:10 No. The problem with this change was, that if UiDe
thanhph 2017/06/28 14:38:22 Acknowledged! Thanks for the explanation.
+ thread_->Stop();
devtools_server_ = nullptr;
}
@@ -127,6 +133,10 @@ void UiDevToolsServer::StartServer(const std::string& address_string,
server_ = base::MakeUnique<net::HttpServer>(std::move(socket), this);
}
+void UiDevToolsServer::StopServer() {
+ server_.reset();
+}
+
// HttpServer::Delegate Implementation
void UiDevToolsServer::OnConnect(int connection_id) {
NOTIMPLEMENTED();
« no previous file with comments | « components/ui_devtools/devtools_server.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698