use unique_ptr instead of shared_ptr for SpellcheckRequest
This commit is contained in:
parent
a5e6e957cf
commit
12f95429bf
1 changed files with 3 additions and 6 deletions
|
@ -54,16 +54,14 @@ class SpellCheckClient::SpellcheckRequest {
|
||||||
~SpellcheckRequest() {}
|
~SpellcheckRequest() {}
|
||||||
|
|
||||||
const base::string16& text() const { return text_; }
|
const base::string16& text() const { return text_; }
|
||||||
std::shared_ptr<blink::WebTextCheckingCompletion> completion() {
|
blink::WebTextCheckingCompletion* completion() { return completion_.get(); }
|
||||||
return completion_;
|
|
||||||
}
|
|
||||||
WordMap& wordmap() { return word_map_; }
|
WordMap& wordmap() { return word_map_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
base::string16 text_; // Text to be checked in this task.
|
base::string16 text_; // Text to be checked in this task.
|
||||||
WordMap word_map_; // WordMap to hold distinct words in text
|
WordMap word_map_; // WordMap to hold distinct words in text
|
||||||
// The interface to send the misspelled ranges to WebKit.
|
// The interface to send the misspelled ranges to WebKit.
|
||||||
std::shared_ptr<blink::WebTextCheckingCompletion> completion_;
|
std::unique_ptr<blink::WebTextCheckingCompletion> completion_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(SpellcheckRequest);
|
DISALLOW_COPY_AND_ASSIGN(SpellcheckRequest);
|
||||||
};
|
};
|
||||||
|
@ -191,7 +189,6 @@ void SpellCheckClient::SpellCheckText() {
|
||||||
void SpellCheckClient::OnSpellCheckDone(
|
void SpellCheckClient::OnSpellCheckDone(
|
||||||
const std::vector<base::string16>& misspelled_words) {
|
const std::vector<base::string16>& misspelled_words) {
|
||||||
std::vector<blink::WebTextCheckingResult> results;
|
std::vector<blink::WebTextCheckingResult> results;
|
||||||
auto completion_handler = pending_request_param_->completion();
|
|
||||||
|
|
||||||
auto& word_map = pending_request_param_->wordmap();
|
auto& word_map = pending_request_param_->wordmap();
|
||||||
|
|
||||||
|
@ -208,7 +205,7 @@ void SpellCheckClient::OnSpellCheckDone(
|
||||||
words.clear();
|
words.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
completion_handler->DidFinishCheckingText(results);
|
pending_request_param_->completion()->DidFinishCheckingText(results);
|
||||||
pending_request_param_ = nullptr;
|
pending_request_param_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue