Commit b0a7925b authored by Keishi Hattori's avatar Keishi Hattori Committed by Commit Bot

Allow cooperative scheduling for ScheduledAction

ScheduledAction::Execute is only ever called by DOMTimer::Fired which is called as a task. So the stack is simple and we should be able to add AllowedStackScope and allow cooperative scheduling.

Bug: 804661
Change-Id: Ida6d3605810469d0e95b6e72ded3f1aed05ad341
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1743236
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#691088}
parent 07a306fc
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/scheduler/public/cooperative_scheduling_manager.h"
#include "third_party/blink/renderer/platform/wtf/casting.h" #include "third_party/blink/renderer/platform/wtf/casting.h"
namespace blink { namespace blink {
...@@ -132,6 +133,7 @@ void ScheduledAction::Execute(ExecutionContext* context) { ...@@ -132,6 +133,7 @@ void ScheduledAction::Execute(ExecutionContext* context) {
DVLOG(1) << "ScheduledAction::execute " << this << ": context is empty"; DVLOG(1) << "ScheduledAction::execute " << this << ": context is empty";
return; return;
} }
// ExecutionContext::CanExecuteScripts() relies on the current context to // ExecutionContext::CanExecuteScripts() relies on the current context to
// determine if it is allowed. Enter the scope here. // determine if it is allowed. Enter the scope here.
ScriptState::Scope scope(script_state_->Get()); ScriptState::Scope scope(script_state_->Get());
...@@ -147,6 +149,9 @@ void ScheduledAction::Execute(ExecutionContext* context) { ...@@ -147,6 +149,9 @@ void ScheduledAction::Execute(ExecutionContext* context) {
<< ": frame can not execute scripts"; << ": frame can not execute scripts";
return; return;
} }
scheduler::CooperativeSchedulingManager::AllowedStackScope
allowed_stack_scope(
scheduler::CooperativeSchedulingManager::Instance());
Execute(frame); Execute(frame);
} else { } else {
DVLOG(1) << "ScheduledAction::execute " << this << ": worker scope"; DVLOG(1) << "ScheduledAction::execute " << this << ": worker scope";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment