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

Unified Diff: content/browser/devtools/render_frame_devtools_agent_host.cc

Issue 2585053002: Fix telemetry hangs with PlzNavigate. (Closed)
Patch Set: now disable plznav again Created 4 years 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: content/browser/devtools/render_frame_devtools_agent_host.cc
diff --git a/content/browser/devtools/render_frame_devtools_agent_host.cc b/content/browser/devtools/render_frame_devtools_agent_host.cc
index 76b3866d638974a579b444ec8e8ee4eafc6b3e96..3f3baf1467b295cc39570edba3bf54241b6b01d0 100644
--- a/content/browser/devtools/render_frame_devtools_agent_host.cc
+++ b/content/browser/devtools/render_frame_devtools_agent_host.cc
@@ -130,6 +130,8 @@ class RenderFrameDevToolsAgentHost::FrameHostHolder {
std::vector<std::pair<int, std::string>> pending_messages_;
// <call_id> -> PendingMessage
std::map<int, PendingMessage> sent_messages_;
+ // These are sent messages for which we got a reply while suspended.
+ std::map<int, PendingMessage> sent_messages_whose_reply_came_while_suspended_;
};
RenderFrameDevToolsAgentHost::FrameHostHolder::FrameHostHolder(
@@ -165,6 +167,13 @@ void RenderFrameDevToolsAgentHost::FrameHostHolder::Reattach(
host_->GetRoutingID(), agent_->GetId(), agent_->session()->session_id(),
chunk_processor_.state_cookie()));
if (old) {
+ if (IsBrowserSideNavigationEnabled()) {
+ for (const auto& pair :
+ old->sent_messages_whose_reply_came_while_suspended_) {
+ DispatchProtocolMessage(pair.second.session_id, pair.first,
+ pair.second.method, pair.second.message);
+ }
+ }
for (const auto& pair : old->sent_messages_) {
DispatchProtocolMessage(pair.second.session_id, pair.first,
pair.second.method, pair.second.message);
@@ -233,11 +242,14 @@ RenderFrameDevToolsAgentHost::FrameHostHolder::ProcessChunkedMessageFromAgent(
void RenderFrameDevToolsAgentHost::FrameHostHolder::SendMessageToClient(
int session_id,
const std::string& message) {
- sent_messages_.erase(chunk_processor_.last_call_id());
- if (suspended_)
+ int id = chunk_processor_.last_call_id();
+ if (suspended_) {
+ sent_messages_whose_reply_came_while_suspended_[id] = sent_messages_[id];
pending_messages_.push_back(std::make_pair(session_id, message));
- else
+ } else {
agent_->SendMessageToClient(session_id, message);
+ }
+ sent_messages_.erase(id);
}
void RenderFrameDevToolsAgentHost::FrameHostHolder::Suspend() {
@@ -250,6 +262,7 @@ void RenderFrameDevToolsAgentHost::FrameHostHolder::Resume() {
agent_->SendMessageToClient(pair.first, pair.second);
std::vector<std::pair<int, std::string>> empty;
pending_messages_.swap(empty);
+ sent_messages_whose_reply_came_while_suspended_.clear();
}
// RenderFrameDevToolsAgentHost ------------------------------------------------
@@ -691,6 +704,8 @@ void RenderFrameDevToolsAgentHost::DidFinishNavigation(
DiscardPending();
}
pending_handle_ = nullptr;
+ } else {
+ current_->Resume();
dgozman 2016/12/19 18:26:44 Let's only resume when navigation_handles_ is empt
jam 2016/12/19 20:13:02 Ok, I don't really understand why there are multip
dgozman 2016/12/19 20:29:52 I'm not sure. From the time this was added, I vagu
nasko 2016/12/19 20:59:00 Yes, you can have multiple navigations simultaneou
jam 2016/12/19 22:23:15 Thanks, this is helpful to know. You say "most com
}
DispatchBufferedProtocolMessagesIfNecessary();
@@ -732,6 +747,7 @@ void RenderFrameDevToolsAgentHost::AboutToNavigate(
return;
DCHECK(current_);
navigating_handles_.insert(navigation_handle);
+ current_->Suspend();
dgozman 2016/12/19 18:26:44 I think we should only do this (and line before) i
jam 2016/12/19 20:13:02 That's always the case, i.e. see https://cs.chrom
dgozman 2016/12/19 20:29:52 Right, my bad.
DCHECK(CheckConsistency());
}
« 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