#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.h"
#include "base/check_deref.h"
#include "base/debug/crash_logging.h"
#include "base/time/time.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_idle_request_options.h"
#include "third_party/blink/renderer/core/editing/commands/undo_stack.h"
#include "third_party/blink/renderer/core/editing/commands/undo_step.h"
#include "third_party/blink/renderer/core/editing/editing_utilities.h"
#include "third_party/blink/renderer/core/editing/editor.h"
#include "third_party/blink/renderer/core/editing/ephemeral_range.h"
#include "third_party/blink/renderer/core/editing/frame_selection.h"
#include "third_party/blink/renderer/core/editing/iterators/character_iterator.h"
#include "third_party/blink/renderer/core/editing/selection_template.h"
#include "third_party/blink/renderer/core/editing/spellcheck/cold_mode_spell_check_requester.h"
#include "third_party/blink/renderer/core/editing/spellcheck/hot_mode_spell_check_requester.h"
#include "third_party/blink/renderer/core/editing/spellcheck/spell_check_requester.h"
#include "third_party/blink/renderer/core/editing/spellcheck/spell_checker.h"
#include "third_party/blink/renderer/core/editing/visible_selection.h"
#include "third_party/blink/renderer/core/editing/visible_units.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/scheduler/scripted_idle_task_controller.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cancellable_task.h"
namespace blink {
namespace {
constexpr base::TimeDelta kColdModeTimerInterval = …;
constexpr base::TimeDelta kConsecutiveColdModeTimerInterval = …;
const int kHotModeRequestTimeoutMS = …;
const int kInvalidHandle = …;
const int kDummyHandleForForcedInvocation = …;
constexpr base::TimeDelta kIdleSpellcheckTestTimeout = …;
}
class IdleSpellCheckController::IdleCallback final : public IdleTask { … };
IdleSpellCheckController::~IdleSpellCheckController() = default;
void IdleSpellCheckController::Trace(Visitor* visitor) const { … }
IdleSpellCheckController::IdleSpellCheckController(
LocalDOMWindow& window,
SpellCheckRequester& requester)
: … { … }
LocalDOMWindow& IdleSpellCheckController::GetWindow() const { … }
Document& IdleSpellCheckController::GetDocument() const { … }
bool IdleSpellCheckController::IsSpellCheckingEnabled() const { … }
void IdleSpellCheckController::DisposeIdleCallback() { … }
void IdleSpellCheckController::Deactivate() { … }
void IdleSpellCheckController::RespondToChangedSelection() { … }
void IdleSpellCheckController::RespondToChangedContents() { … }
void IdleSpellCheckController::RespondToChangedEnablement() { … }
void IdleSpellCheckController::SetNeedsInvocation() { … }
void IdleSpellCheckController::SetNeedsColdModeInvocation() { … }
void IdleSpellCheckController::ColdModeTimerFired() { … }
bool IdleSpellCheckController::NeedsHotModeCheckingUnderCurrentSelection()
const { … }
void IdleSpellCheckController::HotModeInvocation(IdleDeadline* deadline) { … }
void IdleSpellCheckController::Invoke(IdleDeadline* deadline) { … }
void IdleSpellCheckController::ContextDestroyed() { … }
void IdleSpellCheckController::ForceInvocationForTesting() { … }
void IdleSpellCheckController::SkipColdModeTimerForTesting() { … }
void IdleSpellCheckController::SetNeedsMoreColdModeInvocationForTesting() { … }
void IdleSpellCheckController::SetSpellCheckingDisabled(
const Element& element) { … }
const char* IdleSpellCheckController::GetStateAsString() const { … }
}