OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
453 } | 453 } |
454 | 454 |
455 void RenderFrameHostManager::CommitPendingIfNecessary( | 455 void RenderFrameHostManager::CommitPendingIfNecessary( |
456 RenderFrameHostImpl* render_frame_host, | 456 RenderFrameHostImpl* render_frame_host, |
457 bool was_caused_by_user_gesture) { | 457 bool was_caused_by_user_gesture) { |
458 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 458 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
459 switches::kEnableBrowserSideNavigation)) { | 459 switches::kEnableBrowserSideNavigation)) { |
460 if (render_frame_host == speculative_render_frame_host_.get()) { | 460 if (render_frame_host == speculative_render_frame_host_.get()) { |
461 CommitPending(); | 461 CommitPending(); |
462 } else if (render_frame_host == render_frame_host_.get()) { | 462 } else if (render_frame_host == render_frame_host_.get()) { |
463 // TODO(carlosk): this code doesn't properly handle in-page navigation or | 463 DCHECK(!should_reuse_web_ui_ || web_ui_); |
Charlie Reis
2015/04/02 03:18:36
DCHECK_IMPLIES(should_reuse_web_ui_, web_ui_);
(T
carlosk
2015/04/07 14:42:31
Done.
| |
464 // interwoven navigation requests. | 464 // When the current RenderFrameHost is committing there's still the |
465 DCHECK(!speculative_render_frame_host_); | 465 // possibility that there is a speculative WebUI to be made active. |
466 // But if there's also a speculative RenderFrameHost set it means the | |
467 // WebUI was not meant for the current one. | |
468 // TODO(carlosk): this code might not handle interwoven navigation | |
469 // requests properly. For example, if two navigations to the current | |
470 // RenderFrameHost are requested closely to each other, one requiring a | |
471 // new WebUI and the other requiring none, it might happen that a WebUI is | |
Charlie Reis
2015/04/02 03:18:36
Can there actually be two navigations in the same
carlosk
2015/04/07 14:42:31
I looked through the code and had the impression f
| |
472 // set when it shouldn't or the other way around. | |
Charlie Reis
2015/04/02 03:18:36
If this is a real issue, what's the plan for fixin
carlosk
2015/04/07 14:42:31
My previous comment covers this.
| |
473 if (speculative_web_ui_ && !speculative_render_frame_host_) { | |
474 CommitPending(); | |
Charlie Reis
2015/04/02 03:18:36
I'm noticing that this ends up echoing a lot of th
carlosk
2015/04/07 14:42:31
Done. As we plan to eliminate |cross_navigation_pe
| |
475 } else { | |
476 CleanUpNavigation(); | |
477 } | |
466 } else { | 478 } else { |
467 // No one else should be sending us a DidNavigate in this state. | 479 // No one else should be sending us a DidNavigate in this state. |
468 DCHECK(false); | 480 DCHECK(false); |
469 } | 481 } |
470 DCHECK(!speculative_render_frame_host_); | 482 DCHECK(!speculative_render_frame_host_); |
471 return; | 483 return; |
472 } | 484 } |
473 | 485 |
474 if (!cross_navigation_pending_) { | 486 if (!cross_navigation_pending_) { |
475 DCHECK(!pending_render_frame_host_); | 487 DCHECK(!pending_render_frame_host_); |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1630 if (pending_web_ui_) { | 1642 if (pending_web_ui_) { |
1631 web_ui_.reset(pending_web_ui_.release()); | 1643 web_ui_.reset(pending_web_ui_.release()); |
1632 } else if (!pending_and_current_web_ui_.get()) { | 1644 } else if (!pending_and_current_web_ui_.get()) { |
1633 web_ui_.reset(); | 1645 web_ui_.reset(); |
1634 } else { | 1646 } else { |
1635 DCHECK_EQ(pending_and_current_web_ui_.get(), web_ui_.get()); | 1647 DCHECK_EQ(pending_and_current_web_ui_.get(), web_ui_.get()); |
1636 pending_and_current_web_ui_.reset(); | 1648 pending_and_current_web_ui_.reset(); |
1637 } | 1649 } |
1638 } else { | 1650 } else { |
1639 // PlzNavigate | 1651 // PlzNavigate |
1640 if (!should_reuse_web_ui_) | 1652 if (speculative_web_ui_) { |
Charlie Reis
2015/04/02 03:18:36
Again, these new cases look a lot like lines 1642-
carlosk
2015/04/07 14:42:31
Done. No problems just the need for some extra Plz
| |
1653 DCHECK(!should_reuse_web_ui_); | |
1641 web_ui_.reset(speculative_web_ui_.release()); | 1654 web_ui_.reset(speculative_web_ui_.release()); |
1655 } else if (should_reuse_web_ui_) { | |
1656 DCHECK(web_ui_); | |
1657 should_reuse_web_ui_ = false; | |
1658 } else { | |
1659 web_ui_.reset(); | |
1660 } | |
1642 DCHECK(!speculative_web_ui_); | 1661 DCHECK(!speculative_web_ui_); |
1662 DCHECK(!should_reuse_web_ui_); | |
1643 } | 1663 } |
1644 | 1664 |
1645 // It's possible for the pending_render_frame_host_ to be nullptr when we | 1665 // It's possible for the pending_render_frame_host_ to be nullptr when we |
1646 // aren't crossing process boundaries. If so, we just needed to handle the Web | 1666 // aren't crossing process boundaries. If so, we just needed to handle the Web |
1647 // UI committing above and we're done. | 1667 // UI committing above and we're done. |
1648 if (!pending_render_frame_host_ && !speculative_render_frame_host_) { | 1668 if (!pending_render_frame_host_ && !speculative_render_frame_host_) { |
1649 if (will_focus_location_bar) | 1669 if (will_focus_location_bar) |
1650 delegate_->SetFocusToLocationBar(false); | 1670 delegate_->SetFocusToLocationBar(false); |
1651 return; | 1671 return; |
1652 } | 1672 } |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2019 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 2039 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
2020 SiteInstance* instance) { | 2040 SiteInstance* instance) { |
2021 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 2041 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
2022 if (iter != proxy_hosts_.end()) { | 2042 if (iter != proxy_hosts_.end()) { |
2023 delete iter->second; | 2043 delete iter->second; |
2024 proxy_hosts_.erase(iter); | 2044 proxy_hosts_.erase(iter); |
2025 } | 2045 } |
2026 } | 2046 } |
2027 | 2047 |
2028 } // namespace content | 2048 } // namespace content |
OLD | NEW |