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

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

Issue 1108283002: PlzNavigate: Call DidStartLoading and DidStopLoading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Commentses. Created 5 years, 7 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
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_controller_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/profiler/scoped_tracker.h" 10 #include "base/profiler/scoped_tracker.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return false; 159 return false;
160 } 160 }
161 161
162 bool FrameTreeNode::IsLoading() const { 162 bool FrameTreeNode::IsLoading() const {
163 RenderFrameHostImpl* current_frame_host = 163 RenderFrameHostImpl* current_frame_host =
164 render_manager_.current_frame_host(); 164 render_manager_.current_frame_host();
165 RenderFrameHostImpl* pending_frame_host = 165 RenderFrameHostImpl* pending_frame_host =
166 render_manager_.pending_frame_host(); 166 render_manager_.pending_frame_host();
167 167
168 DCHECK(current_frame_host); 168 DCHECK(current_frame_host);
169 // TODO(fdegans): Change the implementation logic for PlzNavigate once 169
170 // DidStartLoading and DidStopLoading are properly called. 170 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
171 if (pending_frame_host && pending_frame_host->is_loading()) 171 switches::kEnableBrowserSideNavigation)) {
172 return true; 172 if (navigation_request_)
173 return true;
174 } else {
175 if (pending_frame_host && pending_frame_host->is_loading())
176 return true;
177 }
173 return current_frame_host->is_loading(); 178 return current_frame_host->is_loading();
174 } 179 }
175 180
176 bool FrameTreeNode::CommitPendingSandboxFlags() { 181 bool FrameTreeNode::CommitPendingSandboxFlags() {
177 bool did_change_flags = 182 bool did_change_flags =
178 effective_sandbox_flags_ != replication_state_.sandbox_flags; 183 effective_sandbox_flags_ != replication_state_.sandbox_flags;
179 effective_sandbox_flags_ = replication_state_.sandbox_flags; 184 effective_sandbox_flags_ = replication_state_.sandbox_flags;
180 return did_change_flags; 185 return did_change_flags;
181 } 186 }
182 187
183 void FrameTreeNode::SetNavigationRequest( 188 void FrameTreeNode::SetNavigationRequest(
184 scoped_ptr<NavigationRequest> navigation_request) { 189 scoped_ptr<NavigationRequest> navigation_request) {
185 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 190 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
186 switches::kEnableBrowserSideNavigation)); 191 switches::kEnableBrowserSideNavigation));
187 ResetNavigationRequest(false); 192 ResetNavigationRequest(false);
188 // TODO(clamy): perform the StartLoading logic here. 193
194 // Force the throbber to start to keep it in sync with what is happening in
195 // the UI. Blink doesn't send throb notifications for JavaScript URLs, so it
196 // is not done here either.
197 if (!navigation_request->common_params().url.SchemeIs(
198 url::kJavaScriptScheme)) {
199 // TODO(fdegans): Check if this is a same-document navigation and set the
200 // proper argument.
201 DidStartLoading(true);
202 }
203
189 navigation_request_ = navigation_request.Pass(); 204 navigation_request_ = navigation_request.Pass();
190 } 205 }
191 206
192 void FrameTreeNode::ResetNavigationRequest(bool is_commit) { 207 void FrameTreeNode::ResetNavigationRequest(bool is_commit) {
193 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 208 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
194 switches::kEnableBrowserSideNavigation)); 209 switches::kEnableBrowserSideNavigation));
195 // Upon commit the current NavigationRequest will be reset. There should be no 210 if (!navigation_request_)
196 // cleanup performed since the navigation is still ongoing. If the reset 211 return;
197 // corresponds to a cancelation, the RenderFrameHostManager should clean up
198 // any speculative RenderFrameHost it created for the navigation.
199 if (navigation_request_ && !is_commit) {
200 // TODO(clamy): perform the StopLoading logic.
201 render_manager_.CleanUpNavigation();
202 }
203 navigation_request_.reset(); 212 navigation_request_.reset();
213
214 // During commit, the clean up of a speculative RenderFrameHost is done in
215 // RenderFrameHostManager::DidNavigateFrame. The load is also still being
216 // tracked.
217 if (is_commit)
218 return;
219
220 // If the reset corresponds to a cancelation, the RenderFrameHostManager
221 // should clean up any speculative RenderFrameHost it created for the
222 // navigation.
223 DidStopLoading();
224 render_manager_.CleanUpNavigation();
204 } 225 }
205 226
206 bool FrameTreeNode::has_started_loading() const { 227 bool FrameTreeNode::has_started_loading() const {
207 return loading_progress_ != kLoadingProgressNotStarted; 228 return loading_progress_ != kLoadingProgressNotStarted;
208 } 229 }
209 230
210 void FrameTreeNode::reset_loading_progress() { 231 void FrameTreeNode::reset_loading_progress() {
211 loading_progress_ = kLoadingProgressNotStarted; 232 loading_progress_ = kLoadingProgressNotStarted;
212 } 233 }
213 234
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 FROM_HERE_WITH_EXPLICIT_FUNCTION( 283 FROM_HERE_WITH_EXPLICIT_FUNCTION(
263 "465796 FrameTreeNode::DidStopLoading::End")); 284 "465796 FrameTreeNode::DidStopLoading::End"));
264 } 285 }
265 286
266 void FrameTreeNode::DidChangeLoadProgress(double load_progress) { 287 void FrameTreeNode::DidChangeLoadProgress(double load_progress) {
267 loading_progress_ = load_progress; 288 loading_progress_ = load_progress;
268 frame_tree_->UpdateLoadProgress(); 289 frame_tree_->UpdateLoadProgress();
269 } 290 }
270 291
271 } // namespace content 292 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_controller_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698