mirror of
https://github.com/openharmony/miscservices_inputmethod.git
synced 2026-08-26 17:06:35 -04:00
@@ -19,7 +19,6 @@
|
||||
|
||||
#include "utils/log.h"
|
||||
#include "input_method_ability.h"
|
||||
#define LISTENER_TYPTE_MAX_LENGTH 64
|
||||
namespace OHOS {
|
||||
namespace MiscServices {
|
||||
struct EventListener {
|
||||
@@ -181,6 +180,7 @@ namespace MiscServices {
|
||||
uv_work_t *work = new (std::nothrow) uv_work_t;
|
||||
if (work == nullptr) {
|
||||
IMSA_HILOGI("EventTarget::Emit No memory work == nullptr");
|
||||
delete work;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ namespace MiscServices {
|
||||
work->data = (void *)eventTargetCB;
|
||||
|
||||
int ret = uv_queue_work(loop, work, [](uv_work_t *work) {}, [](uv_work_t *work, int status) {
|
||||
//Js Thread
|
||||
// Js Thread
|
||||
if (work == nullptr) {
|
||||
IMSA_HILOGI("EventTarget::Emit work == nullptr");
|
||||
return;
|
||||
@@ -202,13 +202,15 @@ namespace MiscServices {
|
||||
|
||||
napi_value thisVar = nullptr;
|
||||
napi_get_reference_value(eventTargetCB->env, eventTargetCB->thisVarRef, &thisVar);
|
||||
for (EventListener *eventListener = eventTargetCB->first; eventListener != nullptr; eventListener = eventListener->next) {
|
||||
for (EventListener *eventListener = eventTargetCB->first; eventListener != nullptr;
|
||||
eventListener = eventListener->next) {
|
||||
if (strcmp(eventListener->type, eventTargetCB->type) == 0) {
|
||||
napi_value jsEvent = eventTargetCB->event ? eventTargetCB->event->ToJsObject() : nullptr;
|
||||
napi_value handler = nullptr;
|
||||
napi_value result = nullptr;
|
||||
napi_get_reference_value(eventTargetCB->env, eventListener->handlerRef, &handler);
|
||||
napi_call_function(eventTargetCB->env, thisVar, handler, jsEvent ? 1 : 0, jsEvent ? &jsEvent : nullptr, &result);
|
||||
napi_call_function(eventTargetCB->env, thisVar, handler,
|
||||
jsEvent ? 1 : 0, jsEvent ? &jsEvent : nullptr, &result);
|
||||
if (eventListener->isOnce) {
|
||||
eventTargetCB->eventTarget->Off(eventTargetCB->type, handler);
|
||||
}
|
||||
@@ -219,12 +221,8 @@ namespace MiscServices {
|
||||
if (eventTargetCB) {
|
||||
delete eventTargetCB;
|
||||
}
|
||||
delete work;
|
||||
});
|
||||
if (ret != 0) {
|
||||
IMSA_HILOGI("EventTarget::Emit failed to execute libuv work queue");
|
||||
delete work;
|
||||
}
|
||||
delete work;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ namespace MiscServices {
|
||||
InputMethodAbility::InputMethodAbility() : stop_(false)
|
||||
{
|
||||
writeInputChannel = nullptr;
|
||||
editorAttribute = nullptr;
|
||||
Initialize();
|
||||
OnConnect();
|
||||
}
|
||||
@@ -89,8 +90,9 @@ namespace MiscServices {
|
||||
sptr<IInputMethodCore> stub2 = stub;
|
||||
if (mImms != nullptr) {
|
||||
mImms->setInputMethodCore(stub2);
|
||||
} else {
|
||||
IMSA_HILOGI("InputMethodAbility::OnConnect() mImms is nullptr");
|
||||
}
|
||||
IMSA_HILOGI("InputMethodAbility::OnConnect() mImms is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OHOS {
|
||||
namespace MiscServices {
|
||||
using namespace ErrorCode;
|
||||
InputMethodAgentProxy::InputMethodAgentProxy(const sptr<IRemoteObject> &object)
|
||||
: IRemoteProxy<IInputMethodAgent>(object)
|
||||
: IRemoteProxy<IInputMethodAgent>(object)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace MiscServices {
|
||||
|
||||
InputMethodAgentStub::InputMethodAgentStub()
|
||||
{
|
||||
msgHandler_ = nullptr;
|
||||
}
|
||||
|
||||
InputMethodAgentStub::~InputMethodAgentStub()
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
namespace OHOS {
|
||||
namespace MiscServices {
|
||||
InputMethodCoreProxy::InputMethodCoreProxy(const OHOS::sptr<OHOS::IRemoteObject> &impl)
|
||||
: IRemoteProxy<IInputMethodCore>(impl)
|
||||
: IRemoteProxy<IInputMethodCore>(impl)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include "message_handler.h"
|
||||
#include "i_input_data_channel.h"
|
||||
#include "input_method_core_stub.h"
|
||||
|
||||
Reference in New Issue
Block a user