Program running method, device, computer equipment, storage medium and program product

By running the server program of the virtual server on the Hongmeng system terminal, detecting and parsing WASM programs, and using the built-in browser kernel of the Hongmeng system to execute WASM programs, the problem that the Hongmeng system cannot directly support the operation of WASM format programs is solved, and compatibility and security are guaranteed.

CN119356763BActive Publication Date: 2025-04-15SHENZHEN XUNLONG SOFTWARE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411909138.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-04-15
Estimated Expiration
2044-12-24

AI Technical Summary

Technical Problem

The Hongmeng system cannot directly support program operation in WASM format, especially when dealing with compatibility and performance differences between different devices, resulting in increased system complexity.

Method used

By running the server program of the virtual server on the terminal, detecting whether the web page request points to the locally stored WASM program, and determining its parsing method, using the built-in browser kernel of the Hongmeng system for parsing and executing.

Benefits of technology

It realizes the compatible operation of the Hongmeng system for WASM programs, ensures compatibility and security, and avoids secondary development of applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119356763B_ABST
    Figure CN119356763B_ABST
Patent Text Reader

Abstract

The present application relates to a program running method, device, computer equipment, storage medium and program product. Applied to a terminal with Hongmeng system installed, the method includes: running a server program; the server program is a virtual server; through the server program, detecting whether the web page request triggered by the terminal points to the WASM program stored in the terminal; if so, determining the parsing method of the WASM program through the server program; parsing the WASM program through the browser kernel built into the Hongmeng system using the parsing method to obtain the parsing result; executing the parsing result to realize the running of the WASM program. This method can make the Hongmeng system compatible with WASM programs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of processor technology, and in particular to a program running method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] With the development of operating systems based on processor technology, Hongmeng system has emerged. The goal of Hongmeng system is to build an operating system for the interconnection of all things, so its focus is on the compatibility of Hongmeng system.

[0003] However, since Hongmeng needs to ensure that applications have a consistent user experience on different types of devices, and IoT devices such as smart watches have very limited computing resources and memory, the introduction of these IoT devices may increase the complexity of the system, especially in dealing with the compatibility and performance differences of different devices. Based on this, in order to be compatible with these devices, Hongmeng cannot directly support the running of WASM format programs. Summary of the invention

[0004] Based on this, it is necessary to provide a program running method, device, computer equipment, computer-readable storage medium and computer program product that can make the Hongmeng system compatible with WASM programs in response to the above-mentioned technical problems.

[0005] In a first aspect, the present application provides a program running method, which is applied to a terminal installed with a Hongmeng system, and the method includes:

[0006] Running a server program; the server program is a virtual server;

[0007] Detecting, by the server program, whether the web page request triggered by the terminal points to the WASM program stored in the terminal;

[0008] If yes, the parsing method of the WASM program is determined by the server program;

[0009] Parse the WASM program using the parsing method through the browser kernel built into the Hongmeng system to obtain a parsing result;

[0010] The parsing result is executed to implement the running of the WASM program.

[0011] In one embodiment, the running of the server program includes:

[0012] Compile the server data to be compiled according to the file format supported by the kernel of the Hongmeng system to obtain an initial server program; the server data to be compiled includes a set of methods for processing web page requests;

[0013] The preset port of the initial server program is configured as a listening port to obtain the server program; the listening port is used to monitor web page requests pointing to the WASM program stored in the terminal;

[0014] Running the server program;

[0015] The determining of the parsing method of the WASM program by the server program includes:

[0016] In the set of processing methods for web page requests, a target processing method matching the web page request is determined; the target processing method is a parsing method of the WASM program.

[0017] In one embodiment, determining the target processing method that matches the web page request in the set of processing methods for the web page request includes:

[0018] Determine the file extension corresponding to the WASM program through the server program;

[0019] According to the file suffix, a target processing method matching the web page request is determined in a set of processing methods for web page requests.

[0020] In one embodiment, detecting, by the server program, whether the webpage request triggered by the terminal points to the WASM program stored in the terminal includes:

[0021] Through the server program, detecting whether the web page request triggered by the terminal points to the WASM program in the directory where the server program is located;

[0022] The directory where the server program is located is a directory where the terminal stores the WASM program.

[0023] In one of the embodiments, the parsing result is a machine code;

[0024] The executing the parsing result to implement the running of the WASM program includes:

[0025] The machine code is executed based on a browser to implement the page running represented by the WASM program.

[0026] In one embodiment, before executing the parsing result to implement the running of the WASM program, the method further includes:

[0027] Adjusting the display configuration items of the browser kernel to preset parameters;

[0028] The preset parameters indicate that the browser kernel supports the running of the WASM program.

[0029] In a second aspect, the present application further provides a terminal installed with a Hongmeng system, the device comprising:

[0030] A running module, used to run a server program; the server program is a virtual server;

[0031] A detection module, used to detect, through the server program, whether the web page request triggered by the terminal points to the WASM program stored in the terminal;

[0032] The detection module is used to determine the parsing method of the WASM program through the server program if yes;

[0033] A parsing module, used to parse the WASM program using the parsing method through the browser kernel built into the Hongmeng system to obtain a parsing result;

[0034] The running module is used to execute the parsing result to realize the running of the WASM program.

[0035] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the program running method in any of the above embodiments are implemented.

[0036] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the program running method in any of the above embodiments are implemented.

[0037] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the program running method in any of the above embodiments are implemented.

[0038] The above-mentioned program running method, device, computer equipment, computer-readable storage medium and computer program product are applied to a terminal with a Hongmeng system, and the method includes: running a server program; enabling the terminal to have both information input and output functions and server functions; and because the server is a virtual server, it will not invade the kernel of the Hongmeng system, and can ensure the kernel security of the Hongmeng system. Furthermore, through the server program, it is detected whether the web page request triggered by the terminal points to the WASM program stored in the terminal, so that the server program focuses on the service terminal itself, so that the number of web page requests is reduced, and services are provided for local programs in WASM format, so that the server program processing is reduced, thereby reducing the frequency of data processing by the server program and the amount of resources it occupies. Then, when a webpage request points to a WASM program stored in the terminal, the server program determines the parsing method of the WASM program, so that the server program forms a bridge between the WASM program and the Hongmeng system, so that the Hongmeng system can flexibly adjust the parsing method, and then parse the WASM program using the parsing method through the browser kernel built into the Hongmeng system to obtain a parsing result; and execute the parsing result to realize the operation of the WASM program. As a result, a terminal with the Hongmeng system can safely run WASM programs, ensure compatibility, and avoid secondary development of applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 An application environment diagram of a program running method in an embodiment;

[0041] Figure 2 A schematic diagram of a flow chart of a program running method in one embodiment;

[0042] Figure 3 A schematic diagram of the process of executing a server program in one embodiment;

[0043] Figure 4 It is a structural block diagram of a program running device in one embodiment;

[0044] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0046] The program running method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, handheld game consoles, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc.

[0047] In an exemplary embodiment, Figure 2 As shown, a program running method is provided, which is applied to Figure 1 The terminal is installed with Hongmeng system, and the method includes the following steps 202 to 210. Among them:

[0048] Step 202, run the server program; the server program is a virtual server.

[0049] A server program is a program with server functions. A server program is a program that can respond to web page requests. A server program is an executable library of the Hongmeng system, which can provide corresponding processing functions for different web page requests to obtain corresponding response results, and feed back the corresponding response results to the kernel, browser or other programs of the Hongmeng system. A virtual server is a program that is run by a terminal and provides server functions.

[0050] In some embodiments, running the server program includes: creating the server program through the httplib library, and running the created server program.

[0051] In some embodiments, running a server program includes: running a listening thread of the server program until the listening thread detects whether the web page request triggered by the terminal points to the WASM program stored in the terminal, and then controlling the server program to run a thread for processing the web page request. As a result, the running process of the server program is decoupled into two stages. In the listening stage, the listening thread is run separately, so that relatively few resources are occupied and the normal operation of the terminal is not affected. In the stage of detecting a local web page request, other threads of the server program are run to increase the number of threads occupied by the server program so as to respond to web page requests more efficiently.

[0052] Step 204: Detect, through the server program, whether the web page request triggered by the terminal points to the WASM program stored in the terminal.

[0053] Web page requests are request instructions based on the page triggering of the terminal. Since the terminal resources are limited and the terminal resources are allocated to both page display and server program tasks, the server is used to process the web page requests triggered by the terminal itself to reduce the scope and number of web page requests that the server program can respond to, thereby ensuring processing efficiency.

[0054] WASM programs (WebAssembly) are binary-encoded computer programs that are encoded in WASM, a low-level assembly-like language. They can run with near-native performance and can provide compilation targets for languages ​​such as C / C++, C#, and Rust so that they can run on web pages. WASM programs can run in most web browsers, but because the Hongmeng system itself pursues the need for the Internet of Everything, WASM programs are not supported. WASM programs are designed to coexist with JavaScript, that is, WASM programs can call JavaScript functions and JavaScript can also call WASM functions. This interoperability allows WASM modules to be seamlessly integrated with existing web applications.

[0055] In some embodiments, the server program is used to detect whether the web page request triggered by the terminal points to the WASM program stored in the terminal, including: detecting whether the terminal triggers the web page request through the listening thread of the server program; in the case of triggering the web page request, judging whether the web page request points to the WASM program stored in the terminal through the listening thread. Thus, the work of the listening thread can be performed step by step, and the resources used in each step can be flexibly changed to allocate resources more flexibly.

[0056] Step 206: If yes, determine the parsing method of the WASM program through the server program.

[0057] The parsing method is used to convert the format and analyze the data of the WASM program. The parsing method can be in the form of a function or a mapping table.

[0058] In some embodiments, determining the parsing method of the WASM program through the server program includes: decoding the web page request through the request processing thread of the server program to obtain request content data; mapping according to the request content data to obtain the parsing method of the WASM program.

[0059] Step 208, parse the WASM program using the parsing method through the browser kernel built into the Hongmeng system to obtain the parsing result.

[0060] The browser kernel is the core component inside the browser. It interacts with the server program or other servers through network protocols and obtains resources according to user requests. The browser kernel is used to parse and present web page content. It is a bridge between the browser and the network content. It is used to convert web page data in formats such as HTML and CSS into a format that the browser can display. It can also be used to execute JavaScript and render web pages.

[0061] The parsing result is data that can be executed by the browser. The parsing result is data in a format that can be supported by the browser of the Hongmeng system. When the browser kernel built into the Hongmeng system does not support WASM programs, the parsing result is a format other than WASM format. For example, the parsing result includes but is not limited to data in formats such as HTML, CSS, and JavaScript.

[0062] In some embodiments, the browser kernel built into the Hongmeng system uses a parsing method to parse the WASM program and obtain a parsing result, including: calling the thread corresponding to the browser through the browser kernel built into the Hongmeng system, converting the format of the WASM program according to the parsing method, and obtaining a parsing result.

[0063] Step 210: Execute the parsing result to implement the running of the WASM program.

[0064] In some embodiments, executing the parsing result to implement the running of the WASM program includes: executing the parsing result by a browser of the terminal to display the processing result of the WASM program on the current page.

[0065] In some embodiments, the parsing results are executed to realize the running of the WASM program, including: the parsing results are executed by an application of the Hongmeng system to display the processing results of the WASM program on the current page.

[0066] In the above-mentioned program running method, it is applied to a terminal with a Hongmeng system, and the method includes: running a server program; making the terminal have both the function of information input and output and the function of a server; and because the server is a virtual server, it will not invade the kernel of the Hongmeng system, and can ensure the kernel security of the Hongmeng system. Then, through the server program, it is detected whether the web page request triggered by the terminal points to the WASM program stored in the terminal, so that the server program focuses on the service terminal itself, so that the number of web page requests is reduced, and services are provided for local programs in WASM format, so that the server program processing is reduced, thereby reducing the frequency of data processing by the server program and the amount of resources it occupies. Then, when the web page request points to the WASM program stored in the terminal, the server program determines the parsing method of the WASM program, so that the server program forms a bridge between the WASM program and the Hongmeng system, so that the Hongmeng system can flexibly adjust the parsing method, and then through the browser kernel built into the Hongmeng system, the parsing method is used to parse the WASM program to obtain the parsing result; the parsing result is executed to realize the operation of the WASM program. As a result, terminals with Hongmeng system can safely run WASM programs, ensure compatibility, and avoid secondary development of applications.

[0067] In some embodiments, Figure 3 As shown, running the server program includes steps 302 to 306; correspondingly, determining the parsing method of the WASM program through the server program includes step 308. Among them:

[0068] Step 302, compile the server data to be compiled according to the file format supported by the kernel of the Hongmeng system to obtain the initial server program; the server data to be compiled includes a set of methods for processing web page requests.

[0069] The file format supported by the kernel is the file format that the Hongmeng system kernel can run directly. The file format supported by the kernel includes assembly language in binary format, but does not include WASM in binary format.

[0070] The initial server program is an example program that can be run on the Hongmeng system. Since it is compiled into a file format supported by the kernel of the terminal's local Hongmeng system, the initial server program can be run directly on the kernel of the Hongmeng system, avoiding additional virtualization processing. Compared with containerized deployment, it takes up less memory and CPU resources.

[0071] The web page request processing method set is a data set for providing processing methods corresponding to the web page request types according to the web page request types. The web page request processing method set is divided according to the web page request types, and each type of web page request has a corresponding processing method.

[0072] The types of web page requests used to determine the processing methods can be divided according to the information display methods involved in the web page requests to improve adaptability; for example, there are corresponding processing methods for web page requests involving images, and there are corresponding processing methods for web page requests involving text.

[0073] The types of web page requests used to determine the processing method can be divided according to the functions involved in the web page requests. For example, the routing processing functions of different HTTP request methods are set through Get, Post, Put, Delete and other methods.

[0074] In some embodiments, the server data to be compiled is compiled according to the file format supported by the kernel of the Hongmeng system to obtain an initial server program, including: compiling the server data to be compiled into binary machine code to obtain a compilation result; the compilation result is the initial server program.

[0075] Step 304, configure the preset port of the initial server program as a listening port to obtain the server program; the listening port is used to monitor the web page request pointing to the WASM program stored in the terminal.

[0076] The preset port is a port pre-set by the initial server program, which can be identified by a serial number. For example, the preset port can be port 81. The WASM program needs to interact with the Hongmeng system through the port of the initial server program to limit the WASM program's access rights to the Hongmeng system and prevent the WASM program from performing malicious operations.

[0077] The listening port is obtained by adjusting the configuration information of the preset port. The electronic device detected by the listening port is local to the terminal, the program format detected by the listening port is WASM format, and the data type detected by the listening port is web page request, that is, the listening port is used to listen to web page requests pointing to WASM programs stored in the terminal; in this case, the listening port has a reduced number of electronic devices, program formats and data types, so the data resources occupied are reduced.

[0078] The server program is an initial server program with a listening port. The server program has the functions of the initial server program, and the server program also has a listening port to control its own operation more flexibly.

[0079] In some embodiments, the preset port of the initial server program is configured as a listening port to obtain the server program, including: numerically adjusting the configuration item of the preset port of the initial server program to obtain the listening port; and using the initial server program with the listening port as the server program.

[0080] Step 306, running the server program.

[0081] In some embodiments, running a server program includes: running a listening thread corresponding to a listening port until the listening thread detects that a web page request triggered by a terminal points to a WASM program stored in the terminal, and then controlling the server program to run a thread for processing web page requests; the thread for processing web page requests is a thread that provides a target processing method in accordance with a method for processing web page requests in a centralized method for processing web page requests.

[0082] For example: the server program runs based on the first thread and at least one second thread, the first thread is a listening thread for running the listening port; the second thread is a thread for processing web page requests. Correspondingly, running the server program includes: running the first thread until the first thread detects that the web page request triggered by the terminal points to the WASM program stored in the terminal, and controlling the server program to run the second thread; and providing a thread of the target processing method according to the processing method of the web page request concentration through the second thread.

[0083] Step 308, in the set of processing methods for web page requests, determine a target processing method that matches the web page request; the target processing method is a parsing method of the WASM program.

[0084] In some embodiments, determining a target processing method that matches a web page request in a set of processing methods includes: determining a target processing method that matches a web page request in a set of processing methods according to an identifier carried by the web page request.

[0085] In some embodiments, in a set of processing methods for web page requests, determining a target processing method that matches a web page request includes: determining, through a server-side program, a file suffix corresponding to a WASM program; and determining, in a set of processing methods for web page requests, a target processing method that matches a web page request according to the file suffix.

[0086] The file suffix is ​​the file type that the running result of the WASM program is adapted to. The file suffix of the WASM program itself is .wasm. When the WASM program is used for display, the file suffix of the display file represented by the WASM program is the corresponding file suffix.

[0087] The file suffixes corresponding to WASM programs include but are not limited to txt, jpeg and other formats; the WASM program itself cannot be directly converted into txt, jpeg and other formats. Therefore, when a web page requests to represent txt, jpeg and other formats, the target processing method is determined by the file suffix, so that the kernel of the Hongmeng system can convert the WASM program into web page content with the same or similar effect as the file suffix.

[0088] For example, the text representation of a WASM program is .wat, which is essentially a readable text format that can be easily viewed and edited with a text editor. Although .wat itself is not .txt, since .wat is a text format file, it can display the txt web page content normally.

[0089] In some embodiments, determining the file suffix name corresponding to the WASM program through a server-side program includes: determining the file suffix name corresponding to the WASM program through a program suffix name mapping table stored in the server-side program; wherein the mapping table is used to represent the correspondence between the content contained in the WASM program and the file suffix name, so that the content of the WASM program is substituted into the program suffix name mapping table through the server-side program to obtain the file suffix name corresponding to the WASM program.

[0090] In some embodiments, according to the file suffix name, a target processing method that matches the web page request is determined in a set of processing methods for processing web page requests, including: substituting the file suffix name into a suffix name processing method mapping table to obtain a mapping result; in the set of processing methods for processing web page requests, the suffix name processing method indicated by the mapping result is used as the target processing method that matches the web page request.

[0091] Therefore, by determining the target processing method that matches the web page request according to the file suffix name, the amount of data carried by the web page request can be reduced, and the processing method of the web page request under different types can be determined more finely through the file suffix name, so as to increase the specificity of the processing method and ensure that the processing efficiency is improved.

[0092] In this embodiment, the server data to be compiled is compiled according to the file format supported by the Hongmeng system to obtain the initial server program; the initial server program in the Hongmeng system can provide the corresponding processing method for web page requests according to the processing method set for web page requests; and then the preset port of the initial server program is configured as a listening port to obtain the server program to realize data interaction between the process where the Hongmeng system is located and the process where the server program is located. Then, in the processing method set for web page requests, the target processing method matching the web page request is determined, so that the terminal adaptively selects the target processing method of the browser to reduce the amount of resources required for data processing by the process where the browser is located, thereby improving processing efficiency.

[0093] In some embodiments, detecting, through a server program, whether a web page request triggered by a terminal points to a WASM program stored in the terminal includes: detecting, through a server program, whether a web page request triggered by a terminal points to a WASM program in a directory where the server program is located; wherein the directory where the server program is located belongs to a directory where the terminal stores WASM programs.

[0094] The directory where the server program is located is the directory where the data generated by the server program is located during the operation of the server program. Since the server program is only used to detect local web page requests of the terminal, the directory where the server program is located can be the directory where the data generated by the server program is located, and it is also the directory where the server data to be compiled is stored, so that these data are gathered in the same directory for easy debugging and access.

[0095] In some embodiments, a server-side program is used to detect whether a web page request triggered by a terminal points to a WASM program in the directory where the server-side program is located, including: determining a request header from the web page request triggered by the terminal through the server-side program; extracting a path indicated by the web page request from the request header; if the path and the directory where the server-side program is located are in the same parent directory, and the file format indicated by the path is in WASM format, then determining that the web page request triggered by the terminal points to a WASM program in the directory where the server-side program is located.

[0096] In some embodiments, a server program is used to detect whether the web page request triggered by the terminal points to a WASM program in the directory where the server program is located, including: determining through the server program that the path indicated by the web page request triggered by the terminal is the same as the directory where the server program is located, and the file format indicated by the path is in WASM format, then determining that the web page request triggered by the terminal points to the WASM program in the directory where the server program is located.

[0097] In this embodiment, the program range detected by the server program is narrowed to the directory where the server program is located, so the scope of the server program detection is further narrowed, which can shorten the access path and more efficiently detect the local web page request triggered by the terminal.

[0098] In some embodiments, the parsing result is a machine code; executing the parsing result to implement the running of the WASM program includes: executing the machine code based on the browser to implement the running of the WASM program in the browser.

[0099] Machine code is a binary program under the browser framework. The browser executes machine code relatively quickly.

[0100] In some embodiments, executing machine code based on a browser includes: the browser executes the machine code according to a preset linear memory area. Thus, the browser will prevent the machine code from accessing memory across boundaries through memory access restrictions, thereby ensuring the security of the Hongmeng system.

[0101] In some embodiments, executing machine code based on a browser includes: instantiating the machine code to obtain a machine code instance; binding the machine code instance to a JavaScript instance, and displaying content corresponding to the machine code instance when the JavaScript instance is executed.

[0102] In this embodiment, the browser kernel converts the WASM program into machine code according to the parsing method provided by the server program, so as to improve the running efficiency of the browser to implement the WASM program and further improve the processing efficiency.

[0103] In some embodiments, before executing the parsing result to implement the running of the WASM program, it also includes: adjusting the display configuration items of the browser kernel to preset parameters; wherein the preset parameters indicate that the browser kernel supports the running of the WASM program.

[0104] The browser kernel of Hongmeng system is a browser component used for data parsing. Display configuration items are configuration parameters of the browser kernel, which are used to control the program running mode of Hongmeng system to adaptively adjust the functions of the browser kernel.

[0105] In some embodiments, adjusting the display configuration items of the browser kernel to preset parameters includes: adjusting the display configuration items of the browser kernel to preset parameters through a configuration interface.

[0106] In this embodiment, although the Hongmeng system itself does not support the running of WASM programs, the browser of the Hongmeng system has corresponding display configuration items. By pre-configuring the display configuration items of the browser kernel, the browser kernel can support the running of WASM programs. In addition, due to the existence of the display configuration item, when the computing power of the terminal is insufficient to run the WASM program, the browser kernel can also not support the running of the WASM program to ensure the running efficiency.

[0107] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0108] Based on the same inventive concept, the embodiment of the present application also provides a program running device for implementing the program running method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more program running device embodiments provided below can refer to the limitations on the program running method above, and will not be repeated here.

[0109] In an exemplary embodiment, Figure 4 As shown, a program running device is provided, which is applied to a terminal installed with a Hongmeng system, and the device includes:

[0110] The running module 402 is used to run the server program; the server program is a virtual server;

[0111] The detection module 404 is used to detect, through the server program, whether the web page request triggered by the terminal points to the WASM program stored in the terminal;

[0112] The detection module 404 is used to determine the parsing method of the WASM program through the server program if yes;

[0113] The parsing module 406 is used to parse the WASM program using the parsing method through the browser kernel built into the Hongmeng system to obtain a parsing result;

[0114] The running module 402 is used to execute the parsing result to realize the running of the WASM program.

[0115] In one embodiment, the operation module 402 is used to:

[0116] Compile the server data to be compiled according to the file format supported by the kernel of the Hongmeng system to obtain an initial server program; the server data to be compiled includes a set of methods for processing web page requests;

[0117] The preset port of the initial server program is configured as a listening port to obtain the server program; the listening port is used to monitor web page requests pointing to the WASM program stored in the terminal;

[0118] Running the server program;

[0119] The detection module 404 is used to:

[0120] In the set of processing methods for web page requests, a target processing method matching the web page request is determined; the target processing method is a parsing method of the WASM program.

[0121] In one embodiment, the detection module 404 is used to:

[0122] Determine the file extension corresponding to the WASM program through the server program;

[0123] According to the file suffix, a target processing method matching the web page request is determined in a set of processing methods for web page requests.

[0124] In one embodiment, the detection module 404 is used to:

[0125] Through the server program, detecting whether the web page request triggered by the terminal points to the WASM program in the directory where the server program is located;

[0126] The directory where the server program is located is a directory where the terminal stores the WASM program.

[0127] In one of the embodiments, the parsing result is a machine code;

[0128] The operation module 402 is used to:

[0129] The machine code is executed based on a browser to implement the page running represented by the WASM program.

[0130] In one embodiment, before executing the parsing result to implement the running of the WASM program, the running module 402 is further used to:

[0131] Adjusting the display configuration items of the browser kernel to preset parameters;

[0132] The preset parameters indicate that the browser kernel supports the running of the WASM program.

[0133] Each module in the above program running device can be implemented in whole or in part by software, hardware and their combination. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.

[0134] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 5As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a program running method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

[0135] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0136] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0137] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0138] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0139] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0140] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0141] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0142] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A program running method, characterized in that: Applied to a terminal installed with Hongmeng system, the method includes: Running a server program; the server program is a virtual server; Through the server program, it is detected whether the web page request triggered by the terminal points to the WASM program stored in the terminal; the server program provides a processing function for the web page request to obtain a corresponding response result, and feeds back the response result to the Hongmeng system; If yes, the parsing method of the WASM program is determined by the server program; Parse the WASM program using the parsing method through the browser kernel built into the Hongmeng system to obtain a parsing result; The parsing result is executed to implement the running of the WASM program.

2. The method according to claim 1, characterized in that The running of the server program includes: Compile the server data to be compiled according to the file format supported by the kernel of the Hongmeng system to obtain an initial server program; the server data to be compiled includes a set of methods for processing web page requests; The preset port of the initial server program is configured as a listening port to obtain the server program; the listening port is used to monitor web page requests pointing to the WASM program stored in the terminal; Running the server program; The determining of the parsing method of the WASM program by the server program includes: In the set of processing methods for web page requests, a target processing method matching the web page request is determined; the target processing method is a parsing method of the WASM program.

3. The method according to claim 2, characterized in that The step of determining a target processing method that matches the web page request in the set of processing methods for the web page request includes: Determine the file extension corresponding to the WASM program through the server program; According to the file suffix, a target processing method matching the web page request is determined in a set of processing methods for web page requests.

4. The method according to claim 1, characterized in that The detecting, by the server program, whether the webpage request triggered by the terminal points to the WASM program stored in the terminal includes: Through the server program, detecting whether the web page request triggered by the terminal points to the WASM program in the directory where the server program is located; The directory where the server program is located is a directory where the terminal stores the WASM program.

5. The method according to claim 1, characterized in that The parsing result is a machine code; The executing the parsing result to implement the running of the WASM program includes: The machine code is executed based on the browser to implement the running of the WASM program in the browser.

6. The method according to claim 1, characterized in that Before executing the parsing result to implement the running of the WASM program, the method further includes: Adjusting the display configuration items of the browser kernel to preset parameters; The preset parameters indicate that the browser kernel supports the running of the WASM program.

7. A program running device, characterized in that: Applied to a terminal installed with Hongmeng system, the device includes: A running module, used to run a server program; the server program is a virtual server; A detection module, used to detect, through the server program, whether the web page request triggered by the terminal points to the WASM program stored in the terminal; the server program provides a processing function for the web page request to obtain a corresponding response result, and feeds back the response result to the Hongmeng system; The detection module is used to determine the parsing method of the WASM program through the server program if yes; A parsing module, used to parse the WASM program using the parsing method through the browser kernel built into the Hongmeng system to obtain a parsing result; The running module is used to execute the parsing result to realize the running of the WASM program.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Application program running method and device, computer equipment and storage medium

    CN108108219A