| 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 30 matching lines...) Expand all Loading... |
| 41 #include "core/inspector/InspectorInstrumentation.h" | 41 #include "core/inspector/InspectorInstrumentation.h" |
| 42 #include "core/loader/DocumentLoader.h" | 42 #include "core/loader/DocumentLoader.h" |
| 43 #include "core/loader/FormSubmission.h" | 43 #include "core/loader/FormSubmission.h" |
| 44 #include "core/loader/FrameLoadRequest.h" | 44 #include "core/loader/FrameLoadRequest.h" |
| 45 #include "core/loader/FrameLoader.h" | 45 #include "core/loader/FrameLoader.h" |
| 46 #include "core/loader/FrameLoaderClient.h" | 46 #include "core/loader/FrameLoaderClient.h" |
| 47 #include "core/loader/FrameLoaderStateMachine.h" | 47 #include "core/loader/FrameLoaderStateMachine.h" |
| 48 #include "core/page/Page.h" | 48 #include "core/page/Page.h" |
| 49 #include "platform/SharedBuffer.h" | 49 #include "platform/SharedBuffer.h" |
| 50 #include "platform/UserGestureIndicator.h" | 50 #include "platform/UserGestureIndicator.h" |
| 51 #include "platform/scheduler/CancellableTaskFactory.h" |
| 51 #include "public/platform/Platform.h" | 52 #include "public/platform/Platform.h" |
| 52 #include "wtf/CurrentTime.h" | 53 #include "wtf/CurrentTime.h" |
| 53 | 54 |
| 54 namespace blink { | 55 namespace blink { |
| 55 | 56 |
| 56 unsigned NavigationDisablerForBeforeUnload::s_navigationDisableCount = 0; | 57 unsigned NavigationDisablerForBeforeUnload::s_navigationDisableCount = 0; |
| 57 | 58 |
| 58 FrameNavigationDisabler::FrameNavigationDisabler(LocalFrame* frame) | 59 FrameNavigationDisabler::FrameNavigationDisabler(LocalFrame* frame) |
| 59 : m_navigationScheduler(frame->navigationScheduler()) | 60 : m_navigationScheduler(&frame->navigationScheduler()) |
| 60 { | 61 { |
| 61 m_navigationScheduler.disableFrameNavigation(); | 62 m_navigationScheduler->disableFrameNavigation(); |
| 62 } | 63 } |
| 63 | 64 |
| 64 FrameNavigationDisabler::~FrameNavigationDisabler() | 65 FrameNavigationDisabler::~FrameNavigationDisabler() |
| 65 { | 66 { |
| 66 m_navigationScheduler.enableFrameNavigation(); | 67 m_navigationScheduler->enableFrameNavigation(); |
| 67 } | 68 } |
| 68 | 69 |
| 69 class ScheduledNavigation : public NoBaseWillBeGarbageCollectedFinalized<Schedul
edNavigation> { | 70 class ScheduledNavigation : public NoBaseWillBeGarbageCollectedFinalized<Schedul
edNavigation> { |
| 70 WTF_MAKE_NONCOPYABLE(ScheduledNavigation); WTF_MAKE_FAST_ALLOCATED_WILL_BE_R
EMOVED(ScheduledNavigation); | 71 WTF_MAKE_NONCOPYABLE(ScheduledNavigation); WTF_MAKE_FAST_ALLOCATED_WILL_BE_R
EMOVED(ScheduledNavigation); |
| 71 public: | 72 public: |
| 72 ScheduledNavigation(double delay, Document* originDocument, bool replacesCur
rentItem, bool isLocationChange) | 73 ScheduledNavigation(double delay, Document* originDocument, bool replacesCur
rentItem, bool isLocationChange) |
| 73 : m_delay(delay) | 74 : m_delay(delay) |
| 74 , m_originDocument(originDocument) | 75 , m_originDocument(originDocument) |
| 75 , m_replacesCurrentItem(replacesCurrentItem) | 76 , m_replacesCurrentItem(replacesCurrentItem) |
| 76 , m_isLocationChange(isLocationChange) | 77 , m_isLocationChange(isLocationChange) |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 , m_submission(submission) | 261 , m_submission(submission) |
| 261 { | 262 { |
| 262 ASSERT(m_submission->form()); | 263 ASSERT(m_submission->form()); |
| 263 } | 264 } |
| 264 | 265 |
| 265 RefPtrWillBeMember<FormSubmission> m_submission; | 266 RefPtrWillBeMember<FormSubmission> m_submission; |
| 266 }; | 267 }; |
| 267 | 268 |
| 268 NavigationScheduler::NavigationScheduler(LocalFrame* frame) | 269 NavigationScheduler::NavigationScheduler(LocalFrame* frame) |
| 269 : m_frame(frame) | 270 : m_frame(frame) |
| 270 , m_navigateTaskFactory(WTF::bind(&NavigationScheduler::navigateTask, this)) | 271 , m_navigateTaskFactory(CancellableTaskFactory::create(this, &NavigationSche
duler::navigateTask)) |
| 271 , m_navigationDisableCount(0) | 272 , m_navigationDisableCount(0) |
| 272 { | 273 { |
| 273 } | 274 } |
| 274 | 275 |
| 275 NavigationScheduler::~NavigationScheduler() | 276 NavigationScheduler::~NavigationScheduler() |
| 276 { | 277 { |
| 277 } | 278 } |
| 278 | 279 |
| 279 bool NavigationScheduler::locationChangePending() | 280 bool NavigationScheduler::locationChangePending() |
| 280 { | 281 { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 m_redirect = redirect; | 408 m_redirect = redirect; |
| 408 startTimer(); | 409 startTimer(); |
| 409 } | 410 } |
| 410 | 411 |
| 411 void NavigationScheduler::startTimer() | 412 void NavigationScheduler::startTimer() |
| 412 { | 413 { |
| 413 if (!m_redirect) | 414 if (!m_redirect) |
| 414 return; | 415 return; |
| 415 | 416 |
| 416 ASSERT(m_frame->page()); | 417 ASSERT(m_frame->page()); |
| 417 if (m_navigateTaskFactory.isPending()) | 418 if (m_navigateTaskFactory->isPending()) |
| 418 return; | 419 return; |
| 419 if (!m_redirect->shouldStartTimer(m_frame)) | 420 if (!m_redirect->shouldStartTimer(m_frame)) |
| 420 return; | 421 return; |
| 421 | 422 |
| 422 Platform::current()->currentThread()->scheduler()->loadingTaskRunner()->post
DelayedTask( | 423 Platform::current()->currentThread()->scheduler()->loadingTaskRunner()->post
DelayedTask( |
| 423 FROM_HERE, m_navigateTaskFactory.cancelAndCreate(), m_redirect->delay())
; | 424 FROM_HERE, m_navigateTaskFactory->cancelAndCreate(), m_redirect->delay()
); |
| 424 | 425 |
| 425 InspectorInstrumentation::frameScheduledNavigation(m_frame, m_redirect->dela
y()); | 426 InspectorInstrumentation::frameScheduledNavigation(m_frame, m_redirect->dela
y()); |
| 426 } | 427 } |
| 427 | 428 |
| 428 void NavigationScheduler::cancel() | 429 void NavigationScheduler::cancel() |
| 429 { | 430 { |
| 430 if (m_navigateTaskFactory.isPending()) | 431 if (m_navigateTaskFactory->isPending()) |
| 431 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); | 432 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); |
| 432 m_navigateTaskFactory.cancel(); | 433 m_navigateTaskFactory->cancel(); |
| 433 m_redirect.clear(); | 434 m_redirect.clear(); |
| 434 } | 435 } |
| 435 | 436 |
| 436 DEFINE_TRACE(NavigationScheduler) | 437 DEFINE_TRACE(NavigationScheduler) |
| 437 { | 438 { |
| 438 visitor->trace(m_frame); | 439 visitor->trace(m_frame); |
| 439 visitor->trace(m_redirect); | 440 visitor->trace(m_redirect); |
| 440 } | 441 } |
| 441 | 442 |
| 442 } // namespace blink | 443 } // namespace blink |
| OLD | NEW |