Chromium Code Reviews| 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_); |
| 464 // interwoven navigation requests. | 464 // TODO(carlosk): this code might not handle interwoven navigation |
|
clamy
2015/03/31 11:40:42
Could you add a comment explaining that even if th
carlosk
2015/03/31 14:19:39
Done.
| |
| 465 DCHECK(!speculative_render_frame_host_); | 465 // requests properly. |
|
carlosk
2015/03/27 17:11:29
Due to the possibility of having multiple ongoing
clamy
2015/03/31 11:40:42
Yes we should maybe think about pausing a navigati
carlosk
2015/03/31 14:19:39
Let's talk offline about this as I don't understan
| |
| 466 if (speculative_web_ui_ && !speculative_render_frame_host_) { | |
| 467 CommitPending(); | |
| 468 } else { | |
| 469 CleanUpNavigation(); | |
| 470 } | |
| 466 } else { | 471 } else { |
| 467 // No one else should be sending us a DidNavigate in this state. | 472 // No one else should be sending us a DidNavigate in this state. |
| 468 DCHECK(false); | 473 DCHECK(false); |
| 469 } | 474 } |
| 470 DCHECK(!speculative_render_frame_host_); | 475 DCHECK(!speculative_render_frame_host_); |
| 471 return; | 476 return; |
| 472 } | 477 } |
| 473 | 478 |
| 474 if (!cross_navigation_pending_) { | 479 if (!cross_navigation_pending_) { |
| 475 DCHECK(!pending_render_frame_host_); | 480 DCHECK(!pending_render_frame_host_); |
| (...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1630 if (pending_web_ui_) { | 1635 if (pending_web_ui_) { |
| 1631 web_ui_.reset(pending_web_ui_.release()); | 1636 web_ui_.reset(pending_web_ui_.release()); |
| 1632 } else if (!pending_and_current_web_ui_.get()) { | 1637 } else if (!pending_and_current_web_ui_.get()) { |
| 1633 web_ui_.reset(); | 1638 web_ui_.reset(); |
| 1634 } else { | 1639 } else { |
| 1635 DCHECK_EQ(pending_and_current_web_ui_.get(), web_ui_.get()); | 1640 DCHECK_EQ(pending_and_current_web_ui_.get(), web_ui_.get()); |
| 1636 pending_and_current_web_ui_.reset(); | 1641 pending_and_current_web_ui_.reset(); |
| 1637 } | 1642 } |
| 1638 } else { | 1643 } else { |
| 1639 // PlzNavigate | 1644 // PlzNavigate |
| 1640 if (!should_reuse_web_ui_) | 1645 if (speculative_web_ui_) { |
| 1646 DCHECK(!should_reuse_web_ui_); | |
| 1641 web_ui_.reset(speculative_web_ui_.release()); | 1647 web_ui_.reset(speculative_web_ui_.release()); |
| 1648 } else if (should_reuse_web_ui_) { | |
|
clamy
2015/03/31 11:40:42
At which point is should_reuse_web_ui_ reset?
carlosk
2015/03/31 14:19:39
You are right to bring this up: this is the place.
| |
| 1649 CHECK(web_ui_); | |
|
clamy
2015/03/31 11:40:42
I wonder if this should be a DCHECK seeing that al
carlosk
2015/03/31 14:19:39
Done.
| |
| 1650 } else { | |
| 1651 web_ui_.reset(); | |
| 1652 } | |
|
carlosk
2015/03/27 17:11:30
This code does basically the same as the previous
| |
| 1642 DCHECK(!speculative_web_ui_); | 1653 DCHECK(!speculative_web_ui_); |
| 1643 } | 1654 } |
| 1644 | 1655 |
| 1645 // It's possible for the pending_render_frame_host_ to be nullptr when we | 1656 // 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 | 1657 // aren't crossing process boundaries. If so, we just needed to handle the Web |
| 1647 // UI committing above and we're done. | 1658 // UI committing above and we're done. |
| 1648 if (!pending_render_frame_host_ && !speculative_render_frame_host_) { | 1659 if (!pending_render_frame_host_ && !speculative_render_frame_host_) { |
| 1649 if (will_focus_location_bar) | 1660 if (will_focus_location_bar) |
| 1650 delegate_->SetFocusToLocationBar(false); | 1661 delegate_->SetFocusToLocationBar(false); |
| 1651 return; | 1662 return; |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2019 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 2030 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
| 2020 SiteInstance* instance) { | 2031 SiteInstance* instance) { |
| 2021 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 2032 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
| 2022 if (iter != proxy_hosts_.end()) { | 2033 if (iter != proxy_hosts_.end()) { |
| 2023 delete iter->second; | 2034 delete iter->second; |
| 2024 proxy_hosts_.erase(iter); | 2035 proxy_hosts_.erase(iter); |
| 2025 } | 2036 } |
| 2026 } | 2037 } |
| 2027 | 2038 |
| 2028 } // namespace content | 2039 } // namespace content |
| OLD | NEW |