Commit 30291a6e authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Change Speech Recognition to use a normal Remote instead of a RevocableBinding.

RevocableBinding is going to go away. Change to use a direct Receiver
interface.

BUG=978694

Change-Id: Ib936e500b8e203ac1cbbe739867ff671bb1f22fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1834074Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarMario Sanchez Prada <mario@igalia.com>
Commit-Queue: Mario Sanchez Prada <mario@igalia.com>
Cr-Commit-Position: refs/heads/master@{#701946}
parent ee8fdbdd
...@@ -60,9 +60,8 @@ void SpeechRecognition::start(ExceptionState& exception_state) { ...@@ -60,9 +60,8 @@ void SpeechRecognition::start(ExceptionState& exception_state) {
GetExecutionContext()->GetTaskRunner(blink::TaskType::kMiscPlatformAPI); GetExecutionContext()->GetTaskRunner(blink::TaskType::kMiscPlatformAPI);
mojo::PendingRemote<mojom::blink::SpeechRecognitionSessionClient> mojo::PendingRemote<mojom::blink::SpeechRecognitionSessionClient>
session_client; session_client;
binding_.Bind(session_client.InitWithNewPipeAndPassReceiver(), receiver_.Bind(session_client.InitWithNewPipeAndPassReceiver(), task_runner);
GetExecutionContext()->GetInterfaceInvalidator(), task_runner); receiver_.set_disconnect_handler(WTF::Bind(
binding_.set_connection_error_handler(WTF::Bind(
&SpeechRecognition::OnConnectionError, WrapWeakPersistent(this))); &SpeechRecognition::OnConnectionError, WrapWeakPersistent(this)));
mojo::PendingReceiver<mojom::blink::SpeechRecognitionSession> mojo::PendingReceiver<mojom::blink::SpeechRecognitionSession>
...@@ -175,7 +174,7 @@ void SpeechRecognition::Ended() { ...@@ -175,7 +174,7 @@ void SpeechRecognition::Ended() {
started_ = false; started_ = false;
stopping_ = false; stopping_ = false;
session_.reset(); session_.reset();
binding_.Close(); receiver_.reset();
DispatchEvent(*Event::Create(event_type_names::kEnd)); DispatchEvent(*Event::Create(event_type_names::kEnd));
} }
...@@ -189,6 +188,7 @@ ExecutionContext* SpeechRecognition::GetExecutionContext() const { ...@@ -189,6 +188,7 @@ ExecutionContext* SpeechRecognition::GetExecutionContext() const {
void SpeechRecognition::ContextDestroyed(ExecutionContext*) { void SpeechRecognition::ContextDestroyed(ExecutionContext*) {
controller_ = nullptr; controller_ = nullptr;
receiver_.reset();
} }
bool SpeechRecognition::HasPendingActivity() const { bool SpeechRecognition::HasPendingActivity() const {
...@@ -222,7 +222,7 @@ SpeechRecognition::SpeechRecognition(LocalFrame* frame, ...@@ -222,7 +222,7 @@ SpeechRecognition::SpeechRecognition(LocalFrame* frame,
controller_(SpeechRecognitionController::From(frame)), controller_(SpeechRecognitionController::From(frame)),
started_(false), started_(false),
stopping_(false), stopping_(false),
binding_(this) {} receiver_(this) {}
SpeechRecognition::~SpeechRecognition() = default; SpeechRecognition::~SpeechRecognition() = default;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_SPEECH_SPEECH_RECOGNITION_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_SPEECH_SPEECH_RECOGNITION_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_SPEECH_SPEECH_RECOGNITION_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_SPEECH_SPEECH_RECOGNITION_H_
#include "mojo/public/cpp/bindings/receiver.h"
#include "third_party/blink/public/mojom/speech/speech_recognizer.mojom-blink.h" #include "third_party/blink/public/mojom/speech/speech_recognizer.mojom-blink.h"
#include "third_party/blink/public/platform/web_private_ptr.h" #include "third_party/blink/public/platform/web_private_ptr.h"
#include "third_party/blink/renderer/bindings/core/v8/active_script_wrappable.h" #include "third_party/blink/renderer/bindings/core/v8/active_script_wrappable.h"
...@@ -36,7 +37,6 @@ ...@@ -36,7 +37,6 @@
#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_result.h" #include "third_party/blink/renderer/modules/speech/speech_recognition_result.h"
#include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/mojo/revocable_binding.h"
#include "third_party/blink/renderer/platform/mojo/revocable_interface_ptr.h" #include "third_party/blink/renderer/platform/mojo/revocable_interface_ptr.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
...@@ -135,7 +135,7 @@ class MODULES_EXPORT SpeechRecognition final ...@@ -135,7 +135,7 @@ class MODULES_EXPORT SpeechRecognition final
bool started_; bool started_;
bool stopping_; bool stopping_;
HeapVector<Member<SpeechRecognitionResult>> final_results_; HeapVector<Member<SpeechRecognitionResult>> final_results_;
RevocableBinding<mojom::blink::SpeechRecognitionSessionClient> binding_; mojo::Receiver<mojom::blink::SpeechRecognitionSessionClient> receiver_;
RevocableInterfacePtr<mojom::blink::SpeechRecognitionSession> session_; RevocableInterfacePtr<mojom::blink::SpeechRecognitionSession> session_;
}; };
......
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