Commit 5d8ae4f4 authored by Darren Shen's avatar Darren Shen Committed by Commit Bot

ime: Fix IME service disconnection bug.

When the system PK feature flag is enabled, NativeInputMethodEngine will
connect to the IME service. NativeInputMethodEngine is itself a Receiver
that receives Mojo calls from the IME service.

The IME service frequently calls ProcessMessage on the Mojo interface,
but NativeInputMethodEngine doesn't handle it on purpose (ProcessMessage
is only used by the IME extension). However, NativeInputMethodEngine::
ProcessMessage must invoke the callback, or else the connection will
drop [1].

Hence, NativeInputMethodEngine::ProcessMessage should ignore all messages
but still run the callback to avoid dropping the connection.

[1] https://source.chromium.org/chromium/chromium/src/+/master:mojo/public/cpp/bindings/tests/receiver_callback_unittest.cc;l=292;drc=9c82b0a2f6742e35cb0368ba61568ce0522dd1ec

Bug: 1019541
Change-Id: Ie66c32fde279c441513d99607db2f54c2fd4ef51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2410102Reviewed-by: default avatarLeo Zhang <googleo@chromium.org>
Commit-Queue: Darren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810492}
parent 0cc01e57
......@@ -162,6 +162,13 @@ void NativeInputMethodEngine::ImeObserver::OnActivate(
}
base_observer_->OnActivate(engine_id);
}
void NativeInputMethodEngine::ImeObserver::ProcessMessage(
const std::vector<uint8_t>& message,
ProcessMessageCallback callback) {
// NativeInputMethodEngine doesn't use binary messages, but it must run the
// callback to avoid dropping the connection.
std::move(callback).Run(std::vector<uint8_t>());
}
void NativeInputMethodEngine::ImeObserver::OnFocus(
const IMEEngineHandlerInterface::InputContext& context) {
......
......@@ -91,7 +91,7 @@ class NativeInputMethodEngine : public InputMethodEngine {
// mojom::InputChannel:
void ProcessMessage(const std::vector<uint8_t>& message,
ProcessMessageCallback callback) override {}
ProcessMessageCallback callback) override;
void OnFocus() override {}
void ProcessKeypressForRulebased(
ime::mojom::PhysicalKeyEventPtr event,
......
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