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

Unified Diff: components/ui_devtools/devtools_client.cc

Issue 2470933002: Disable agents when client disconnects (Closed)
Patch Set: fix nit Created 4 years, 1 month 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_client.h ('k') | components/ui_devtools/devtools_server.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ui_devtools/devtools_client.cc
diff --git a/components/ui_devtools/devtools_client.cc b/components/ui_devtools/devtools_client.cc
index 94a751ab6894745e7cf938869c13bf0d2fa31ad5..492c021ff28a80fe6a30f90332aa1e0b4dad701f 100644
--- a/components/ui_devtools/devtools_client.cc
+++ b/components/ui_devtools/devtools_client.cc
@@ -25,6 +25,11 @@ void UiDevToolsClient::AddAgent(std::unique_ptr<UiDevToolsAgent> agent) {
agents_.push_back(std::move(agent));
}
+void UiDevToolsClient::Disconnect() {
+ connection_id_ = kNotConnected;
+ DisableAllAgents();
+}
+
void UiDevToolsClient::Dispatch(const std::string& data) {
dispatcher_.dispatch(protocol::parseJSON(data));
}
@@ -41,6 +46,11 @@ const std::string& UiDevToolsClient::name() const {
return name_;
}
+void UiDevToolsClient::DisableAllAgents() {
+ for (std::unique_ptr<UiDevToolsAgent>& agent : agents_)
+ agent->Disable();
+}
+
void UiDevToolsClient::sendProtocolResponse(int callId, const String& message) {
if (connected())
server_->SendOverWebSocket(connection_id_, message);
« no previous file with comments | « components/ui_devtools/devtools_client.h ('k') | components/ui_devtools/devtools_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698