Commit 27bb2916 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

Inline static Create() factory functions from renderer/modules/speech

This CL removes Create() factory functions in
//third_partyb/blink/renderer/modules/speech only when it
meets the policy of removing Create(). Then, this CL makes all callers
use MakeGarbageCollected<Foo> instead.

This CL removes below factory functions,
  - SpeechRecognitionController::Create
  - SpeechSynthesisVoice::Create
  - SpeechRecognitionAlternative::Create

Bug: 939691
Change-Id: Ieb586730ca358e01e50105cf3f2b5987ea256b8d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1961288Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#724070}
parent be45be71
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "third_party/blink/renderer/modules/speech/speech_recognition_error_event.h" #include "third_party/blink/renderer/modules/speech/speech_recognition_error_event.h"
#include "third_party/blink/renderer/modules/speech/speech_recognition_event.h" #include "third_party/blink/renderer/modules/speech/speech_recognition_event.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
namespace blink { namespace blink {
...@@ -107,7 +108,7 @@ void SpeechRecognition::ResultRetrieved( ...@@ -107,7 +108,7 @@ void SpeechRecognition::ResultRetrieved(
HeapVector<Member<SpeechRecognitionAlternative>> alternatives; HeapVector<Member<SpeechRecognitionAlternative>> alternatives;
alternatives.ReserveInitialCapacity(result->hypotheses.size()); alternatives.ReserveInitialCapacity(result->hypotheses.size());
for (const auto& hypothesis : result->hypotheses) { for (const auto& hypothesis : result->hypotheses) {
alternatives.push_back(SpeechRecognitionAlternative::Create( alternatives.push_back(MakeGarbageCollected<SpeechRecognitionAlternative>(
hypothesis->utterance, hypothesis->confidence)); hypothesis->utterance, hypothesis->confidence));
} }
aggregated_results.push_back(SpeechRecognitionResult::Create( aggregated_results.push_back(SpeechRecognitionResult::Create(
......
...@@ -27,13 +27,6 @@ ...@@ -27,13 +27,6 @@
namespace blink { namespace blink {
SpeechRecognitionAlternative* SpeechRecognitionAlternative::Create(
const String& transcript,
double confidence) {
return MakeGarbageCollected<SpeechRecognitionAlternative>(transcript,
confidence);
}
SpeechRecognitionAlternative::SpeechRecognitionAlternative( SpeechRecognitionAlternative::SpeechRecognitionAlternative(
const String& transcript, const String& transcript,
double confidence) double confidence)
......
...@@ -37,8 +37,6 @@ class MODULES_EXPORT SpeechRecognitionAlternative final ...@@ -37,8 +37,6 @@ class MODULES_EXPORT SpeechRecognitionAlternative final
DEFINE_WRAPPERTYPEINFO(); DEFINE_WRAPPERTYPEINFO();
public: public:
static SpeechRecognitionAlternative* Create(const String&, double);
SpeechRecognitionAlternative(const String&, double); SpeechRecognitionAlternative(const String&, double);
const String& transcript() const { return transcript_; } const String& transcript() const { return transcript_; }
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/modules/speech/speech_grammar_list.h" #include "third_party/blink/renderer/modules/speech/speech_grammar_list.h"
#include "third_party/blink/renderer/modules/speech/speech_recognition.h" #include "third_party/blink/renderer/modules/speech/speech_recognition.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
namespace blink { namespace blink {
...@@ -44,11 +45,6 @@ SpeechRecognitionController::~SpeechRecognitionController() { ...@@ -44,11 +45,6 @@ SpeechRecognitionController::~SpeechRecognitionController() {
// FIXME: Call m_client->pageDestroyed(); once we have implemented a client. // FIXME: Call m_client->pageDestroyed(); once we have implemented a client.
} }
SpeechRecognitionController* SpeechRecognitionController::Create(
LocalFrame& frame) {
return MakeGarbageCollected<SpeechRecognitionController>(frame);
}
void SpeechRecognitionController::Start( void SpeechRecognitionController::Start(
mojo::PendingReceiver<mojom::blink::SpeechRecognitionSession> mojo::PendingReceiver<mojom::blink::SpeechRecognitionSession>
session_receiver, session_receiver,
...@@ -79,7 +75,7 @@ void SpeechRecognitionController::Start( ...@@ -79,7 +75,7 @@ void SpeechRecognitionController::Start(
void ProvideSpeechRecognitionTo(LocalFrame& frame) { void ProvideSpeechRecognitionTo(LocalFrame& frame) {
SpeechRecognitionController::ProvideTo( SpeechRecognitionController::ProvideTo(
frame, SpeechRecognitionController::Create(frame)); frame, MakeGarbageCollected<SpeechRecognitionController>(frame));
} }
mojo::Remote<mojom::blink::SpeechRecognizer>& mojo::Remote<mojom::blink::SpeechRecognizer>&
......
...@@ -60,7 +60,6 @@ class SpeechRecognitionController final ...@@ -60,7 +60,6 @@ class SpeechRecognitionController final
bool interim_results, bool interim_results,
uint32_t max_alternatives); uint32_t max_alternatives);
static SpeechRecognitionController* Create(LocalFrame& frame);
static SpeechRecognitionController* From(LocalFrame* frame) { static SpeechRecognitionController* From(LocalFrame* frame) {
return Supplement<LocalFrame>::From<SpeechRecognitionController>(frame); return Supplement<LocalFrame>::From<SpeechRecognitionController>(frame);
} }
......
...@@ -72,8 +72,10 @@ SpeechSynthesis::SpeechSynthesis(ExecutionContext* context) ...@@ -72,8 +72,10 @@ SpeechSynthesis::SpeechSynthesis(ExecutionContext* context)
void SpeechSynthesis::OnSetVoiceList( void SpeechSynthesis::OnSetVoiceList(
Vector<mojom::blink::SpeechSynthesisVoicePtr> mojom_voices) { Vector<mojom::blink::SpeechSynthesisVoicePtr> mojom_voices) {
voice_list_.clear(); voice_list_.clear();
for (auto& mojom_voice : mojom_voices) for (auto& mojom_voice : mojom_voices) {
voice_list_.push_back(SpeechSynthesisVoice::Create(std::move(mojom_voice))); voice_list_.push_back(
MakeGarbageCollected<SpeechSynthesisVoice>(std::move(mojom_voice)));
}
VoicesDidChange(); VoicesDidChange();
} }
......
...@@ -27,11 +27,6 @@ ...@@ -27,11 +27,6 @@
namespace blink { namespace blink {
SpeechSynthesisVoice* SpeechSynthesisVoice::Create(
mojom::blink::SpeechSynthesisVoicePtr voice) {
return MakeGarbageCollected<SpeechSynthesisVoice>(std::move(voice));
}
SpeechSynthesisVoice::SpeechSynthesisVoice( SpeechSynthesisVoice::SpeechSynthesisVoice(
mojom::blink::SpeechSynthesisVoicePtr mojom_voice) mojom::blink::SpeechSynthesisVoicePtr mojom_voice)
: mojom_voice_(std::move(mojom_voice)) {} : mojom_voice_(std::move(mojom_voice)) {}
......
...@@ -38,9 +38,6 @@ class SpeechSynthesisVoice final : public ScriptWrappable { ...@@ -38,9 +38,6 @@ class SpeechSynthesisVoice final : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO(); DEFINE_WRAPPERTYPEINFO();
public: public:
static SpeechSynthesisVoice* Create(
mojom::blink::SpeechSynthesisVoicePtr mojom_voice);
explicit SpeechSynthesisVoice( explicit SpeechSynthesisVoice(
mojom::blink::SpeechSynthesisVoicePtr mojom_voice); mojom::blink::SpeechSynthesisVoicePtr mojom_voice);
~SpeechSynthesisVoice() override; ~SpeechSynthesisVoice() override;
......
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