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

Unified Diff: headless/lib/browser/headless_devtools_client_impl.cc

Issue 1906423003: headless: Remove old load observer API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update headless shell. Created 4 years, 8 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 | « headless/app/headless_shell.cc ('k') | headless/lib/browser/headless_web_contents_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/browser/headless_devtools_client_impl.cc
diff --git a/headless/lib/browser/headless_devtools_client_impl.cc b/headless/lib/browser/headless_devtools_client_impl.cc
index 78f4dade292708d1e7ee55e552b0fe115f5c551a..2f662bb669550ec6b7ff2e075844fddebd0c4f66 100644
--- a/headless/lib/browser/headless_devtools_client_impl.cc
+++ b/headless/lib/browser/headless_devtools_client_impl.cc
@@ -102,17 +102,18 @@ bool HeadlessDevToolsClientImpl::DispatchMessageReply(
NOTREACHED() << "Unexpected reply";
return false;
}
- if (!it->second.callback_with_result.is_null()) {
+ Callback callback = std::move(it->second);
+ pending_messages_.erase(it);
+ if (!callback.callback_with_result.is_null()) {
const base::DictionaryValue* result_dict;
if (!message_dict.GetDictionary("result", &result_dict)) {
NOTREACHED() << "Badly formed reply result";
return false;
}
- it->second.callback_with_result.Run(*result_dict);
- } else if (!it->second.callback.is_null()) {
- it->second.callback.Run();
+ callback.callback_with_result.Run(*result_dict);
+ } else if (!callback.callback.is_null()) {
+ callback.callback.Run();
}
- pending_messages_.erase(it);
return true;
}
« no previous file with comments | « headless/app/headless_shell.cc ('k') | headless/lib/browser/headless_web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698