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

Side by Side Diff: content/browser/frame_host/frame_tree_node.cc

Issue 1092973002: Revert of PlzNavigate: move ownership of the NavigationRequest to the FrameTreeNode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months 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 unified diff | Download patch
OLDNEW
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/frame_tree_node.h" 5 #include "content/browser/frame_host/frame_tree_node.h"
6 6
7 #include <queue> 7 #include <queue>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "content/browser/frame_host/frame_tree.h" 11 #include "content/browser/frame_host/frame_tree.h"
12 #include "content/browser/frame_host/navigation_request.h"
13 #include "content/browser/frame_host/navigator.h" 12 #include "content/browser/frame_host/navigator.h"
14 #include "content/browser/frame_host/render_frame_host_impl.h" 13 #include "content/browser/frame_host/render_frame_host_impl.h"
15 #include "content/browser/renderer_host/render_view_host_impl.h" 14 #include "content/browser/renderer_host/render_view_host_impl.h"
16 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
17 #include "content/public/common/content_switches.h" 16 #include "content/public/common/content_switches.h"
18 17
19 namespace content { 18 namespace content {
20 19
21 namespace { 20 namespace {
22 21
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 std::pair<FrameTreeNodeIDMap::iterator, bool> result = 64 std::pair<FrameTreeNodeIDMap::iterator, bool> result =
66 g_frame_tree_node_id_map.Get().insert( 65 g_frame_tree_node_id_map.Get().insert(
67 std::make_pair(frame_tree_node_id_, this)); 66 std::make_pair(frame_tree_node_id_, this));
68 CHECK(result.second); 67 CHECK(result.second);
69 } 68 }
70 69
71 FrameTreeNode::~FrameTreeNode() { 70 FrameTreeNode::~FrameTreeNode() {
72 frame_tree_->FrameRemoved(this); 71 frame_tree_->FrameRemoved(this);
73 72
74 g_frame_tree_node_id_map.Get().erase(frame_tree_node_id_); 73 g_frame_tree_node_id_map.Get().erase(frame_tree_node_id_);
74 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
75 switches::kEnableBrowserSideNavigation)) {
76 navigator_->CancelNavigation(this);
77 }
75 } 78 }
76 79
77 bool FrameTreeNode::IsMainFrame() const { 80 bool FrameTreeNode::IsMainFrame() const {
78 return frame_tree_->root() == this; 81 return frame_tree_->root() == this;
79 } 82 }
80 83
81 void FrameTreeNode::AddChild(scoped_ptr<FrameTreeNode> child, 84 void FrameTreeNode::AddChild(scoped_ptr<FrameTreeNode> child,
82 int process_id, 85 int process_id,
83 int frame_routing_id) { 86 int frame_routing_id) {
84 // Child frame must always be created in the same process as the parent. 87 // Child frame must always be created in the same process as the parent.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 return current_frame_host->is_loading(); 167 return current_frame_host->is_loading();
165 } 168 }
166 169
167 bool FrameTreeNode::CommitPendingSandboxFlags() { 170 bool FrameTreeNode::CommitPendingSandboxFlags() {
168 bool did_change_flags = 171 bool did_change_flags =
169 effective_sandbox_flags_ != replication_state_.sandbox_flags; 172 effective_sandbox_flags_ != replication_state_.sandbox_flags;
170 effective_sandbox_flags_ = replication_state_.sandbox_flags; 173 effective_sandbox_flags_ = replication_state_.sandbox_flags;
171 return did_change_flags; 174 return did_change_flags;
172 } 175 }
173 176
174 void FrameTreeNode::SetNavigationRequest(
175 scoped_ptr<NavigationRequest> navigation_request) {
176 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
177 switches::kEnableBrowserSideNavigation));
178 ResetNavigationRequest(false);
179 // TODO(clamy): perform the StartLoading logic here.
180 navigation_request_ = navigation_request.Pass();
181 }
182
183 void FrameTreeNode::ResetNavigationRequest(bool is_commit) {
184 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
185 switches::kEnableBrowserSideNavigation));
186 // Upon commit the current NavigationRequest will be reset. There should be no
187 // cleanup performed since the navigation is still ongoing. If the reset
188 // corresponds to a cancelation, the RenderFrameHostManager should clean up
189 // any speculative RenderFrameHost it created for the navigation.
190 if (navigation_request_ && !is_commit) {
191 // TODO(clamy): perform the StopLoading logic.
192 render_manager_.CleanUpNavigation();
193 }
194 navigation_request_.reset();
195 }
196
197 } // namespace content 177 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/frame_tree_node.h ('k') | content/browser/frame_host/navigation_controller_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698