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

Unified Diff: chrome/browser/devtools/devtools_ui_bindings.cc

Issue 1504763004: [DevTools] Fix frontend host race and assert. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: documentObjectCleared Created 5 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 | « chrome/browser/devtools/devtools_ui_bindings.h ('k') | content/renderer/devtools/devtools_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/devtools_ui_bindings.cc
diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc
index acd7397bd037ed93d328383b7d014fea6ab04cda..a86a9242593c9b2681312f36deabe313aced54df 100644
--- a/chrome/browser/devtools/devtools_ui_bindings.cc
+++ b/chrome/browser/devtools/devtools_ui_bindings.cc
@@ -286,6 +286,7 @@ class DevToolsUIBindings::FrontendWebContentsObserver
void DidStartNavigationToPendingEntry(
const GURL& url,
content::NavigationController::ReloadType reload_type) override;
+ void DocumentAvailableInMainFrame() override;
void DocumentOnLoadCompletedInMainFrame() override;
void DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
@@ -338,6 +339,11 @@ void DevToolsUIBindings::FrontendWebContentsObserver::
}
void DevToolsUIBindings::FrontendWebContentsObserver::
+ DocumentAvailableInMainFrame() {
+ devtools_bindings_->DocumentAvailableInMainFrame();
+}
+
+void DevToolsUIBindings::FrontendWebContentsObserver::
DocumentOnLoadCompletedInMainFrame() {
devtools_bindings_->DocumentOnLoadCompletedInMainFrame();
}
@@ -484,6 +490,7 @@ DevToolsUIBindings::DevToolsUIBindings(content::WebContents* web_contents)
delegate_(new DefaultBindingsDelegate(web_contents_)),
devices_updates_enabled_(false),
frontend_loaded_(false),
+ reattaching_(false),
weak_factory_(this) {
g_instances.Get().push_back(this);
frontend_contents_observer_.reset(new FrontendWebContentsObserver(this));
@@ -1127,8 +1134,7 @@ void DevToolsUIBindings::AttachTo(
void DevToolsUIBindings::Reattach() {
DCHECK(agent_host_.get());
- agent_host_->DetachClient();
- agent_host_->AttachClient(this);
+ reattaching_ = true;
}
void DevToolsUIBindings::Detach() {
@@ -1174,6 +1180,14 @@ void DevToolsUIBindings::CallClientFunction(const std::string& function_name,
base::UTF8ToUTF16(javascript));
}
+void DevToolsUIBindings::DocumentAvailableInMainFrame() {
+ if (!reattaching_)
+ return;
+ reattaching_ = false;
+ agent_host_->DetachClient();
+ agent_host_->AttachClient(this);
+}
+
void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() {
// In the DEBUG_DEVTOOLS mode, the DocumentOnLoadCompletedInMainFrame event
// arrives before the LoadCompleted event, thus it should not trigger the
« no previous file with comments | « chrome/browser/devtools/devtools_ui_bindings.h ('k') | content/renderer/devtools/devtools_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698