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

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

Issue 2876513002: Use WTF::TimeDelta to specify delays on WebTaskRunner (Closed)
Patch Set: mac fix Created 3 years, 7 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. 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 WebScheduler* scheduler = Platform::Current()->CurrentThread()->Scheduler(); 533 WebScheduler* scheduler = Platform::Current()->CurrentThread()->Scheduler();
534 scheduler->AddPendingNavigation(frame_type_); 534 scheduler->AddPendingNavigation(frame_type_);
535 535
536 // wrapWeakPersistent(this) is safe because a posted task is canceled when the 536 // wrapWeakPersistent(this) is safe because a posted task is canceled when the
537 // task handle is destroyed on the dtor of this NavigationScheduler. 537 // task handle is destroyed on the dtor of this NavigationScheduler.
538 navigate_task_handle_ = 538 navigate_task_handle_ =
539 scheduler->LoadingTaskRunner()->PostDelayedCancellableTask( 539 scheduler->LoadingTaskRunner()->PostDelayedCancellableTask(
540 BLINK_FROM_HERE, 540 BLINK_FROM_HERE,
541 WTF::Bind(&NavigationScheduler::NavigateTask, 541 WTF::Bind(&NavigationScheduler::NavigateTask,
542 WrapWeakPersistent(this)), 542 WrapWeakPersistent(this)),
543 redirect_->Delay() * 1000.0); 543 TimeDelta::FromSecondsD(redirect_->Delay()));
544 544
545 probe::frameScheduledNavigation(frame_, redirect_->Delay()); 545 probe::frameScheduledNavigation(frame_, redirect_->Delay());
546 } 546 }
547 547
548 void NavigationScheduler::Cancel() { 548 void NavigationScheduler::Cancel() {
549 if (navigate_task_handle_.IsActive()) { 549 if (navigate_task_handle_.IsActive()) {
550 Platform::Current()->CurrentThread()->Scheduler()->RemovePendingNavigation( 550 Platform::Current()->CurrentThread()->Scheduler()->RemovePendingNavigation(
551 frame_type_); 551 frame_type_);
552 probe::frameClearedScheduledNavigation(frame_); 552 probe::frameClearedScheduledNavigation(frame_);
553 } 553 }
554 navigate_task_handle_.Cancel(); 554 navigate_task_handle_.Cancel();
555 redirect_.Clear(); 555 redirect_.Clear();
556 } 556 }
557 557
558 DEFINE_TRACE(NavigationScheduler) { 558 DEFINE_TRACE(NavigationScheduler) {
559 visitor->Trace(frame_); 559 visitor->Trace(frame_);
560 visitor->Trace(redirect_); 560 visitor->Trace(redirect_);
561 } 561 }
562 562
563 } // namespace blink 563 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698