summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/editing/spellcheck
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-13 16:23:34 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-14 10:37:21 +0000
commit38a9a29f4f9436cace7f0e7abf9c586057df8a4e (patch)
treec4e8c458dc595bc0ddb435708fa2229edfd00bd4 /chromium/third_party/blink/renderer/core/editing/spellcheck
parente684a3455bcc29a6e3e66a004e352dea4e1141e7 (diff)
downloadqtwebengine-chromium-38a9a29f4f9436cace7f0e7abf9c586057df8a4e.tar.gz
BASELINE: Update Chromium to 73.0.3683.37
Change-Id: I08c9af2948b645f671e5d933aca1f7a90ea372f2 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/editing/spellcheck')
-rw-r--r--chromium/third_party/blink/renderer/core/editing/spellcheck/cold_mode_spell_check_requester.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/editing/spellcheck/cold_mode_spell_check_requester.h4
-rw-r--r--chromium/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.h4
-rw-r--r--chromium/third_party/blink/renderer/core/editing/spellcheck/spell_check_requester.cc15
-rw-r--r--chromium/third_party/blink/renderer/core/editing/spellcheck/spell_checker.h3
6 files changed, 16 insertions, 14 deletions
diff --git a/chromium/third_party/blink/renderer/core/editing/spellcheck/cold_mode_spell_check_requester.cc b/chromium/third_party/blink/renderer/core/editing/spellcheck/cold_mode_spell_check_requester.cc
index d1f45225520..e4d6b57c21b 100644
--- a/chromium/third_party/blink/renderer/core/editing/spellcheck/cold_mode_spell_check_requester.cc
+++ b/chromium/third_party/blink/renderer/core/editing/spellcheck/cold_mode_spell_check_requester.cc
@@ -30,7 +30,7 @@ const int kInvalidChunkIndex = -1;
// static
ColdModeSpellCheckRequester* ColdModeSpellCheckRequester::Create(
LocalFrame& frame) {
- return new ColdModeSpellCheckRequester(frame);
+ return MakeGarbageCollected<ColdModeSpellCheckRequester>(frame);
}
void ColdModeSpellCheckRequester::Trace(blink::Visitor* visitor) {
diff --git a/chromium/third_party/blink/renderer/core/editing/spellcheck/cold_mode_spell_check_requester.h b/chromium/third_party/blink/renderer/core/editing/spellcheck/cold_mode_spell_check_requester.h
index 12fe2e355e3..cf73d780d24 100644
--- a/chromium/third_party/blink/renderer/core/editing/spellcheck/cold_mode_spell_check_requester.h
+++ b/chromium/third_party/blink/renderer/core/editing/spellcheck/cold_mode_spell_check_requester.h
@@ -25,6 +25,8 @@ class ColdModeSpellCheckRequester
public:
static ColdModeSpellCheckRequester* Create(LocalFrame&);
+ explicit ColdModeSpellCheckRequester(LocalFrame&);
+
void SetNeedsMoreInvocationForTesting() {
needs_more_invocation_for_testing_ = true;
}
@@ -37,8 +39,6 @@ class ColdModeSpellCheckRequester
void Trace(blink::Visitor*);
private:
- explicit ColdModeSpellCheckRequester(LocalFrame&);
-
LocalFrame& GetFrame() const { return *frame_; }
SpellCheckRequester& GetSpellCheckRequester() const;
diff --git a/chromium/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.cc b/chromium/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.cc
index 6dfe7b5ec4e..8f7de165492 100644
--- a/chromium/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.cc
+++ b/chromium/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.cc
@@ -70,7 +70,7 @@ void IdleSpellCheckController::Trace(blink::Visitor* visitor) {
}
IdleSpellCheckController* IdleSpellCheckController::Create(LocalFrame& frame) {
- return new IdleSpellCheckController(frame);
+ return MakeGarbageCollected<IdleSpellCheckController>(frame);
}
IdleSpellCheckController::IdleSpellCheckController(LocalFrame& frame)
diff --git a/chromium/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.h b/chromium/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.h
index 5e03f504dce..646d7444001 100644
--- a/chromium/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.h
+++ b/chromium/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.h
@@ -34,6 +34,8 @@ class CORE_EXPORT IdleSpellCheckController final
public:
static IdleSpellCheckController* Create(LocalFrame&);
+
+ explicit IdleSpellCheckController(LocalFrame&);
~IdleSpellCheckController();
enum class State {
@@ -66,8 +68,6 @@ class CORE_EXPORT IdleSpellCheckController final
private:
class IdleCallback;
- explicit IdleSpellCheckController(LocalFrame&);
-
LocalFrame& GetFrame() const { return *frame_; }
// Returns whether there is an active document to work on.
diff --git a/chromium/third_party/blink/renderer/core/editing/spellcheck/spell_check_requester.cc b/chromium/third_party/blink/renderer/core/editing/spellcheck/spell_check_requester.cc
index 4f1134de40f..3098bd0798f 100644
--- a/chromium/third_party/blink/renderer/core/editing/spellcheck/spell_check_requester.cc
+++ b/chromium/third_party/blink/renderer/core/editing/spellcheck/spell_check_requester.cc
@@ -59,12 +59,14 @@ class WebTextCheckingCompletionImpl : public WebTextCheckingCompletion {
void DidFinishCheckingText(
const WebVector<WebTextCheckingResult>& results) override {
- request_->DidSucceed(ToCoreResults(results));
+ if (request_)
+ request_->DidSucceed(ToCoreResults(results));
delete this;
}
void DidCancelCheckingText() override {
- request_->DidCancel();
+ if (request_)
+ request_->DidCancel();
// TODO(dgozman): use std::unique_ptr.
delete this;
}
@@ -72,7 +74,9 @@ class WebTextCheckingCompletionImpl : public WebTextCheckingCompletion {
private:
virtual ~WebTextCheckingCompletionImpl() = default;
- Persistent<SpellCheckRequest> request_;
+ // As |WebTextCheckingCompletionImpl| is mananaged outside Blink, it should
+ // only keep weak references to Blink objects to prevent memory leaks.
+ WeakPersistent<SpellCheckRequest> request_;
};
} // namespace
@@ -233,11 +237,6 @@ void SpellCheckRequester::PrepareForLeakDetection() {
// the leak detector, they're all cancelled to prevent flaky leaks being
// reported.
request_queue_.clear();
- // WebTextCheckClient stores a set of WebTextCheckingCompletion objects,
- // which may store references to already invoked requests. We should clear
- // these references to prevent them from being a leak source.
- if (WebTextCheckClient* text_checker_client = GetTextCheckerClient())
- text_checker_client->CancelAllPendingRequests();
}
void SpellCheckRequester::InvokeRequest(SpellCheckRequest* request) {
diff --git a/chromium/third_party/blink/renderer/core/editing/spellcheck/spell_checker.h b/chromium/third_party/blink/renderer/core/editing/spellcheck/spell_checker.h
index c25947e0511..419b1d02523 100644
--- a/chromium/third_party/blink/renderer/core/editing/spellcheck/spell_checker.h
+++ b/chromium/third_party/blink/renderer/core/editing/spellcheck/spell_checker.h
@@ -97,6 +97,9 @@ class CORE_EXPORT SpellChecker final : public GarbageCollected<SpellChecker> {
//
// Hence allow the leak detector to effectively stop the spell checker to
// ensure leak reporting stability.
+ //
+ // TODO(xiaochengh): Now that there's no strong reference to SpellCheckRequest
+ // from outside Blink, this function may have become redundant. Investigate.
void PrepareForLeakDetection();
void DidAttachDocument(Document*);