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

Unified Diff: third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp

Issue 2527143002: Suspend frame schedulers on a page suspension (Closed)
Patch Set: mod a comment Created 4 years 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
Index: third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp
diff --git a/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp b/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp
index a016b4e6ea52fc2446a6b11846fb9de35df8341f..e8e1ac08cc2e120c6c66b157172c77435da37c91 100644
--- a/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp
+++ b/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp
@@ -37,8 +37,6 @@ namespace blink {
MainThreadTaskRunner::MainThreadTaskRunner(ExecutionContext* context)
: m_context(context),
- m_pendingTasksTimer(this, &MainThreadTaskRunner::pendingTasksTimerFired),
- m_suspended(false),
m_weakFactory(this),
// Bind a WeakPtr now to avoid data races creating a WeakPtr inside
// postTask.
@@ -81,46 +79,9 @@ void MainThreadTaskRunner::perform(std::unique_ptr<ExecutionContextTask> task,
if (ThreadHeap::willObjectBeLazilySwept(m_context.get()))
return;
- if (!isInspectorTask &&
- (m_context->tasksNeedSuspension() || !m_pendingTasks.isEmpty())) {
- m_pendingTasks.append(make_pair(std::move(task), instrumenting));
- return;
- }
-
InspectorInstrumentation::AsyncTask asyncTask(m_context, task.get(),
!isInspectorTask);
task->performTask(m_context);
}
-void MainThreadTaskRunner::suspend() {
- DCHECK(!m_suspended);
- m_pendingTasksTimer.stop();
- m_suspended = true;
-}
-
-void MainThreadTaskRunner::resume() {
- DCHECK(m_suspended);
- if (!m_pendingTasks.isEmpty())
- m_pendingTasksTimer.startOneShot(0, BLINK_FROM_HERE);
-
- m_suspended = false;
-}
-
-void MainThreadTaskRunner::pendingTasksTimerFired(TimerBase*) {
- // If the owner m_context is about to be swept then it
- // is no longer safe to access.
- if (ThreadHeap::willObjectBeLazilySwept(m_context.get()))
- return;
-
- while (!m_pendingTasks.isEmpty()) {
- std::unique_ptr<ExecutionContextTask> task =
- std::move(m_pendingTasks[0].first);
- const bool instrumenting = m_pendingTasks[0].second;
- m_pendingTasks.remove(0);
- InspectorInstrumentation::AsyncTask asyncTask(m_context, task.get(),
- instrumenting);
- task->performTask(m_context);
- }
-}
-
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698