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

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

Issue 1421483005: Reland: Remove DCHECK_IMPLIES/CHECK_IMPLIES. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/navigation_handle_impl.h" 5 #include "content/browser/frame_host/navigation_handle_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "content/browser/frame_host/frame_tree_node.h" 8 #include "content/browser/frame_host/frame_tree_node.h"
9 #include "content/browser/frame_host/navigator.h" 9 #include "content/browser/frame_host/navigator.h"
10 #include "content/browser/frame_host/navigator_delegate.h" 10 #include "content/browser/frame_host/navigator_delegate.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 RenderFrameHostImpl* render_frame_host) { 271 RenderFrameHostImpl* render_frame_host) {
272 CHECK(!render_frame_host_); 272 CHECK(!render_frame_host_);
273 render_frame_host_ = render_frame_host; 273 render_frame_host_ = render_frame_host;
274 state_ = READY_TO_COMMIT; 274 state_ = READY_TO_COMMIT;
275 GetDelegate()->ReadyToCommitNavigation(this); 275 GetDelegate()->ReadyToCommitNavigation(this);
276 } 276 }
277 277
278 void NavigationHandleImpl::DidCommitNavigation( 278 void NavigationHandleImpl::DidCommitNavigation(
279 bool same_page, 279 bool same_page,
280 RenderFrameHostImpl* render_frame_host) { 280 RenderFrameHostImpl* render_frame_host) {
281 CHECK_IMPLIES(render_frame_host_, render_frame_host_ == render_frame_host); 281 CHECK(!render_frame_host_ || render_frame_host_ == render_frame_host);
282 is_same_page_ = same_page; 282 is_same_page_ = same_page;
283 render_frame_host_ = render_frame_host; 283 render_frame_host_ = render_frame_host;
284 state_ = net_error_code_ == net::OK ? DID_COMMIT : DID_COMMIT_ERROR_PAGE; 284 state_ = net_error_code_ == net::OK ? DID_COMMIT : DID_COMMIT_ERROR_PAGE;
285 } 285 }
286 286
287 NavigationThrottle::ThrottleCheckResult 287 NavigationThrottle::ThrottleCheckResult
288 NavigationHandleImpl::CheckWillStartRequest() { 288 NavigationHandleImpl::CheckWillStartRequest() {
289 DCHECK(state_ == WILL_SEND_REQUEST || state_ == DEFERRING_START); 289 DCHECK(state_ == WILL_SEND_REQUEST || state_ == DEFERRING_START);
290 DCHECK_IMPLIES(state_ == WILL_SEND_REQUEST, next_index_ == 0); 290 DCHECK(state_ != WILL_SEND_REQUEST || next_index_ == 0);
291 DCHECK_IMPLIES(state_ == DEFERRING_START, next_index_ != 0); 291 DCHECK(state_ != DEFERRING_START || next_index_ != 0);
292 for (size_t i = next_index_; i < throttles_.size(); ++i) { 292 for (size_t i = next_index_; i < throttles_.size(); ++i) {
293 NavigationThrottle::ThrottleCheckResult result = 293 NavigationThrottle::ThrottleCheckResult result =
294 throttles_[i]->WillStartRequest(); 294 throttles_[i]->WillStartRequest();
295 switch (result) { 295 switch (result) {
296 case NavigationThrottle::PROCEED: 296 case NavigationThrottle::PROCEED:
297 continue; 297 continue;
298 298
299 case NavigationThrottle::CANCEL_AND_IGNORE: 299 case NavigationThrottle::CANCEL_AND_IGNORE:
300 return result; 300 return result;
301 301
302 case NavigationThrottle::DEFER: 302 case NavigationThrottle::DEFER:
303 state_ = DEFERRING_START; 303 state_ = DEFERRING_START;
304 next_index_ = i + 1; 304 next_index_ = i + 1;
305 return result; 305 return result;
306 306
307 default: 307 default:
308 NOTREACHED(); 308 NOTREACHED();
309 } 309 }
310 } 310 }
311 next_index_ = 0; 311 next_index_ = 0;
312 state_ = WILL_SEND_REQUEST; 312 state_ = WILL_SEND_REQUEST;
313 return NavigationThrottle::PROCEED; 313 return NavigationThrottle::PROCEED;
314 } 314 }
315 315
316 NavigationThrottle::ThrottleCheckResult 316 NavigationThrottle::ThrottleCheckResult
317 NavigationHandleImpl::CheckWillRedirectRequest() { 317 NavigationHandleImpl::CheckWillRedirectRequest() {
318 DCHECK(state_ == WILL_REDIRECT_REQUEST || state_ == DEFERRING_REDIRECT); 318 DCHECK(state_ == WILL_REDIRECT_REQUEST || state_ == DEFERRING_REDIRECT);
319 DCHECK_IMPLIES(state_ == WILL_REDIRECT_REQUEST, next_index_ == 0); 319 DCHECK(state_ != WILL_REDIRECT_REQUEST || next_index_ == 0);
320 DCHECK_IMPLIES(state_ == DEFERRING_REDIRECT, next_index_ != 0); 320 DCHECK(state_ != DEFERRING_REDIRECT || next_index_ != 0);
321 for (size_t i = next_index_; i < throttles_.size(); ++i) { 321 for (size_t i = next_index_; i < throttles_.size(); ++i) {
322 NavigationThrottle::ThrottleCheckResult result = 322 NavigationThrottle::ThrottleCheckResult result =
323 throttles_[i]->WillRedirectRequest(); 323 throttles_[i]->WillRedirectRequest();
324 switch (result) { 324 switch (result) {
325 case NavigationThrottle::PROCEED: 325 case NavigationThrottle::PROCEED:
326 continue; 326 continue;
327 327
328 case NavigationThrottle::CANCEL_AND_IGNORE: 328 case NavigationThrottle::CANCEL_AND_IGNORE:
329 return result; 329 return result;
330 330
331 case NavigationThrottle::DEFER: 331 case NavigationThrottle::DEFER:
332 state_ = DEFERRING_REDIRECT; 332 state_ = DEFERRING_REDIRECT;
333 next_index_ = i + 1; 333 next_index_ = i + 1;
334 return result; 334 return result;
335 335
336 default: 336 default:
337 NOTREACHED(); 337 NOTREACHED();
338 } 338 }
339 } 339 }
340 next_index_ = 0; 340 next_index_ = 0;
341 state_ = WILL_REDIRECT_REQUEST; 341 state_ = WILL_REDIRECT_REQUEST;
342 return NavigationThrottle::PROCEED; 342 return NavigationThrottle::PROCEED;
343 } 343 }
344 344
345 } // namespace content 345 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_entry_impl.cc ('k') | content/browser/frame_host/navigation_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698