| OLD | NEW |
| 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. | 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 5 * (http://www.torchmobile.com/) | 5 * (http://www.torchmobile.com/) |
| 6 * Copyright (C) 2009 Adam Barth. All rights reserved. | 6 * Copyright (C) 2009 Adam Barth. All rights reserved. |
| 7 * | 7 * |
| 8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
| 9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
| 10 * are met: | 10 * are met: |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 schedule(ScheduledReload::create()); | 470 schedule(ScheduledReload::create()); |
| 471 } | 471 } |
| 472 | 472 |
| 473 void NavigationScheduler::navigateTask() { | 473 void NavigationScheduler::navigateTask() { |
| 474 Platform::current()->currentThread()->scheduler()->removePendingNavigation( | 474 Platform::current()->currentThread()->scheduler()->removePendingNavigation( |
| 475 m_frameType); | 475 m_frameType); |
| 476 | 476 |
| 477 if (!m_frame->page()) | 477 if (!m_frame->page()) |
| 478 return; | 478 return; |
| 479 if (m_frame->page()->suspended()) { | 479 if (m_frame->page()->suspended()) { |
| 480 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); | 480 probe::frameClearedScheduledNavigation(m_frame); |
| 481 return; | 481 return; |
| 482 } | 482 } |
| 483 | 483 |
| 484 ScheduledNavigation* redirect(m_redirect.release()); | 484 ScheduledNavigation* redirect(m_redirect.release()); |
| 485 redirect->fire(m_frame); | 485 redirect->fire(m_frame); |
| 486 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); | 486 probe::frameClearedScheduledNavigation(m_frame); |
| 487 } | 487 } |
| 488 | 488 |
| 489 void NavigationScheduler::schedule(ScheduledNavigation* redirect) { | 489 void NavigationScheduler::schedule(ScheduledNavigation* redirect) { |
| 490 DCHECK(m_frame->page()); | 490 DCHECK(m_frame->page()); |
| 491 | 491 |
| 492 // In a back/forward navigation, we sometimes restore history state to | 492 // In a back/forward navigation, we sometimes restore history state to |
| 493 // iframes, even though the state was generated dynamically and JS will try to | 493 // iframes, even though the state was generated dynamically and JS will try to |
| 494 // put something different in the iframe. In this case, we will load stale | 494 // put something different in the iframe. In this case, we will load stale |
| 495 // things and/or confuse the JS when it shortly thereafter tries to schedule a | 495 // things and/or confuse the JS when it shortly thereafter tries to schedule a |
| 496 // location change. Let the JS have its way. | 496 // location change. Let the JS have its way. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 521 scheduler->addPendingNavigation(m_frameType); | 521 scheduler->addPendingNavigation(m_frameType); |
| 522 | 522 |
| 523 // wrapWeakPersistent(this) is safe because a posted task is canceled when the | 523 // wrapWeakPersistent(this) is safe because a posted task is canceled when the |
| 524 // task handle is destroyed on the dtor of this NavigationScheduler. | 524 // task handle is destroyed on the dtor of this NavigationScheduler. |
| 525 m_navigateTaskHandle = | 525 m_navigateTaskHandle = |
| 526 scheduler->loadingTaskRunner()->postDelayedCancellableTask( | 526 scheduler->loadingTaskRunner()->postDelayedCancellableTask( |
| 527 BLINK_FROM_HERE, WTF::bind(&NavigationScheduler::navigateTask, | 527 BLINK_FROM_HERE, WTF::bind(&NavigationScheduler::navigateTask, |
| 528 wrapWeakPersistent(this)), | 528 wrapWeakPersistent(this)), |
| 529 m_redirect->delay() * 1000.0); | 529 m_redirect->delay() * 1000.0); |
| 530 | 530 |
| 531 InspectorInstrumentation::frameScheduledNavigation(m_frame, | 531 probe::frameScheduledNavigation(m_frame, m_redirect->delay()); |
| 532 m_redirect->delay()); | |
| 533 } | 532 } |
| 534 | 533 |
| 535 void NavigationScheduler::cancel() { | 534 void NavigationScheduler::cancel() { |
| 536 if (m_navigateTaskHandle.isActive()) { | 535 if (m_navigateTaskHandle.isActive()) { |
| 537 Platform::current()->currentThread()->scheduler()->removePendingNavigation( | 536 Platform::current()->currentThread()->scheduler()->removePendingNavigation( |
| 538 m_frameType); | 537 m_frameType); |
| 539 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); | 538 probe::frameClearedScheduledNavigation(m_frame); |
| 540 } | 539 } |
| 541 m_navigateTaskHandle.cancel(); | 540 m_navigateTaskHandle.cancel(); |
| 542 m_redirect.clear(); | 541 m_redirect.clear(); |
| 543 } | 542 } |
| 544 | 543 |
| 545 DEFINE_TRACE(NavigationScheduler) { | 544 DEFINE_TRACE(NavigationScheduler) { |
| 546 visitor->trace(m_frame); | 545 visitor->trace(m_frame); |
| 547 visitor->trace(m_redirect); | 546 visitor->trace(m_redirect); |
| 548 } | 547 } |
| 549 | 548 |
| 550 } // namespace blink | 549 } // namespace blink |
| OLD | NEW |