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

Unified Diff: Source/core/loader/NavigationScheduler.cpp

Issue 1305933007: Make NavigationScheduler post loading tasks instead of timers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/loader/NavigationScheduler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/NavigationScheduler.cpp
diff --git a/Source/core/loader/NavigationScheduler.cpp b/Source/core/loader/NavigationScheduler.cpp
index 2841a7980c71c1b8148245126de3899c5819f461..fb383ba36357f39070c5ddb80384382b3addf2c4 100644
--- a/Source/core/loader/NavigationScheduler.cpp
+++ b/Source/core/loader/NavigationScheduler.cpp
@@ -48,6 +48,7 @@
#include "core/page/Page.h"
#include "platform/SharedBuffer.h"
#include "platform/UserGestureIndicator.h"
+#include "public/platform/Platform.h"
#include "wtf/CurrentTime.h"
namespace blink {
@@ -266,7 +267,7 @@ private:
NavigationScheduler::NavigationScheduler(LocalFrame* frame)
: m_frame(frame)
- , m_timer(this, &NavigationScheduler::timerFired)
+ , m_navigateTaskFactory(WTF::bind(&NavigationScheduler::navigateTask, this))
haraken 2015/09/03 23:43:30 Sigbjorn: NavigationScheduler is a part of object.
sof 2015/09/04 06:28:34 It will work out fine, but https://codereview.chro
haraken 2015/09/04 06:32:40 Makes sense.
, m_navigationDisableCount(0)
{
}
@@ -371,7 +372,7 @@ void NavigationScheduler::scheduleReload()
schedule(ScheduledReload::create());
}
-void NavigationScheduler::timerFired(Timer<NavigationScheduler>*)
+void NavigationScheduler::navigateTask()
{
if (!m_frame->page())
return;
@@ -413,20 +414,22 @@ void NavigationScheduler::startTimer()
return;
ASSERT(m_frame->page());
- if (m_timer.isActive())
+ if (m_navigateTaskFactory.isPending())
return;
if (!m_redirect->shouldStartTimer(m_frame))
return;
- m_timer.startOneShot(m_redirect->delay(), FROM_HERE);
+ Platform::current()->currentThread()->scheduler()->loadingTaskRunner()->postDelayedTask(
+ FROM_HERE, m_navigateTaskFactory.cancelAndCreate(), m_redirect->delay());
jochen (gone - plz use gerrit) 2015/09/07 14:50:59 this is wrong: startOneShot takes seconds, postDel
+
InspectorInstrumentation::frameScheduledNavigation(m_frame, m_redirect->delay());
}
void NavigationScheduler::cancel()
{
- if (m_timer.isActive())
+ if (m_navigateTaskFactory.isPending())
InspectorInstrumentation::frameClearedScheduledNavigation(m_frame);
- m_timer.stop();
+ m_navigateTaskFactory.cancel();
m_redirect.clear();
}
« no previous file with comments | « Source/core/loader/NavigationScheduler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698