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

Side by Side Diff: components/ui_devtools/devtools_server.cc

Issue 2470933002: Disable agents when client disconnects (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/ui_devtools/devtools_server.h" 5 #include "components/ui_devtools/devtools_server.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 task_runner_->PostTask(FROM_HERE, base::Bind(&UiDevToolsClient::Dispatch, 154 task_runner_->PostTask(FROM_HERE, base::Bind(&UiDevToolsClient::Dispatch,
155 base::Unretained(client), data)); 155 base::Unretained(client), data));
156 } 156 }
157 157
158 void UiDevToolsServer::OnClose(int connection_id) { 158 void UiDevToolsServer::OnClose(int connection_id) {
159 ConnectionsMap::iterator it = connections_.find(connection_id); 159 ConnectionsMap::iterator it = connections_.find(connection_id);
160 if (it == connections_.end()) 160 if (it == connections_.end())
161 return; 161 return;
162 UiDevToolsClient* client = it->second; 162 UiDevToolsClient* client = it->second;
163 DCHECK(client); 163 DCHECK(client);
164 client->DisableAllAgents();
164 client->set_connection_id(UiDevToolsClient::kNotConnected); 165 client->set_connection_id(UiDevToolsClient::kNotConnected);
sadrul 2016/11/02 01:45:39 Would it make sense to combine these two into a si
Sarmad Hashmi 2016/11/02 02:43:53 Great idea! Done.
165 connections_.erase(it); 166 connections_.erase(it);
166 } 167 }
167 168
168 } // namespace devtools 169 } // namespace devtools
169 } // namespace ui 170 } // namespace ui
OLDNEW
« components/ui_devtools/devtools_client.cc ('K') | « components/ui_devtools/devtools_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698