| 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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 if (!m_redirect->shouldStartTimer(m_frame)) | 517 if (!m_redirect->shouldStartTimer(m_frame)) |
| 518 return; | 518 return; |
| 519 | 519 |
| 520 WebScheduler* scheduler = Platform::current()->currentThread()->scheduler(); | 520 WebScheduler* scheduler = Platform::current()->currentThread()->scheduler(); |
| 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, |
| 528 wrapWeakPersistent(this)), | 528 WTF::bind(&NavigationScheduler::navigateTask, |
| 529 wrapWeakPersistent(this)), |
| 529 m_redirect->delay() * 1000.0); | 530 m_redirect->delay() * 1000.0); |
| 530 | 531 |
| 531 InspectorInstrumentation::frameScheduledNavigation(m_frame, | 532 InspectorInstrumentation::frameScheduledNavigation(m_frame, |
| 532 m_redirect->delay()); | 533 m_redirect->delay()); |
| 533 } | 534 } |
| 534 | 535 |
| 535 void NavigationScheduler::cancel() { | 536 void NavigationScheduler::cancel() { |
| 536 if (m_navigateTaskHandle.isActive()) { | 537 if (m_navigateTaskHandle.isActive()) { |
| 537 Platform::current()->currentThread()->scheduler()->removePendingNavigation( | 538 Platform::current()->currentThread()->scheduler()->removePendingNavigation( |
| 538 m_frameType); | 539 m_frameType); |
| 539 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); | 540 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); |
| 540 } | 541 } |
| 541 m_navigateTaskHandle.cancel(); | 542 m_navigateTaskHandle.cancel(); |
| 542 m_redirect.clear(); | 543 m_redirect.clear(); |
| 543 } | 544 } |
| 544 | 545 |
| 545 DEFINE_TRACE(NavigationScheduler) { | 546 DEFINE_TRACE(NavigationScheduler) { |
| 546 visitor->trace(m_frame); | 547 visitor->trace(m_frame); |
| 547 visitor->trace(m_redirect); | 548 visitor->trace(m_redirect); |
| 548 } | 549 } |
| 549 | 550 |
| 550 } // namespace blink | 551 } // namespace blink |
| OLD | NEW |