| 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. (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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 268 |
| 269 NavigationScheduler::NavigationScheduler(LocalFrame* frame) | 269 NavigationScheduler::NavigationScheduler(LocalFrame* frame) |
| 270 : m_frame(frame) | 270 : m_frame(frame) |
| 271 , m_navigateTaskFactory(CancellableTaskFactory::create(this, &NavigationSche
duler::navigateTask)) | 271 , m_navigateTaskFactory(CancellableTaskFactory::create(this, &NavigationSche
duler::navigateTask)) |
| 272 , m_navigationDisableCount(0) | 272 , m_navigationDisableCount(0) |
| 273 { | 273 { |
| 274 } | 274 } |
| 275 | 275 |
| 276 NavigationScheduler::~NavigationScheduler() | 276 NavigationScheduler::~NavigationScheduler() |
| 277 { | 277 { |
| 278 // TODO(alexclarke): Can remove this if oilpan is on since any pending task
should |
| 279 // keep the NavigationScheduler alive. |
| 280 if (m_navigateTaskFactory->isPending()) |
| 281 Platform::current()->currentThread()->scheduler()->removePendingNavigati
on(); |
| 278 } | 282 } |
| 279 | 283 |
| 280 bool NavigationScheduler::locationChangePending() | 284 bool NavigationScheduler::locationChangePending() |
| 281 { | 285 { |
| 282 return m_redirect && m_redirect->isLocationChange(); | 286 return m_redirect && m_redirect->isLocationChange(); |
| 283 } | 287 } |
| 284 | 288 |
| 285 bool NavigationScheduler::isNavigationScheduled() const | 289 bool NavigationScheduler::isNavigationScheduled() const |
| 286 { | 290 { |
| 287 return m_redirect; | 291 return m_redirect; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 { | 372 { |
| 369 if (!shouldScheduleReload()) | 373 if (!shouldScheduleReload()) |
| 370 return; | 374 return; |
| 371 if (m_frame->document()->url().isEmpty()) | 375 if (m_frame->document()->url().isEmpty()) |
| 372 return; | 376 return; |
| 373 schedule(ScheduledReload::create()); | 377 schedule(ScheduledReload::create()); |
| 374 } | 378 } |
| 375 | 379 |
| 376 void NavigationScheduler::navigateTask() | 380 void NavigationScheduler::navigateTask() |
| 377 { | 381 { |
| 382 Platform::current()->currentThread()->scheduler()->removePendingNavigation()
; |
| 383 |
| 378 if (!m_frame->page()) | 384 if (!m_frame->page()) |
| 379 return; | 385 return; |
| 380 if (m_frame->page()->defersLoading()) { | 386 if (m_frame->page()->defersLoading()) { |
| 381 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); | 387 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); |
| 382 return; | 388 return; |
| 383 } | 389 } |
| 384 | 390 |
| 385 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | 391 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
| 386 | 392 |
| 387 OwnPtrWillBeRawPtr<ScheduledNavigation> redirect(m_redirect.release()); | 393 OwnPtrWillBeRawPtr<ScheduledNavigation> redirect(m_redirect.release()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 413 { | 419 { |
| 414 if (!m_redirect) | 420 if (!m_redirect) |
| 415 return; | 421 return; |
| 416 | 422 |
| 417 ASSERT(m_frame->page()); | 423 ASSERT(m_frame->page()); |
| 418 if (m_navigateTaskFactory->isPending()) | 424 if (m_navigateTaskFactory->isPending()) |
| 419 return; | 425 return; |
| 420 if (!m_redirect->shouldStartTimer(m_frame)) | 426 if (!m_redirect->shouldStartTimer(m_frame)) |
| 421 return; | 427 return; |
| 422 | 428 |
| 423 Platform::current()->currentThread()->scheduler()->loadingTaskRunner()->post
DelayedTask( | 429 WebScheduler* scheduler = Platform::current()->currentThread()->scheduler(); |
| 430 scheduler->addPendingNavigation(); |
| 431 scheduler->loadingTaskRunner()->postDelayedTask( |
| 424 FROM_HERE, m_navigateTaskFactory->cancelAndCreate(), m_redirect->delay()
* 1000.0); | 432 FROM_HERE, m_navigateTaskFactory->cancelAndCreate(), m_redirect->delay()
* 1000.0); |
| 425 | 433 |
| 426 InspectorInstrumentation::frameScheduledNavigation(m_frame, m_redirect->dela
y()); | 434 InspectorInstrumentation::frameScheduledNavigation(m_frame, m_redirect->dela
y()); |
| 427 } | 435 } |
| 428 | 436 |
| 429 void NavigationScheduler::cancel() | 437 void NavigationScheduler::cancel() |
| 430 { | 438 { |
| 431 if (m_navigateTaskFactory->isPending()) | 439 if (m_navigateTaskFactory->isPending()) { |
| 440 Platform::current()->currentThread()->scheduler()->removePendingNavigati
on(); |
| 432 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); | 441 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); |
| 442 } |
| 433 m_navigateTaskFactory->cancel(); | 443 m_navigateTaskFactory->cancel(); |
| 434 m_redirect.clear(); | 444 m_redirect.clear(); |
| 435 } | 445 } |
| 436 | 446 |
| 437 DEFINE_TRACE(NavigationScheduler) | 447 DEFINE_TRACE(NavigationScheduler) |
| 438 { | 448 { |
| 439 visitor->trace(m_frame); | 449 visitor->trace(m_frame); |
| 440 visitor->trace(m_redirect); | 450 visitor->trace(m_redirect); |
| 441 } | 451 } |
| 442 | 452 |
| 443 } // namespace blink | 453 } // namespace blink |
| OLD | NEW |