WO2022100244A1 - Communication processing method and apparatus, storage medium, and electronic device - Google Patents

Communication processing method and apparatus, storage medium, and electronic device Download PDF

Info

Publication number
WO2022100244A1
WO2022100244A1 PCT/CN2021/116981 CN2021116981W WO2022100244A1 WO 2022100244 A1 WO2022100244 A1 WO 2022100244A1 CN 2021116981 W CN2021116981 W CN 2021116981W WO 2022100244 A1 WO2022100244 A1 WO 2022100244A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
event
communication
thread
communication request
Prior art date
Application number
PCT/CN2021/116981
Other languages
French (fr)
Chinese (zh)
Inventor
吴川平
陈林
冯涛
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2022100244A1 publication Critical patent/WO2022100244A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/48Indexing scheme relating to G06F9/48
    • G06F2209/482Application
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5021Priority
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Definitions

  • the present application relates to the field of electronic technologies, and in particular, to a communication processing method, apparatus, storage medium, and electronic device.
  • Embodiments of the present application provide a communication processing method, apparatus, storage medium, and electronic device, which can efficiently implement communication between applications developed in different application development languages.
  • an embodiment of the present application provides a communication processing method for communicating between a first application and a second application, where the first application is developed by a first application development language, and the second application is developed by a second application.
  • Two application development languages are used for development, and the communication processing method includes:
  • the communication request is processed by the second application.
  • an embodiment of the present application further provides a communication processing apparatus for communicating between a first application and a second application, where the first application is developed by a first application development language, and the second application is developed by The second application development language is used for development, and the communication processing device includes:
  • an acquisition module configured to acquire a communication request generated by the first application when the first engine is running
  • a calling module for calling a communication interface in the first engine according to the communication request, and the communication interface is developed by a third application development language
  • a determining module configured to determine the thread of the second application running in the second engine through the communication interface
  • a sending module configured to send the communication request to the interface of the second application through the thread
  • a processing module configured to process the communication request through the second application.
  • an embodiment of the present application further provides a storage medium, where a computer program is stored in the storage medium, and when the computer program runs on a computer, the computer is made to execute the above communication processing method, and the communication processing
  • the method is used to communicate between a first application and a second application, the first application is developed by a first application development language, the second application is developed by a second application development language, and the communication processing method includes:
  • the communication request is processed by the second application.
  • an embodiment of the present application further provides an electronic device, the electronic device includes a processor and a memory, the memory stores a computer program, and the processor calls the computer program stored in the memory by calling the computer program.
  • the communication processing method is used for communication between a first application and a second application, the first application is developed by the first application development language, and the second application is developed by the second application Application development language is used for development, and the communication processing method includes:
  • the communication request is processed by the second application.
  • FIG. 1 is a schematic diagram of a first application scenario of the communication processing method provided by the embodiment of the present application.
  • FIG. 2 is a first schematic flowchart of a communication processing method provided by an embodiment of the present application.
  • FIG. 3 is a schematic diagram of a second application scenario of the communication processing method provided by the embodiment of the present application.
  • FIG. 4 is a schematic flowchart of a second type of communication processing method provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a third application scenario of the communication processing method provided by the embodiment of the present application.
  • FIG. 6 is a schematic diagram of a running environment architecture of a second application provided by an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of a communication processing apparatus provided by an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • the embodiment of the present application provides a communication processing method, and the communication processing method can be applied to an electronic device.
  • Electronic devices can be smart phones, tablet computers, gaming devices, AR (Augmented Reality) devices, data storage devices, audio playback devices, video playback devices, notebook computers, desktop computing devices, wearable devices such as electronic watches, electronic Glasses, electronic helmets, electronic bracelets, electronic necklaces, electronic clothing and other equipment.
  • FIG. 1 is a schematic diagram of a first application scenario of the communication processing method provided by the embodiment of the present application.
  • the communication processing method can be applied to communicate between the first application A1 and the second application A2.
  • the first application A1 is developed by the first application development language, and the first application A1 may run in the first engine B1.
  • the second application A2 is developed by the second application development language, and the second application A2 can run in the second engine B2.
  • the first application development language and the second application development language are different application development languages.
  • the first application development language may be JavaScript language
  • the second application development language may be Dart language
  • the first application development language may be Python, Lua and other languages
  • the second application development language may be C# language.
  • only the JavaScript language is used as the first application development language
  • the Dart language is used as the second application development language.
  • FIG. 2 is a schematic flowchart of a first type of communication processing method provided by an embodiment of the present application.
  • the communication processing method includes the following steps:
  • the first application is run by the first engine.
  • the first engine may be a V8 engine.
  • the V8 engine runs the first application, the engine creates an instance, which is V8 Runtime.
  • a communication request may be generated, and the communication request is used for requesting to communicate with the second application.
  • the communication request may be a rendering instruction, which is used to instruct the second application to render a user interface (User Interface, UI).
  • the electronic device can acquire and process the communication request.
  • the electronic device After acquiring the communication request generated by the first application, invokes the communication interface in the first engine according to the communication request.
  • the communication interface can be integrated in the first engine, and the communication interface is developed by a third application development language.
  • the third application development language is different from the first application development language and the second application development language.
  • the communication interface may be a C++ language communication interface. Since the V8 engine is an engine developed by the C++ language, the communication interface of the C++ language can be integrated in the V8 engine, and the functions of the C++ can be directly called.
  • the second application is run by the second engine.
  • the second engine may be a Flutter engine.
  • the Flutter engine is an open source UI toolkit that helps developers efficiently build beautiful applications through a set of code bases.
  • the second engine When the second application runs in the second engine, the second engine will run a thread of the second application.
  • the thread In the Dart application, the thread is called isolate. After the Dart application starts, it starts executing the main function and runs the main thread main isolate.
  • the Flutter engine processes single-threaded tasks by default. If a new thread is not started, tasks are processed in the main thread by default.
  • the electronic device calls the communication interface in the first engine, for example, after calling the communication interface of the C++ language in the V8 engine, the thread of the second application running in the second engine is determined through the communication interface.
  • the electronic device can call the communication interface of the C++ language in the V8 engine to find the thread of the second application in the Flutter engine.
  • the electronic device After determining the thread of the second application in the second engine through the communication interface in the first engine, the electronic device can send the communication request of the first application to the interface of the second application through the thread.
  • the communication request can be processed through the second application.
  • the electronic device may execute the rendering instruction through the second application to render and generate a corresponding user interface (UI).
  • UI user interface
  • FIG. 3 is a schematic diagram of a second application scenario of the communication processing method provided by the embodiment of the present application.
  • the first application A1 generates a communication request when the first engine B1 is running, and then the first engine B1 calls the communication interface B11 in the first engine B1 to find the thread of the second application running in the second engine B2 through the communication interface B11 A21, the communication request is then sent to the interface A22 of the second application through the thread A21, and finally the application request is processed by the second application A2. Therefore, the communication between the first application A1 and the second application A2 can be realized, that is, the communication between the cross-language applications can be realized.
  • FIG. 4 is a second schematic flowchart of the communication processing method provided by the embodiment of the present application.
  • sending the communication request to the interface of the second application through the thread includes the following steps:
  • the electronic device After determining the thread of the second application running in the second engine, the electronic device adds a task event to the task queue of the thread through the second engine, and executes the task event through the thread, so as to send the communication request to the second engine.
  • the task event is an event corresponding to the communication request.
  • the task queue of the thread may include one or more task events, or may not include task events.
  • the thread executes each task event in sequence.
  • the communication request can be sent to the interface of the second application.
  • the thread may be the main thread main isolate of the second application.
  • the main isolate includes event loop eventloop, event queue eventqueue and task queue microtaskqueue.
  • the event queue eventqueue is responsible for processing I/O events, drawing events, gesture events, and receiving external events such as other thread messages.
  • the task queue microtaskqueue can add events to the main process mainisolate.
  • the execution priority of the event in the task queue microtaskqueue is higher than the execution priority of the event in the event queue eventqueue.
  • the thread main isolate executes the events in the event queue eventqueue and the events in the task queue microtaskqueue, it firstly judges whether the task queue microtaskqueue is empty, if the task queue microtaskqueue is not empty, then executes the events in the task queue microtaskqueue, if If the task queue microtaskqueue is empty, the events in the event queue eventqueue are executed.
  • the thread main isolate executes the events in the task queue microtaskqueue, it will block the execution of the events in the event queue eventqueue, which will delay the response of the events in the event queue eventqueue. Therefore, in order to improve the response speed of the communication request, for example, when the communication request includes a rendering instruction, in order to ensure a timely response to the rendering instruction, an event corresponding to the communication request may be added to the task queue microtaskqueue.
  • FIG. 5 is a schematic diagram of a third application scenario of the communication processing method provided by the embodiment of the present application.
  • V8 Engine runs the first application
  • an instance V8 Runtime is created in the engine.
  • the V8 Runtime calls the communication interface shell in the engine V8.
  • the communication interface shell is a communication interface developed by C++ language.
  • the thread window of the second application in the Flutter engine is determined through the communication interface shell, and scheduling information is sent to the thread window, for example, a task event is added to the task queue microtaskqueue of the thread window.
  • the thread window can be an instance of the UI thread.
  • the thread window executes the added task event, thereby sending the communication request of the first application to the DartProxy interface of the second application.
  • the interface DartProxy can be an instance of the Dart application, providing the interface of the Dart application.
  • the communication request is processed by the second application.
  • the Dart application when the Dart application generates a communication request to communicate with the JavaScript application, the Dart application can execute a piece of JS code through the interface DartProxy to call the dart2js function, and the dart2js function can execute a piece of JS code to call the V8 engine. Run the corresponding scripting language, the V8 engine will pass the obtained function return value to the dart2js function, and the dart2js function will return the final result to the interface DartProxy.
  • FIG. 6 is a schematic diagram of a running environment architecture of a second application provided by an embodiment of the present application.
  • the second application can run on the Flutter engine.
  • the Flutter engine includes the framework FlutterFramework, the virtual machine module Dart VM, the UI runner UI Runner, the GPU runner GPU Runner, the IO runner IORunner, the platform runner Platform Runner and the APP layer.
  • the virtual machine module Dart VM is used to run the root thread Root Isolate.
  • UI Runner UI Runner is used to run UI Runner Thread, such as Dart code that executes Root Isolate.
  • the GPU runner GPU Runner is used to run GPU threads GPU RunnerThread, such as executing GPU instructions.
  • the IO runner IORunner is used to run the IO thread IO RunnerThread, such as reading compressed images, to prepare for the rendering of the GPU Runner.
  • the platform runner Platform Runner is used to run the platform thread Platform Runner Thread, such as performing platform-related logic processing.
  • the platform runner Platform Runner is the main task runner of Flutter.
  • the APP layer is used to run applications.
  • the communication processing method provided by the embodiment of the present application includes: obtaining a communication request generated by the first application when the first engine runs; calling a communication interface in the first engine according to the communication request, and the communication interface is developed by the third application language; determine the thread of the second application running in the second engine through the communication interface; send the communication request to the interface of the second application through the thread; process the communication request through the second application.
  • relay is performed through a communication interface developed in a third application development language, so as to determine the thread of the second application and send the communication request to the interface of the second application, so that the first communication interface developed in different application development languages can be realized.
  • the communication between the application and the second application has a short communication path, and no thread switching is required during the communication process, so the communication between applications developed in different application development languages can be efficiently implemented.
  • the embodiment of the present application also provides a communication processing apparatus, and the communication processing apparatus can be integrated in an electronic device.
  • the electronic device can be a smart phone, a tablet computer, a game device, an AR (Augmented Reality) device, a data storage device, an audio playback device, a video playback device, a notebook computer, a desktop computing device, a wearable device such as an electronic watch, Electronic glasses, electronic helmets, electronic bracelets, electronic necklaces, electronic clothing and other equipment.
  • the communication processing device may be used to communicate between the first application and the second application.
  • the first application is developed in a first application development language
  • the second application is developed in a second application development language
  • the first application development language and the second application development language are different application development languages.
  • FIG. 7 is a schematic structural diagram of a communication processing apparatus 200 according to an embodiment of the present application.
  • the communication processing device 200 is used to communicate between the first application and the second application, the first application is developed by the first application development language, and the second application is developed by the second application development language, and the communication processing device 200 includes: Obtaining module 201 , calling module 202 , determining module 203 , sending module 204 and processing module 205 .
  • an obtaining module 201 configured to obtain a communication request generated when the first application is run by the first engine
  • a calling module 202 configured to call the communication interface in the first engine according to the communication request
  • a determining module 203 configured to determine the thread of the second application running in the second engine through the communication interface
  • a sending module 204 configured to send the communication request to the interface of the second application through the thread
  • the processing module 205 is configured to process the communication request through the second application.
  • the sending module 204 is configured to: add a task event to the task queue of the thread through the second engine, where the task event is an event corresponding to the communication request; execute the task event through the thread to send the communication request to the second engine Application interface.
  • a thread includes an event queue and a task queue, and events in the task queue have a higher execution priority than events in the event queue.
  • the processing module 205 when the thread executes the event in the event queue and the event in the task queue, the processing module 205 is configured to: determine whether the task queue is empty, if the task queue is not empty, execute the event in the task queue, If the task queue is empty, the events in the event queue are executed.
  • the communication request includes rendering instructions
  • the processing module 205 is configured to: execute the rendering instructions through the second application to generate a corresponding user interface.
  • the communication processing apparatus 200 includes: an obtaining module 201, configured to obtain a communication request generated by the first application when the first engine runs; a calling module 202, configured to call the communication in the first engine according to the communication request interface, the communication interface is developed by the third application development language; the determining module 203 is used to determine the thread of the second application running in the second engine through the communication interface; the sending module 204 is used to send the communication request to the first application through the thread The interface of the second application; the processing module 205 is used for processing the communication request through the second application.
  • the communication processing device performs transfer through the communication interface developed by the third application development language to determine the thread of the second application and send the communication request to the interface of the second application, so that the first application developed in different application development languages and the interface of the second application can be realized.
  • the communication between the second applications has a short communication path, and no thread switching is required during the communication process, so the communication between applications developed in different application development languages can be efficiently implemented.
  • the embodiments of the present application also provide an electronic device.
  • the electronic device may be a smart phone, a tablet computer, a game device, an AR (Augmented Reality) device, a data storage device, an audio playback device, a video playback device, a notebook computer, a desktop computing device, a wearable device such as an electronic watch, Electronic glasses, electronic helmets, electronic bracelets, electronic necklaces, electronic clothing and other equipment.
  • the electronic device may be used to communicate between the first application and the second application.
  • the first application is developed in a first application development language
  • the second application is developed in a second application development language
  • the first application development language and the second application development language are different application development languages.
  • FIG. 8 is a schematic structural diagram of an electronic device 300 according to an embodiment of the present application.
  • Electronic device 300 includes processor 301 and memory 302 .
  • the processor 301 is electrically connected to the memory 302 .
  • the processor 301 is the control center of the electronic device 300, uses various interfaces and lines to connect various parts of the entire electronic device, executes the electronic device by running or calling the computer program stored in the memory 302, and calling the data stored in the memory 302. Various functions of the device and processing data, so as to carry out the overall monitoring of the electronic device.
  • Memory 302 may be used to store computer programs and data.
  • the computer program stored in the memory 302 contains instructions executable in the processor.
  • a computer program can be composed of various functional modules.
  • the processor 301 executes various functional applications and data processing by calling the computer program stored in the memory 302 .
  • the processor 301 in the electronic device 300 loads the instructions corresponding to the processes of one or more computer programs into the memory 302 according to the following steps, and is executed by the processor 301 and stored in the memory 302 computer program that performs the following steps:
  • the communication request is processed by the second application.
  • the processor 301 when the communication request is sent to the interface of the second application through the thread, the processor 301 performs the following steps:
  • the task event is executed by the thread to send the communication request to the interface of the second application.
  • the thread includes an event queue and a task queue, and events in the task queue have a higher execution priority than events in the event queue.
  • the thread when executing the event in the event queue and the event in the task queue, the thread determines whether the task queue is empty, if the task queue is not empty, executes the event in the task queue, if the task queue is empty , the events in the event queue are executed.
  • the communication request includes rendering instructions, and when processing the communication request through the second application, the processor 301 performs the following steps:
  • the rendering instruction is executed by the second application to generate a corresponding user interface.
  • the embodiment of the present application provides an electronic device, and the electronic device performs the following steps: acquiring a communication request generated when the first application is run by the first engine; calling a communication interface in the first engine according to the communication request, and communicating The interface is developed by the third application development language; the thread of the second application running in the second engine is determined through the communication interface; the communication request is sent to the interface of the second application through the thread; the communication request is processed through the second application.
  • the electronic device performs transfer through the communication interface developed by the third application development language, so as to determine the thread of the second application and send the communication request to the interface of the second application, so that the first application developed in different application development languages and the first application developed in different application development languages can be realized.
  • the communication between the two applications, and the communication path is short, and no thread switching is required during the communication process, so the communication between applications developed in different application development languages can be efficiently realized.
  • An embodiment of the present application further provides a storage medium, where a computer program is stored in the storage medium, and when the computer program runs on a computer, the computer executes the communication processing method described in any of the above embodiments, and the communication processing Methods include:
  • the communication request is processed by the second application.
  • the communication processing method when the communication request is sent to the interface of the second application through the thread, the communication processing method includes:
  • the task event is executed by the thread to send the communication request to the interface of the second application.
  • a thread includes an event queue and a task queue, and events in the task queue have a higher execution priority than events in the event queue.
  • the communication processing method when the thread executes the event in the event queue and the event in the task queue, the communication processing method includes:
  • the communication request includes rendering instructions
  • the communication request is processed by the second application
  • the communication processing method includes:
  • the rendering instruction is executed by the second application to generate a corresponding user interface.
  • the storage medium may include, but is not limited to: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Stored Programmes (AREA)

Abstract

A communication processing method and apparatus, a storage medium and an electronic device. The communication processing method comprises: acquiring a communication request generated when a first application is run by a first engine; invoking a communication interface in the first engine according to the communication request; determining a thread of a second application running in a second engine by means of the communication interface; sending the communication request to an interface of the second application by means of the thread; and processing the communication request by means of the second application.

Description

通信处理方法、装置、存储介质及电子设备Communication processing method, device, storage medium, and electronic device
本申请要求于2020年11月12日提交中国专利局、申请号为202011262429.X、发明名称为“通信处理方法、装置、存储介质及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on November 12, 2020 with the application number 202011262429.X and the title of the invention is "communication processing method, device, storage medium and electronic device", the entire content of which is approved by Reference is incorporated in this application.
技术领域technical field
本申请涉及电子技术领域,特别涉及一种通信处理方法、装置、存储介质及电子设备。The present application relates to the field of electronic technologies, and in particular, to a communication processing method, apparatus, storage medium, and electronic device.
背景技术Background technique
在计算机领域,程序开发语言众多,例如Java、JavaScript、C、C++、Dart等各种语言都可以用于开发应用程序,并且各种程序开发语言各有优劣。In the computer field, there are many program development languages, such as Java, JavaScript, C, C++, Dart and other languages can be used to develop application programs, and various program development languages have their own advantages and disadvantages.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供一种通信处理方法、装置、存储介质及电子设备,可以高效实现不同应用开发语言开发的应用之间的通信。Embodiments of the present application provide a communication processing method, apparatus, storage medium, and electronic device, which can efficiently implement communication between applications developed in different application development languages.
第一方面,本申请实施例提供一种通信处理方法,用于在第一应用与第二应用之间通信,所述第一应用由第一应用开发语言进行开发,所述第二应用由第二应用开发语言进行开发,所述通信处理方法包括:In a first aspect, an embodiment of the present application provides a communication processing method for communicating between a first application and a second application, where the first application is developed by a first application development language, and the second application is developed by a second application. Two application development languages are used for development, and the communication processing method includes:
获取所述第一应用由第一引擎运行时产生的通信请求;obtaining a communication request generated when the first application is run by the first engine;
根据所述通信请求调用所述第一引擎中的通信接口,所述通信接口由第三应用开发语言进行开发;Invoke a communication interface in the first engine according to the communication request, where the communication interface is developed by a third application development language;
通过所述通信接口确定运行于第二引擎中的所述第二应用的线程;determining, via the communication interface, a thread of the second application running in the second engine;
通过所述线程将所述通信请求发送给所述第二应用的接口;Send the communication request to the interface of the second application through the thread;
通过所述第二应用对所述通信请求进行处理。The communication request is processed by the second application.
第二方面,本申请实施例还提供一种通信处理装置,用于在第一应用与第二应用之间通信,所述第一应用由第一应用开发语言进行开发,所述第二应用由第二应用开发语言进行开发,所述通信处理装置包括:In a second aspect, an embodiment of the present application further provides a communication processing apparatus for communicating between a first application and a second application, where the first application is developed by a first application development language, and the second application is developed by The second application development language is used for development, and the communication processing device includes:
获取模块,用于获取所述第一应用由第一引擎运行时产生的通信请求;an acquisition module, configured to acquire a communication request generated by the first application when the first engine is running;
调用模块,用于根据所述通信请求调用所述第一引擎中的通信接口,所述 通信接口由第三应用开发语言进行开发;a calling module for calling a communication interface in the first engine according to the communication request, and the communication interface is developed by a third application development language;
确定模块,用于通过所述通信接口确定运行于第二引擎中的所述第二应用的线程;a determining module, configured to determine the thread of the second application running in the second engine through the communication interface;
发送模块,用于通过所述线程将所述通信请求发送给所述第二应用的接口;a sending module, configured to send the communication request to the interface of the second application through the thread;
处理模块,用于通过所述第二应用对所述通信请求进行处理。A processing module, configured to process the communication request through the second application.
第三方面,本申请实施例还提供一种存储介质,所述存储介质中存储有计算机程序,当所述计算机程序在计算机上运行时,使得所述计算机执行上述通信处理方法,所述通信处理方法用于在第一应用与第二应用之间通信,所述第一应用由第一应用开发语言进行开发,所述第二应用由第二应用开发语言进行开发,所述通信处理方法包括:In a third aspect, an embodiment of the present application further provides a storage medium, where a computer program is stored in the storage medium, and when the computer program runs on a computer, the computer is made to execute the above communication processing method, and the communication processing The method is used to communicate between a first application and a second application, the first application is developed by a first application development language, the second application is developed by a second application development language, and the communication processing method includes:
获取所述第一应用由第一引擎运行时产生的通信请求;obtaining a communication request generated when the first application is run by the first engine;
根据所述通信请求调用所述第一引擎中的通信接口,所述通信接口由第三应用开发语言进行开发;Invoke a communication interface in the first engine according to the communication request, where the communication interface is developed by a third application development language;
通过所述通信接口确定运行于第二引擎中的所述第二应用的线程;determining, via the communication interface, a thread of the second application running in the second engine;
通过所述线程将所述通信请求发送给所述第二应用的接口;Send the communication request to the interface of the second application through the thread;
通过所述第二应用对所述通信请求进行处理。The communication request is processed by the second application.
第四方面,本申请实施例还提供一种电子设备,所述电子设备包括处理器和存储器,所述存储器中存储有计算机程序,所述处理器通过调用所述存储器中存储的所述计算机程序,用于执行上述通信处理方法,所述通信处理方法用于在第一应用与第二应用之间通信,所述第一应用由第一应用开发语言进行开发,所述第二应用由第二应用开发语言进行开发,所述通信处理方法包括:In a fourth aspect, an embodiment of the present application further provides an electronic device, the electronic device includes a processor and a memory, the memory stores a computer program, and the processor calls the computer program stored in the memory by calling the computer program. , used to execute the above communication processing method, the communication processing method is used for communication between a first application and a second application, the first application is developed by the first application development language, and the second application is developed by the second application Application development language is used for development, and the communication processing method includes:
获取所述第一应用由第一引擎运行时产生的通信请求;obtaining a communication request generated when the first application is run by the first engine;
根据所述通信请求调用所述第一引擎中的通信接口,所述通信接口由第三应用开发语言进行开发;Invoke a communication interface in the first engine according to the communication request, where the communication interface is developed by a third application development language;
通过所述通信接口确定运行于第二引擎中的所述第二应用的线程;determining, via the communication interface, a thread of the second application running in the second engine;
通过所述线程将所述通信请求发送给所述第二应用的接口;Send the communication request to the interface of the second application through the thread;
通过所述第二应用对所述通信请求进行处理。The communication request is processed by the second application.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所 需要使用的附图作简单地介绍。显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present application more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative effort.
图1为本申请实施例提供的通信处理方法的第一种应用场景示意图。FIG. 1 is a schematic diagram of a first application scenario of the communication processing method provided by the embodiment of the present application.
图2为本申请实施例提供的通信处理方法的第一种流程示意图。FIG. 2 is a first schematic flowchart of a communication processing method provided by an embodiment of the present application.
图3为本申请实施例提供的通信处理方法的第二种应用场景示意图。FIG. 3 is a schematic diagram of a second application scenario of the communication processing method provided by the embodiment of the present application.
图4为本申请实施例提供的通信处理方法的第二种流程示意图。FIG. 4 is a schematic flowchart of a second type of communication processing method provided by an embodiment of the present application.
图5为本申请实施例提供的通信处理方法的第三种应用场景示意图。FIG. 5 is a schematic diagram of a third application scenario of the communication processing method provided by the embodiment of the present application.
图6为本申请实施例提供的第二应用的运行环境架构示意图。FIG. 6 is a schematic diagram of a running environment architecture of a second application provided by an embodiment of the present application.
图7为本申请实施例提供的通信处理装置的结构示意图。FIG. 7 is a schematic structural diagram of a communication processing apparatus provided by an embodiment of the present application.
图8为本申请实施例提供的电子设备的结构示意图。FIG. 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域技术人员在没有付出创造性劳动前提下所获得的所有其他实施例,都属于本申请的保护范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of this application.
本申请实施例提供一种通信处理方法,该通信处理方法可以应用于电子设备中。电子设备可以为智能手机、平板电脑、游戏设备、AR(Augmented Reality,增强现实)设备、数据存储装置、音频播放装置、视频播放装置、笔记本电脑、桌面计算设备、可穿戴设备诸如电子手表、电子眼镜、电子头盔、电子手链、电子项链、电子衣物等设备。The embodiment of the present application provides a communication processing method, and the communication processing method can be applied to an electronic device. Electronic devices can be smart phones, tablet computers, gaming devices, AR (Augmented Reality) devices, data storage devices, audio playback devices, video playback devices, notebook computers, desktop computing devices, wearable devices such as electronic watches, electronic Glasses, electronic helmets, electronic bracelets, electronic necklaces, electronic clothing and other equipment.
参考图1,图1为本申请实施例提供的通信处理方法的第一种应用场景示意图。Referring to FIG. 1 , FIG. 1 is a schematic diagram of a first application scenario of the communication processing method provided by the embodiment of the present application.
该通信处理方法可以应用于在第一应用A1与第二应用A2之间进行通信。第一应用A1由第一应用开发语言进行开发,第一应用A1可以运行于第一引擎B1中。第二应用A2由第二应用开发语言进行开发,第二应用A2可以运行于第二引擎B2中。其中,第一应用开发语言与第二应用开发语言为不同的应用开发语言。例如,第一应用开发语言可以为JavaScript语言,第二应用开发语言 可以为Dart语言;或者,第一应用开发语言可以为Python、Lua等语言,第二应用开发语言可以为C#语言。以下仅以第一应用开发语言为JavaScript语言、第二应用开发语言为Dart语言进行说明。The communication processing method can be applied to communicate between the first application A1 and the second application A2. The first application A1 is developed by the first application development language, and the first application A1 may run in the first engine B1. The second application A2 is developed by the second application development language, and the second application A2 can run in the second engine B2. The first application development language and the second application development language are different application development languages. For example, the first application development language may be JavaScript language, and the second application development language may be Dart language; or, the first application development language may be Python, Lua and other languages, and the second application development language may be C# language. In the following, only the JavaScript language is used as the first application development language, and the Dart language is used as the second application development language.
在本申请的描述中,需要理解的是,诸如“第一”、“第二”等术语仅用于区分类似的对象,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。In the description of this application, it should be understood that terms such as "first", "second" and the like are only used to distinguish similar objects, and cannot be interpreted as indicating or implying relative importance or implying the indicated technology number of features.
参考图2,图2为本申请实施例提供的通信处理方法的第一种流程示意图。其中,通信处理方法包括以下步骤:Referring to FIG. 2 , FIG. 2 is a schematic flowchart of a first type of communication processing method provided by an embodiment of the present application. Wherein, the communication processing method includes the following steps:
110,获取第一应用由第一引擎运行时产生的通信请求。110. Acquire a communication request generated by the first application when the first engine runs.
其中,第一应用由第一引擎来运行。例如,第一应用为JavaScript语言开发的应用时,第一引擎可以为V8引擎。V8引擎在运行第一应用时,引擎创建一个实例,即为V8 Runtime。Wherein, the first application is run by the first engine. For example, when the first application is an application developed in the JavaScript language, the first engine may be a V8 engine. When the V8 engine runs the first application, the engine creates an instance, which is V8 Runtime.
第一引擎运行第一应用时,可以产生通信请求,该通信请求用于请求与第二应用进行通信。例如,该通信请求可以为渲染指令,用于指示第二应用对用户界面(User Interface,UI)进行渲染。第一应用产生通信请求后,电子设备可以获取该通信请求,并进行处理。When the first engine runs the first application, a communication request may be generated, and the communication request is used for requesting to communicate with the second application. For example, the communication request may be a rendering instruction, which is used to instruct the second application to render a user interface (User Interface, UI). After the first application generates the communication request, the electronic device can acquire and process the communication request.
120,根据通信请求调用第一引擎中的通信接口。120. Call the communication interface in the first engine according to the communication request.
电子设备获取到第一应用产生的通信请求后,根据该通信请求调用第一引擎中的通信接口。其中,该通信接口可以集成在第一引擎中,该通信接口由第三应用开发语言进行开发。第三应用开发语言与第一应用开发语言、第二应用开发语言都不同。例如,第一引擎为V8引擎时,该通信接口可以为C++语言的通信接口。由于V8引擎是通过C++语言开发的引擎,因此V8引擎中可以集成C++语言的通信接口,并且可以直接调用C++的函数。After acquiring the communication request generated by the first application, the electronic device invokes the communication interface in the first engine according to the communication request. Wherein, the communication interface can be integrated in the first engine, and the communication interface is developed by a third application development language. The third application development language is different from the first application development language and the second application development language. For example, when the first engine is a V8 engine, the communication interface may be a C++ language communication interface. Since the V8 engine is an engine developed by the C++ language, the communication interface of the C++ language can be integrated in the V8 engine, and the functions of the C++ can be directly called.
130,通过通信接口确定运行于第二引擎中的第二应用的线程。130. Determine the thread of the second application running in the second engine through the communication interface.
其中,第二应用由第二引擎来运行。例如,第二应用为Dart语言开发的应用时,第二引擎可以为Flutter引擎。Flutter引擎为一个开源的UI工具包,可以帮助开发者通过一套代码库高效地构建精美应用。Wherein, the second application is run by the second engine. For example, when the second application is an application developed in the Dart language, the second engine may be a Flutter engine. The Flutter engine is an open source UI toolkit that helps developers efficiently build beautiful applications through a set of code bases.
第二应用在第二引擎中运行时,第二引擎会运行第二应用的一个线程,在Dart应用中,线程称为isolate。Dart应用启动后,开始执行主函数并运行主线 程main isolate。此外,Flutter引擎默认是单线程任务处理的,如果不开启新的线程,任务默认在主线程中处理。When the second application runs in the second engine, the second engine will run a thread of the second application. In the Dart application, the thread is called isolate. After the Dart application starts, it starts executing the main function and runs the main thread main isolate. In addition, the Flutter engine processes single-threaded tasks by default. If a new thread is not started, tasks are processed in the main thread by default.
电子设备调用第一引擎中的通信接口,例如调用V8引擎中的C++语言的通信接口后,通过该通信接口确定运行于第二引擎中的第二应用的线程。例如,电子设备可以调用V8引擎中的C++语言的通信接口来查找Flutter引擎中的第二应用的线程。After the electronic device calls the communication interface in the first engine, for example, after calling the communication interface of the C++ language in the V8 engine, the thread of the second application running in the second engine is determined through the communication interface. For example, the electronic device can call the communication interface of the C++ language in the V8 engine to find the thread of the second application in the Flutter engine.
140,通过线程将通信请求发送给第二应用的接口。140. Send the communication request to the interface of the second application through the thread.
电子设备通过第一引擎中的通信接口确定第二引擎中的第二应用的线程后,即可通过该线程将第一应用的通信请求发送给第二应用的接口。After determining the thread of the second application in the second engine through the communication interface in the first engine, the electronic device can send the communication request of the first application to the interface of the second application through the thread.
150,通过第二应用对通信请求进行处理。150. Process the communication request by using the second application.
电子设备通过第二应用的线程将通信请求发送给第二应用的接口后,即可通过第二应用对该通信请求进行处理。例如,该通信请求包括渲染指令时,电子设备可以通过第二应用执行该渲染指令,以渲染生成对应的用户界面(UI)。After the electronic device sends the communication request to the interface of the second application through the thread of the second application, the communication request can be processed through the second application. For example, when the communication request includes a rendering instruction, the electronic device may execute the rendering instruction through the second application to render and generate a corresponding user interface (UI).
请同时参考图3,图3为本申请实施例提供的通信处理方法的第二种应用场景示意图。Please also refer to FIG. 3 , which is a schematic diagram of a second application scenario of the communication processing method provided by the embodiment of the present application.
其中,第一应用A1由第一引擎B1运行时产生通信请求,随后第一引擎B1调用第一引擎B1中的通信接口B11,通过通信接口B11查找第二引擎B2中运行的第二应用的线程A21,随后通过线程A21将该通信请求发送给第二应用的接口A22,最后由第二应用A2对该应用请求进行处理。从而,即可实现第一应用A1与第二应用A2之间的通信,也即实现跨语言应用之间的通信。The first application A1 generates a communication request when the first engine B1 is running, and then the first engine B1 calls the communication interface B11 in the first engine B1 to find the thread of the second application running in the second engine B2 through the communication interface B11 A21, the communication request is then sent to the interface A22 of the second application through the thread A21, and finally the application request is processed by the second application A2. Therefore, the communication between the first application A1 and the second application A2 can be realized, that is, the communication between the cross-language applications can be realized.
在一些实施例中,参考图4,图4为本申请实施例提供的通信处理方法的第二种流程示意图。In some embodiments, referring to FIG. 4 , FIG. 4 is a second schematic flowchart of the communication processing method provided by the embodiment of the present application.
其中,通过线程将通信请求发送给第二应用的接口,包括以下步骤:Wherein, sending the communication request to the interface of the second application through the thread includes the following steps:
141,通过第二引擎向线程的任务队列中添加一个任务事件,任务事件为通信请求对应的事件;141, adding a task event to the task queue of the thread through the second engine, where the task event is an event corresponding to the communication request;
142,通过线程执行任务事件,以将通信请求发送给第二应用的接口。142. Execute the task event through the thread to send the communication request to the interface of the second application.
电子设备确定运行于第二引擎中的第二应用的线程后,通过第二引擎向该线程的任务队列中添加一个任务事件,并通过该线程执行该任务事件,以将该通信请求发送给第二应用的接口。其中,该任务事件为该通信请求对应的事件。After determining the thread of the second application running in the second engine, the electronic device adds a task event to the task queue of the thread through the second engine, and executes the task event through the thread, so as to send the communication request to the second engine. Two application interfaces. The task event is an event corresponding to the communication request.
可以理解的,该线程的任务队列中可以包括一个或多个任务事件,也可以不包括任务事件。当该任务队列中包括任务事件时,该线程按照顺序依次执行每一个任务事件。当执行到该通信请求对应的任务事件时,即可将该通信请求发送给第二应用的接口。It can be understood that the task queue of the thread may include one or more task events, or may not include task events. When the task queue includes task events, the thread executes each task event in sequence. When the task event corresponding to the communication request is executed, the communication request can be sent to the interface of the second application.
例如,在一些实施例中,该线程可以为第二应用的主线程main isolate。main isolate包括事件循环eventloop、事件队列eventqueue以及任务队列microtaskqueue。其中,事件队列eventqueue负责处理I/O事件、绘制事件、手势事件以及接收其他线程消息等外部事件。任务队列microtaskqueue可以向主进程mainisolate内部添加事件。For example, in some embodiments, the thread may be the main thread main isolate of the second application. The main isolate includes event loop eventloop, event queue eventqueue and task queue microtaskqueue. Among them, the event queue eventqueue is responsible for processing I/O events, drawing events, gesture events, and receiving external events such as other thread messages. The task queue microtaskqueue can add events to the main process mainisolate.
其中,任务队列microtaskqueue中的事件的执行优先级高于事件队列eventqueue中的事件的执行优先级。例如,该线程main isolate在执行事件队列eventqueue中的事件和任务队列microtaskqueue中的事件时,先判断任务队列microtaskqueue是否为空,若任务队列microtaskqueue不为空,则执行任务队列microtaskqueue中的事件,若任务队列microtaskqueue为空,则执行事件队列eventqueue中的事件。Among them, the execution priority of the event in the task queue microtaskqueue is higher than the execution priority of the event in the event queue eventqueue. For example, when the thread main isolate executes the events in the event queue eventqueue and the events in the task queue microtaskqueue, it firstly judges whether the task queue microtaskqueue is empty, if the task queue microtaskqueue is not empty, then executes the events in the task queue microtaskqueue, if If the task queue microtaskqueue is empty, the events in the event queue eventqueue are executed.
因此,该线程main isolate在执行任务队列microtaskqueue中的事件时,会阻塞事件队列eventqueue中的事件的执行,会使得事件队列eventqueue中的事件响应延时。因此,为了提高对该通信请求的响应速度,例如该通信请求包括渲染指令时,为了保证对渲染指令的及时响应,可以将该通信请求对应的事件添加到任务队列microtaskqueue中。Therefore, when the thread main isolate executes the events in the task queue microtaskqueue, it will block the execution of the events in the event queue eventqueue, which will delay the response of the events in the event queue eventqueue. Therefore, in order to improve the response speed of the communication request, for example, when the communication request includes a rendering instruction, in order to ensure a timely response to the rendering instruction, an event corresponding to the communication request may be added to the task queue microtaskqueue.
同时参考图5,图5为本申请实施例提供的通信处理方法的第三种应用场景示意图。Referring to FIG. 5 at the same time, FIG. 5 is a schematic diagram of a third application scenario of the communication processing method provided by the embodiment of the present application.
其中,V8引擎在运行第一应用时,在引擎中创建实例V8 Runtime。第一应用产生通信请求时,V8 Runtime调用引擎V8中的通信接口shell。通信接口shell为通过C++语言开发的通信接口。随后,通过通信接口shell确定Flutter引擎中的第二应用的线程window,并向该线程window发送调度信息,例如向该线程window的任务队列microtaskqueue中添加一个任务事件。其中,该线程window可以为UI线程的一个实例。随后,该线程window执行添加的任务事件,从而将第一应用的通信请求发送到第二应用的接口DartProxy。其中,接口 DartProxy可以为Dart应用的一个实例,提供Dart应用的接口。随后,通过第二应用对通信请求进行处理。Among them, when the V8 engine runs the first application, an instance V8 Runtime is created in the engine. When the first application generates a communication request, the V8 Runtime calls the communication interface shell in the engine V8. The communication interface shell is a communication interface developed by C++ language. Subsequently, the thread window of the second application in the Flutter engine is determined through the communication interface shell, and scheduling information is sent to the thread window, for example, a task event is added to the task queue microtaskqueue of the thread window. Wherein, the thread window can be an instance of the UI thread. Subsequently, the thread window executes the added task event, thereby sending the communication request of the first application to the DartProxy interface of the second application. Among them, the interface DartProxy can be an instance of the Dart application, providing the interface of the Dart application. Subsequently, the communication request is processed by the second application.
此外,可以理解的,当Dart应用产生通信请求与JavaScript应用进行通信时,Dart应用可以通过接口DartProxy执行一段JS代码来调用dart2js函数,dart2js函数可以执行一段JS代码来调用V8引擎,V8引擎编译并运行对应的脚本语言,V8引擎将得到的函数返回值传递给dart2js函数,dart2js函数向接口DartProxy返回最终的结果。In addition, it can be understood that when the Dart application generates a communication request to communicate with the JavaScript application, the Dart application can execute a piece of JS code through the interface DartProxy to call the dart2js function, and the dart2js function can execute a piece of JS code to call the V8 engine. Run the corresponding scripting language, the V8 engine will pass the obtained function return value to the dart2js function, and the dart2js function will return the final result to the interface DartProxy.
同时参考图6,图6为本申请实施例提供的第二应用的运行环境架构示意图。Referring to FIG. 6 at the same time, FIG. 6 is a schematic diagram of a running environment architecture of a second application provided by an embodiment of the present application.
第二应用可以运行于Flutter引擎。其中,Flutter引擎包括框架FlutterFramework、虚拟机模块Dart VM、UI运行器UI Runner、GPU运行器GPU Runner、IO运行器IORunner、平台运行器Platform Runner以及APP层。虚拟机模块Dart VM用于运行根线程Root Isolate。UI运行器UI Runner用于运行UI线程UI Runner Thread,例如执行Root Isolate的Dart代码。GPU运行器GPU Runner用于运行GPU线程GPU RunnerThread,例如执行GPU指令。IO运行器IORunner用于运行IO线程IO RunnerThread,例如读取压缩的图片,为GPU Runner的渲染做好准备。平台运行器Platform Runner用于运行平台线程Platform Runner Thread,例如执行与平台相关的逻辑处理,平台运行器Platform Runner为Flutter的主任务运行器。APP层用于运行应用。The second application can run on the Flutter engine. Among them, the Flutter engine includes the framework FlutterFramework, the virtual machine module Dart VM, the UI runner UI Runner, the GPU runner GPU Runner, the IO runner IORunner, the platform runner Platform Runner and the APP layer. The virtual machine module Dart VM is used to run the root thread Root Isolate. UI Runner UI Runner is used to run UI Runner Thread, such as Dart code that executes Root Isolate. The GPU runner GPU Runner is used to run GPU threads GPU RunnerThread, such as executing GPU instructions. The IO runner IORunner is used to run the IO thread IO RunnerThread, such as reading compressed images, to prepare for the rendering of the GPU Runner. The platform runner Platform Runner is used to run the platform thread Platform Runner Thread, such as performing platform-related logic processing. The platform runner Platform Runner is the main task runner of Flutter. The APP layer is used to run applications.
由上可知,本申请实施例提供的通信处理方法,包括:获取第一应用由第一引擎运行时产生的通信请求;根据通信请求调用第一引擎中的通信接口,通信接口由第三应用开发语言进行开发;通过通信接口确定运行于第二引擎中的第二应用的线程;通过线程将通信请求发送给第二应用的接口;通过第二应用对通信请求进行处理。所述通信处理方法中,通过第三应用开发语言开发的通信接口进行中转,以确定第二应用的线程并将通信请求发送给第二应用的接口,从而可以实现不同应用开发语言开发的第一应用与第二应用之间的通信,并且通信路径短,通信过程中无需进行线程切换,因此可以高效实现不同应用开发语言开发的应用之间的通信。As can be seen from the above, the communication processing method provided by the embodiment of the present application includes: obtaining a communication request generated by the first application when the first engine runs; calling a communication interface in the first engine according to the communication request, and the communication interface is developed by the third application language; determine the thread of the second application running in the second engine through the communication interface; send the communication request to the interface of the second application through the thread; process the communication request through the second application. In the communication processing method, relay is performed through a communication interface developed in a third application development language, so as to determine the thread of the second application and send the communication request to the interface of the second application, so that the first communication interface developed in different application development languages can be realized. The communication between the application and the second application has a short communication path, and no thread switching is required during the communication process, so the communication between applications developed in different application development languages can be efficiently implemented.
本申请实施例还提供一种通信处理装置,该通信处理装置可以集成在电子设备中。该电子设备可以为智能手机、平板电脑、游戏设备、AR(Augmented  Reality,增强现实)设备、数据存储装置、音频播放装置、视频播放装置、笔记本电脑、桌面计算设备、可穿戴设备诸如电子手表、电子眼镜、电子头盔、电子手链、电子项链、电子衣物等设备。该通信处理装置可以用于在第一应用与第二应用之间通信。该第一应用由第一应用开发语言进行开发,该第二应用由第二应用开发语言进行开发,第一应用开发语言与第二应用开发语言为不同的应用开发语言。The embodiment of the present application also provides a communication processing apparatus, and the communication processing apparatus can be integrated in an electronic device. The electronic device can be a smart phone, a tablet computer, a game device, an AR (Augmented Reality) device, a data storage device, an audio playback device, a video playback device, a notebook computer, a desktop computing device, a wearable device such as an electronic watch, Electronic glasses, electronic helmets, electronic bracelets, electronic necklaces, electronic clothing and other equipment. The communication processing device may be used to communicate between the first application and the second application. The first application is developed in a first application development language, the second application is developed in a second application development language, and the first application development language and the second application development language are different application development languages.
参考图7,图7为本申请实施例提供的通信处理装置200的结构示意图。其中,通信处理装置200用于在第一应用与第二应用之间通信,第一应用由第一应用开发语言进行开发,第二应用由第二应用开发语言进行开发,通信处理装置200包括:获取模块201、调用模块202、确定模块203、发送模块204以及处理模块205。Referring to FIG. 7 , FIG. 7 is a schematic structural diagram of a communication processing apparatus 200 according to an embodiment of the present application. Wherein, the communication processing device 200 is used to communicate between the first application and the second application, the first application is developed by the first application development language, and the second application is developed by the second application development language, and the communication processing device 200 includes: Obtaining module 201 , calling module 202 , determining module 203 , sending module 204 and processing module 205 .
获取模块201,用于获取第一应用由第一引擎运行时产生的通信请求;an obtaining module 201, configured to obtain a communication request generated when the first application is run by the first engine;
调用模块202,用于根据通信请求调用第一引擎中的通信接口;a calling module 202, configured to call the communication interface in the first engine according to the communication request;
确定模块203,用于通过通信接口确定运行于第二引擎中的第二应用的线程;a determining module 203, configured to determine the thread of the second application running in the second engine through the communication interface;
发送模块204,用于通过线程将通信请求发送给第二应用的接口;a sending module 204, configured to send the communication request to the interface of the second application through the thread;
处理模块205,用于通过第二应用对通信请求进行处理。The processing module 205 is configured to process the communication request through the second application.
在一些实施例中,发送模块204用于:通过第二引擎向线程的任务队列中添加一个任务事件,任务事件为通信请求对应的事件;通过线程执行任务事件,以将通信请求发送给第二应用的接口。In some embodiments, the sending module 204 is configured to: add a task event to the task queue of the thread through the second engine, where the task event is an event corresponding to the communication request; execute the task event through the thread to send the communication request to the second engine Application interface.
在一些实施例中,线程包括事件队列和任务队列,任务队列中的事件的执行优先级高于事件队列中的事件的执行优先级。In some embodiments, a thread includes an event queue and a task queue, and events in the task queue have a higher execution priority than events in the event queue.
在一些实施例中,线程在执行事件队列中的事件和任务队列中的事件时,处理模块205用于:判断任务队列是否为空,若任务队列不为空,则执行任务队列中的事件,若任务队列为空,则执行事件队列中的事件。In some embodiments, when the thread executes the event in the event queue and the event in the task queue, the processing module 205 is configured to: determine whether the task queue is empty, if the task queue is not empty, execute the event in the task queue, If the task queue is empty, the events in the event queue are executed.
在一些实施例中,通信请求包括渲染指令,处理模块205用于:通过第二应用执行渲染指令,以生成对应的用户界面。In some embodiments, the communication request includes rendering instructions, and the processing module 205 is configured to: execute the rendering instructions through the second application to generate a corresponding user interface.
通信处理装置200的各个模块的具体实现过程可以参考上述通信处理方法的各个实施例中的描述,在此不再赘述。For the specific implementation process of each module of the communication processing apparatus 200, reference may be made to the descriptions in the various embodiments of the foregoing communication processing methods, which will not be repeated here.
本申请实施例提供的通信处理装置200,包括:获取模块201,用于获取第一应用由第一引擎运行时产生的通信请求;调用模块202,用于根据通信请求调用第一引擎中的通信接口,通信接口由第三应用开发语言进行开发;确定模块203,用于通过通信接口确定运行于第二引擎中的第二应用的线程;发送模块204,用于通过线程将通信请求发送给第二应用的接口;处理模块205,用于通过第二应用对通信请求进行处理。所述通信处理装置通过第三应用开发语言开发的通信接口进行中转,以确定第二应用的线程并将通信请求发送给第二应用的接口,从而可以实现不同应用开发语言开发的第一应用与第二应用之间的通信,并且通信路径短,通信过程中无需进行线程切换,因此可以高效实现不同应用开发语言开发的应用之间的通信。The communication processing apparatus 200 provided by the embodiment of the present application includes: an obtaining module 201, configured to obtain a communication request generated by the first application when the first engine runs; a calling module 202, configured to call the communication in the first engine according to the communication request interface, the communication interface is developed by the third application development language; the determining module 203 is used to determine the thread of the second application running in the second engine through the communication interface; the sending module 204 is used to send the communication request to the first application through the thread The interface of the second application; the processing module 205 is used for processing the communication request through the second application. The communication processing device performs transfer through the communication interface developed by the third application development language to determine the thread of the second application and send the communication request to the interface of the second application, so that the first application developed in different application development languages and the interface of the second application can be realized. The communication between the second applications has a short communication path, and no thread switching is required during the communication process, so the communication between applications developed in different application development languages can be efficiently implemented.
本申请实施例还提供一种电子设备。该电子设备可以为智能手机、平板电脑、游戏设备、AR(Augmented Reality,增强现实)设备、数据存储装置、音频播放装置、视频播放装置、笔记本电脑、桌面计算设备、可穿戴设备诸如电子手表、电子眼镜、电子头盔、电子手链、电子项链、电子衣物等设备。该电子设备可以用于在第一应用与第二应用之间通信。该第一应用由第一应用开发语言进行开发,该第二应用由第二应用开发语言进行开发,第一应用开发语言与第二应用开发语言为不同的应用开发语言。The embodiments of the present application also provide an electronic device. The electronic device may be a smart phone, a tablet computer, a game device, an AR (Augmented Reality) device, a data storage device, an audio playback device, a video playback device, a notebook computer, a desktop computing device, a wearable device such as an electronic watch, Electronic glasses, electronic helmets, electronic bracelets, electronic necklaces, electronic clothing and other equipment. The electronic device may be used to communicate between the first application and the second application. The first application is developed in a first application development language, the second application is developed in a second application development language, and the first application development language and the second application development language are different application development languages.
参考图8,图8为本申请实施例提供的电子设备300的结构示意图。电子设备300包括处理器301和存储器302。其中,处理器301与存储器302电性连接。Referring to FIG. 8 , FIG. 8 is a schematic structural diagram of an electronic device 300 according to an embodiment of the present application. Electronic device 300 includes processor 301 and memory 302 . The processor 301 is electrically connected to the memory 302 .
处理器301是电子设备300的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或调用存储在存储器302内的计算机程序,以及调用存储在存储器302内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。The processor 301 is the control center of the electronic device 300, uses various interfaces and lines to connect various parts of the entire electronic device, executes the electronic device by running or calling the computer program stored in the memory 302, and calling the data stored in the memory 302. Various functions of the device and processing data, so as to carry out the overall monitoring of the electronic device.
存储器302可用于存储计算机程序和数据。存储器302存储的计算机程序中包含有可在处理器中执行的指令。计算机程序可以组成各种功能模块。处理器301通过调用存储在存储器302的计算机程序,从而执行各种功能应用以及数据处理。Memory 302 may be used to store computer programs and data. The computer program stored in the memory 302 contains instructions executable in the processor. A computer program can be composed of various functional modules. The processor 301 executes various functional applications and data processing by calling the computer program stored in the memory 302 .
在本实施例中,电子设备300中的处理器301按照如下的步骤,将一个或 一个以上的计算机程序的进程对应的指令加载到存储器302中,并由处理器301来运行存储在存储器302中的计算机程序,从而执行以下步骤:In this embodiment, the processor 301 in the electronic device 300 loads the instructions corresponding to the processes of one or more computer programs into the memory 302 according to the following steps, and is executed by the processor 301 and stored in the memory 302 computer program that performs the following steps:
获取第一应用由第一引擎运行时产生的通信请求;obtaining a communication request generated by the first application when the first engine is running;
根据通信请求调用第一引擎中的通信接口,通信接口由第三应用开发语言进行开发;Call the communication interface in the first engine according to the communication request, and the communication interface is developed by the third application development language;
通过通信接口确定运行于第二引擎中的第二应用的线程;Determine the thread of the second application running in the second engine through the communication interface;
通过线程将通信请求发送给第二应用的接口;An interface for sending a communication request to the second application through a thread;
通过第二应用对通信请求进行处理。The communication request is processed by the second application.
在一些实施例中,通过线程将通信请求发送给第二应用的接口时,处理器301执行以下步骤:In some embodiments, when the communication request is sent to the interface of the second application through the thread, the processor 301 performs the following steps:
通过第二引擎向线程的任务队列中添加一个任务事件,任务事件为通信请求对应的事件;Add a task event to the task queue of the thread through the second engine, and the task event is the event corresponding to the communication request;
通过线程执行任务事件,以将通信请求发送给第二应用的接口。The task event is executed by the thread to send the communication request to the interface of the second application.
在一些实施例中,该线程包括事件队列和任务队列,任务队列中的事件的执行优先级高于事件队列中的事件的执行优先级。In some embodiments, the thread includes an event queue and a task queue, and events in the task queue have a higher execution priority than events in the event queue.
在一些实施例中,该线程在执行事件队列中的事件和任务队列中的事件时,判断任务队列是否为空,若任务队列不为空,则执行任务队列中的事件,若任务队列为空,则执行事件队列中的事件。In some embodiments, when executing the event in the event queue and the event in the task queue, the thread determines whether the task queue is empty, if the task queue is not empty, executes the event in the task queue, if the task queue is empty , the events in the event queue are executed.
在一些实施例中,通信请求包括渲染指令,通过第二应用对通信请求进行处理时,处理器301执行以下步骤:In some embodiments, the communication request includes rendering instructions, and when processing the communication request through the second application, the processor 301 performs the following steps:
通过第二应用执行渲染指令,以生成对应的用户界面。The rendering instruction is executed by the second application to generate a corresponding user interface.
由上可知,本申请实施例提供了一种电子设备,该电子设备执行以下步骤:获取第一应用由第一引擎运行时产生的通信请求;根据通信请求调用第一引擎中的通信接口,通信接口由第三应用开发语言进行开发;通过通信接口确定运行于第二引擎中的第二应用的线程;通过线程将通信请求发送给第二应用的接口;通过第二应用对通信请求进行处理。所述电子设备通过第三应用开发语言开发的通信接口进行中转,以确定第二应用的线程并将通信请求发送给第二应用的接口,从而可以实现不同应用开发语言开发的第一应用与第二应用之间的通信,并且通信路径短,通信过程中无需进行线程切换,因此可以高效实现不 同应用开发语言开发的应用之间的通信。It can be seen from the above that the embodiment of the present application provides an electronic device, and the electronic device performs the following steps: acquiring a communication request generated when the first application is run by the first engine; calling a communication interface in the first engine according to the communication request, and communicating The interface is developed by the third application development language; the thread of the second application running in the second engine is determined through the communication interface; the communication request is sent to the interface of the second application through the thread; the communication request is processed through the second application. The electronic device performs transfer through the communication interface developed by the third application development language, so as to determine the thread of the second application and send the communication request to the interface of the second application, so that the first application developed in different application development languages and the first application developed in different application development languages can be realized. The communication between the two applications, and the communication path is short, and no thread switching is required during the communication process, so the communication between applications developed in different application development languages can be efficiently realized.
本申请实施例还提供一种存储介质,所述存储介质中存储有计算机程序,当所述计算机程序在计算机上运行时,所述计算机执行上述任一实施例所述的通信处理方法,通信处理方法包括:An embodiment of the present application further provides a storage medium, where a computer program is stored in the storage medium, and when the computer program runs on a computer, the computer executes the communication processing method described in any of the above embodiments, and the communication processing Methods include:
获取第一应用由第一引擎运行时产生的通信请求;obtaining a communication request generated by the first application when the first engine is running;
根据通信请求调用第一引擎中的通信接口,通信接口由第三应用开发语言进行开发;Call the communication interface in the first engine according to the communication request, and the communication interface is developed by the third application development language;
通过通信接口确定运行于第二引擎中的第二应用的线程;Determine the thread of the second application running in the second engine through the communication interface;
通过线程将通信请求发送给第二应用的接口;An interface for sending a communication request to the second application through a thread;
通过第二应用对通信请求进行处理。The communication request is processed by the second application.
在一些实施例中,通过线程将通信请求发送给第二应用的接口时,通信处理方法包括:In some embodiments, when the communication request is sent to the interface of the second application through the thread, the communication processing method includes:
通过第二引擎向线程的任务队列中添加一个任务事件,任务事件为通信请求对应的事件;Add a task event to the task queue of the thread through the second engine, and the task event is the event corresponding to the communication request;
通过线程执行任务事件,以将通信请求发送给第二应用的接口。The task event is executed by the thread to send the communication request to the interface of the second application.
在一些实施例中,线程包括事件队列和任务队列,任务队列中的事件的执行优先级高于事件队列中的事件的执行优先级。In some embodiments, a thread includes an event queue and a task queue, and events in the task queue have a higher execution priority than events in the event queue.
在一些实施例中,线程在执行事件队列中的事件和任务队列中的事件时,通信处理方法包括:In some embodiments, when the thread executes the event in the event queue and the event in the task queue, the communication processing method includes:
判断任务队列是否为空,若任务队列不为空,则执行任务队列中的事件,若任务队列为空,则执行事件队列中的事件。Determine whether the task queue is empty, if the task queue is not empty, execute the event in the task queue, if the task queue is empty, execute the event in the event queue.
在一些实施例中,通信请求包括渲染指令,通过第二应用对通信请求进行处理,通信处理方法包括:In some embodiments, the communication request includes rendering instructions, the communication request is processed by the second application, and the communication processing method includes:
通过第二应用执行渲染指令,以生成对应的用户界面。The rendering instruction is executed by the second application to generate a corresponding user interface.
需要说明的是,本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过计算机程序来指令相关的硬件来完成,所述计算机程序可以存储于计算机可读存储介质中,所述存储介质可以包括但不限于:只读存储器(ROM,Read Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁盘或光盘等。It should be noted that those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium , the storage medium may include, but is not limited to: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, etc.
以上对本申请实施例所提供的通信处理方法、装置、存储介质及电子设备进行了详细介绍。本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The communication processing method, apparatus, storage medium, and electronic device provided by the embodiments of the present application have been described in detail above. The principles and implementations of the present application are described herein using specific examples, and the descriptions of the above embodiments are only used to help understand the methods and core ideas of the present application; meanwhile, for those skilled in the art, according to the Thoughts, there will be changes in specific embodiments and application scopes. To sum up, the contents of this specification should not be construed as limitations on the present application.

Claims (20)

  1. 一种通信处理方法,用于在第一应用与第二应用之间通信,所述第一应用由第一应用开发语言进行开发,所述第二应用由第二应用开发语言进行开发,所述通信处理方法包括:A communication processing method for communicating between a first application and a second application, the first application being developed by a first application development language, the second application being developed by a second application development language, the Communication processing methods include:
    获取所述第一应用由第一引擎运行时产生的通信请求;obtaining a communication request generated when the first application is run by the first engine;
    根据所述通信请求调用所述第一引擎中的通信接口,所述通信接口由第三应用开发语言进行开发;Invoke a communication interface in the first engine according to the communication request, where the communication interface is developed by a third application development language;
    通过所述通信接口确定运行于第二引擎中的所述第二应用的线程;determining, via the communication interface, a thread of the second application running in the second engine;
    通过所述线程将所述通信请求发送给所述第二应用的接口;sending the communication request to the interface of the second application through the thread;
    通过所述第二应用对所述通信请求进行处理。The communication request is processed by the second application.
  2. 根据权利要求1所述的通信处理方法,其中,所述通过所述线程将所述通信请求发送给所述第二应用的接口,包括:The communication processing method according to claim 1, wherein the interface for sending the communication request to the second application through the thread comprises:
    通过所述第二引擎向所述线程的任务队列中添加一个任务事件,所述任务事件为所述通信请求对应的事件;A task event is added to the task queue of the thread by the second engine, and the task event is an event corresponding to the communication request;
    通过所述线程执行所述任务事件,以将所述通信请求发送给所述第二应用的接口。The task event is executed by the thread to send the communication request to the interface of the second application.
  3. 根据权利要求2所述的通信处理方法,其中,所述线程包括事件队列和任务队列,所述任务队列中的事件的执行优先级高于所述事件队列中的事件的执行优先级。The communication processing method according to claim 2, wherein the thread includes an event queue and a task queue, and the execution priority of the event in the task queue is higher than the execution priority of the event in the event queue.
  4. 根据权利要求3所述的通信处理方法,其中,所述线程在执行所述事件队列中的事件和所述任务队列中的事件时,判断所述任务队列是否为空,若所述任务队列不为空,则执行所述任务队列中的事件,若所述任务队列为空,则执行所述事件队列中的事件。The communication processing method according to claim 3, wherein the thread judges whether the task queue is empty when executing the event in the event queue and the event in the task queue, and if the task queue is not If it is empty, execute the event in the task queue; if the task queue is empty, execute the event in the event queue.
  5. 根据权利要求1所述的通信处理方法,其中,所述通信请求包括渲染指令,所述通过所述第二应用对所述通信请求进行处理,包括:The communication processing method according to claim 1, wherein the communication request includes a rendering instruction, and the processing of the communication request by the second application includes:
    通过所述第二应用执行所述渲染指令,以生成对应的用户界面。The rendering instruction is executed by the second application to generate a corresponding user interface.
  6. 根据权利要求1所述的通信处理方法,其中,所述第一应用开发语言包括JavaScript语言、Python语言或Lua语言。The communication processing method according to claim 1, wherein the first application development language comprises JavaScript language, Python language or Lua language.
  7. 根据权利要求1所述的通信处理方法,其中,所述第二应用开发语言包括Dart语言或C#语言。The communication processing method according to claim 1, wherein the second application development language comprises Dart language or C# language.
  8. 一种通信处理装置,用于在第一应用与第二应用之间通信,所述第一应用由第一应用开发语言进行开发,所述第二应用由第二应用开发语言进行开发,所述通信处理装置包括:A communication processing device for communicating between a first application and a second application, the first application being developed by a first application development language, the second application being developed by a second application development language, the The communication processing device includes:
    获取模块,用于获取所述第一应用由第一引擎运行时产生的通信请求;an acquisition module, configured to acquire a communication request generated by the first application when the first engine is running;
    调用模块,用于根据所述通信请求调用所述第一引擎中的通信接口,所述通信接口由第三应用开发语言进行开发;a calling module, configured to call a communication interface in the first engine according to the communication request, where the communication interface is developed by a third application development language;
    确定模块,用于通过所述通信接口确定运行于第二引擎中的所述第二应用的线程;a determining module, configured to determine the thread of the second application running in the second engine through the communication interface;
    发送模块,用于通过所述线程将所述通信请求发送给所述第二应用的接口;a sending module, configured to send the communication request to the interface of the second application through the thread;
    处理模块,用于通过所述第二应用对所述通信请求进行处理。A processing module, configured to process the communication request through the second application.
  9. 根据权利要求8所述的通信处理装置,其中,所述发送模块用于:The communication processing device according to claim 8, wherein the sending module is used for:
    通过所述第二引擎向所述线程的任务队列中添加一个任务事件,所述任务事件为所述通信请求对应的事件;A task event is added to the task queue of the thread by the second engine, and the task event is an event corresponding to the communication request;
    通过所述线程执行所述任务事件,以将所述通信请求发送给所述第二应用的接口。The task event is executed by the thread to send the communication request to the interface of the second application.
  10. 根据权利要求9所述的通信处理装置,其中,所述线程包括事件队列和任务队列,所述任务队列中的事件的执行优先级高于所述事件队列中的事件的执行优先级。The communication processing apparatus according to claim 9, wherein the thread includes an event queue and a task queue, and the execution priority of the event in the task queue is higher than the execution priority of the event in the event queue.
  11. 根据权利要求10所述的通信处理装置,其中,所述线程在执行所述事件队列中的事件和所述任务队列中的事件时,所述处理模块用于:The communication processing apparatus according to claim 10, wherein, when the thread executes the event in the event queue and the event in the task queue, the processing module is configured to:
    判断所述任务队列是否为空,若所述任务队列不为空,则执行所述任务队列中的事件,若所述任务队列为空,则执行所述事件队列中的事件。Determine whether the task queue is empty, if the task queue is not empty, execute the event in the task queue, if the task queue is empty, execute the event in the event queue.
  12. 根据权利要求8所述的通信处理装置,其中,所述通信请求包括渲染指令,所述处理模块用于:The communication processing apparatus according to claim 8, wherein the communication request includes a rendering instruction, and the processing module is configured to:
    通过所述第二应用执行所述渲染指令,以生成对应的用户界面。The rendering instruction is executed by the second application to generate a corresponding user interface.
  13. 一种存储介质,所述存储介质中存储有计算机程序,当所述计算机程序在计算机上运行时,使得所述计算机执行通信处理方法,所述通信处理方法 用于在第一应用与第二应用之间通信,所述第一应用由第一应用开发语言进行开发,所述第二应用由第二应用开发语言进行开发,所述通信处理方法包括:A storage medium, in which a computer program is stored, when the computer program runs on a computer, the computer is made to execute a communication processing method, and the communication processing method is used between a first application and a second application The first application is developed by the first application development language, the second application is developed by the second application development language, and the communication processing method includes:
    获取所述第一应用由第一引擎运行时产生的通信请求;obtaining a communication request generated by the first application when the first engine is running;
    根据所述通信请求调用所述第一引擎中的通信接口,所述通信接口由第三应用开发语言进行开发;Invoke a communication interface in the first engine according to the communication request, where the communication interface is developed by a third application development language;
    通过所述通信接口确定运行于第二引擎中的所述第二应用的线程;determining, via the communication interface, a thread of the second application running in the second engine;
    通过所述线程将所述通信请求发送给所述第二应用的接口;sending the communication request to the interface of the second application through the thread;
    通过所述第二应用对所述通信请求进行处理。The communication request is processed by the second application.
  14. 一种电子设备,所述电子设备包括处理器和存储器,所述存储器中存储有计算机程序,所述处理器通过调用所述存储器中存储的所述计算机程序,用于执行通信处理方法,所述通信处理方法用于在第一应用与第二应用之间通信,所述第一应用由第一应用开发语言进行开发,所述第二应用由第二应用开发语言进行开发,所述处理器用于:An electronic device, the electronic device includes a processor and a memory, a computer program is stored in the memory, the processor is used to execute a communication processing method by calling the computer program stored in the memory, the The communication processing method is used for communication between a first application and a second application, the first application is developed by the first application development language, the second application is developed by the second application development language, and the processor is used for :
    获取所述第一应用由第一引擎运行时产生的通信请求;obtaining a communication request generated by the first application when the first engine is running;
    根据所述通信请求调用所述第一引擎中的通信接口,所述通信接口由第三应用开发语言进行开发;Invoke a communication interface in the first engine according to the communication request, where the communication interface is developed by a third application development language;
    通过所述通信接口确定运行于第二引擎中的所述第二应用的线程;determining, via the communication interface, a thread of the second application running in the second engine;
    通过所述线程将所述通信请求发送给所述第二应用的接口;Send the communication request to the interface of the second application through the thread;
    通过所述第二应用对所述通信请求进行处理。The communication request is processed by the second application.
  15. 根据权利要求14所述的电子设备,其中,所述通过所述线程将所述通信请求发送给所述第二应用的接口时,所述处理器用于:The electronic device of claim 14, wherein, when the communication request is sent to the interface of the second application through the thread, the processor is configured to:
    通过所述第二引擎向所述线程的任务队列中添加一个任务事件,所述任务事件为所述通信请求对应的事件;A task event is added to the task queue of the thread by the second engine, and the task event is an event corresponding to the communication request;
    通过所述线程执行所述任务事件,以将所述通信请求发送给所述第二应用的接口。The task event is executed by the thread to send the communication request to the interface of the second application.
  16. 根据权利要求15所述的电子设备,其中,所述线程包括事件队列和任务队列,所述任务队列中的事件的执行优先级高于所述事件队列中的事件的执行优先级。The electronic device according to claim 15, wherein the thread includes an event queue and a task queue, and the execution priority of the events in the task queue is higher than the execution priority of the events in the event queue.
  17. 根据权利要求16所述的电子设备,其中,所述线程在执行所述事件队列中的事件和所述任务队列中的事件时,所述处理器用于:The electronic device according to claim 16, wherein, when the thread executes the event in the event queue and the event in the task queue, the processor is configured to:
    判断所述任务队列是否为空,若所述任务队列不为空,则执行所述任务队列中的事件,若所述任务队列为空,则执行所述事件队列中的事件。Determine whether the task queue is empty, if the task queue is not empty, execute the event in the task queue, if the task queue is empty, execute the event in the event queue.
  18. 根据权利要求14所述的电子设备,其中,所述通信请求包括渲染指令,所述通过所述第二应用对所述通信请求进行处理时,所述处理器用于:The electronic device according to claim 14, wherein the communication request includes a rendering instruction, and when the communication request is processed by the second application, the processor is configured to:
    通过所述第二应用执行所述渲染指令,以生成对应的用户界面。The rendering instruction is executed by the second application to generate a corresponding user interface.
  19. 根据权利要求14所述的电子设备,其中,所述第一应用开发语言包括JavaScript语言、Python语言或Lua语言。The electronic device according to claim 14, wherein the first application development language comprises JavaScript language, Python language or Lua language.
  20. 根据权利要求14所述的电子设备,其中,所述第二应用开发语言包括Dart语言或C#语言。The electronic device according to claim 14, wherein the second application development language comprises Dart language or C# language.
PCT/CN2021/116981 2020-11-12 2021-09-07 Communication processing method and apparatus, storage medium, and electronic device WO2022100244A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011262429.X 2020-11-12
CN202011262429.XA CN112256421A (en) 2020-11-12 2020-11-12 Communication processing method, communication processing device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
WO2022100244A1 true WO2022100244A1 (en) 2022-05-19

Family

ID=74265647

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/116981 WO2022100244A1 (en) 2020-11-12 2021-09-07 Communication processing method and apparatus, storage medium, and electronic device

Country Status (2)

Country Link
CN (1) CN112256421A (en)
WO (1) WO2022100244A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256421A (en) * 2020-11-12 2021-01-22 Oppo广东移动通信有限公司 Communication processing method, communication processing device, storage medium and electronic equipment
CN114077456A (en) * 2021-08-18 2022-02-22 五八有限公司 Component processing method and device, electronic equipment and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9823909B1 (en) * 2014-05-02 2017-11-21 Amazon Technologies, Inc. Program code conversion for cross-platform compatibility
CN110659028A (en) * 2019-09-30 2020-01-07 北京达佳互联信息技术有限公司 Data processing system, method, device, electronic equipment and storage medium
CN110688601A (en) * 2019-09-18 2020-01-14 郑州阿帕斯科技有限公司 Data processing method and device
CN110691136A (en) * 2019-09-29 2020-01-14 广州华多网络科技有限公司 Data interaction method and device, electronic equipment and storage medium
CN111182019A (en) * 2019-08-08 2020-05-19 腾讯科技(深圳)有限公司 Cross-platform communication method and device and electronic equipment
CN111290806A (en) * 2020-02-10 2020-06-16 广州虎牙科技有限公司 Calling method and device of application program interface, computer equipment and storage medium
CN111666112A (en) * 2020-04-21 2020-09-15 苏宁云计算有限公司 Method, device and system for realizing platform plug-in and computer equipment
CN112256421A (en) * 2020-11-12 2021-01-22 Oppo广东移动通信有限公司 Communication processing method, communication processing device, storage medium and electronic equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108572818B (en) * 2017-03-08 2021-07-23 斑马智行网络(香港)有限公司 User interface rendering method and device
CN107133045A (en) * 2017-05-09 2017-09-05 上海雪鲤鱼计算机科技有限公司 Cross-platform game engine multi-threading correspondence method, device, storage medium and equipment
CN109388504A (en) * 2018-09-26 2019-02-26 平安科技(深圳)有限公司 Messageization docks processing method, device, computer equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9823909B1 (en) * 2014-05-02 2017-11-21 Amazon Technologies, Inc. Program code conversion for cross-platform compatibility
CN111182019A (en) * 2019-08-08 2020-05-19 腾讯科技(深圳)有限公司 Cross-platform communication method and device and electronic equipment
CN110688601A (en) * 2019-09-18 2020-01-14 郑州阿帕斯科技有限公司 Data processing method and device
CN110691136A (en) * 2019-09-29 2020-01-14 广州华多网络科技有限公司 Data interaction method and device, electronic equipment and storage medium
CN110659028A (en) * 2019-09-30 2020-01-07 北京达佳互联信息技术有限公司 Data processing system, method, device, electronic equipment and storage medium
CN111290806A (en) * 2020-02-10 2020-06-16 广州虎牙科技有限公司 Calling method and device of application program interface, computer equipment and storage medium
CN111666112A (en) * 2020-04-21 2020-09-15 苏宁云计算有限公司 Method, device and system for realizing platform plug-in and computer equipment
CN112256421A (en) * 2020-11-12 2021-01-22 Oppo广东移动通信有限公司 Communication processing method, communication processing device, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN112256421A (en) 2021-01-22

Similar Documents

Publication Publication Date Title
US11829787B2 (en) Multi-process model for cross-platform applications
US20190087212A1 (en) Android simulator and method for implementing android simulator
US7930687B2 (en) Execution context infrastructure
WO2022100244A1 (en) Communication processing method and apparatus, storage medium, and electronic device
US10019298B2 (en) Middleware interface and middleware interface generator
WO2018161813A1 (en) Resource loading method and device
KR102076379B1 (en) Persistent and resilient worker processes
US20150261726A1 (en) Screenshot method and device
US20150339137A1 (en) Methods, systems, and media for binary compatible graphics support in mobile operating systems
US10705850B2 (en) Stack frame unwinding for exception handling
US20160077850A1 (en) Methods, systems, and media for binary compatibility
KR20140101412A (en) Isa bridging with callback
US8390631B2 (en) Synchronizing queued data access between multiple GPU rendering contexts
US10733005B1 (en) Providing access to mobile applications by heterogeneous devices
CN111078325A (en) Application program running method and device, electronic equipment and storage medium
CN109117253A (en) A kind of method and apparatus of micro-kernel scheduling
CN110489318B (en) Systrace information grabbing method and device, storage medium and terminal
CN111258715B (en) Multi-operating system rendering processing method and device
CN111104183A (en) Application program running method and device, electronic equipment and storage medium
Stein Spunky, a Genode kernel in Ada/SPARK
WO2022166553A1 (en) Method and apparatus for implementing batch system calls
WO2023169157A1 (en) Sub application running method and apparatus, electronic device, program product, and storage medium
CN118093083A (en) Page processing method, page processing device, computer equipment and computer readable storage medium
CN117971435A (en) Task execution method, device, electronic equipment and computer readable storage medium
CN118069287A (en) Application management method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21890772

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21890772

Country of ref document: EP

Kind code of ref document: A1