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

Side by Side Diff: third_party/WebKit/Source/core/loader/NavigationScheduler.cpp

Issue 2327643003: Replace ASSERT*() with DCHECK*() in core/fetch/ and core/loader/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 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 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2009 Adam Barth. All rights reserved. 5 * Copyright (C) 2009 Adam Barth. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 { 287 {
288 visitor->trace(m_submission); 288 visitor->trace(m_submission);
289 ScheduledNavigation::trace(visitor); 289 ScheduledNavigation::trace(visitor);
290 } 290 }
291 291
292 private: 292 private:
293 ScheduledFormSubmission(Document* document, FormSubmission* submission, bool replacesCurrentItem) 293 ScheduledFormSubmission(Document* document, FormSubmission* submission, bool replacesCurrentItem)
294 : ScheduledNavigation(0, document, replacesCurrentItem, true) 294 : ScheduledNavigation(0, document, replacesCurrentItem, true)
295 , m_submission(submission) 295 , m_submission(submission)
296 { 296 {
297 ASSERT(m_submission->form()); 297 DCHECK(m_submission->form());
298 } 298 }
299 299
300 Member<FormSubmission> m_submission; 300 Member<FormSubmission> m_submission;
301 }; 301 };
302 302
303 NavigationScheduler::NavigationScheduler(LocalFrame* frame) 303 NavigationScheduler::NavigationScheduler(LocalFrame* frame)
304 : m_frame(frame) 304 : m_frame(frame)
305 , m_navigateTaskFactory(CancellableTaskFactory::create(this, &NavigationSche duler::navigateTask)) 305 , m_navigateTaskFactory(CancellableTaskFactory::create(this, &NavigationSche duler::navigateTask))
306 , m_frameType(m_frame->isMainFrame() ? WebScheduler::NavigatingFrameType::kM ainFrame : WebScheduler::NavigatingFrameType::kChildFrame) 306 , m_frameType(m_frame->isMainFrame() ? WebScheduler::NavigatingFrameType::kM ainFrame : WebScheduler::NavigatingFrameType::kChildFrame)
307 { 307 {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 m_frame->loader().load(request); 402 m_frame->loader().load(request);
403 return; 403 return;
404 } 404 }
405 } 405 }
406 406
407 schedule(ScheduledLocationChange::create(originDocument, url, replacesCurren tItem)); 407 schedule(ScheduledLocationChange::create(originDocument, url, replacesCurren tItem));
408 } 408 }
409 409
410 void NavigationScheduler::schedulePageBlock(Document* originDocument) 410 void NavigationScheduler::schedulePageBlock(Document* originDocument)
411 { 411 {
412 ASSERT(m_frame->page()); 412 DCHECK(m_frame->page());
413 const KURL& url = m_frame->document()->url(); 413 const KURL& url = m_frame->document()->url();
414 schedule(ScheduledPageBlock::create(originDocument, url)); 414 schedule(ScheduledPageBlock::create(originDocument, url));
415 } 415 }
416 416
417 void NavigationScheduler::scheduleFormSubmission(Document* document, FormSubmiss ion* submission) 417 void NavigationScheduler::scheduleFormSubmission(Document* document, FormSubmiss ion* submission)
418 { 418 {
419 ASSERT(m_frame->page()); 419 DCHECK(m_frame->page());
420 schedule(ScheduledFormSubmission::create(document, submission, mustReplaceCu rrentItem(m_frame))); 420 schedule(ScheduledFormSubmission::create(document, submission, mustReplaceCu rrentItem(m_frame)));
421 } 421 }
422 422
423 void NavigationScheduler::scheduleReload() 423 void NavigationScheduler::scheduleReload()
424 { 424 {
425 if (!shouldScheduleReload()) 425 if (!shouldScheduleReload())
426 return; 426 return;
427 if (m_frame->document()->url().isEmpty()) 427 if (m_frame->document()->url().isEmpty())
428 return; 428 return;
429 schedule(ScheduledReload::create()); 429 schedule(ScheduledReload::create());
(...skipping 10 matching lines...) Expand all
440 return; 440 return;
441 } 441 }
442 442
443 ScheduledNavigation* redirect(m_redirect.release()); 443 ScheduledNavigation* redirect(m_redirect.release());
444 redirect->fire(m_frame); 444 redirect->fire(m_frame);
445 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); 445 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame);
446 } 446 }
447 447
448 void NavigationScheduler::schedule(ScheduledNavigation* redirect) 448 void NavigationScheduler::schedule(ScheduledNavigation* redirect)
449 { 449 {
450 ASSERT(m_frame->page()); 450 DCHECK(m_frame->page());
451 451
452 // In a back/forward navigation, we sometimes restore history state to ifram es, even though the state was generated 452 // In a back/forward navigation, we sometimes restore history state to ifram es, even though the state was generated
453 // dynamically and JS will try to put something different in the iframe. In this case, we will load stale things 453 // dynamically and JS will try to put something different in the iframe. In this case, we will load stale things
454 // and/or confuse the JS when it shortly thereafter tries to schedule a loca tion change. Let the JS have its way. 454 // and/or confuse the JS when it shortly thereafter tries to schedule a loca tion change. Let the JS have its way.
455 // FIXME: This check seems out of place. 455 // FIXME: This check seems out of place.
456 if (!m_frame->loader().stateMachine()->committedFirstRealDocumentLoad() && m _frame->loader().provisionalDocumentLoader()) { 456 if (!m_frame->loader().stateMachine()->committedFirstRealDocumentLoad() && m _frame->loader().provisionalDocumentLoader()) {
457 m_frame->loader().stopAllLoaders(); 457 m_frame->loader().stopAllLoaders();
458 if (!m_frame->host()) 458 if (!m_frame->host())
459 return; 459 return;
460 } 460 }
461 461
462 cancel(); 462 cancel();
463 m_redirect = redirect; 463 m_redirect = redirect;
464 startTimer(); 464 startTimer();
465 } 465 }
466 466
467 void NavigationScheduler::startTimer() 467 void NavigationScheduler::startTimer()
468 { 468 {
469 if (!m_redirect) 469 if (!m_redirect)
470 return; 470 return;
471 471
472 ASSERT(m_frame->page()); 472 DCHECK(m_frame->page());
473 if (m_navigateTaskFactory->isPending()) 473 if (m_navigateTaskFactory->isPending())
474 return; 474 return;
475 if (!m_redirect->shouldStartTimer(m_frame)) 475 if (!m_redirect->shouldStartTimer(m_frame))
476 return; 476 return;
477 477
478 WebScheduler* scheduler = Platform::current()->currentThread()->scheduler(); 478 WebScheduler* scheduler = Platform::current()->currentThread()->scheduler();
479 scheduler->addPendingNavigation(m_frameType); 479 scheduler->addPendingNavigation(m_frameType);
480 scheduler->loadingTaskRunner()->postDelayedTask( 480 scheduler->loadingTaskRunner()->postDelayedTask(
481 BLINK_FROM_HERE, m_navigateTaskFactory->cancelAndCreate(), m_redirect->d elay() * 1000.0); 481 BLINK_FROM_HERE, m_navigateTaskFactory->cancelAndCreate(), m_redirect->d elay() * 1000.0);
482 482
(...skipping 10 matching lines...) Expand all
493 m_redirect.clear(); 493 m_redirect.clear();
494 } 494 }
495 495
496 DEFINE_TRACE(NavigationScheduler) 496 DEFINE_TRACE(NavigationScheduler)
497 { 497 {
498 visitor->trace(m_frame); 498 visitor->trace(m_frame);
499 visitor->trace(m_redirect); 499 visitor->trace(m_redirect);
500 } 500 }
501 501
502 } // namespace blink 502 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/NavigationScheduler.h ('k') | third_party/WebKit/Source/core/loader/PingLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698