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

Unified Diff: chrome/test/chromedriver/chrome/devtools_client_impl.cc

Issue 643003003: [chromedriver] Delete ResponseInfo objects after command response (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/chrome/devtools_client_impl.cc
diff --git a/chrome/test/chromedriver/chrome/devtools_client_impl.cc b/chrome/test/chromedriver/chrome/devtools_client_impl.cc
index 5c28526457da548e627da62fc33665f779cfa630..543cc90d9dc373500d611588a07f5c637f3cc6a5 100644
--- a/chrome/test/chromedriver/chrome/devtools_client_impl.cc
+++ b/chrome/test/chromedriver/chrome/devtools_client_impl.cc
@@ -277,10 +277,14 @@ Status DevToolsClientImpl::ProcessNextMessage(
if (status.IsError())
return status;
- // The command response may have already been received or blocked while
- // notifying listeners.
- if (expected_id != -1 && response_info_map_[expected_id]->state != kWaiting)
- return Status(kOk);
+ // The command response may have already been received (in which case it will
+ // have been deleted from |response_info_map_|) or blocked while notifying
+ // listeners.
+ if (expected_id != -1) {
+ ResponseInfoMap::iterator iter = response_info_map_.find(expected_id);
+ if (iter == response_info_map_.end() || iter->second->state != kWaiting)
+ return Status(kOk);
+ }
if (crashed_)
return Status(kTabCrashed);
@@ -383,12 +387,9 @@ Status DevToolsClientImpl::ProcessCommandResponse(
return Status(kUnknownError, "unexpected command response");
linked_ptr<ResponseInfo> response_info = response_info_map_[response.id];
- if (response_info->state == kReceived)
- return Status(kUnknownError, "received multiple command responses");
+ response_info_map_.erase(response.id);
- if (response_info->state == kIgnored) {
- response_info_map_.erase(response.id);
- } else {
+ if (response_info->state != kIgnored) {
response_info->state = kReceived;
response_info->response.id = response.id;
response_info->response.error = response.error;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698