Commit f2520bc2 authored by Darren Shen's avatar Darren Shen Committed by Commit Bot

ime: Use consistent C++ naming style.

Some of the code from crrev/2537516 uses JS style rather than C++ style.

Bug: b/172527471
Change-Id: Iee01a5eccc83b6c7060cb7c32aa51981cda09f6f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2557702
Commit-Queue: Leo Zhang <googleo@chromium.org>
Reviewed-by: default avatarLeo Zhang <googleo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#831233}
parent 51c50a15
...@@ -67,9 +67,9 @@ DecoderEngine::~DecoderEngine() {} ...@@ -67,9 +67,9 @@ DecoderEngine::~DecoderEngine() {}
bool DecoderEngine::TryLoadDecoder() { bool DecoderEngine::TryLoadDecoder() {
auto* decoder = ImeDecoder::GetInstance(); auto* decoder = ImeDecoder::GetInstance();
if (decoder->GetStatus() == ImeDecoder::Status::kSuccess && if (decoder->GetStatus() == ImeDecoder::Status::kSuccess &&
decoder->GetEntryPoints().isReady) { decoder->GetEntryPoints().is_ready) {
decoder_entry_points_ = decoder->GetEntryPoints(); decoder_entry_points_ = decoder->GetEntryPoints();
decoder_entry_points_->initOnce(platform_); decoder_entry_points_->init_once(platform_);
return true; return true;
} }
return false; return false;
...@@ -84,7 +84,7 @@ bool DecoderEngine::BindRequest( ...@@ -84,7 +84,7 @@ bool DecoderEngine::BindRequest(
// Activates an IME engine via the shared library. Passing a // Activates an IME engine via the shared library. Passing a
// |ClientDelegate| for engine instance created by the shared library to // |ClientDelegate| for engine instance created by the shared library to
// make safe calls on the client. // make safe calls on the client.
if (decoder_entry_points_->activateIme( if (decoder_entry_points_->activate_ime(
ime_spec.c_str(), ime_spec.c_str(),
new ClientDelegate(ime_spec, std::move(remote)))) { new ClientDelegate(ime_spec, std::move(remote)))) {
decoder_channel_receivers_.Add(this, std::move(receiver)); decoder_channel_receivers_.Add(this, std::move(receiver));
...@@ -101,7 +101,7 @@ bool DecoderEngine::BindRequest( ...@@ -101,7 +101,7 @@ bool DecoderEngine::BindRequest(
bool DecoderEngine::IsImeSupportedByDecoder(const std::string& ime_spec) { bool DecoderEngine::IsImeSupportedByDecoder(const std::string& ime_spec) {
if (decoder_entry_points_) { if (decoder_entry_points_) {
return decoder_entry_points_->support(ime_spec.c_str()); return decoder_entry_points_->supports(ime_spec.c_str());
} }
return false; return false;
} }
......
...@@ -47,9 +47,9 @@ void ImeLoggerBridge(int severity, const char* message) { ...@@ -47,9 +47,9 @@ void ImeLoggerBridge(int severity, const char* message) {
} }
// Check whether the crucial members of an EntryPoints are loaded. // Check whether the crucial members of an EntryPoints are loaded.
bool isEntryPointsLoaded(ImeDecoder::EntryPoints entry) { bool IsEntryPointsLoaded(ImeDecoder::EntryPoints entry) {
return (entry.initOnce && entry.support && entry.activateIme && return (entry.init_once && entry.supports && entry.activate_ime &&
entry.process && entry.closeDecoder); entry.process && entry.close);
} }
} // namespace } // namespace
...@@ -77,28 +77,28 @@ ImeDecoder::ImeDecoder() : status_(Status::kUninitialized) { ...@@ -77,28 +77,28 @@ ImeDecoder::ImeDecoder() : status_(Status::kUninitialized) {
library.GetFunctionPointer(IME_MAIN_ENTRY_CREATE_FN_NAME)); library.GetFunctionPointer(IME_MAIN_ENTRY_CREATE_FN_NAME));
// TODO(b/172527471): Create a macro to fetch function pointers. // TODO(b/172527471): Create a macro to fetch function pointers.
entry_points_.initOnce = reinterpret_cast<ImeDecoderInitOnceFn>( entry_points_.init_once = reinterpret_cast<ImeDecoderInitOnceFn>(
library.GetFunctionPointer("ImeDecoderInitOnce")); library.GetFunctionPointer("ImeDecoderInitOnce"));
entry_points_.support = reinterpret_cast<ImeDecoderSupportsFn>( entry_points_.supports = reinterpret_cast<ImeDecoderSupportsFn>(
library.GetFunctionPointer("ImeDecoderSupports")); library.GetFunctionPointer("ImeDecoderSupports"));
entry_points_.activateIme = reinterpret_cast<ImeDecoderActivateImeFn>( entry_points_.activate_ime = reinterpret_cast<ImeDecoderActivateImeFn>(
library.GetFunctionPointer("ImeDecoderActivateIme")); library.GetFunctionPointer("ImeDecoderActivateIme"));
entry_points_.process = reinterpret_cast<ImeDecoderProcessFn>( entry_points_.process = reinterpret_cast<ImeDecoderProcessFn>(
library.GetFunctionPointer("ImeDecoderProcess")); library.GetFunctionPointer("ImeDecoderProcess"));
entry_points_.closeDecoder = reinterpret_cast<ImeDecoderCloseFn>( entry_points_.close = reinterpret_cast<ImeDecoderCloseFn>(
library.GetFunctionPointer("ImeDecoderClose")); library.GetFunctionPointer("ImeDecoderClose"));
if (!isEntryPointsLoaded(entry_points_)) { if (!IsEntryPointsLoaded(entry_points_)) {
status_ = Status::kFunctionMissing; status_ = Status::kFunctionMissing;
return; return;
} }
entry_points_.isReady = true; entry_points_.is_ready = true;
// Optional function pointer. // Optional function pointer.
ImeEngineLoggerSetterFn loggerSetter = ImeEngineLoggerSetterFn logger_setter =
reinterpret_cast<ImeEngineLoggerSetterFn>( reinterpret_cast<ImeEngineLoggerSetterFn>(
library.GetFunctionPointer("SetImeEngineLogger")); library.GetFunctionPointer("SetImeEngineLogger"));
if (loggerSetter) { if (logger_setter) {
loggerSetter(ImeLoggerBridge); logger_setter(ImeLoggerBridge);
} else { } else {
LOG(WARNING) << "Failed to set a Chrome Logger for decoder DSO."; LOG(WARNING) << "Failed to set a Chrome Logger for decoder DSO.";
} }
......
...@@ -31,14 +31,14 @@ class ImeDecoder { ...@@ -31,14 +31,14 @@ class ImeDecoder {
// This contains the function pointers to the entry points for the loaded // This contains the function pointers to the entry points for the loaded
// decoder shared library. // decoder shared library.
struct EntryPoints { struct EntryPoints {
ImeDecoderInitOnceFn initOnce; ImeDecoderInitOnceFn init_once;
ImeDecoderSupportsFn support; ImeDecoderSupportsFn supports;
ImeDecoderActivateImeFn activateIme; ImeDecoderActivateImeFn activate_ime;
ImeDecoderProcessFn process; ImeDecoderProcessFn process;
ImeDecoderCloseFn closeDecoder; ImeDecoderCloseFn close;
// Whether the EntryPoints is ready to use. // Whether the EntryPoints is ready to use.
bool isReady; bool is_ready = false;
}; };
// Gets the singleton ImeDecoder. // Gets the singleton ImeDecoder.
......
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