| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
drive-by suggestion
std::unique_ptr<Core, base::OnTaskRunnerDeleter> core_;could you use `base::SequenceBound<Core> core_;` here?
core_(new Core(), base::OnTaskRunnerDeleter(ui_task_runner_)) {```
core_(content::GetUIThreadTaskRunner({}),
base::BindPostTaskToCurrentDefault(base::BindOnce(
&OnDeviceSpeechRecognitionEngine::OnAsrStreamCreated,
weak_factory_.GetWeakPtr()))) {
```
// Safe because core_ is deleted via DeleteSoon on the same task runner,
// guaranteeing this task will run before the Deleter task.
ui_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&Core::CreateModelClient, base::Unretained(core_.get()),
config_.initial_context.global_id, config_.quality));```
core_.AsyncCall(&Core::CreateModelClient)
.WithArgs(config_.initial_context.global_id, config_.quality);
```
// Safe because core_ is deleted via DeleteSoon on the same task runner,
// guaranteeing this task will run before the Deleter task.
ui_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&Core::SetAudioParameters, base::Unretained(core_.get()),
audio_parameters.sample_rate()));```
core_.AsyncCall(&Core::SetAudioParameters)
.WithArgs(audio_parameters.sample_rate());
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
std::unique_ptr<Core, base::OnTaskRunnerDeleter> core_;could you use `base::SequenceBound<Core> core_;` here?
Done
core_(new Core(), base::OnTaskRunnerDeleter(ui_task_runner_)) {```
core_(content::GetUIThreadTaskRunner({}),
base::BindPostTaskToCurrentDefault(base::BindOnce(
&OnDeviceSpeechRecognitionEngine::OnAsrStreamCreated,
weak_factory_.GetWeakPtr()))) {
```
Done
// Safe because core_ is deleted via DeleteSoon on the same task runner,
// guaranteeing this task will run before the Deleter task.
ui_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&Core::CreateModelClient, base::Unretained(core_.get()),
config_.initial_context.global_id, config_.quality));Evan Liu```
core_.AsyncCall(&Core::CreateModelClient)
.WithArgs(config_.initial_context.global_id, config_.quality);
```
Done
// Safe because core_ is deleted via DeleteSoon on the same task runner,
// guaranteeing this task will run before the Deleter task.
ui_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&Core::SetAudioParameters, base::Unretained(core_.get()),
audio_parameters.sample_rate()));Evan Liu```
core_.AsyncCall(&Core::SetAudioParameters)
.WithArgs(audio_parameters.sample_rate());
```
Done
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
core_ = base::SequenceBound<Core>(move into initializer list; i.e., `core_(...)` just after `config_` above
session_created_ = true;already done on line 189
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Commit-Queue | +2 |
move into initializer list; i.e., `core_(...)` just after `config_` above
Reverting this change since `weak_factory_` isn't initialized in the initializer list.
already done on line 189
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
18 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: content/browser/speech/on_device_speech_recognition_engine_impl.cc
Insertions: 0, Deletions: 2.
@@ -208,8 +208,6 @@
std::move(on_stream_created_callback_)
.Run(std::move(asr_stream), std::move(asr_stream_responder));
}
-
- session_created_ = true;
}
void OnDeviceSpeechRecognitionEngine::OnAsrStreamCreated(
```
speech: Fix threading sequence checker in OnDeviceSpeechRecognitionEngine
Encapsulates all UI-thread-specific state into a dedicated Core class to
ensure state mutations only happen on the UI thread. Cross-thread
communication is handled using base::BindPostTask to seamlessly hop
between the IO and UI threads, fixing a sequence checker crash during
model initialization.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |