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

Unified Diff: components/ui_devtools/devtools_client.cc

Issue 2470933002: Disable agents when client disconnects (Closed)
Patch Set: sadruls comments 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
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..d3982dfcd0a5cddf15aa97988227a4c426ec6eb2 100644
--- a/components/ui_devtools/devtools_client.cc
+++ b/components/ui_devtools/devtools_client.cc
@@ -25,6 +25,16 @@ void UiDevToolsClient::AddAgent(std::unique_ptr<UiDevToolsAgent> agent) {
agents_.push_back(std::move(agent));
}
+void UiDevToolsClient::DisableAllAgents() {
+ for (std::unique_ptr<UiDevToolsAgent>& agent : agents_)
+ agent->Disable();
+}
+
+void UiDevToolsClient::Disconnect() {
+ connection_id_ = kNotConnected;
+ DisableAllAgents();
+}
+
void UiDevToolsClient::Dispatch(const std::string& data) {
dispatcher_.dispatch(protocol::parseJSON(data));
}

Powered by Google App Engine
This is Rietveld 408576698