WO2024061036A1 - Inter-engine communication method and related device - Google Patents
Inter-engine communication method and related device Download PDFInfo
- Publication number
- WO2024061036A1 WO2024061036A1 PCT/CN2023/117917 CN2023117917W WO2024061036A1 WO 2024061036 A1 WO2024061036 A1 WO 2024061036A1 CN 2023117917 W CN2023117917 W CN 2023117917W WO 2024061036 A1 WO2024061036 A1 WO 2024061036A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- objects
- engine
- request
- bridging layer
- same
- Prior art date
- Legal status (The legal status 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 status listed.)
- Ceased
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F15/00—Digital computers in general; Data processing equipment in general
- G06F15/16—Combinations of two or more digital computers each having at least an arithmetic unit, a program unit and a register, e.g. for a simultaneous processing of several programs
- G06F15/163—Interprocessor communication
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
Definitions
- the present application relates to the field of computer technology, and in particular, to an inter-engine communication method and related equipment.
- Ets is an extensible TS (TypeScript) language and the main development language for Hongmeng applications. It has the advantages of ecological integration with JS (JavaScript), efficient type system, and concise and efficient declarative development paradigm. In order to further expand the Hongmeng ecosystem, it is necessary to introduce the Web ecosystem.
- the Web ecosystem is mainly developed in HTML5 (H5) language. H5 pages are loaded and displayed through the web components in Hongmeng's Ark development framework (ArkUI).
- the Hongmeng Ets code runs in the JS runtime of the Ark engine, and the H5 JS code runs in the JS runtime of the V8 engine of the WebView. Since the two languages run in different JS engines, it can also be understood that the two languages run in two independent sandbox-isolated contexts, resulting in the inability to communicate directly between H5 and Ets. In H5, it is impossible to reuse the Application Programming Interface (API) customized by developers on the Ets side or the Hongmeng system, which seriously affects the promotion and expansion of the Hongmeng application ecosystem.
- API Application Programming Interface
- the technical problem to be solved by the embodiments of this application is to provide an inter-engine communication method and related equipment to realize communication between different JS engines.
- the implementation example of this application provides a communication method between engines, which is characterized in that it is applied to an operating system.
- the operating system includes a first engine, a second engine and a bridging layer.
- the first engine includes multiple a first object
- the second engine includes a plurality of second objects
- the method includes: receiving a first request sent by the first engine through the bridging layer, the first request being used to request execution of the plurality of second objects.
- N first objects among the first objects, N is an integer greater than 0; in response to the first request, the bridging layer determines whether there are any of the plurality of second objects that are the same as the N first objects.
- N second objects with the same object if they exist, send a second request to the second engine through the bridging layer, where the second request is used to request the second engine to execute the N according to the corresponding function parameters.
- a second object is characterized in that it is applied to an operating system.
- the operating system includes a first engine, a second
- a bridge layer can be added between the first engine and the second engine to realize communication between different engines through the bridge layer.
- the first application can be run on the first engine, and the first application can include multiple first objects; the second application can be run on the second engine, and the second application can include multiple second objects, and The first application and the second application run in two different contexts.
- the first engine can send a request to execute one or more first objects to the bridging layer, and then the bridging layer determines whether there are multiple second objects that match the one or more first objects mentioned above.
- the bridging layer will send a request to the second engine to execute the corresponding one or more second objects, and the request may include function parameters that need to be used during the execution process, so that the second object
- the engine can execute the corresponding second object based on the function parameters, realizing cross-engine communication.
- it is avoided to directly register the objects of the second engine in the first engine, and the information interaction between two different engines is efficiently realized through the bridging layer. Therefore, on the premise of ensuring security, the two operations are solved.
- the problem is that environments are isolated from each other and cannot call each other's objects (or functions).
- determining whether there are N second objects that are the same as the N first objects among the plurality of second objects includes: determining whether among the plurality of second objects There are N second objects that have the same object identifiers as the N first objects; wherein, if they exist, the N second objects are the same as the N first objects.
- the bridging layer can obtain the object names (also called object identifiers) of multiple first objects from the first engine, and the bridging layer can also obtain the objects of multiple second objects from the second engine. name. Further, when the bridging layer receives the request sent by the first engine, it can determine whether there are N second objects with the same object names as the N first objects in the request among the multiple second objects. If they exist, the bridge layer The layer can send an execution request to the second engine, so that the first engine can call the second engine through the bridging layer during operation. object. In this application, it is avoided to directly register the objects of the second engine in the first engine, and the information interaction between two different engines is efficiently realized through the bridging layer. Therefore, on the premise of ensuring security, the two operations are solved. The problem is that environments are isolated from each other and cannot call each other's objects (or functions).
- determining whether there are N second objects that are the same as the N first objects among the plurality of second objects includes: determining whether among the plurality of second objects There are N second objects that have the same object identifiers as the N first objects; if they exist, the first function included in each of the N first objects is determined through the first record table; so The first record table includes the first function included in each first object among the plurality of first objects; based on the second record table, determine all the first functions included in each first object among the N first objects. Whether the first function is consistent with the second function included in each second object in the N second objects; wherein, if they are consistent, there is a function in the plurality of second objects that is the same as the N first objects.
- the N second objects; the second record table includes a second function included in each of the second objects.
- the bridging layer not only needs to determine whether the object names are the same, but also needs to determine whether the functions under the object names are the same by looking up the table. If they are the same, the bridging layer can send an execution request to the second engine, so as to achieve running During the process, the first engine can call objects in the second engine through the bridging layer. In this application, it is avoided to directly register the objects of the second engine in the first engine, and the information interaction between two different engines is efficiently realized through the bridging layer. Therefore, on the premise of ensuring security, the two operations are solved. The problem is that environments are isolated from each other and cannot call each other's objects (or functions).
- the method further includes: obtaining an object identifier corresponding to each of the plurality of first objects through the bridging layer, and each of the first objects includes: The first function generates the first record table; the object identifier corresponding to each second object in the plurality of second objects is obtained through the bridging layer, and each second object includes The second function generates the second record table.
- the bridging layer can obtain the object names (also called object identifiers) of multiple first objects and the function names under the object names from the first engine and generate the first record table.
- the bridging layer can also The object names of multiple second objects and the function names under the object names are obtained from the second engine and a second record table is generated. Then the bridging layer can determine the names under the object names in the request based on the first record table and the second record table. functions are the same.
- it is avoided to directly register the objects of the second engine in the first engine, and the information interaction between two different engines is efficiently realized through the bridging layer. Therefore, on the premise of ensuring security, the two operations are solved.
- the problem is that environments are isolated from each other and cannot call each other's objects (or functions).
- the method further includes: in response to the second request, executing the N second objects according to the corresponding function parameters through the second engine, and generating the Nth The execution results corresponding to the two objects are forwarded to the first engine through the bridging layer, and the execution results corresponding to the N second objects sent by the second engine are forwarded.
- the second engine can respond to the request of the bridge layer, execute the corresponding second object based on the function parameters, and generate the corresponding execution result, and then forward the execution result to the first engine through the bridge layer, thereby Implement cross-engine data interaction.
- it is avoided to directly register the objects of the second engine in the first engine, and the information interaction between two different engines is efficiently realized through the bridging layer. Therefore, on the premise of ensuring security, the two operations are solved.
- the environment is isolated from each other, unable to call each other's objects (or functions), and cannot transfer data.
- the method further includes: if the N second objects that are the same as the N first objects do not exist among the plurality of second objects, through the bridging layer A first notification is sent to the first engine, where the first notification includes a message of execution errors of the N first objects.
- the second engine cannot execute the object in the request, and the first engine can be notified through the bridging layer that the object in the request will not be executed.
- it is avoided to directly register the objects of the second engine in the first engine, and the information interaction between two different engines is efficiently realized through the bridging layer. Therefore, on the premise of ensuring security, the two operations are solved.
- the environment is isolated from each other, unable to call each other's objects (or functions), and cannot transfer data.
- the present application provides an electronic device, characterized in that the electronic device runs an operating system, the operating system includes a first engine, a second engine and a bridging layer, and the first engine includes a plurality of third engines.
- the first processing unit is specifically configured to: determine whether the plurality of second objects is the same as the The object identifiers of the N first objects are the same N second objects; wherein, if they exist, the N second objects are the same as the N first objects.
- the first processing unit is specifically configured to: determine whether there are N second objects among the plurality of second objects that have the same object identifiers as the N first objects; If it exists, determine the first function included in each first object among the N first objects through the first record table; the first record table includes the first function included in each first object among the plurality of first objects. The first function; based on the second record table, determine the first function included in each of the N first objects and the first function included in each of the N second objects. Whether the second function is consistent; wherein, if consistent, there are N second objects that are the same as the N first objects among the plurality of second objects; the second record table includes the second object The second function included in each second object.
- the device further includes: a second receiving unit configured to obtain, through the bridging layer, the object identifier corresponding to each first object in the plurality of first objects, and each The first function included in each of the first objects generates the first record table; a third receiving unit is used to obtain each of the plurality of second objects through the bridging layer The corresponding object identifier and the second function included in each second object generate the second record table.
- the device further includes: a second processing unit, configured to respond to the second request, execute the N second objects according to the corresponding function parameters through the second engine, and generate execution results corresponding to the N second objects; a second sending unit configured to forward to the first engine through the bridging layer all the execution results corresponding to the N second objects sent by the second engine. Describe the execution results.
- the device further includes: a third sending unit, configured to: if there are no N second objects that are the same as the N first objects among the plurality of second objects, , then a first notification is sent to the first engine through the bridge layer, where the first notification includes execution error messages for the N first objects.
- a third sending unit configured to: if there are no N second objects that are the same as the N first objects among the plurality of second objects, , then a first notification is sent to the first engine through the bridge layer, where the first notification includes execution error messages for the N first objects.
- the present application provides a computer storage medium, characterized in that the computer storage medium stores a computer program, and when the computer program is executed by a processor, it implements the method described in any one of the first aspects above.
- embodiments of the present application provide an electronic device, which includes a processor.
- the processor is configured to support the electronic device in implementing corresponding functions in the inter-engine communication method provided in the first aspect.
- the electronic device may also include a memory coupled to the processor that stores necessary program instructions and data for the electronic device.
- the electronic device may also include a communication interface for the electronic device to communicate with other devices or communication networks.
- the present application provides a chip system that includes a processor to support the electronic device to implement the functions involved in the above-mentioned first aspect, for example, generating or processing those involved in the above-mentioned inter-engine communication method. Information.
- the chip system further includes a memory, and the memory is used to store necessary program instructions and data of the electronic device.
- the chip system may be composed of chips, or may include chips and other separate components.
- the present application provides a computer program, characterized in that the computer program includes instructions that, when the computer program is executed by a computer, cause the computer to perform any of the methods described in the first aspect. .
- FIG. 1 is a schematic structural diagram of an electronic device 100 provided by an embodiment of the present invention.
- Figure 2 is a schematic diagram of a system architecture for cross-engine communication provided by an embodiment of the present invention.
- FIG. 3 is a schematic flowchart of an inter-engine communication method in an embodiment of the present application.
- Figure 4 is a schematic diagram of the interaction between the H5 side and the Ets side provided by an embodiment of the present invention.
- FIG. 5 is a schematic diagram of an interface of an electronic device provided by an embodiment of the present invention.
- Figure 6 is a schematic flow chart of interaction between the H5 side and the Ets side provided by an embodiment of the present invention.
- FIG. 7 is a schematic diagram of an electronic device provided by this application according to an embodiment of the present invention.
- an embodiment means that a particular feature, structure or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application.
- the appearances of this phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those skilled in the art understand, both explicitly and implicitly, that the embodiments described herein may be combined with other embodiments.
- FIG. 1 shows a schematic structural diagram of an electronic device 100 .
- electronic device 100 may have more or fewer components than shown in the figures, may combine two or more components, or may have a different component configuration.
- the various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and/or application specific integrated circuits.
- the electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2.
- Mobile communication module 150 wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, And subscriber identification module (subscriber identification module, SIM) card interface 195, etc.
- SIM subscriber identification module
- the sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and an environment.
- the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100 .
- the electronic device 100 may include more or fewer components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently.
- the components illustrated may be implemented in hardware, software, or a combination of software and hardware.
- the processor 110 may include one or more processing units.
- the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) wait.
- application processor application processor, AP
- modem processor graphics processing unit
- GPU graphics processing unit
- image signal processor image signal processor
- ISP image signal processor
- controller memory
- video codec digital signal processor
- DSP digital signal processor
- baseband processor baseband processor
- NPU neural-network processing unit
- different processing units can be independent devices or integrated in one or more processors.
- the controller may be the nerve center and command center of the electronic device 100 .
- the controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions.
- the processor 110 may also be provided with a memory for storing instructions and data.
- the memory in processor 110 is cache memory. This memory may hold instructions or data that have been recently used or recycled by processor 110 . If the processor 110 needs to use the instructions or data again, it can be called directly from the memory. Repeated access is avoided and the waiting time of the processor 110 is reduced, thus improving the efficiency of the system.
- processor 110 may include one or more interfaces.
- Interfaces may include integrated circuit (inter-integrated circuit, I2C) interface, integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, pulse code modulation (pulse code modulation, PCM) interface, universal asynchronous receiver and transmitter (universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and /or universal serial bus (USB) interface, etc.
- I2C integrated circuit
- I2S integrated circuit built-in audio
- PCM pulse code modulation
- UART universal asynchronous receiver and transmitter
- MIPI mobile industry processor interface
- GPIO general-purpose input/output
- SIM subscriber identity module
- USB universal serial bus
- the interface connection relationships between the modules illustrated in the embodiment of the present invention are only schematic illustrations and do not constitute a structural limitation of the electronic device 100 .
- the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
- the charging management module 140 is used to receive charging input from the charger.
- the charger can be a wireless charger or a wired charger.
- the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
- the power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, internal memory 121, external memory, display screen 194, camera 193, wireless communication module 160, etc.
- the wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
- the electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like.
- the GPU is an image processing microprocessor and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
- Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
- the display screen 194 is used to display images, videos, etc.
- Display 194 includes a display panel.
- the display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode).
- LCD liquid crystal display
- OLED organic light-emitting diode
- AMOLED organic light-emitting diode
- FLED flexible light-emitting diode
- Miniled MicroLed, Micro-oLed, quantum dot light emitting diode (QLED), etc.
- the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
- the electronic device 100 can implement the shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
- ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
- the camera 193 is used to capture still images or videos.
- the object generates an optical image through the lens and projects it onto the photosensitive element.
- the photosensitive element can be a charge coupled device (CCD) or a complementary metal oxide semiconductor (CMOS) phototransistor.
- CMOS complementary metal oxide semiconductor
- the photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal.
- the ISP outputs the digital image signal to the DSP for processing.
- the DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format.
- the electronic device 100 may include other cameras.
- the electronic device may also include a dot matrix transmitter (not shown in the figure) for emitting light.
- the camera collects light reflected from the face to obtain a face image, and the processor processes and analyzes the face image, and verifies it by comparing it with the stored face image information.
- Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
- Video codecs are used to compress or decompress digital video.
- Electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
- MPEG moving picture experts group
- MPEG2 MPEG2, MPEG3, MPEG4, etc.
- NPU is a neural network (NN) computing processor.
- NN neural network
- applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
- the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100.
- the external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. Such as saving music, videos, etc. files in external memory card.
- Internal memory 121 may be used to store computer executable program code, which includes instructions.
- the processor 110 executes instructions stored in the internal memory 121 to execute various functional applications and data processing of the electronic device 100 .
- the internal memory 121 may include a program storage area and a data storage area. Among them, the stored program area can store the operating system and at least one application required for the function (such as face recognition function, fingerprint recognition function, mobile payment function, etc.).
- the storage data area can store data created during the use of the electronic device 100 (such as face information template data, fingerprint information templates, etc.).
- the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
- the electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playback, recording, etc.
- the audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals.
- Speaker 170A also called “speaker” is used to convert audio electrical signals into sound signals.
- Receiver 170B also called “earpiece” is used to convert audio electrical signals into sound signals.
- Microphone 170C also called “microphone” or “microphone”, is used to convert sound signals into electrical signals.
- the headphone interface 170D is used to connect wired headphones.
- the headphone interface 170D may be a USB interface 130, or may be a 3.5mm open mobile terminal platform (OMTP) standard interface, or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.
- OMTP open mobile terminal platform
- CTIA Cellular Telecommunications Industry Association of the USA
- the pressure sensor 180A is used to sense the pressure signal and convert the pressure signal into an electrical signal.
- the pressure sensor 180A can be disposed on the display screen 194.
- the gyro sensor 180B may be used to determine the motion posture of the electronic device 100 .
- the angular velocity of electronic device 100 about three axes ie, x, y, and z axes
- Proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode.
- the light emitting diode may be an infrared light emitting diode.
- the ambient light sensor 180L is used to sense ambient light brightness.
- the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
- the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
- Fingerprint sensor 180H is used to collect fingerprints.
- the electronic device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access to application locks, fingerprint photography, fingerprint answering of incoming calls, etc.
- the fingerprint sensor 180H can be disposed below the touch screen.
- the electronic device 100 can receive the user's touch operation on the area corresponding to the fingerprint sensor on the touch screen.
- the electronic device 100 can respond to the touch operation and collect the fingerprint of the user's finger. information.
- Temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 utilizes the temperature detected by the temperature sensor 180J to execute the temperature processing strategy.
- Touch sensor 180K also called “touch panel”.
- the touch sensor 180K can be disposed on the display screen 194.
- the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen”.
- the touch sensor 180K is used to detect a touch operation on or near the touch sensor 180K.
- the touch sensor can pass the detected touch operation to the application processor to determine the touch event type.
- Visual output related to the touch operation may be provided through display screen 194 .
- the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a location different from that of the display screen 194 .
- the buttons 190 include a power button, a volume button, etc.
- Key 190 may be a mechanical key. It can also be a touch button.
- the electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
- the indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, or may be used to indicate messages, missed calls, notifications, etc.
- the SIM card interface 195 is used to connect a SIM card.
- the SIM card can be connected to or separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195 .
- the electronic device 100 uses an eSIM, that is, an embedded SIM card.
- the eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100 .
- Figure 2 is a schematic diagram of a cross-engine communication system architecture provided by an embodiment of the present invention. This system can be run in the software system of the above-mentioned electronic device 100 and can solve the problem that different JS engines cannot communicate with each other during operation. question.
- the system architecture can include Ark JS engine module (Ark JavaScript Engine), Ark development architecture module (ArkUI Framework), H5JS engine module, JS engine bridge module, JS method identification module, and fault tolerance module.
- the Ark JS engine module can be responsible for executing JS code, parsing and generating Abstract Syntax Tree (AST), converting it into bytecode, and generating machine code, etc., and executing the machine code and passing the execution results to the Framework of ArkUI Module;
- ArkUI Framework module can be responsible for interacting with the JS engine, page life cycle management, event distribution, loading UI components, routing jumps, data binding, etc.;
- the H5JS engine module can be responsible for parsing and executing H5 JS code, and executing the JS
- the object name, function name, and function parameters are passed to the JS engine bridge module;
- the JS engine bridge module can be responsible for monitoring the object name, method name (also called function name), and function parameters passed by the Ark engine and the H5 JS engine.
- the JS method identification module can be responsible for obtaining the H5 side and Ets side method names from the JS engine bridge module. , determine whether the JS method on the H5 side is the same as the method on the Ets side; the fault tolerance module can be responsible for processing illegal input on the H5 side, and monitor the existence of the method in Ets in real time, completing fault tolerance protection on the application side to avoid abnormal situations.
- Figure 3 is a flow diagram of a method for communicating between engines in an embodiment of the present application.
- the following will be combined with Figure 3 and based on the system architecture of cross-engine communication in Figure 2 above to describe the method for communicating between engines in an embodiment of the present application from the interaction side.
- the method is applied to an operating system, the operating system includes a first engine, a second engine and a bridging layer, the first engine includes a plurality of first objects, the second engine includes a plurality of second objects, the plurality of first objects are objects running in a first application, the plurality of second objects are objects running in a second application, the first application and the second application are two different applications, that is, the first application and the second application run in two different contexts.
- the method can be used to solve the problem that different engines cannot communicate with each other at run time. It should be noted that in order to describe the method for communicating between engines in an embodiment of the present application in more detail, the present application describes the corresponding execution subject in each process step, and the electronic device (which can be the electronic device 100 in Figure 1 above) is described, but it does not mean that the embodiment of the present application can only perform the corresponding method flow through the described execution subject.
- Step S201 The electronic device receives the first request sent by the first engine through the bridge layer.
- the first request is used to request execution of N first objects among the plurality of first objects, where N is an integer greater than 0.
- the first engine can be the H5JS engine on the H5 side mentioned above, and the H5JS engine can be used to parse and execute H5 JS code.
- Step S202 The electronic device responds to the first request through the bridge layer and determines whether there are N second objects that are the same as the N first objects among the plurality of second objects.
- the bridging layer when the bridging layer receives the first request sent by the first engine, it determines the target object requested to be executed in the first request, that is, N first objects, and then the bridging layer determines whether any of the multiple second objects of the second engine There is a second object that is identical to the target object.
- the second engine can be the Ark JS engine on the Ets side mentioned above.
- the Ark JS engine can be used to execute JS code, parse and generate abstract syntax trees, convert it into bytecode, and generate machine code, etc.
- determining whether there are N second objects that are the same as the N first objects among the plurality of second objects includes: determining whether among the plurality of second objects There are N second objects that have the same object identifiers as the N first objects; wherein, if they exist, the N second objects are the same as the N first objects.
- the bridge layer can obtain the object names (also called object identifiers) of multiple first objects from the first engine, and the bridge layer can also obtain the object names of multiple second objects from the second engine. Furthermore, after the bridge layer receives the request sent by the first engine, it can determine whether there are N second objects with the same object names as the N first objects in the request among the multiple second objects. If so, the bridge layer can send an execution request to the second engine, so that the first engine can call the objects in the second engine through the bridge layer during operation. In the present application, it is avoided to register the objects of the second engine directly in the first engine, and the information interaction between the two different engines is efficiently realized through the bridge layer. Therefore, under the premise of ensuring safety, the problem that the two operating environments are isolated from each other and cannot call each other's objects (or functions) is solved.
- object names also called object identifiers
- determining whether there are N second objects that are the same as the N first objects among the plurality of second objects includes: determining whether among the plurality of second objects There are N second objects that have the same object identifiers as the N first objects; if they exist, the first function included in each of the N first objects is determined through the first record table; so The first record table includes the first function included in each first object among the plurality of first objects; based on the second record table, determine all the first functions included in each first object among the N first objects. Whether the first function is consistent with the second function included in each second object in the N second objects; wherein, if they are consistent, there is a function in the plurality of second objects that is the same as the N first objects.
- the N second objects; the second record table includes a second function included in each of the second objects.
- the bridging layer not only needs to determine whether the object names are the same, but also needs to check the table to determine whether the functions under the object names are the same. If they are the same, the bridging layer can send an execution request to the second engine, thereby realizing the first execution during operation.
- the engine can call objects in the second engine through the bridging layer.
- it is avoided to directly register the objects of the second engine in the first engine, and the information interaction between two different engines is efficiently realized through the bridging layer. Therefore, on the premise of ensuring security, the two operations are solved.
- the problem is that environments are isolated from each other and cannot call each other's objects (or functions).
- the method further includes: obtaining, through the bridging layer, an object identifier corresponding to each of the first objects in the plurality of first objects, and an object identifier included in each first object.
- the first function generates the first record table; and obtains, through the bridging layer, the object identifier corresponding to each second object in the plurality of second objects, and the information included in each second object.
- the second function generates the second record table.
- the bridge layer can obtain the object names (also called object identifiers) of multiple first objects and the function names under the object names from the first engine and generate a first record table, and the bridge layer can also obtain the object names of multiple second objects and the function names under the object names from the second engine and generate a second record table, and then the bridge layer can determine whether the functions under the object names in the request are the same based on the first record table and the second record table.
- object names also called object identifiers
- the bridge layer can determine whether the functions under the object names in the request are the same based on the first record table and the second record table.
- Figure 4 is a schematic diagram of the interaction between the H5 side and the Ets side provided by an embodiment of the present invention. It can be used on the JS engine side (i.e. the second engine) of ArkUI (Hongmeng's application development framework). Run the code on the Ets side) and H5's JS engine (i.e. the first engine, which can be used to run the code on the H5 side) build two mapping tables, and a bridge layer can be built between the two JS running environments for message transmission.
- JS engine side i.e. the second engine
- ArkUI Haongmeng's application development framework
- the JS engine bridge module parses the object name and method name (also known as function name) customized by the developer on the Ark engine (i.e., the second engine) and registers them to obtain the object name included in the Ark engine and the method list under each object name (also known as function list) and record them in the second record table;
- the JS engine of WebView is connected to the JS engine of WebView through the JS engine bridge module. (i.e. the first engine) registers the above method (i.e.
- the H5 page executes the H5 method through the JS engine of WebView; the JS engine of WebView sends a request to the JS engine bridge module to determine whether the method exists; if the JS engine bridge module determines that the method exists based on the above second record table, the JS engine of WebView can be notified that the method exists; the JS engine of WebView sends an execution request to the JS engine bridge module and can carry the function parameters required in the execution process; the JS engine bridge module sends a request to execute the method to the Ark engine; the Ark engine executes the method and returns the result to the WebView kernel, and forwards it to the JS engine of WebView through the JS engine bridge module; the JS engine of WebView then passes the execution result back to the H5 page.
- Step S203 If present, the electronic device sends a second request to the second engine through the bridge layer.
- the second request is used to request the second engine to execute the N second objects according to corresponding function parameters.
- the second request may include function parameters that need to be used in executing the N second requests.
- the method further includes: in response to the second request, executing the N second objects according to the corresponding function parameters through the second engine, and generating the Nth The execution results corresponding to the two objects are forwarded to the first engine through the bridging layer, and the execution results corresponding to the N second objects sent by the second engine are forwarded.
- the second engine can respond to the request of the bridge layer, execute the corresponding second object based on the function parameters, and generate the corresponding execution results, and then forward the execution results to the first engine through the bridge layer, thereby realizing cross-engine Data interaction.
- it is avoided to directly register the objects of the second engine in the first engine, and the information interaction between two different engines is efficiently realized through the bridging layer. Therefore, on the premise of ensuring security, the two operations are solved.
- the environment is isolated from each other, unable to call each other's objects (or functions), and cannot transfer data.
- the second engine can determine again whether the corresponding object (or function) exists. If it exists, execute the corresponding object (or function) based on the function parameters; if not exists, the second engine will not execute the corresponding object (or function), and will notify the first engine of execution failure and return exception log information, thus completing fault-tolerance protection on the application side.
- Figure 5 is a schematic diagram of an interface of an electronic device provided by an embodiment of the present invention.
- a first interface is displayed on the electronic device.
- the first interface can be the one currently opened by the browser. Page, users can implement real-time calculations on this interface.
- the user inputs data 1 and 2.
- the first engine will send a request to call the addition operation (can be understood as a function) to the bridge layer.
- the bridging layer will determine whether the function exists in the second engine. If it exists, the bridging layer will send the function parameters (such as 1 and 2) to the second engine.
- the second engine will execute the corresponding function based on the function parameters and will The execution results are sent to the first engine through the bridge layer.
- the communication method between engines provided by this application can not only solve the problem that the two operating environments are isolated from each other and cannot call each other's objects (or functions), but also can reduce the response delay in the scenario of frequent interaction between H5 and Ets, and the response is instantaneous. .
- the method further includes: if the N second objects that are the same as the N first objects do not exist among the plurality of second objects, through the bridging layer A first notification is sent to the first engine, where the first notification includes a message of execution errors of the N first objects.
- the second engine cannot execute the object in the request, and then the first engine can be notified through the bridge layer that the object in the request will not be executed.
- the object of the second engine is avoided from being directly registered in the first engine, and the information interaction between the two different engines is efficiently realized through the bridge layer. Therefore, under the premise of ensuring security, the problem of the two operating environments being isolated from each other and unable to call each other's objects (or functions) and unable to transfer data is solved.
- the first engine is the JS engine of H5
- the second engine is the Ark engine of the Ets side.
- Figure 6 shows an interaction between the H5 side and the Ets side provided by an embodiment of the present invention.
- a schematic flow chart of the process which describes the inter-engine communication method in the embodiment of the present application from the interactive side in conjunction with the system architecture of cross-engine communication in Figure 2 above.
- a mapping table can be implemented in this application mechanism
- the ArkUI side only executes the Ets side methods
- the H5 side executes the JS methods in H5
- the ArkUI framework converts the object into an Ark engine object (JsValue object).
- a bridging mechanism for the interaction between the H5JS engine and the ArkUI JS engine is also designed, which is responsible for passing the objects and method names of the Ark engine to the H5 JS engine.
- the JS engine bridge module passes the function parameters to the Ark engine.
- the Ark engine executes the JS method according to the function parameters, the execution result is returned to the H5 JS engine, completing the mutual isolation of two different JS engines.
- Communication in the JS running environment; this application also designs a fault-tolerant protection mechanism for communication between H5 and Ark engines.
- Step 1 Start the application.
- the Ark JS engine module executes the JS code of the application developer and parses the object name and method name customized by the developer.
- the JS object and method names are passed to the ArkUI Framework module through the JS to C++ cross-language interface call.
- Step 2 The ArkUI Framework module creates a C++ object based on information such as object name and method name, and binds the corresponding C++ object to the object.
- method register the C++ function with the JS engine bridge module, save the object name and the method list under the object name into a hash table, and send it to the JS method identification module.
- Step 3 The JS method identification module intelligently identifies whether the JS method in the JS engine in ArkUI exists and notifies the fault tolerance module.
- Step 4 When the ArkUI JS engine module parses the objects and methods on the Ets side, when the H5 JS module starts the application and executes the H5 JS code, the H5 JS engine module will also parse the JS objects and method names used on the H5 side. The JS engine bridge module is used to determine whether the method under the object exists to notify the fault tolerance module.
- Step 5 The fault tolerance module sends a message to the Ark JS engine module. If it recognizes that the corresponding method exists, it executes the corresponding JS method. If the method does not exist, it calls back to the application side through JS, and the user can be notified through a pop-up box that the executed method is invalid.
- Step 6 The ArkUI JS engine module executes the JS method and returns the JS execution result to the JS engine bridge module.
- the JS engine bridge module will then pass the JS function execution result to the H5 JS engine through the registered callback;
- Step 7 The H5 JS engine module returns the execution results to the H5 page, triggers page updates through data binding, updates the execution results on the H5 interface, and finally notifies the user.
- a bridge layer can be added between the first engine and the second engine to realize communication between different engines through the bridge layer.
- the first application can be run on the first engine, and the first application can include multiple first objects; the second application can be run on the second engine, and the second application can include multiple second objects, and the first application and the second application run in two different contexts.
- the first engine can send a request to the bridge layer to execute one or more first objects, and then the bridge layer determines whether there is a second object that is the same as the one or more first objects in the multiple second objects.
- the bridge layer sends a request to the second engine to execute the corresponding one or more second objects, and the request can include the function parameters needed to be used during the execution process, so that the second engine can execute the corresponding second object based on the function parameters, thereby realizing cross-engine communication. Since in this application, it is avoided to register the object of the second engine directly in the first engine, and the information interaction between the two different engines is efficiently realized through the bridge layer, so that under the premise of ensuring safety, the problem that the two operating environments are isolated from each other and cannot call each other's objects (or functions) is solved.
- FIG. 7 is a schematic diagram of an electronic device provided by this application according to an embodiment of the present invention.
- the electronic device 30 runs an operating system.
- the operating system includes a first engine, a second engine and a bridge layer.
- the first engine includes a plurality of first objects
- the second engine includes a plurality of second objects.
- the electronic device 30 may include a first receiving unit 301, a first processing unit 302, a first sending unit 303, a second receiving unit 304, a third receiving unit 305, a second processing unit 306, a second sending unit 307, a third Sending unit 308, where the detailed descriptions of each module are as follows.
- the first receiving unit 301 is configured to receive a first request sent by the first engine through the bridge layer, where the first request is used to request execution of N first objects among the plurality of first objects, N is an integer greater than 0;
- the first processing unit 302 is configured to respond to the first request through the bridging layer and determine whether there are N second objects that are the same as the N first objects among the plurality of second objects;
- the first sending unit 303 is configured to, if present, send a second request to the second engine through the bridge layer.
- the second request is used to request the second engine to execute the N according to the corresponding function parameters. a second object.
- the first processing unit 302 is specifically configured to determine whether there are N second objects among the plurality of second objects that have the same object identifiers as the N first objects. ; Wherein, if they exist, the N second objects are the same as the N first objects.
- the first processing unit 302 is specifically configured to determine whether there are N second objects among the plurality of second objects that have the same object identifiers as the N first objects. ; If it exists, determine the first function included in each of the N first objects through the first record table; the first record table includes each first object in the plurality of first objects. The first function included; based on the second record table, determine the first function included in each of the N first objects and the first function included in each of the N second objects. Whether the second function of The second function included in each second object in the object.
- the device further includes: a second receiving unit 304, configured to obtain the object identifier corresponding to each of the plurality of first objects through the bridging layer, and The first function included in each first object generates the first record table; the third receiving unit 305 is used to obtain each of the plurality of second objects through the bridging layer. The object identifiers corresponding to the two objects and the second function included in each second object are used to generate the second record table.
- the device further includes: a second processing unit 306, configured to respond to the second request, execute the N second objects according to the corresponding function parameters through the second engine , and generate execution results corresponding to the N second objects; the second sending unit 307 is configured to forward the N second objects corresponding to the N second objects sent by the second engine to the first engine through the bridging layer. of The execution result.
- a second processing unit 306 configured to respond to the second request, execute the N second objects according to the corresponding function parameters through the second engine , and generate execution results corresponding to the N second objects
- the second sending unit 307 is configured to forward the N second objects corresponding to the N second objects sent by the second engine to the first engine through the bridging layer. of The execution result.
- the device further includes: a third sending unit 308, configured to: if the N second objects that are the same as the N first objects do not exist in the plurality of second objects, object, a first notification is sent to the first engine through the bridge layer, where the first notification includes execution error messages for the N first objects.
- a third sending unit 308 configured to: if the N second objects that are the same as the N first objects do not exist in the plurality of second objects, object, a first notification is sent to the first engine through the bridge layer, where the first notification includes execution error messages for the N first objects.
- the present application provides a computer storage medium, characterized in that the computer storage medium stores a computer program, and when the computer program is executed by a processor, any one of the above-mentioned inter-engine communication methods is implemented.
- An embodiment of the present application provides an electronic device.
- the electronic device includes a processor.
- the processor is configured to support the electronic device to implement corresponding functions in any of the above inter-engine communication methods.
- the electronic device may also include a memory coupled to the processor that stores necessary program instructions and data for the electronic device.
- the electronic device may also include a communication interface for the electronic device to communicate with other devices or communication networks.
- the present application provides a chip system, which includes a processor for supporting an electronic device to implement the functions involved above, for example, generating or processing information involved in the above-mentioned inter-engine communication method.
- the chip system also includes a memory, which is used to store program instructions and data necessary for the electronic device.
- the chip system can be composed of a chip, or it can include a chip and other separate devices.
- the present application provides a computer program, which is characterized in that the computer program includes instructions, which when the computer program is executed by a computer, causes the computer to execute the above-mentioned inter-engine communication method.
- the disclosed device can be implemented in other ways.
- the device embodiments described above are only illustrative.
- the division of the above units is only a logical function division. In actual implementation, there may be other divisions.
- multiple units or components may be combined or integrated. to another system, or some features can be ignored, or not implemented.
- the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical or other forms.
- the units described above as separate components may or may not be physically separated.
- the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
- each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit.
- the above integrated units can be implemented in the form of hardware or software functional units.
- the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
- the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product.
- the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server or network device, etc., specifically a processor in a computer device) to perform all or part of the steps of the above-mentioned methods in each embodiment of the present application.
- the aforementioned storage medium may include: U disk, mobile hard disk, magnetic disk, optical disk, read-only memory (Read-Only Memory, abbreviated: ROM) or random access memory (Random Access Memory, abbreviated: RAM) and other media that can store program codes.
- ROM Read-Only Memory
- RAM Random Access Memory
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Stored Programmes (AREA)
Abstract
Description
本申请要求于2022年09月19日提交中国专利局、申请号为202211137787.7、申请名称为“一种引擎间的通信方法及相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application submitted to the China Patent Office on September 19, 2022, with application number 202211137787.7 and the application title "An inter-engine communication method and related equipment", the entire content of which is incorporated by reference. in this application.
本申请涉及计算机技术领域,尤其涉及一种引擎间的通信方法及相关设备。The present application relates to the field of computer technology, and in particular, to an inter-engine communication method and related equipment.
Ets是一种可扩展的TS(TypeScript)语言,是鸿蒙应用主要的开发语言,具有与JS(JavaScript)生态融合,高效的类型系统、简洁高效的声明式开发范式的优点。为了进一步扩展鸿蒙生态,需要引入Web生态,Web生态主要是HTML5(H5)语言开发的,通过鸿蒙的方舟开发框架(ArkUI)中的web组件进行加载并显示H5页面。Ets is an extensible TS (TypeScript) language and the main development language for Hongmeng applications. It has the advantages of ecological integration with JS (JavaScript), efficient type system, and concise and efficient declarative development paradigm. In order to further expand the Hongmeng ecosystem, it is necessary to introduce the Web ecosystem. The Web ecosystem is mainly developed in HTML5 (H5) language. H5 pages are loaded and displayed through the web components in Hongmeng's Ark development framework (ArkUI).
鸿蒙Ets代码运行在Ark引擎的JS运行环境(JS runtime)中,H5的JS代码运行在网络视图(WebView)的V8引擎的JS运行环境(JS runtime)中。由于这两种语言运行在不同的JS引擎中,也可以理解为这两种语言运行在两个彼此独立的沙箱隔离的上下文(context)中,导致H5和Ets之间无法直接进行通信,同时在H5中无法复用Ets侧开发者自定义或鸿蒙系统的应用程序编程接口(Application Programming Interface,API),严重影响了鸿蒙应用生态的推广和扩展。The Hongmeng Ets code runs in the JS runtime of the Ark engine, and the H5 JS code runs in the JS runtime of the V8 engine of the WebView. Since the two languages run in different JS engines, it can also be understood that the two languages run in two independent sandbox-isolated contexts, resulting in the inability to communicate directly between H5 and Ets. In H5, it is impossible to reuse the Application Programming Interface (API) customized by developers on the Ets side or the Hongmeng system, which seriously affects the promotion and expansion of the Hongmeng application ecosystem.
因此,如何提供一种引擎间的通信方法及相关设备,以实现不同引擎之间的通信,如实现H5侧和Ets侧的信息互通,是亟待解决的问题。Therefore, how to provide an inter-engine communication method and related equipment to realize communication between different engines, such as realizing information exchange between the H5 side and the Ets side, is an issue that needs to be solved urgently.
发明内容Contents of the invention
本申请实施例所要解决的技术问题在于,提供一种引擎间的通信方法及相关设备,以实现不同JS引擎之间的通信。The technical problem to be solved by the embodiments of this application is to provide an inter-engine communication method and related equipment to realize communication between different JS engines.
第一方面,本申请实施案例提供一种引擎间的通信方法,其特征在于,应用于操作系统,所述操作系统包括第一引擎、第二引擎和桥接层,所述第一引擎包括多个第一对象,所述第二引擎包括多个第二对象,所述方法包括:通过所述桥接层接收所述第一引擎发送的第一请求,所述第一请求用于请求执行所述多个第一对象中的N个第一对象,N为大于0的整数;通过所述桥接层响应于所述第一请求,判断所述多个第二对象中是否存在与所述N个第一对象相同的N个第二对象;若存在,通过所述桥接层向所述第二引擎发送第二请求,所述第二请求用于请求所述第二引擎按照对应的函数参数执行所述N个第二对象。In the first aspect, the implementation example of this application provides a communication method between engines, which is characterized in that it is applied to an operating system. The operating system includes a first engine, a second engine and a bridging layer. The first engine includes multiple a first object, the second engine includes a plurality of second objects, and the method includes: receiving a first request sent by the first engine through the bridging layer, the first request being used to request execution of the plurality of second objects. N first objects among the first objects, N is an integer greater than 0; in response to the first request, the bridging layer determines whether there are any of the plurality of second objects that are the same as the N first objects. N second objects with the same object; if they exist, send a second request to the second engine through the bridging layer, where the second request is used to request the second engine to execute the N according to the corresponding function parameters. a second object.
本发明实施例中,可以在第一引擎和第二引擎之间增加一个桥接层,以通过桥接层实现不同引擎之间的通信。具体的,可以在第一引擎上运行第一应用,第一应用中可以包括多个第一对象;可以在第二引擎上运行第二应用,第二应用中可以包括多个第二对象,且第一应用和第二应用运行在两个不同的上下文中。进一步地,在两个引擎运行过程中,第一引擎可以向桥接层发送执行一个或多个第一对象的请求,然后桥接层判断多个第二对象中是否存在与上述一个或多个第一对象相同的第二对象,若存在,桥接层再向第二引擎发送执行对应的一个或多个第二对象的请求,且在该请求中可以包括执行过程中需要使用的函数参数,从而第二引擎可以基于函数参数执行对应的第二对象,实现了跨引擎通信。由于在本申请中,避免将第二引擎的对象直接在第一引擎中注册,且通过桥接层高效实现两个不同引擎之间的信息交互,因此在保证安全的前提下,解决了两个运行环境相互隔离无法调用彼此对象(或函数)的问题。In this embodiment of the present invention, a bridge layer can be added between the first engine and the second engine to realize communication between different engines through the bridge layer. Specifically, the first application can be run on the first engine, and the first application can include multiple first objects; the second application can be run on the second engine, and the second application can include multiple second objects, and The first application and the second application run in two different contexts. Further, during the operation of the two engines, the first engine can send a request to execute one or more first objects to the bridging layer, and then the bridging layer determines whether there are multiple second objects that match the one or more first objects mentioned above. If a second object with the same object exists, the bridging layer will send a request to the second engine to execute the corresponding one or more second objects, and the request may include function parameters that need to be used during the execution process, so that the second object The engine can execute the corresponding second object based on the function parameters, realizing cross-engine communication. In this application, it is avoided to directly register the objects of the second engine in the first engine, and the information interaction between two different engines is efficiently realized through the bridging layer. Therefore, on the premise of ensuring security, the two operations are solved. The problem is that environments are isolated from each other and cannot call each other's objects (or functions).
在一种可能的实现方式中,所述判断所述多个第二对象中是否存在与所述N个第一对象相同的N个第二对象,包括:判断所述多个第二对象中是否存在与所述N个第一对象的对象标识相同的N个第二对象;其中,若存在则所述N个第二对象与所述N个第一对象相同。In a possible implementation, determining whether there are N second objects that are the same as the N first objects among the plurality of second objects includes: determining whether among the plurality of second objects There are N second objects that have the same object identifiers as the N first objects; wherein, if they exist, the N second objects are the same as the N first objects.
在本发明实施例中,桥接层可以从第一引擎获取到多个第一对象的对象名(也可以称为对象标识),桥接层也可以从第二引擎获取到多个第二对象的对象名。进一步地,当桥接层接收第一引擎发送的请求后,可以判断多个第二对象中是否存在与请求中的N个第一对象的对象名相同的N个第二对象,若存在,则桥接层可以向第二引擎发送执行请求,从而实现在运行过程中第一引擎可以通过桥接层调用第二引擎中的 对象。由于在本申请中,避免将第二引擎的对象直接在第一引擎中注册,且通过桥接层高效实现两个不同引擎之间的信息交互,因此在保证安全的前提下,解决了两个运行环境相互隔离无法调用彼此对象(或函数)的问题。In the embodiment of the present invention, the bridging layer can obtain the object names (also called object identifiers) of multiple first objects from the first engine, and the bridging layer can also obtain the objects of multiple second objects from the second engine. name. Further, when the bridging layer receives the request sent by the first engine, it can determine whether there are N second objects with the same object names as the N first objects in the request among the multiple second objects. If they exist, the bridge layer The layer can send an execution request to the second engine, so that the first engine can call the second engine through the bridging layer during operation. object. In this application, it is avoided to directly register the objects of the second engine in the first engine, and the information interaction between two different engines is efficiently realized through the bridging layer. Therefore, on the premise of ensuring security, the two operations are solved. The problem is that environments are isolated from each other and cannot call each other's objects (or functions).
在一种可能的实现方式中,所述判断所述多个第二对象中是否存在与所述N个第一对象相同的N个第二对象,包括:判断所述多个第二对象中是否存在与所述N个第一对象的对象标识相同的N个第二对象;若存在,则通过第一记录表确定所述N个第一对象中每个第一对象包括的第一函数;所述第一记录表包括所述多个第一对象中每个第一对象包括的所述第一函数;基于第二记录表,判断所述N个第一对象中每个第一对象包括的所述第一函数与所述N个第二对象中每个第二对象包括的第二函数是否一致;其中,若一致则所述多个第二对象中存在与所述N个第一对象相同的所述N个第二对象;所述第二记录表包括所述第二对象中每个所述第二对象所包括的第二函数。In a possible implementation, determining whether there are N second objects that are the same as the N first objects among the plurality of second objects includes: determining whether among the plurality of second objects There are N second objects that have the same object identifiers as the N first objects; if they exist, the first function included in each of the N first objects is determined through the first record table; so The first record table includes the first function included in each first object among the plurality of first objects; based on the second record table, determine all the first functions included in each first object among the N first objects. Whether the first function is consistent with the second function included in each second object in the N second objects; wherein, if they are consistent, there is a function in the plurality of second objects that is the same as the N first objects. The N second objects; the second record table includes a second function included in each of the second objects.
在本发明实施例中,桥接层不仅需要判断对象名是否相同,还需要通过查表确定对象名下的函数是否相同,若相同,则桥接层可以向第二引擎发送执行请求,从而实现在运行过程中第一引擎可以通过桥接层调用第二引擎中的对象。由于在本申请中,避免将第二引擎的对象直接在第一引擎中注册,且通过桥接层高效实现两个不同引擎之间的信息交互,因此在保证安全的前提下,解决了两个运行环境相互隔离无法调用彼此对象(或函数)的问题。In the embodiment of the present invention, the bridging layer not only needs to determine whether the object names are the same, but also needs to determine whether the functions under the object names are the same by looking up the table. If they are the same, the bridging layer can send an execution request to the second engine, so as to achieve running During the process, the first engine can call objects in the second engine through the bridging layer. In this application, it is avoided to directly register the objects of the second engine in the first engine, and the information interaction between two different engines is efficiently realized through the bridging layer. Therefore, on the premise of ensuring security, the two operations are solved. The problem is that environments are isolated from each other and cannot call each other's objects (or functions).
在一种可能的实现方式中,所述方法还包括:通过所述桥接层获取所述多个第一对象中每个所述第一对象对应的对象标识,以及每个所述第一对象包括的所述第一函数,生成所述第一记录表;通过所述桥接层获取所述多个第二对象中每个所述第二对象对应的对象标识,以及每个所述第二对象包括的所述第二函数,生成所述第二记录表。In a possible implementation, the method further includes: obtaining an object identifier corresponding to each of the plurality of first objects through the bridging layer, and each of the first objects includes: The first function generates the first record table; the object identifier corresponding to each second object in the plurality of second objects is obtained through the bridging layer, and each second object includes The second function generates the second record table.
在本发明实施例中,桥接层可以从第一引擎获取到多个第一对象的对象名(也可以称为对象标识)以及对象名下的函数名并生成第一记录表,桥接层也可以从第二引擎获取到多个第二对象的对象名以及对象名下的函数名并生成第二记录表,进而桥接层可以基于第一记录表和第二记录表判断请求中的对象名下的函数是否相同。由于在本申请中,避免将第二引擎的对象直接在第一引擎中注册,且通过桥接层高效实现两个不同引擎之间的信息交互,因此在保证安全的前提下,解决了两个运行环境相互隔离无法调用彼此对象(或函数)的问题。In the embodiment of the present invention, the bridging layer can obtain the object names (also called object identifiers) of multiple first objects and the function names under the object names from the first engine and generate the first record table. The bridging layer can also The object names of multiple second objects and the function names under the object names are obtained from the second engine and a second record table is generated. Then the bridging layer can determine the names under the object names in the request based on the first record table and the second record table. functions are the same. In this application, it is avoided to directly register the objects of the second engine in the first engine, and the information interaction between two different engines is efficiently realized through the bridging layer. Therefore, on the premise of ensuring security, the two operations are solved. The problem is that environments are isolated from each other and cannot call each other's objects (or functions).
在一种可能的实现方式中,所述方法还包括:响应于所述第二请求,通过所述第二引擎按照对应的函数参数执行所述N个第二对象,并生成所述N个第二对象对应的执行结果;通过所述桥接层向所述第一引擎转发所述第二引擎发送的所述N个第二对象对应的所述执行结果。In a possible implementation, the method further includes: in response to the second request, executing the N second objects according to the corresponding function parameters through the second engine, and generating the Nth The execution results corresponding to the two objects are forwarded to the first engine through the bridging layer, and the execution results corresponding to the N second objects sent by the second engine are forwarded.
在本发明实施例中,第二引擎可以响应于桥接层的请求,可以基于函数参数执行对应的第二对象,并生成相应的执行结果,然后可以通过桥接层向第一引擎转发执行结果,从而实现跨引擎的数据交互。由于在本申请中,避免将第二引擎的对象直接在第一引擎中注册,且通过桥接层高效实现两个不同引擎之间的信息交互,因此在保证安全的前提下,解决了两个运行环境相互隔离无法调用彼此对象(或函数),以及无法进行数据传递的问题。In the embodiment of the present invention, the second engine can respond to the request of the bridge layer, execute the corresponding second object based on the function parameters, and generate the corresponding execution result, and then forward the execution result to the first engine through the bridge layer, thereby Implement cross-engine data interaction. In this application, it is avoided to directly register the objects of the second engine in the first engine, and the information interaction between two different engines is efficiently realized through the bridging layer. Therefore, on the premise of ensuring security, the two operations are solved. The environment is isolated from each other, unable to call each other's objects (or functions), and cannot transfer data.
在一种可能的实现方式中,所述方法还包括:若所述多个第二对象中不存在与所述N个第一对象相同的所述N个第二对象,则通过所述桥接层向所述第一引擎发送第一通知,所述第一通知包括所述N个第一对象执行错误的消息。In a possible implementation, the method further includes: if the N second objects that are the same as the N first objects do not exist among the plurality of second objects, through the bridging layer A first notification is sent to the first engine, where the first notification includes a message of execution errors of the N first objects.
在本发明实施例中,若不存在相同的对象,则表示第二引擎无法执行请求中的对象,进而可以通过桥接层通知第一引擎请求中的对象不会被执行。由于在本申请中,避免将第二引擎的对象直接在第一引擎中注册,且通过桥接层高效实现两个不同引擎之间的信息交互,因此在保证安全的前提下,解决了两个运行环境相互隔离无法调用彼此对象(或函数),以及无法进行数据传递的问题。In this embodiment of the present invention, if the same object does not exist, it means that the second engine cannot execute the object in the request, and the first engine can be notified through the bridging layer that the object in the request will not be executed. In this application, it is avoided to directly register the objects of the second engine in the first engine, and the information interaction between two different engines is efficiently realized through the bridging layer. Therefore, on the premise of ensuring security, the two operations are solved. The environment is isolated from each other, unable to call each other's objects (or functions), and cannot transfer data.
第二方面,本申请提供了一种电子设备,其特征在于,所述电子设备运行操作系统,所述操作系统包括第一引擎、第二引擎和桥接层,所述第一引擎包括多个第一对象,所述第二引擎包括多个第二对象,所述装置包括:第一接收单元,用于通过所述桥接层接收所述第一引擎发送的第一请求,所述第一请求用于请求执行所述多个第一对象中的N个第一对象,N为大于0的整数;第一处理单元,用于通过所述桥接层响应于所述第一请求,判断所述多个第二对象中是否存在与所述N个第一对象相同的N个第二对象;第一发送单元,用于,若存在,通过所述桥接层向所述第二引擎发送第二请求,所述第二请求用于请求所述第二引擎按照对应的函数参数执行所述N个第二对象。In a second aspect, the present application provides an electronic device, characterized in that the electronic device runs an operating system, the operating system includes a first engine, a second engine and a bridging layer, and the first engine includes a plurality of third engines. An object, the second engine includes a plurality of second objects, the device includes: a first receiving unit configured to receive a first request sent by the first engine through the bridging layer, the first request is Upon requesting execution of N first objects among the plurality of first objects, N is an integer greater than 0; a first processing unit configured to respond to the first request through the bridging layer to determine whether the plurality of first objects are Whether there are N second objects that are the same as the N first objects in the second object; the first sending unit is used to, if there is, send a second request to the second engine through the bridging layer, so The second request is used to request the second engine to execute the N second objects according to corresponding function parameters.
在一种可能的实现方式中,所述第一处理单元,具体用于:判断所述多个第二对象中是否存在与所述 N个第一对象的对象标识相同的N个第二对象;其中,若存在则所述N个第二对象与所述N个第一对象相同。In a possible implementation, the first processing unit is specifically configured to: determine whether the plurality of second objects is the same as the The object identifiers of the N first objects are the same N second objects; wherein, if they exist, the N second objects are the same as the N first objects.
在一种可能的实现方式中,所述第一处理单元,具体用于:判断所述多个第二对象中是否存在与所述N个第一对象的对象标识相同的N个第二对象;若存在,则通过第一记录表确定所述N个第一对象中每个第一对象包括的第一函数;所述第一记录表包括所述多个第一对象中每个第一对象包括的所述第一函数;基于第二记录表,判断所述N个第一对象中每个第一对象包括的所述第一函数与所述N个第二对象中每个第二对象包括的第二函数是否一致;其中,若一致则所述多个第二对象中存在与所述N个第一对象相同的所述N个第二对象;所述第二记录表包括所述第二对象中每个所述第二对象所包括的第二函数。In a possible implementation, the first processing unit is specifically configured to: determine whether there are N second objects among the plurality of second objects that have the same object identifiers as the N first objects; If it exists, determine the first function included in each first object among the N first objects through the first record table; the first record table includes the first function included in each first object among the plurality of first objects. The first function; based on the second record table, determine the first function included in each of the N first objects and the first function included in each of the N second objects. Whether the second function is consistent; wherein, if consistent, there are N second objects that are the same as the N first objects among the plurality of second objects; the second record table includes the second object The second function included in each second object.
在一种可能的实现方式中,所述设备还包括:第二接收单元,用于通过所述桥接层获取所述多个第一对象中每个所述第一对象对应的对象标识,以及每个所述第一对象包括的所述第一函数,生成所述第一记录表;第三接收单元,用于通过所述桥接层获取所述多个第二对象中每个所述第二对象对应的对象标识,以及每个所述第二对象包括的所述第二函数,生成所述第二记录表。In a possible implementation, the device further includes: a second receiving unit configured to obtain, through the bridging layer, the object identifier corresponding to each first object in the plurality of first objects, and each The first function included in each of the first objects generates the first record table; a third receiving unit is used to obtain each of the plurality of second objects through the bridging layer The corresponding object identifier and the second function included in each second object generate the second record table.
在一种可能的实现方式中,所述设备还包括:第二处理单元,用于响应于所述第二请求,通过所述第二引擎按照对应的函数参数执行所述N个第二对象,并生成所述N个第二对象对应的执行结果;第二发送单元,用于通过所述桥接层向所述第一引擎转发所述第二引擎发送的所述N个第二对象对应的所述执行结果。In a possible implementation, the device further includes: a second processing unit, configured to respond to the second request, execute the N second objects according to the corresponding function parameters through the second engine, and generate execution results corresponding to the N second objects; a second sending unit configured to forward to the first engine through the bridging layer all the execution results corresponding to the N second objects sent by the second engine. Describe the execution results.
在一种可能的实现方式中,所述设备还包括:第三发送单元,用于若所述多个第二对象中不存在与所述N个第一对象相同的所述N个第二对象,则通过所述桥接层向所述第一引擎发送第一通知,所述第一通知包括所述N个第一对象执行错误的消息。In a possible implementation, the device further includes: a third sending unit, configured to: if there are no N second objects that are the same as the N first objects among the plurality of second objects, , then a first notification is sent to the first engine through the bridge layer, where the first notification includes execution error messages for the N first objects.
第三方面,本申请提供了一种计算机存储介质,其特征在于,所述计算机存储介质存储有计算机程序,该计算机程序被处理器执行时实现上述第一方面任意一项所述的方法。In a third aspect, the present application provides a computer storage medium, characterized in that the computer storage medium stores a computer program, and when the computer program is executed by a processor, it implements the method described in any one of the first aspects above.
第四方面,本申请实施例提供一种电子设备,该电子设备中包括处理器,处理器被配置为支持该电子设备实现第一方面提供的一种引擎间的通信方法中相应的功能。该电子设备还可以包括存储器,存储器用于与处理器耦合,其保存该电子设备必要的程序指令和数据。该电子设备还可以包括通信接口,用于该电子设备与其他设备或通信网络通信。In a fourth aspect, embodiments of the present application provide an electronic device, which includes a processor. The processor is configured to support the electronic device in implementing corresponding functions in the inter-engine communication method provided in the first aspect. The electronic device may also include a memory coupled to the processor that stores necessary program instructions and data for the electronic device. The electronic device may also include a communication interface for the electronic device to communicate with other devices or communication networks.
第五方面,本申请提供了一种芯片系统,该芯片系统包括处理器,用于支持电子设备实现上述第一方面中所涉及的功能,例如,生成或处理上述引擎间的通信方法中所涉及的信息。在一种可能的设计中,所述芯片系统还包括存储器,所述存储器,用于保存电子设备必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分离器件。In a fifth aspect, the present application provides a chip system that includes a processor to support the electronic device to implement the functions involved in the above-mentioned first aspect, for example, generating or processing those involved in the above-mentioned inter-engine communication method. Information. In a possible design, the chip system further includes a memory, and the memory is used to store necessary program instructions and data of the electronic device. The chip system may be composed of chips, or may include chips and other separate components.
第六方面,本申请提供一种计算机程序,其特征在于,所述计算机程序包括指令,当所述计算机程序被计算机执行时,使得所述计算机执行上述第一方面中任意一项所述的方法。In a sixth aspect, the present application provides a computer program, characterized in that the computer program includes instructions that, when the computer program is executed by a computer, cause the computer to perform any of the methods described in the first aspect. .
图1为本发明实施例提供的一种电子设备100的结构示意图。FIG. 1 is a schematic structural diagram of an electronic device 100 provided by an embodiment of the present invention.
图2是本发明实施例提供的一种跨引擎通信的系统架构示意图。Figure 2 is a schematic diagram of a system architecture for cross-engine communication provided by an embodiment of the present invention.
图3是本申请实施例中的一种引擎间的通信方法的流程示意图。Figure 3 is a schematic flowchart of an inter-engine communication method in an embodiment of the present application.
图4为本发明实施例提供的一种H5侧与Ets侧交互的示意图。Figure 4 is a schematic diagram of the interaction between the H5 side and the Ets side provided by an embodiment of the present invention.
图5为本发明实施例提供的一种电子设备的界面示意图。FIG. 5 is a schematic diagram of an interface of an electronic device provided by an embodiment of the present invention.
图6为本发明实施例提供的一种H5侧与Ets侧交互的流程示意图。Figure 6 is a schematic flow chart of interaction between the H5 side and the Ets side provided by an embodiment of the present invention.
图7是本发明实施例提供的本申请提供了一种电子设备的示意图。FIG. 7 is a schematic diagram of an electronic device provided by this application according to an embodiment of the present invention.
下面将结合本申请实施例中的附图,对本申请实施例进行描述。The embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
本申请的说明书和权利要求书及所述附图中的术语“第一”、“第二”、“第三”和“第四”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。 The terms “first”, “second”, “third” and “fourth” in the description, claims and drawings of this application are used to distinguish different objects, rather than to describe a specific sequence. . Furthermore, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes Other steps or units inherent to such processes, methods, products or devices.
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。Reference herein to "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The appearances of this phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those skilled in the art understand, both explicitly and implicitly, that the embodiments described herein may be combined with other embodiments.
图1示出了电子设备100的结构示意图。FIG. 1 shows a schematic structural diagram of an electronic device 100 .
下面以电子设备100为例对实施例进行具体说明。应该理解的是,电子设备100可以具有比图中所示的更多的或者更少的部件,可以组合两个或多个的部件,或者可以具有不同的部件配置。图中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。The following uses the electronic device 100 as an example to describe the embodiment in detail. It should be understood that electronic device 100 may have more or fewer components than shown in the figures, may combine two or more components, or may have a different component configuration. The various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and/or application specific integrated circuits.
电子设备100可以包括:处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中,传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。The electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2. Mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, And subscriber identification module (subscriber identification module, SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and an environment. Light sensor 180L, bone conduction sensor 180M, etc.
可以理解的是,本发明实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100 . In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently. The components illustrated may be implemented in hardware, software, or a combination of software and hardware.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) wait. Among them, different processing units can be independent devices or integrated in one or more processors.
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller may be the nerve center and command center of the electronic device 100 . The controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in processor 110 is cache memory. This memory may hold instructions or data that have been recently used or recycled by processor 110 . If the processor 110 needs to use the instructions or data again, it can be called directly from the memory. Repeated access is avoided and the waiting time of the processor 110 is reduced, thus improving the efficiency of the system.
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, processor 110 may include one or more interfaces. Interfaces may include integrated circuit (inter-integrated circuit, I2C) interface, integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, pulse code modulation (pulse code modulation, PCM) interface, universal asynchronous receiver and transmitter (universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and /or universal serial bus (USB) interface, etc.
可以理解的是,本发明实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationships between the modules illustrated in the embodiment of the present invention are only schematic illustrations and do not constitute a structural limitation of the electronic device 100 . In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。The charging management module 140 is used to receive charging input from the charger. Among them, the charger can be a wireless charger or a wired charger.
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, internal memory 121, external memory, display screen 194, camera 193, wireless communication module 160, etc.
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。 The electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like. The GPU is an image processing microprocessor and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。The display screen 194 is used to display images, videos, etc. Display 194 includes a display panel. The display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode). emitting diode (AMOLED), flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 can implement the shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括其他摄像头。电子设备还可以包括点阵发射器(图中未示出),用于发射光线。摄像头采集人脸反射的光线,得到人脸图像,处理器对人脸图像进行处理和分析,通过与存储的人脸图像的信息进行比较以进行验证。The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal oxide semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include other cameras. The electronic device may also include a dot matrix transmitter (not shown in the figure) for emitting light. The camera collects light reflected from the face to obtain a face image, and the processor processes and analyzes the face image, and verifies it by comparing it with the stored face image information.
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如,借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, for example, drawing on the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. Such as saving music, videos, etc. files in external memory card.
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用(比如人脸识别功能,指纹识别功能、移动支付功能等)。存储数据区可存储电子设备100使用过程中所创建的数据(比如人脸信息模板数据,指纹信息模板等)。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。Internal memory 121 may be used to store computer executable program code, which includes instructions. The processor 110 executes instructions stored in the internal memory 121 to execute various functional applications and data processing of the electronic device 100 . The internal memory 121 may include a program storage area and a data storage area. Among them, the stored program area can store the operating system and at least one application required for the function (such as face recognition function, fingerprint recognition function, mobile payment function, etc.). The storage data area can store data created during the use of the electronic device 100 (such as face information template data, fingerprint information templates, etc.). In addition, the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playback, recording, etc.
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals.
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。Speaker 170A, also called "speaker", is used to convert audio electrical signals into sound signals.
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。Receiver 170B, also called "earpiece", is used to convert audio electrical signals into sound signals.
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals.
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。The headphone interface 170D is used to connect wired headphones. The headphone interface 170D may be a USB interface 130, or may be a 3.5mm open mobile terminal platform (OMTP) standard interface, or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器, 电容式压力传感器等。The pressure sensor 180A is used to sense the pressure signal and convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, Capacitive pressure sensor, etc.
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。The gyro sensor 180B may be used to determine the motion posture of the electronic device 100 . In some embodiments, the angular velocity of electronic device 100 about three axes (ie, x, y, and z axes) may be determined by gyro sensor 180B.
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。Proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode.
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。The ambient light sensor 180L is used to sense ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。其中,该指纹传感器180H可以设置在触控屏下方,电子设备100可以接收用户在触控屏上该指纹传感器对应的区域的触摸操作,电子设备100可以响应于该触摸操作,采集用户手指的指纹信息。Fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access to application locks, fingerprint photography, fingerprint answering of incoming calls, etc. The fingerprint sensor 180H can be disposed below the touch screen. The electronic device 100 can receive the user's touch operation on the area corresponding to the fingerprint sensor on the touch screen. The electronic device 100 can respond to the touch operation and collect the fingerprint of the user's finger. information.
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。Temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 utilizes the temperature detected by the temperature sensor 180J to execute the temperature processing strategy.
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。Touch sensor 180K, also called "touch panel". The touch sensor 180K can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is used to detect a touch operation on or near the touch sensor 180K. The touch sensor can pass the detected touch operation to the application processor to determine the touch event type. Visual output related to the touch operation may be provided through display screen 194 . In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a location different from that of the display screen 194 .
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。The buttons 190 include a power button, a volume button, etc. Key 190 may be a mechanical key. It can also be a touch button. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。The indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, or may be used to indicate messages, missed calls, notifications, etc.
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。在一些实施例中,电子设备100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to or separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195 . In some embodiments, the electronic device 100 uses an eSIM, that is, an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100 .
下面结合附图对本申请的实施例进行描述。The embodiments of the present application are described below with reference to the accompanying drawings.
基于上述提出的技术问题,也为了便于理解本发明实施例,下面先对本发明实施例所基于的系统架构进行描述。请参见图2,图2是本发明实施例提供的一种跨引擎通信的系统架构示意图,该系统可以运行在上述电子设备100的软件系统中,可以解决不同JS引擎在运行时不能相互通讯的问题。该系统架构中可以包括方舟JS引擎模块(Ark JavaScript Engine)、方舟开发架构模块(ArkUI Framework)、H5JS引擎模块、JS引擎桥接模块、JS方法识别模块、容错模块。其中,Ark JS引擎模块可以负责执行JS代码,解析生成抽象语法树(Abstract Syntax Tree,AST),转成字节码,并生成机器码等,并执行机器码且将执行结果传给ArkUI的Framework模块;ArkUI Framework模块可以负责与JS引擎进行交互,页面生命周期管理,事件分发,加载UI组件,路由跳转、数据绑定等;H5JS引擎模块可以负责解析执行H5的JS代码,将执行的JS对象名和函数名、函数参数传给JS引擎桥接模块;JS引擎桥接模块可以负责监测Ark引擎和H5的JS引擎的传递过来的对象名,方法名(也可以称为函数名),和函数参数,函数执行结果等消息,后续将详细描述如何基于JS引擎桥接模块实现不同引擎之间的通信,在此先不赘述;JS方法识别模块可以负责从JS引擎桥接模块获取H5侧和Ets侧的方法名,判断H5侧的JS方法是否与Ets侧的方法相同;容错模块可以负责处理H5侧非法的输入,并在Ets实时监测方法是否存在,完成应用侧的容错保护,避免出现异常情况。Based on the technical issues raised above and to facilitate understanding of the embodiments of the present invention, the system architecture on which the embodiments of the present invention are based is first described below. Please refer to Figure 2. Figure 2 is a schematic diagram of a cross-engine communication system architecture provided by an embodiment of the present invention. This system can be run in the software system of the above-mentioned electronic device 100 and can solve the problem that different JS engines cannot communicate with each other during operation. question. The system architecture can include Ark JS engine module (Ark JavaScript Engine), Ark development architecture module (ArkUI Framework), H5JS engine module, JS engine bridge module, JS method identification module, and fault tolerance module. Among them, the Ark JS engine module can be responsible for executing JS code, parsing and generating Abstract Syntax Tree (AST), converting it into bytecode, and generating machine code, etc., and executing the machine code and passing the execution results to the Framework of ArkUI Module; ArkUI Framework module can be responsible for interacting with the JS engine, page life cycle management, event distribution, loading UI components, routing jumps, data binding, etc.; the H5JS engine module can be responsible for parsing and executing H5 JS code, and executing the JS The object name, function name, and function parameters are passed to the JS engine bridge module; the JS engine bridge module can be responsible for monitoring the object name, method name (also called function name), and function parameters passed by the Ark engine and the H5 JS engine. Function execution results and other messages will be described in detail later on how to implement communication between different engines based on the JS engine bridge module. I will not go into details here; the JS method identification module can be responsible for obtaining the H5 side and Ets side method names from the JS engine bridge module. , determine whether the JS method on the H5 side is the same as the method on the Ets side; the fault tolerance module can be responsible for processing illegal input on the H5 side, and monitor the existence of the method in Ets in real time, completing fault tolerance protection on the application side to avoid abnormal situations.
下面对本发明实施例所基于的具体方法架构进行描述。The specific method architecture based on the embodiment of the present invention is described below.
请参见图3,图3是本申请实施例中的一种引擎间的通信方法的流程示意图,下面将结合附图3并基于上述图2中的跨引擎通信的系统架构从交互侧对本申请实施例中的引擎间的通信方法进行描述。该方法应用于操作系统,所述操作系统包括第一引擎、第二引擎和桥接层,所述第一引擎包括多个第一对象,所述第二引擎包括多个第二对象,多个第一对象为第一应用中运行的对象,多个第二对象为第二应用中运行的对象,第一应用与第二应用为两个不同的应用,即第一应用和第二应用运行在两个不同的上下文中。该方法可以用于解决不同引擎在运行时不能相互通讯的问题。需要说明的是,为了更详细的描述本申请实施例中的引擎间的通信方法,本申请在各个流程步骤中描述了相应的执行主体分别电子设备(可以为上述图1中的电子设备100),但不代表本申请实施例只能通过所描述的执行主体进行对应的方法流程。 Please refer to Figure 3, which is a flow diagram of a method for communicating between engines in an embodiment of the present application. The following will be combined with Figure 3 and based on the system architecture of cross-engine communication in Figure 2 above to describe the method for communicating between engines in an embodiment of the present application from the interaction side. The method is applied to an operating system, the operating system includes a first engine, a second engine and a bridging layer, the first engine includes a plurality of first objects, the second engine includes a plurality of second objects, the plurality of first objects are objects running in a first application, the plurality of second objects are objects running in a second application, the first application and the second application are two different applications, that is, the first application and the second application run in two different contexts. The method can be used to solve the problem that different engines cannot communicate with each other at run time. It should be noted that in order to describe the method for communicating between engines in an embodiment of the present application in more detail, the present application describes the corresponding execution subject in each process step, and the electronic device (which can be the electronic device 100 in Figure 1 above) is described, but it does not mean that the embodiment of the present application can only perform the corresponding method flow through the described execution subject.
步骤S201:电子设备通过所述桥接层接收所述第一引擎发送的第一请求。Step S201: The electronic device receives the first request sent by the first engine through the bridge layer.
具体的,所述第一请求用于请求执行所述多个第一对象中的N个第一对象,N为大于0的整数。第一引擎可以为上述提及的H5侧H5JS引擎,H5JS引擎可以用于解析执行H5的JS代码。Specifically, the first request is used to request execution of N first objects among the plurality of first objects, where N is an integer greater than 0. The first engine can be the H5JS engine on the H5 side mentioned above, and the H5JS engine can be used to parse and execute H5 JS code.
步骤S202:电子设备通过所述桥接层响应于所述第一请求,判断所述多个第二对象中是否存在与所述N个第一对象相同的N个第二对象。Step S202: The electronic device responds to the first request through the bridge layer and determines whether there are N second objects that are the same as the N first objects among the plurality of second objects.
具体的,当桥接层接收第一引擎发送的第一请求后,确定第一请求中请求执行的目标对象,即N个第一对象,然后桥接层判断第二引擎的多个第二对象中是否存在与目标对象相同的第二对象。第二引擎可以为上述提及的Ets侧的Ark JS引擎,Ark JS引擎可以用于执行JS代码,解析生成抽象语法树,转成字节码,并生成机器码等。Specifically, when the bridging layer receives the first request sent by the first engine, it determines the target object requested to be executed in the first request, that is, N first objects, and then the bridging layer determines whether any of the multiple second objects of the second engine There is a second object that is identical to the target object. The second engine can be the Ark JS engine on the Ets side mentioned above. The Ark JS engine can be used to execute JS code, parse and generate abstract syntax trees, convert it into bytecode, and generate machine code, etc.
在一种可能的实现方式中,所述判断所述多个第二对象中是否存在与所述N个第一对象相同的N个第二对象,包括:判断所述多个第二对象中是否存在与所述N个第一对象的对象标识相同的N个第二对象;其中,若存在则所述N个第二对象与所述N个第一对象相同。In a possible implementation, determining whether there are N second objects that are the same as the N first objects among the plurality of second objects includes: determining whether among the plurality of second objects There are N second objects that have the same object identifiers as the N first objects; wherein, if they exist, the N second objects are the same as the N first objects.
具体的,桥接层可以从第一引擎获取到多个第一对象的对象名(也可以称为对象标识),桥接层也可以从第二引擎获取到多个第二对象的对象名。进一步地,当桥接层接收第一引擎发送的请求后,可以判断多个第二对象中是否存在与请求中的N个第一对象的对象名相同的N个第二对象,若存在,则桥接层可以向第二引擎发送执行请求,从而实现在运行过程中第一引擎可以通过桥接层调用第二引擎中的对象。由于在本申请中,避免将第二引擎的对象直接在第一引擎中注册,且通过桥接层高效实现两个不同引擎之间的信息交互,因此在保证安全的前提下,解决了两个运行环境相互隔离无法调用彼此对象(或函数)的问题。Specifically, the bridge layer can obtain the object names (also called object identifiers) of multiple first objects from the first engine, and the bridge layer can also obtain the object names of multiple second objects from the second engine. Furthermore, after the bridge layer receives the request sent by the first engine, it can determine whether there are N second objects with the same object names as the N first objects in the request among the multiple second objects. If so, the bridge layer can send an execution request to the second engine, so that the first engine can call the objects in the second engine through the bridge layer during operation. In the present application, it is avoided to register the objects of the second engine directly in the first engine, and the information interaction between the two different engines is efficiently realized through the bridge layer. Therefore, under the premise of ensuring safety, the problem that the two operating environments are isolated from each other and cannot call each other's objects (or functions) is solved.
在一种可能的实现方式中,所述判断所述多个第二对象中是否存在与所述N个第一对象相同的N个第二对象,包括:判断所述多个第二对象中是否存在与所述N个第一对象的对象标识相同的N个第二对象;若存在,则通过第一记录表确定所述N个第一对象中每个第一对象包括的第一函数;所述第一记录表包括所述多个第一对象中每个第一对象包括的所述第一函数;基于第二记录表,判断所述N个第一对象中每个第一对象包括的所述第一函数与所述N个第二对象中每个第二对象包括的第二函数是否一致;其中,若一致则所述多个第二对象中存在与所述N个第一对象相同的所述N个第二对象;所述第二记录表包括所述第二对象中每个所述第二对象所包括的第二函数。In a possible implementation, determining whether there are N second objects that are the same as the N first objects among the plurality of second objects includes: determining whether among the plurality of second objects There are N second objects that have the same object identifiers as the N first objects; if they exist, the first function included in each of the N first objects is determined through the first record table; so The first record table includes the first function included in each first object among the plurality of first objects; based on the second record table, determine all the first functions included in each first object among the N first objects. Whether the first function is consistent with the second function included in each second object in the N second objects; wherein, if they are consistent, there is a function in the plurality of second objects that is the same as the N first objects. The N second objects; the second record table includes a second function included in each of the second objects.
具体的,桥接层不仅需要判断对象名是否相同,还需要通过查表确定对象名下的函数是否相同,若相同,则桥接层可以向第二引擎发送执行请求,从而实现在运行过程中第一引擎可以通过桥接层调用第二引擎中的对象。由于在本申请中,避免将第二引擎的对象直接在第一引擎中注册,且通过桥接层高效实现两个不同引擎之间的信息交互,因此在保证安全的前提下,解决了两个运行环境相互隔离无法调用彼此对象(或函数)的问题。Specifically, the bridging layer not only needs to determine whether the object names are the same, but also needs to check the table to determine whether the functions under the object names are the same. If they are the same, the bridging layer can send an execution request to the second engine, thereby realizing the first execution during operation. The engine can call objects in the second engine through the bridging layer. In this application, it is avoided to directly register the objects of the second engine in the first engine, and the information interaction between two different engines is efficiently realized through the bridging layer. Therefore, on the premise of ensuring security, the two operations are solved. The problem is that environments are isolated from each other and cannot call each other's objects (or functions).
在一种可能实现方式中,所述方法还包括:通过所述桥接层获取所述多个第一对象中每个所述第一对象对应的对象标识,以及每个所述第一对象包括的所述第一函数,生成所述第一记录表;通过所述桥接层获取所述多个第二对象中每个所述第二对象对应的对象标识,以及每个所述第二对象包括的所述第二函数,生成所述第二记录表。In a possible implementation, the method further includes: obtaining, through the bridging layer, an object identifier corresponding to each of the first objects in the plurality of first objects, and an object identifier included in each first object. The first function generates the first record table; and obtains, through the bridging layer, the object identifier corresponding to each second object in the plurality of second objects, and the information included in each second object. The second function generates the second record table.
具体的,桥接层可以从第一引擎获取到多个第一对象的对象名(也可以称为对象标识)以及对象名下的函数名并生成第一记录表,桥接层也可以从第二引擎获取到多个第二对象的对象名以及对象名下的函数名并生成第二记录表,进而桥接层可以基于第一记录表和第二记录表判断请求中的对象名下的函数是否相同。由于在本申请中,避免将第二引擎的对象直接在第一引擎中注册,且通过桥接层高效实现两个不同引擎之间的信息交互,因此在保证安全的前提下,解决了两个运行环境相互隔离无法调用彼此对象(或函数)的问题。Specifically, the bridge layer can obtain the object names (also called object identifiers) of multiple first objects and the function names under the object names from the first engine and generate a first record table, and the bridge layer can also obtain the object names of multiple second objects and the function names under the object names from the second engine and generate a second record table, and then the bridge layer can determine whether the functions under the object names in the request are the same based on the first record table and the second record table. In this application, it is avoided to register the objects of the second engine directly in the first engine, and the information interaction between the two different engines is efficiently realized through the bridge layer. Therefore, under the premise of ensuring safety, the problem that the two operating environments are isolated from each other and cannot call each other's objects (or functions) is solved.
例如,如图4所示,图4为本发明实施例提供的一种H5侧与Ets侧交互的示意图,可以在ArkUI(鸿蒙的应用开发框架)的JS引擎侧(即第二引擎,可用于运行Ets侧的代码)和H5的JS引擎(即第一引擎,可用于运行H5侧的代码)侧构建两个映射表,且可以在两个JS运行环境间构建一个桥接层用于传递消息,将H5函数中的参数通过回调传给Ark引擎侧,在Ark引擎侧执行Ets对象的JS方法(也可以称为函数),并通过桥接层将Ark引擎的执行结果回传给H5中的JS函数,实现H5与Ets侧的消息的传递。For example, as shown in Figure 4, Figure 4 is a schematic diagram of the interaction between the H5 side and the Ets side provided by an embodiment of the present invention. It can be used on the JS engine side (i.e. the second engine) of ArkUI (Hongmeng's application development framework). Run the code on the Ets side) and H5's JS engine (i.e. the first engine, which can be used to run the code on the H5 side) build two mapping tables, and a bridge layer can be built between the two JS running environments for message transmission. Pass the parameters in the H5 function to the Ark engine side through callbacks, execute the JS method (also called a function) of the Ets object on the Ark engine side, and pass the execution result of the Ark engine back to the JS function in H5 through the bridging layer. , to realize the transmission of messages between H5 and Ets.
具体的,在JS引擎桥接模块(可以理解为上述桥接层)解析Ark引擎(即第二引擎)上开发者自定义的对象名和方法名(也可以称为函数名)并注册,以获得Ark引擎所包括的对象名以及每个对象名下的方法列表(也可以理解为函数列表)并记录在第二记录表中;通过JS引擎桥接模块在WebView的JS引擎 (即第一引擎)注册上述方法(即函数);H5页面通过WebView的JS引擎执行H5的方法;WebView的JS引擎向JS引擎桥接模块发送请求判断方法是否存在;若JS引擎桥接模块基于上述第二记录表判断方法存在,则可以通知WebView的JS引擎方法存在;WebView的JS引擎向JS引擎桥接模块发送执行请求并且可以携带上执行过程中所需的函数参数;JS引擎桥接模块向Ark引擎发送执行方法的请求;Ark引擎执行该方法并将结果返回给WebView内核,并通过JS引擎桥接模块转发给WebView的JS引擎;WebView的JS引擎再将执行结果回传给H5页面。Specifically, the JS engine bridge module (which can be understood as the above-mentioned bridge layer) parses the object name and method name (also known as function name) customized by the developer on the Ark engine (i.e., the second engine) and registers them to obtain the object name included in the Ark engine and the method list under each object name (also known as function list) and record them in the second record table; the JS engine of WebView is connected to the JS engine of WebView through the JS engine bridge module. (i.e. the first engine) registers the above method (i.e. function); the H5 page executes the H5 method through the JS engine of WebView; the JS engine of WebView sends a request to the JS engine bridge module to determine whether the method exists; if the JS engine bridge module determines that the method exists based on the above second record table, the JS engine of WebView can be notified that the method exists; the JS engine of WebView sends an execution request to the JS engine bridge module and can carry the function parameters required in the execution process; the JS engine bridge module sends a request to execute the method to the Ark engine; the Ark engine executes the method and returns the result to the WebView kernel, and forwards it to the JS engine of WebView through the JS engine bridge module; the JS engine of WebView then passes the execution result back to the H5 page.
步骤S203:若存在,电子设备通过所述桥接层向所述第二引擎发送第二请求。Step S203: If present, the electronic device sends a second request to the second engine through the bridge layer.
具体的,所述第二请求用于请求所述第二引擎按照对应的函数参数执行所述N个第二对象。第二请求中可以包括执行N个第二请求过程中需要使用到的函数参数。Specifically, the second request is used to request the second engine to execute the N second objects according to corresponding function parameters. The second request may include function parameters that need to be used in executing the N second requests.
在一种可能的实现方式中,所述方法还包括:响应于所述第二请求,通过所述第二引擎按照对应的函数参数执行所述N个第二对象,并生成所述N个第二对象对应的执行结果;通过所述桥接层向所述第一引擎转发所述第二引擎发送的所述N个第二对象对应的所述执行结果。In a possible implementation, the method further includes: in response to the second request, executing the N second objects according to the corresponding function parameters through the second engine, and generating the Nth The execution results corresponding to the two objects are forwarded to the first engine through the bridging layer, and the execution results corresponding to the N second objects sent by the second engine are forwarded.
具体的,第二引擎可以响应于桥接层的请求,可以基于函数参数执行对应的第二对象,并生成相应的执行结果,然后可以通过桥接层向第一引擎转发执行结果,从而实现跨引擎的数据交互。由于在本申请中,避免将第二引擎的对象直接在第一引擎中注册,且通过桥接层高效实现两个不同引擎之间的信息交互,因此在保证安全的前提下,解决了两个运行环境相互隔离无法调用彼此对象(或函数),以及无法进行数据传递的问题。Specifically, the second engine can respond to the request of the bridge layer, execute the corresponding second object based on the function parameters, and generate the corresponding execution results, and then forward the execution results to the first engine through the bridge layer, thereby realizing cross-engine Data interaction. In this application, it is avoided to directly register the objects of the second engine in the first engine, and the information interaction between two different engines is efficiently realized through the bridging layer. Therefore, on the premise of ensuring security, the two operations are solved. The environment is isolated from each other, unable to call each other's objects (or functions), and cannot transfer data.
可选的,第二引擎响应于桥接层的第二请求,第二引擎可以再次判断是否存在对应的对象(或函数),若存在,则基于函数参数执行对应的对象(或函数);若不存在,第二引擎不会执行对应的对象(或函数),并通知第一引擎执行失败,返回异常日志信息,从而完成应用侧的容错保护。Optionally, in response to the second request of the bridge layer, the second engine can determine again whether the corresponding object (or function) exists. If it exists, execute the corresponding object (or function) based on the function parameters; if not exists, the second engine will not execute the corresponding object (or function), and will notify the first engine of execution failure and return exception log information, thus completing fault-tolerance protection on the application side.
例如,如图5所示,图5为本发明实施例提供的一种电子设备的界面示意图,图5的(a)中电子设备上显示第一界面,第一界面可以为浏览器当前打开的页面,用户可以在此界面上实现实时计算,如用户输入数据1和2,此时第一引擎会向桥接层发送一个调用加法运算(可以理解为一个函数)的请求。进一步地,桥接层会判断第二引擎中是否存在该函数,若存在,则桥接层将函数参数(如1和2)发送给第二引擎,第二引擎基于函数参数执行对应的函数,并将执行结果通过桥接层发送给第一引擎。最终,如图5的(b)所示可以在电子设备上直接显示执行结果。本申请提供的引擎间的通信方法,不仅能解决两个运行环境相互隔离无法调用彼此对象(或函数)的问题,在H5与Ets频繁交互的场景下,能够降低响应时延,即点即响应。For example, as shown in Figure 5, Figure 5 is a schematic diagram of an interface of an electronic device provided by an embodiment of the present invention. In (a) of Figure 5, a first interface is displayed on the electronic device. The first interface can be the one currently opened by the browser. Page, users can implement real-time calculations on this interface. For example, the user inputs data 1 and 2. At this time, the first engine will send a request to call the addition operation (can be understood as a function) to the bridge layer. Further, the bridging layer will determine whether the function exists in the second engine. If it exists, the bridging layer will send the function parameters (such as 1 and 2) to the second engine. The second engine will execute the corresponding function based on the function parameters and will The execution results are sent to the first engine through the bridge layer. Finally, the execution result can be directly displayed on the electronic device as shown in (b) of Figure 5 . The communication method between engines provided by this application can not only solve the problem that the two operating environments are isolated from each other and cannot call each other's objects (or functions), but also can reduce the response delay in the scenario of frequent interaction between H5 and Ets, and the response is instantaneous. .
在一种可能的实现方式中,所述方法还包括:若所述多个第二对象中不存在与所述N个第一对象相同的所述N个第二对象,则通过所述桥接层向所述第一引擎发送第一通知,所述第一通知包括所述N个第一对象执行错误的消息。In a possible implementation, the method further includes: if the N second objects that are the same as the N first objects do not exist among the plurality of second objects, through the bridging layer A first notification is sent to the first engine, where the first notification includes a message of execution errors of the N first objects.
具体的,若不存在相同的对象,则表示第二引擎无法执行请求中的对象,进而可以通过桥接层通知第一引擎请求中的对象不会被执行。由于在本申请中,避免将第二引擎的对象直接在第一引擎中注册,且通过桥接层高效实现两个不同引擎之间的信息交互,因此在保证安全的前提下,解决了两个运行环境相互隔离无法调用彼此对象(或函数),以及无法进行数据传递的问题。Specifically, if the same object does not exist, it means that the second engine cannot execute the object in the request, and then the first engine can be notified through the bridge layer that the object in the request will not be executed. In this application, the object of the second engine is avoided from being directly registered in the first engine, and the information interaction between the two different engines is efficiently realized through the bridge layer. Therefore, under the premise of ensuring security, the problem of the two operating environments being isolated from each other and unable to call each other's objects (or functions) and unable to transfer data is solved.
接下来,以第一引擎为H5的JS引擎,第二引擎为Ets侧的Ark引擎为例进行说明,如图6所示,图6为本发明实施例提供的一种H5侧与Ets侧交互的流程示意图,图中结合上述图2中的跨引擎通信的系统架构从交互侧对本申请实施例中的引擎间的通信方法进行描述,需要说明的是,在本申请中可以实现一种映射表机制,完成ArkUI侧只执行Ets侧的方法,H5侧执行H5中的JS方法,通过桥接层,将H5的对象传给ArkUI侧,ArkUI框架将该对象转成Ark引擎的对象(JsValue对象),并执行开发者在Ets侧定义的对象下的JS方法;在本申请中也设计了一种H5JS引擎与ArkUI JS引擎交互的桥接机制,负责将Ark引擎的对象和方法名传给H5的JS引擎,识别到该方法存在后,JS引擎桥接模块将函数参数传给Ark引擎,Ark引擎根据函数参数执行JS方法后,再将执行结果返回给H5的JS引擎,完成两个不同JS引擎在相互隔离的JS运行环境下的通讯;本申请还设计了一种H5与Ark引擎通讯的容错保护机制,通过在两个不同JS引擎侧分别判断执行的JS方法是否存在,若不存在,Ark的JS引擎不会执行该方法,并通知应用侧该方法不存在,返回异常日志信息,完成应用侧的容错保护。详细步骤如下:Next, the first engine is the JS engine of H5, and the second engine is the Ark engine of the Ets side. As shown in Figure 6, Figure 6 shows an interaction between the H5 side and the Ets side provided by an embodiment of the present invention. A schematic flow chart of the process, which describes the inter-engine communication method in the embodiment of the present application from the interactive side in conjunction with the system architecture of cross-engine communication in Figure 2 above. It should be noted that a mapping table can be implemented in this application mechanism, the ArkUI side only executes the Ets side methods, the H5 side executes the JS methods in H5, and passes the H5 object to the ArkUI side through the bridging layer. The ArkUI framework converts the object into an Ark engine object (JsValue object). And execute the JS method under the object defined by the developer on the Ets side; in this application, a bridging mechanism for the interaction between the H5JS engine and the ArkUI JS engine is also designed, which is responsible for passing the objects and method names of the Ark engine to the H5 JS engine. , after recognizing that the method exists, the JS engine bridge module passes the function parameters to the Ark engine. After the Ark engine executes the JS method according to the function parameters, the execution result is returned to the H5 JS engine, completing the mutual isolation of two different JS engines. Communication in the JS running environment; this application also designs a fault-tolerant protection mechanism for communication between H5 and Ark engines. By judging whether the executed JS method exists on the two different JS engine sides, if it does not exist, Ark's JS engine This method will not be executed, and the application side will be notified that the method does not exist, and exception log information will be returned to complete the fault tolerance protection of the application side. The detailed steps are as follows:
步骤1:开启应用,Ark JS引擎模块执行应用开发者的JS代码,解析开发者自定义的对象名和方法名,同时JS对象和方法名等通过JS到C++的跨语言接口调用传给ArkUI Framework模块。Step 1: Start the application. The Ark JS engine module executes the JS code of the application developer and parses the object name and method name customized by the developer. At the same time, the JS object and method names are passed to the ArkUI Framework module through the JS to C++ cross-language interface call.
步骤2:ArkUI Framework模块根据对象名和方法名等信息创建C++对象,并在对象上绑定对应的C++ 的方法,并向JS引擎桥接模块注册C++函数,并将对象名和对象名下的方法列表保存到一个哈希表中,发送给JS方法识别模块。Step 2: The ArkUI Framework module creates a C++ object based on information such as object name and method name, and binds the corresponding C++ object to the object. method, register the C++ function with the JS engine bridge module, save the object name and the method list under the object name into a hash table, and send it to the JS method identification module.
步骤3:JS方法识别模块智能识别ArkUI中JS引擎中的JS方法是否存在,并通知容错模块。Step 3: The JS method identification module intelligently identifies whether the JS method in the JS engine in ArkUI exists and notifies the fault tolerance module.
步骤4:在ArkUI JS引擎模块解析Ets侧的对象和方法时,H5的JS模块在应用启动并执行H5的JS代码时,H5的JS引擎模块也会解析H5侧使用的JS对象和方法名,通过JS引擎桥接模块来判断对象下的方法是否存在来通知容错模块。Step 4: When the ArkUI JS engine module parses the objects and methods on the Ets side, when the H5 JS module starts the application and executes the H5 JS code, the H5 JS engine module will also parse the JS objects and method names used on the H5 side. The JS engine bridge module is used to determine whether the method under the object exists to notify the fault tolerance module.
步骤5:容错模块发送消息给Ark JS引擎模块,如果识别到对应的方法存在,执行对应的JS方法,如果方法不存在,通过JS回调到应用侧,可以通过弹框通知用户执行的方法无效。Step 5: The fault tolerance module sends a message to the Ark JS engine module. If it recognizes that the corresponding method exists, it executes the corresponding JS method. If the method does not exist, it calls back to the application side through JS, and the user can be notified through a pop-up box that the executed method is invalid.
步骤6:ArkUI JS引擎模块执行JS方法,并将JS执行结果返回给JS引擎桥接模块,然后JS引擎桥接模块将通过注册的回调将JS函数执行结果传给H5的JS引擎;Step 6: The ArkUI JS engine module executes the JS method and returns the JS execution result to the JS engine bridge module. The JS engine bridge module will then pass the JS function execution result to the H5 JS engine through the registered callback;
步骤7:H5的JS引擎模块将执行结果回传给H5页面,通过数据绑定触发页面更新,将执行结果更新的H5界面上,并最终通知到用户。Step 7: The H5 JS engine module returns the execution results to the H5 page, triggers page updates through data binding, updates the execution results on the H5 interface, and finally notifies the user.
综上,本发明实施例中,可以在第一引擎和第二引擎之间增加一个桥接层,以通过桥接层实现不同引擎之间的通信。具体的,可以在第一引擎上运行第一应用,第一应用中可以包括多个第一对象;可以在第二引擎上运行第二应用,第二应用中可以包括多个第二对象,且第一应用和第二应用运行在两个不同的上下文中。进一步地,在两个引擎运行过程中,第一引擎可以向桥接层发送执行一个或多个第一对象的请求,然后桥接层判断多个第二对象中是否存在与上述一个或多个第一对象相同的第二对象,若存在,桥接层再向第二引擎发送执行对应的一个或多个第二对象的请求,且在该请求中可以包括执行过程中需要使用的函数参数,从而第二引擎可以基于函数参数执行对应的第二对象,实现了跨引擎通信。由于在本申请中,避免将第二引擎的对象直接在第一引擎中注册,且通过桥接层高效实现两个不同引擎之间的信息交互,因此在保证安全的前提下,解决了两个运行环境相互隔离无法调用彼此对象(或函数)的问题。In summary, in an embodiment of the present invention, a bridge layer can be added between the first engine and the second engine to realize communication between different engines through the bridge layer. Specifically, the first application can be run on the first engine, and the first application can include multiple first objects; the second application can be run on the second engine, and the second application can include multiple second objects, and the first application and the second application run in two different contexts. Further, during the operation of the two engines, the first engine can send a request to the bridge layer to execute one or more first objects, and then the bridge layer determines whether there is a second object that is the same as the one or more first objects in the multiple second objects. If so, the bridge layer sends a request to the second engine to execute the corresponding one or more second objects, and the request can include the function parameters needed to be used during the execution process, so that the second engine can execute the corresponding second object based on the function parameters, thereby realizing cross-engine communication. Since in this application, it is avoided to register the object of the second engine directly in the first engine, and the information interaction between the two different engines is efficiently realized through the bridge layer, so that under the premise of ensuring safety, the problem that the two operating environments are isolated from each other and cannot call each other's objects (or functions) is solved.
上述详细阐述了本发明实施例的方法,下面提供了本发明实施例的相关设备。The method of the embodiment of the present invention is described in detail above, and the relevant equipment of the embodiment of the present invention is provided below.
请参见图7,图7是本发明实施例提供的本申请提供了一种电子设备的示意图,该电子设备30运行操作系统,所述操作系统包括第一引擎、第二引擎和桥接层,所述第一引擎包括多个第一对象,所述第二引擎包括多个第二对象。该电子设备30可以包括第一接收单元301、第一处理单元302、第一发送单元303、第二接收单元304、第三接收单元305、第二处理单元306、第二发送单元307、第三发送单元308,其中,各个模块的详细描述如下。Please refer to Figure 7. Figure 7 is a schematic diagram of an electronic device provided by this application according to an embodiment of the present invention. The electronic device 30 runs an operating system. The operating system includes a first engine, a second engine and a bridge layer. The first engine includes a plurality of first objects, and the second engine includes a plurality of second objects. The electronic device 30 may include a first receiving unit 301, a first processing unit 302, a first sending unit 303, a second receiving unit 304, a third receiving unit 305, a second processing unit 306, a second sending unit 307, a third Sending unit 308, where the detailed descriptions of each module are as follows.
第一接收单元301,用于通过所述桥接层接收所述第一引擎发送的第一请求,所述第一请求用于请求执行所述多个第一对象中的N个第一对象,N为大于0的整数;The first receiving unit 301 is configured to receive a first request sent by the first engine through the bridge layer, where the first request is used to request execution of N first objects among the plurality of first objects, N is an integer greater than 0;
第一处理单元302,用于通过所述桥接层响应于所述第一请求,判断所述多个第二对象中是否存在与所述N个第一对象相同的N个第二对象;The first processing unit 302 is configured to respond to the first request through the bridging layer and determine whether there are N second objects that are the same as the N first objects among the plurality of second objects;
第一发送单元303,用于,若存在,通过所述桥接层向所述第二引擎发送第二请求,所述第二请求用于请求所述第二引擎按照对应的函数参数执行所述N个第二对象。The first sending unit 303 is configured to, if present, send a second request to the second engine through the bridge layer. The second request is used to request the second engine to execute the N according to the corresponding function parameters. a second object.
在一种可能的实现方式中,所述第一处理单元302,具体用于:判断所述多个第二对象中是否存在与所述N个第一对象的对象标识相同的N个第二对象;其中,若存在则所述N个第二对象与所述N个第一对象相同。In a possible implementation, the first processing unit 302 is specifically configured to determine whether there are N second objects among the plurality of second objects that have the same object identifiers as the N first objects. ; Wherein, if they exist, the N second objects are the same as the N first objects.
在一种可能的实现方式中,所述第一处理单元302,具体用于:判断所述多个第二对象中是否存在与所述N个第一对象的对象标识相同的N个第二对象;若存在,则通过第一记录表确定所述N个第一对象中每个第一对象包括的第一函数;所述第一记录表包括所述多个第一对象中每个第一对象包括的所述第一函数;基于第二记录表,判断所述N个第一对象中每个第一对象包括的所述第一函数与所述N个第二对象中每个第二对象包括的第二函数是否一致;其中,若一致则所述多个第二对象中存在与所述N个第一对象相同的所述N个第二对象;所述第二记录表包括所述第二对象中每个所述第二对象所包括的第二函数。In a possible implementation, the first processing unit 302 is specifically configured to determine whether there are N second objects among the plurality of second objects that have the same object identifiers as the N first objects. ; If it exists, determine the first function included in each of the N first objects through the first record table; the first record table includes each first object in the plurality of first objects. The first function included; based on the second record table, determine the first function included in each of the N first objects and the first function included in each of the N second objects. Whether the second function of The second function included in each second object in the object.
在一种可能的实现方式中,所述设备还包括:第二接收单元304,用于通过所述桥接层获取所述多个第一对象中每个所述第一对象对应的对象标识,以及每个所述第一对象包括的所述第一函数,生成所述第一记录表;第三接收单元305,用于通过所述桥接层获取所述多个第二对象中每个所述第二对象对应的对象标识,以及每个所述第二对象包括的所述第二函数,生成所述第二记录表。In a possible implementation, the device further includes: a second receiving unit 304, configured to obtain the object identifier corresponding to each of the plurality of first objects through the bridging layer, and The first function included in each first object generates the first record table; the third receiving unit 305 is used to obtain each of the plurality of second objects through the bridging layer. The object identifiers corresponding to the two objects and the second function included in each second object are used to generate the second record table.
在一种可能的实现方式中,所述设备还包括:第二处理单元306,用于响应于所述第二请求,通过所述第二引擎按照对应的函数参数执行所述N个第二对象,并生成所述N个第二对象对应的执行结果;第二发送单元307,用于通过所述桥接层向所述第一引擎转发所述第二引擎发送的所述N个第二对象对应的 所述执行结果。In a possible implementation, the device further includes: a second processing unit 306, configured to respond to the second request, execute the N second objects according to the corresponding function parameters through the second engine , and generate execution results corresponding to the N second objects; the second sending unit 307 is configured to forward the N second objects corresponding to the N second objects sent by the second engine to the first engine through the bridging layer. of The execution result.
在一种可能的实现方式中,所述设备还包括:第三发送单元308,用于若所述多个第二对象中不存在与所述N个第一对象相同的所述N个第二对象,则通过所述桥接层向所述第一引擎发送第一通知,所述第一通知包括所述N个第一对象执行错误的消息。In a possible implementation, the device further includes: a third sending unit 308, configured to: if the N second objects that are the same as the N first objects do not exist in the plurality of second objects, object, a first notification is sent to the first engine through the bridge layer, where the first notification includes execution error messages for the N first objects.
需要说明的是,本发明实施例中所描述的电子设备30中各功能单元的功能可参见上述图3中所述的方法实施例中的步骤S201-步骤S203的相关描述,此处不再赘述。It should be noted that for the functions of each functional unit in the electronic device 30 described in the embodiment of the present invention, please refer to the relevant description of steps S201 to S203 in the method embodiment described in FIG. 3, and will not be described again here. .
本申请提供了一种计算机存储介质,其特征在于,所述计算机存储介质存储有计算机程序,该计算机程序被处理器执行时实现上述任意一种引擎间的通信方法。The present application provides a computer storage medium, characterized in that the computer storage medium stores a computer program, and when the computer program is executed by a processor, any one of the above-mentioned inter-engine communication methods is implemented.
本申请实施例提供一种电子设备,该电子设备中包括处理器,处理器被配置为支持该电子设备实现上述任意一种引擎间的通信方法中相应的功能。该电子设备还可以包括存储器,存储器用于与处理器耦合,其保存该电子设备必要的程序指令和数据。该电子设备还可以包括通信接口,用于该电子设备与其他设备或通信网络通信。An embodiment of the present application provides an electronic device. The electronic device includes a processor. The processor is configured to support the electronic device to implement corresponding functions in any of the above inter-engine communication methods. The electronic device may also include a memory coupled to the processor that stores necessary program instructions and data for the electronic device. The electronic device may also include a communication interface for the electronic device to communicate with other devices or communication networks.
本申请提供了一种芯片系统,该芯片系统包括处理器,用于支持电子设备实现上述所涉及的功能,例如,生成或处理上述一种引擎间的通信方法中所涉及的信息。在一种可能的设计中,所述芯片系统还包括存储器,所述存储器,用于保存电子设备必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分离器件。The present application provides a chip system, which includes a processor for supporting an electronic device to implement the functions involved above, for example, generating or processing information involved in the above-mentioned inter-engine communication method. In one possible design, the chip system also includes a memory, which is used to store program instructions and data necessary for the electronic device. The chip system can be composed of a chip, or it can include a chip and other separate devices.
本申请提供一种计算机程序,其特征在于,所述计算机程序包括指令,当所述计算机程序被计算机执行时,使得所述计算机执行上述一种引擎间的通信方法。The present application provides a computer program, which is characterized in that the computer program includes instructions, which when the computer program is executed by a computer, causes the computer to execute the above-mentioned inter-engine communication method.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above embodiments, each embodiment is described with its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可能可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。It should be noted that for the sake of simple description, the foregoing method embodiments are expressed as a series of action combinations. However, those skilled in the art should know that the present application is not limited by the described action sequence. Because according to this application, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily necessary for this application.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如上述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the above units is only a logical function division. In actual implementation, there may be other divisions. For example, multiple units or components may be combined or integrated. to another system, or some features can be ignored, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical or other forms.
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described above as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated units can be implemented in the form of hardware or software functional units.
上述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以为个人计算机、服务器或者网络设备等,具体可以是计算机设备中的处理器)执行本申请各个实施例上述方法的全部或部分步骤。其中,而前述的存储介质可包括:U盘、移动硬盘、磁碟、光盘、只读存储器(Read-Only Memory,缩写:ROM)或者随机存取存储器(Random Access Memory,缩写:RAM)等各种可以存储程序代码的介质。If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server or network device, etc., specifically a processor in a computer device) to perform all or part of the steps of the above-mentioned methods in each embodiment of the present application. Among them, the aforementioned storage medium may include: U disk, mobile hard disk, magnetic disk, optical disk, read-only memory (Read-Only Memory, abbreviated: ROM) or random access memory (Random Access Memory, abbreviated: RAM) and other media that can store program codes.
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。 As mentioned above, the above embodiments are only used to illustrate the technical solution of the present application, but not to limit it. Although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still make the foregoing technical solutions. The technical solutions described in each embodiment may be modified, or some of the technical features may be equivalently substituted; however, these modifications or substitutions shall not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of each embodiment of the present application.
Claims (14)
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211137787.7 | 2022-09-19 | ||
CN202211137787.7A CN117762647A (en) | 2022-09-19 | 2022-09-19 | Inter-engine communication method and related equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2024061036A1 true WO2024061036A1 (en) | 2024-03-28 |
Family
ID=90318802
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2023/117917 Ceased WO2024061036A1 (en) | 2022-09-19 | 2023-09-11 | Inter-engine communication method and related device |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN117762647A (en) |
WO (1) | WO2024061036A1 (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8490117B1 (en) * | 2006-10-23 | 2013-07-16 | Adobe Systems Incorporated | Bridging script engines |
CN110688601A (en) * | 2019-09-18 | 2020-01-14 | 郑州阿帕斯科技有限公司 | Data processing method and device |
CN110727504A (en) * | 2019-10-21 | 2020-01-24 | 百度在线网络技术(北京)有限公司 | Code execution method and device and rendering equipment |
CN113791790A (en) * | 2021-08-18 | 2021-12-14 | 五八有限公司 | An application program updating method, device, electronic device and storage medium |
US20220035799A1 (en) * | 2020-07-28 | 2022-02-03 | Sap Se | Bridge from natural language processing engine to database engine |
-
2022
- 2022-09-19 CN CN202211137787.7A patent/CN117762647A/en active Pending
-
2023
- 2023-09-11 WO PCT/CN2023/117917 patent/WO2024061036A1/en not_active Ceased
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8490117B1 (en) * | 2006-10-23 | 2013-07-16 | Adobe Systems Incorporated | Bridging script engines |
CN110688601A (en) * | 2019-09-18 | 2020-01-14 | 郑州阿帕斯科技有限公司 | Data processing method and device |
CN110727504A (en) * | 2019-10-21 | 2020-01-24 | 百度在线网络技术(北京)有限公司 | Code execution method and device and rendering equipment |
US20220035799A1 (en) * | 2020-07-28 | 2022-02-03 | Sap Se | Bridge from natural language processing engine to database engine |
CN113791790A (en) * | 2021-08-18 | 2021-12-14 | 五八有限公司 | An application program updating method, device, electronic device and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN117762647A (en) | 2024-03-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20230262065A1 (en) | Atomic Ability Invoking Method and Terminal Device | |
CN113961278B (en) | Page display method and related equipment | |
CN110780929B (en) | Method for calling hardware interface and electronic device | |
US12050633B2 (en) | Data processing method and apparatus | |
WO2021052311A1 (en) | Method for displaying user interface according to color of rear case, and electronic device | |
CN113992663B (en) | Method, electronic device and readable storage medium for sending files | |
CN111259441B (en) | Device control method, device, storage medium and electronic device | |
WO2021042991A1 (en) | Non-intrusive interaction method and electronic device | |
EP4336857A1 (en) | Photographing method and related apparatus | |
CN117156293A (en) | Photographing method and related device | |
CN114915996B (en) | Communication abnormality processing method and related device | |
CN113656089B (en) | Class Validation Methods and Devices in Applications | |
WO2024061036A1 (en) | Inter-engine communication method and related device | |
WO2021151341A1 (en) | Distorted-fingerprint-based touch-control method and electronic device | |
CN111475363A (en) | Stuck identification method and electronic device | |
WO2024152676A1 (en) | Window management method and electronic device | |
CN116052236B (en) | Face detection processing engine, shooting method and equipment related to face detection | |
CN115514881B (en) | Method for controlling camera and electronic equipment | |
CN116701238A (en) | Drive file processing method and related device | |
CN115079981A (en) | Equipment control method and related device | |
CN111695071A (en) | Page display method and related device | |
CN117251223A (en) | Cloud function plug-in configuration and scheduling method, system and electronic equipment | |
CN114398108A (en) | Electronic device, drive loading method thereof, and medium | |
CN112035180A (en) | Automatic instance loading method and device, electronic equipment and storage medium | |
CN116743903B (en) | Chip identification method and electronic 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: 23867325 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: 23867325 Country of ref document: EP Kind code of ref document: A1 |