Commit 5f6049ec authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

Remove useless WebTextCheckClient::ClearAllPendingRequests

WebTextCheckClient used to hold strong reference to Blink objects, which
requires explicit cleanup to avoid leaking those objects.

Now that the references have become weak, the explicit cleanup is no
longer needed. Hence, this patch removes the relevant logic.

Bug: 924616
Cq-Include-Trybots: luci.chromium.try:leak_detection_linux; luci.chromium.try:linux_chromium_asan_rel_ng; luci.chromium.try:layout_test_leak_detection
Change-Id: Ied66b4dfd1a6c58d0253c21ddbc007889c91be6a
Reviewed-on: https://chromium-review.googlesource.com/c/1431393Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625766}
parent 6c1c9f8d
...@@ -192,14 +192,6 @@ void SpellCheckProvider::RequestCheckingOfText( ...@@ -192,14 +192,6 @@ void SpellCheckProvider::RequestCheckingOfText(
UMA_HISTOGRAM_COUNTS_1M("SpellCheck.api.async", text.length()); UMA_HISTOGRAM_COUNTS_1M("SpellCheck.api.async", text.length());
} }
void SpellCheckProvider::CancelAllPendingRequests() {
for (WebTextCheckCompletions::iterator iter(&text_check_completions_);
!iter.IsAtEnd(); iter.Advance()) {
iter.GetCurrentValue()->DidCancelCheckingText();
}
text_check_completions_.Clear();
}
#if !BUILDFLAG(USE_BROWSER_SPELLCHECKER) #if !BUILDFLAG(USE_BROWSER_SPELLCHECKER)
void SpellCheckProvider::OnRespondSpellingService( void SpellCheckProvider::OnRespondSpellingService(
int identifier, int identifier,
......
...@@ -96,7 +96,6 @@ class SpellCheckProvider ...@@ -96,7 +96,6 @@ class SpellCheckProvider
void RequestCheckingOfText( void RequestCheckingOfText(
const blink::WebString& text, const blink::WebString& text,
blink::WebTextCheckingCompletion* completion) override; blink::WebTextCheckingCompletion* completion) override;
void CancelAllPendingRequests() override;
#if !BUILDFLAG(USE_BROWSER_SPELLCHECKER) #if !BUILDFLAG(USE_BROWSER_SPELLCHECKER)
void OnRespondSpellingService(int identifier, void OnRespondSpellingService(int identifier,
......
...@@ -90,13 +90,6 @@ void SpellCheckClient::RequestCheckingOfText( ...@@ -90,13 +90,6 @@ void SpellCheckClient::RequestCheckingOfText(
} }
} }
void SpellCheckClient::CancelAllPendingRequests() {
if (!last_requested_text_checking_completion_)
return;
last_requested_text_checking_completion_->DidCancelCheckingText();
last_requested_text_checking_completion_ = nullptr;
}
void SpellCheckClient::FinishLastTextCheck() { void SpellCheckClient::FinishLastTextCheck() {
if (!last_requested_text_checking_completion_) if (!last_requested_text_checking_completion_)
return; return;
......
...@@ -50,7 +50,6 @@ class SpellCheckClient : public blink::WebTextCheckClient { ...@@ -50,7 +50,6 @@ class SpellCheckClient : public blink::WebTextCheckClient {
void RequestCheckingOfText( void RequestCheckingOfText(
const blink::WebString& text, const blink::WebString& text,
blink::WebTextCheckingCompletion* completion) override; blink::WebTextCheckingCompletion* completion) override;
void CancelAllPendingRequests() override;
private: private:
void FinishLastTextCheck(); void FinishLastTextCheck();
......
...@@ -34,10 +34,6 @@ class WebTextCheckClient { ...@@ -34,10 +34,6 @@ class WebTextCheckClient {
const WebString& text_to_check, const WebString& text_to_check,
WebTextCheckingCompletion* completion_callback) {} WebTextCheckingCompletion* completion_callback) {}
// Clear all stored references to requests, so that it will not become a
// leak source.
virtual void CancelAllPendingRequests() {}
protected: protected:
virtual ~WebTextCheckClient() = default; virtual ~WebTextCheckClient() = default;
}; };
......
...@@ -237,11 +237,6 @@ void SpellCheckRequester::PrepareForLeakDetection() { ...@@ -237,11 +237,6 @@ void SpellCheckRequester::PrepareForLeakDetection() {
// the leak detector, they're all cancelled to prevent flaky leaks being // the leak detector, they're all cancelled to prevent flaky leaks being
// reported. // reported.
request_queue_.clear(); 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) { void SpellCheckRequester::InvokeRequest(SpellCheckRequest* request) {
......
...@@ -6859,12 +6859,6 @@ class StubbornTextCheckClient : public WebTextCheckClient { ...@@ -6859,12 +6859,6 @@ class StubbornTextCheckClient : public WebTextCheckClient {
WebTextCheckingCompletion* completion) override { WebTextCheckingCompletion* completion) override {
completion_ = completion; completion_ = completion;
} }
void CancelAllPendingRequests() override {
if (!completion_)
return;
completion_->DidCancelCheckingText();
completion_ = nullptr;
}
void KickNoResults() { Kick(-1, -1, kWebTextDecorationTypeSpelling); } void KickNoResults() { Kick(-1, -1, kWebTextDecorationTypeSpelling); }
......
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