OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/devtools/render_frame_devtools_agent_host.h" | 5 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
6 | 6 |
7 #include <tuple> | 7 #include <tuple> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
610 | 610 |
611 void RenderFrameDevToolsAgentHost::AboutToNavigateRenderFrame( | 611 void RenderFrameDevToolsAgentHost::AboutToNavigateRenderFrame( |
612 RenderFrameHost* old_host, | 612 RenderFrameHost* old_host, |
613 RenderFrameHost* new_host) { | 613 RenderFrameHost* new_host) { |
614 if (IsBrowserSideNavigationEnabled()) | 614 if (IsBrowserSideNavigationEnabled()) |
615 return; | 615 return; |
616 | 616 |
617 DCHECK(!pending_ || pending_->host() != old_host); | 617 DCHECK(!pending_ || pending_->host() != old_host); |
618 if (!current_ || current_->host() != old_host) | 618 if (!current_ || current_->host() != old_host) |
619 return; | 619 return; |
620 if (old_host == new_host && !current_frame_crashed_) | 620 if (old_host == new_host && !current_frame_crashed_) |
Charlie Reis
2016/09/23 18:26:16
Interesting. I guess current_frame_crashed_ isn't
dgozman
2016/09/24 01:44:04
The logic here is: if we didn't crash there is no
| |
621 return; | 621 return; |
622 DCHECK(!pending_); | 622 DCHECK(!pending_); |
623 SetPending(static_cast<RenderFrameHostImpl*>(new_host)); | 623 SetPending(static_cast<RenderFrameHostImpl*>(new_host)); |
624 // Commit when navigating the same frame after crash, avoiding the same | |
625 // host in current_ and pending_. | |
626 if (old_host == new_host) | |
627 CommitPending(); | |
624 } | 628 } |
625 | 629 |
626 void RenderFrameDevToolsAgentHost::AboutToNavigate( | 630 void RenderFrameDevToolsAgentHost::AboutToNavigate( |
627 NavigationHandle* navigation_handle) { | 631 NavigationHandle* navigation_handle) { |
628 if (!IsBrowserSideNavigationEnabled()) | 632 if (!IsBrowserSideNavigationEnabled()) |
629 return; | 633 return; |
630 DCHECK(current_); | 634 DCHECK(current_); |
631 navigating_handles_.insert(navigation_handle); | 635 navigating_handles_.insert(navigation_handle); |
632 } | 636 } |
633 | 637 |
634 void RenderFrameDevToolsAgentHost::RenderFrameHostChanged( | 638 void RenderFrameDevToolsAgentHost::RenderFrameHostChanged( |
635 RenderFrameHost* old_host, | 639 RenderFrameHost* old_host, |
636 RenderFrameHost* new_host) { | 640 RenderFrameHost* new_host) { |
637 if (IsBrowserSideNavigationEnabled()) | 641 if (IsBrowserSideNavigationEnabled()) |
638 return; | 642 return; |
639 | 643 |
640 DCHECK(!pending_ || pending_->host() != old_host); | 644 DCHECK(!pending_ || pending_->host() != old_host); |
Charlie Reis
2016/09/23 18:26:16
Maybe we can also upgrade this from a DCHECK to a
dgozman
2016/09/24 01:44:04
I can land a separate patch which upgrades to CHEC
Charlie Reis
2016/09/26 16:49:02
Sounds good, thanks.
| |
641 if (!current_ || current_->host() != old_host) | 645 if (!current_ || current_->host() != old_host) |
642 return; | 646 return; |
643 | 647 |
644 // AboutToNavigateRenderFrame was not called for renderer-initiated | 648 // AboutToNavigateRenderFrame was not called for renderer-initiated |
645 // navigation. | 649 // navigation. |
646 if (!pending_) | 650 if (!pending_) |
647 SetPending(static_cast<RenderFrameHostImpl*>(new_host)); | 651 SetPending(static_cast<RenderFrameHostImpl*>(new_host)); |
648 | 652 |
649 CommitPending(); | 653 CommitPending(); |
650 } | 654 } |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1026 RenderFrameHost* host) { | 1030 RenderFrameHost* host) { |
1027 return (current_ && current_->host() == host) || | 1031 return (current_ && current_->host() == host) || |
1028 (pending_ && pending_->host() == host); | 1032 (pending_ && pending_->host() == host); |
1029 } | 1033 } |
1030 | 1034 |
1031 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 1035 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
1032 return current_ && current_->host()->GetParent(); | 1036 return current_ && current_->host()->GetParent(); |
1033 } | 1037 } |
1034 | 1038 |
1035 } // namespace content | 1039 } // namespace content |
OLD | NEW |