Page rendering methods, apparatus, electronic devices, and computer programs
By offloading graphic rendering from the browser to the client process, the method stabilizes mini-program execution, reducing memory consumption and termination risks, ensuring stable operation.
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2026-04-02
AI Technical Summary
The execution stability of mini-programs is compromised due to high memory usage and risk of termination when rendered using embedded browser processes, which can be forcibly terminated, especially with increased usage and potential bugs from operating system upgrades.
A method and apparatus that offloads graphic rendering from the browser process to the application client process, using a second rendering function with equivalent capabilities to reduce memory consumption and risk of termination, ensuring stable execution.
Reduces browser memory consumption and minimizes the risk of mini-program termination by delegating graphic rendering to the client process, maintaining stable operation and avoiding issues from browser upgrades.
Smart Images

Figure 2026510235000001_ABST
Abstract
Description
Technical Field
[0001] (Cross - reference to related applications) This application claims the priority of a Chinese patent application with the application number 202310732158.7, filed with the Chinese Patent Office on June 19, 2023, and all of its contents are incorporated herein by reference.
[0002] This application relates to graphic processing technology, and in particular, to a page rendering method and apparatus, an electronic device, a computer - readable storage medium, and a computer program product.
Background Art
[0003] A mini - program is an application (APP) that can be used without the need for downloading or installation, and can provide great convenience when users use different APPs. In related technologies, the execution of a mini - program is realized by an embedded browser (for example, WebView). That is, the business logic code of the mini - program is interpreted and executed by the browser process, and the graphic rendering function is called by the browser process to render the page frame of the mini - program. However, when adopting the browser process to render the page frame of the mini - program, there is a high risk that the mini - program will be forcibly terminated.
Summary of the Invention
Means for Solving the Problems
[0004] Embodiments of this application provide a page rendering method and apparatus, an electronic device, a computer - readable storage medium, and a computer program product that can improve the execution stability of a mini - program. [[ID=二十九]]
[0005] The technical solutions of the embodiments of this application are realized as follows.
[0006] Embodiments of the present application provide a page rendering method applicable to electronic devices, the method being: Steps include: launching a browser process of an application client in response to a launch operation for a miniprogram, and executing the business logic code of the miniprogram by the browser process, wherein the miniprogram is executed on the application client; Steps include: in response to the browser process executing up to the call code for a first rendering function within the business logic code, the browser process sending a call processing request to the client process, wherein the first rendering function is a graphics rendering function called by the browser process, and the first rendering function is used to render the page frame of the miniprogram; In response to the aforementioned call processing request, the client process determines a second rendering function corresponding to the first rendering function and calls the second rendering function, wherein the graphic rendering capabilities of the second rendering function and the first rendering function are the same. The second rendering function includes the step of performing graphic rendering on the page frame of the miniprogram and obtaining the rendering result of the page frame of the miniprogram.
[0007] Embodiments of the present invention provide a page rendering apparatus comprising a process startup module, a request transmission module, a call processing module, and a graphics rendering module. The process startup module is configured to start the browser process of the browser via the application client's client process in response to a startup operation for the miniprogram, and to execute the business logic code of the miniprogram via the browser process, and the miniprogram is executed on the application client. The request sending module is configured such that, in response to the browser process executing up to the call code for the first rendering function within the business logic code, the browser process sends a call processing request to the client process, the first rendering function being a graphics rendering function called by the browser process, and the first rendering function being used to render the page frame of the miniprogram. The call processing module is configured to respond to the call processing request by the client process to determine a second rendering function corresponding to the first rendering function, and to call the second rendering function, wherein the graphic rendering capabilities of the second rendering function and the first rendering function are the same. The graphics rendering module is configured to perform graphics rendering on the page frame of the miniprogram using the second rendering function and to obtain the rendering result of the page frame of the miniprogram.
[0008] Embodiments of the present application provide an electronic device comprising memory and a processor, The memory is configured to store computer executable instructions or computer programs. The processor is configured to implement the page rendering method provided in the embodiment of the present application when executing computer executable instructions or computer programs stored in the memory.
[0009] Embodiments of the present application provide a computer-readable storage medium storing computer executable instructions or computer programs, wherein the computer executable instructions, when executed by a processor, implement the page rendering method provided in the embodiments of the present application.
[0010] Embodiments of the present application provide a computer program product including a computer program or computer executable instructions, the computer program or computer executable instructions, when executed by a processor, implement the page rendering method provided in the embodiments of the present application.
[0011] The embodiment of the present invention has the following beneficial effects. When an electronic device starts a miniprogram, it first starts a browser process via an application client process, executes the business logic code of the miniprogram, and when it has executed up to the call code for the first rendering function within the business logic code, the browser process sends a call processing request to the client process. This call processing request converts the browser process's call to the first rendering function into a call to the second rendering function by the client process, and the second rendering function graphically renders the miniprogram's page frame. Assuming that the second rendering function is a rendering function that has the same graphic rendering capabilities as the first rendering function, and assuming that the graphic rendering function is guaranteed to be realized correctly, by transferring the graphic rendering process of the miniprogram's page frame to the application client, the browser functions only as the executor of the business logic code. This significantly reduces the browser's memory consumption, reduces the possibility of the browser process being forcibly terminated, ultimately reduces the risk of the miniprogram being forcibly terminated, and improves the execution stability of the miniprogram. [Brief explanation of the drawing]
[0012] [Figure 1] This is a schematic diagram of how a mini-program's page frame is rendered. [Figure 2] This is a schematic diagram showing the architectural configuration of a page rendering system according to an embodiment of the present invention. [Figure 3]This is a schematic diagram showing the configuration of the terminal shown in Figure 2 according to an embodiment of the present invention. [Figure 4] This is flowchart 1 of the page rendering method according to the embodiment of the present invention. [Figure 5] This is flowchart 2 of the page rendering method according to the embodiment of the present invention. [Figure 6] This is flowchart 3 of the page rendering method according to the embodiment of the present invention. [Figure 7] This is a schematic diagram illustrating the rendering of the game screen for a mini-game according to an embodiment of the present invention. [Figure 8] This is a schematic diagram recording the call to a WebGL function according to an embodiment of the present invention. [Figure 9] This is another schematic diagram recording the call to a WebGL function according to an embodiment of the present invention. [Modes for carrying out the invention]
[0013] To further clarify the purpose, technical solutions, and advantages of this application, the application will be described in more detail below with reference to the drawings. The embodiments described herein are not limiting, and all other embodiments that can be obtained without creative effort by those skilled in the art are included within the scope of this application.
[0014] In the following, the phrase "several embodiments" describes a subset of all possible embodiments, but understandably, "several embodiments" may be the same subset or a different subset of all possible embodiments, and can be combined with each other without contradiction.
[0015] Furthermore, it should be explained that terms such as "First / Second" in the embodiments of this application do not limit a specific order, but rather distinguish similar objects. Understandably, "First / Second" can be changed to a specific order or sequence in appropriate cases, so the embodiments of this application described herein may be performed in an order other than those illustrated or described herein.
[0016] In the embodiments of the present application, the terms "module" or "unit" refer to a computer program having a predetermined function or a part of a computer program, which operates together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (e.g., a processing circuit or a memory), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. Furthermore, each module or unit may be a part of the overall module or unit that includes the functions of the module or unit.
[0017] Unless otherwise specified, all technical and scientific terms used in this specification have the same meaning as commonly understood by those skilled in the art of the present application. The terms used in this specification are only adopted for the purpose of explaining the embodiments of the present application and are not intended to limit the present application.
[0018] Before further elaborating on the embodiments of the present application, the nouns and terms related to the embodiments of the present application will be explained. The explanations of the nouns and terms related to the embodiments of the present application are as follows.
[0019] 1) Mini Program: Also called a Web Program, it is a program developed based on a front-end-oriented language (e.g., JavaScript) and realizes services on a Hyper Text Markup Language (HTML) page. It is software that is downloaded by the client via a network (such as the Internet) and interpreted and executed by the client's browser or an embedded browser, and the step of installing it on the client can be omitted. For example, it can be downloaded in a social network client and a mini program for realizing punch-in for work attendance or game services can be executed.
[0020] 2) Client: An application that a user needs to download and install on their device (such as a smartphone) in order to use it. Examples include browser clients and social network clients.
[0021] 3) Client process: A process assigned to a client by a terminal, used to implement various client functions.
[0022] 4) Embedded Browser (WebView): This is a browser embedded in a native application (an application that can run directly on the operating system). Native applications can use embedded browsers to display web pages. Different operating systems have different embedded browsers; for example, some operating systems can display web pages using UIWebView or WKWebView.
[0023] 5) Browser process: This is a process assigned to the embedded browser on the terminal and is used to implement various functions of the browser process.
[0024] 6) Page frame: In a mini-program, this refers to a unit used to render and display screen content. In other words, the screen content of a mini-program is page-rendered using one page frame as the unit, and displayed using one page frame as the unit. By displaying multiple page frames in sequence, the screen content of the mini-program can be displayed dynamically.
[0025] 7) The phrase "responds to ~" indicates a condition or state on which an operation depends. When the dependent condition or state is met, one or more operations may be performed in real time or with a set delay. Unless otherwise specified, there are no restrictions on the order in which multiple operations are performed.
[0026] 8) Rendering Function: In web development or mini-program development, this function is used to define and describe how a page will be displayed. Typically, it is responsible for converting data into an HTML structure for visualization and displaying it in the user interface. While the implementation and concept of page rendering functions may differ across different frameworks and platforms, their main purpose remains similar: to define the page display logic.
[0027] 9) Command buffer: This is a buffer space for storing information about rendering function calls.
[0028] 10) Business logic code: This is the code used to execute the service logic, and in the embodiments of this application, it refers to the business logic code of a miniprogram, that is, the code section that implements various functions and interactions in the miniprogram. This code may include functions such as login authentication, page transitions, data requests and processing, and component operations. Generally, the business logic code of a miniprogram mainly includes the following aspects:
[0029] 1. Page Lifecycle Functions: Each page in a miniprogram has its own lifecycle function, which includes callback functions for different stages such as page loading, page display, page hiding, and page unloading. These functions can be used to perform various logical operations.
[0030] 2. Data Request and Processing: When a miniprogram requires data interaction with a server, it can send a request using its built-in request method and process the returned data, including operations such as data analysis and data display.
[0031] 3. Event Monitoring and Processing: Mini-program pages can monitor various user interaction events, such as click events, slide events, and input events, and implement corresponding business logic through event processing functions.
[0032] 4. Page transitions and parameter transmission: Mini-programs require page transitions, which can be achieved through a built-in Application Programming Interface (API), and data can be transmitted via parameters.
[0033] 5. Component Manipulation: Mini-programs allow you to implement different page functionalities using various built-in and custom components, and you can control the display, hiding, and styling of components through the associated APIs.
[0034] In summary, the business logic code of a mini-program is the code section that implements the various functions and interactions of the mini-program, and these codes enable the implementation of various complex logic and interaction effects of the mini-program.
[0035] Mini-programs are applications (APPs) that can be used without requiring download or installation, offering significant convenience when users are using different APPs. For example, users can use mini-programs to clock in or out without installing the corresponding client, or to play games or enjoy entertainment without installing the corresponding client.
[0036] In related technologies, the execution of miniprograms is achieved through an embedded browser (e.g., WebView). In other words, the browser process interprets and executes the business logic code of the miniprogram, and the browser process also calls a graphics rendering function to render the page frame of the miniprogram.
[0037] As an example, Figure 1 is a schematic diagram of the rendering of a miniprogram's page frame. Referring to Figure 1, the miniprogram's code is typically divided into business logic code (i.e., code coded by the miniprogram's creator to implement the miniprogram's functionality) 11, a client's application programming interface (API) 12, and a rendering function 13, which is used to render the miniprogram's page frame. After the client detects a startup operation for the miniprogram, the client process starts the operating system's embedded browser process. The browser process executes the business logic code 11, calls the rendering function 13, and also calls the client process via the API 12 to perform actions such as reading and writing files and logging in information.
[0038] However, as the usage time of the mini-program increases, the number of page frames that need to be rendered in this way also increases, leading to excessive memory usage in the embedded browser. This can cause the browser process to be forcibly terminated by the terminal, ultimately preventing further use of the mini-program. Therefore, it is understood that using the browser process to render the mini-program's page frames increases the risk of the mini-program being terminated.
[0039] Furthermore, embedded browsers may be upgraded along with the device's operating system (i.e., when the operating system is upgraded, the embedded browser may also be upgraded accordingly). However, upgrading the embedded browser may introduce some execution bugs, which could cause problems when rendering the miniprogram's page frames using the browser process, potentially affecting the normal operation of the miniprogram.
[0040] Embodiments of the present application provide a page rendering method, apparatus, device, computer-readable storage medium, and computer program product that can reduce the risk of a miniprogram being terminated. Below, examples of applications of electronic devices for page rendering provided in embodiments of the present application are described. The electronic devices provided in the present application may be implemented as various types of terminals, such as notebook computers, tablet computers, desktop computers, set-top boxes, and mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable game consoles), or as servers. Below, exemplary applications when the electronic devices are implemented as terminals are described.
[0041] Referring to Figure 2, which is a schematic diagram showing the architectural configuration of a page rendering system according to an embodiment of the present invention. To support a page rendering application, in the page rendering system 100, terminals (exemplified by terminals 400-1 and 400-2) are connected to a server 200 by a network 300, which may be a wide area network or a local area network, or a combination of both. The page rendering system 100 further includes a database 500 to provide data support to the server 200. Here, the database 500 may be independent of the server 200 or may be located within the server 200. Figure 2 shows the case where the database 500 is independent of the server 200.
[0042] Terminals 400-1 and 400-2 are configured to respond to a user's startup operation for a miniprogram on graphical interface 410-1 and graphical interface 410-2 by downloading the miniprogram's program code from server 200 via a client process, starting the browser process of a browser, executing the business logic code within the miniprogram's program code via the browser process, and, in response to the business logic code calling a first rendering function on the miniprogram's page frames, send a call processing request via the browser process to the client process, wherein the first rendering function is a graphic rendering function that the browser process can call; and, in response to the call processing request, determine a second rendering function corresponding to the first rendering function via the client process and call the second rendering function, wherein the second rendering function performs graphic rendering on the miniprogram's page frames, obtains the rendering result of the miniprogram's page frames, and sequentially displays the rendering result of each page frame on graphical interface 410-1 and graphical interface 410-2.
[0043] Server 200 is configured to distribute the program code of the miniprogram to terminals 400-1 and 400-2.
[0044] The embodiments of this invention can be realized by cloud technology, which is a hosting technology that integrates a series of resources such as hardware, software, and networks in a wide area network or local area network to enable data computation, storage, processing, and sharing.
[0045] Cloud computing is a collective term for network technologies, information technologies, integration technologies, management platforms, and application technologies based on the cloud computing business model, forming a resource pool that can be used flexibly and conveniently on demand. Cloud computing technology provides crucial support. Backend services of technical network systems require large amounts of computing and storage resources, which need to be realized through cloud computing.
[0046] Exemplary, server 200 may be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDNs, big data, and artificial intelligence platforms. Terminals 400-1 and 400-2 may be, but are not limited to, smartphones, tablet computers, notebook computers, desktop computers, smart speakers, smartwatches, smart home appliances, or in-vehicle terminals. The terminals and servers may be connected directly or indirectly by wired or wireless communication, and are not limited to the embodiments of this application.
[0047] Referring to Figure 3, Figure 3 is a schematic diagram showing the configuration of the terminal (an embodiment of an electronic device) in Figure 2 according to an embodiment of the present application. The terminal 400 shown in Figure 3 comprises at least one processor 410, memory 450, at least one network interface 420, and a user interface 430. Each component within the terminal 400 is coupled by a bus system 440. Understandably, the bus system 440 is used to enable connection communication between these components. In addition to the data bus, the bus system 440 includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, in Figure 3, all the different buses are represented as the second bus system 440.
[0048] The processor 410 may be an integrated circuit chip equipped with signal processing functions, such as a general-purpose processor, a digital signal processor (DSP), a programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, where the general-purpose processor may be a microprocessor or any conventional processor.
[0049] The user interface 430 includes one or more output devices 431 capable of displaying media content, one or more speakers and / or one or more visual displays. The user interface 430 further includes one or more input devices 432 that facilitate user input, such as a keyboard, mouse, microphone, touchscreen display, camera, and other input buttons and controls.
[0050] The memory 450 may be removable, non-removable, or a combination of both. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, and the like. The memory 450 optionally includes one or more storage devices located physically separate from the processor 410.
[0051] The memory 450 may include volatile memory or non-volatile memory, or it may include both volatile and non-volatile memory. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random-access memory (RAM). The memory 450 described in the embodiments of this application includes any suitable type of memory.
[0052] In some embodiments, the memory 450 can store data to support various operations, such as programs, modules, data structures, or subsets or supersets thereof, as illustrated below.
[0053] Operating System 451 is configured to implement various basic services and handle hardware-based tasks, including system programs such as a framework layer, core library layer, and drive layer, which handle various basic system services and perform hardware-related tasks.
[0054] The network communication module 452 is configured to reach other computing devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 including Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB).
[0055] The display module 453 is configured to enable the display of information (e.g., a user interface for operating peripheral devices and displaying content and information) by one or more output devices 431 (e.g., a display, a speaker) associated with the user interface 430.
[0056] The input processing module 454 is configured to detect one or more user inputs or interactions from one or more input devices 432 and to translate the detected inputs or interactions.
[0057] In some embodiments, the page rendering device provided in the embodiments of the present invention may be implemented in software form, as shown in Figure 3, which illustrates a page rendering device 455 stored in memory 450, and which may be software in the form of a program or plug-in, and which includes software modules such as a process startup module 4551, a request transmission module 4552, a call processing module 4553, a graphics rendering module 4554, a script processing module 4555, and a mapping generation module 4556, and since these modules are logical, they can be arbitrarily combined or further divided depending on the function to be implemented. The function of each module will be described later.
[0058] In some other embodiments, the page rendering apparatus provided in the embodiments of the present application may be implemented in hardware form, for example, the page rendering apparatus provided in the embodiments of the present application may be a processor in the form of a hardware decoding processor, which is programmed to perform the page rendering method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor may employ one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic elements.
[0059] In some embodiments, a terminal or server (both of which are possible implementations of electronic devices) can implement the page rendering method provided in the embodiments of the present invention by executing a computer program. For example, the computer program may be a native program or software module within an operating system, or a native application (APP), that is, a program that needs to be installed on an operating system to run, such as a social network APP or an instant messaging APP, or a mini-program, that is, a program that can be run simply by downloading it to a browser environment, or a mini-program that can be embedded in any APP. In short, the computer program may be any form of application, module, or plug-in.
[0060] The embodiments of this application can be applied to page rendering scenes of application software and operating system miniprograms. The page rendering method provided in the embodiments of this application will be described below. As mentioned above, the electronic device that implements the page rendering method of the embodiments of this application may be a terminal, a server, or a combination thereof. Therefore, the entity that executes each step will not be described again in the following description.
[0061] The page rendering method provided in the embodiments of this application will be described with reference to exemplary applications and embodiments of the electronic devices provided in the embodiments of this application.
[0062] Referring to Figure 4, Figure 4 is a flowchart 1 of the page rendering method according to an embodiment of the present application. The steps shown in Figure 4 will be explained with reference.
[0063] In step S101, in response to a startup operation for the miniprogram, the application client's client process starts the browser's browser process, and the browser process executes the miniprogram's business logic code.
[0064] The embodiment of the present invention is implemented in a scene that graphically renders the page frame of a miniprogram. The graphically rendered page frame is used to display the screen content of the miniprogram. In the embodiment of the present invention, the electronic device detects in real time whether or not it has received a startup operation for the miniprogram, and after receiving the startup operation for the miniprogram and the execution of the miniprogram is triggered, the client process of the application client starts the browser process of the browser, and the browser process interprets and executes the business logic code of the miniprogram, thereby realizing the service function of the miniprogram.
[0065] The miniprogram in the embodiment of the present invention may be a game-type miniprogram (also called a minigame), an office software-type miniprogram, a music-type miniprogram, or any other type of miniprogram, and is not limited to the embodiment of the present invention.
[0066] It should be explained that, in the embodiments of this invention, the client process refers to the client process of an application in which the miniprogram is embedded; that is, the miniprogram is executed within the application client. Therefore, the startup operation for the miniprogram refers to the operation to enter the miniprogram, which is triggered on the application client (hereinafter abbreviated as "client"). This startup operation can be achieved by clicking the miniprogram's icon or scanning the miniprogram's QR code. Here, the above-mentioned application can refer to a social network application, but may also be a music application, a game application, etc., and therefore, the client may be a social network client, a music client, a game client, etc. By being embedded and executed in these clients, the miniprogram can provide its functions to users who have installed these clients.
[0067] The browser in the embodiments of this application may be a browser provided by the client, or an embedded browser provided by the operating system of the electronic device, and is not limited to the embodiments of this application. The browser process refers to the process that the electronic device assigns to the browser.
[0068] The business logic code of a miniprogram is the code that implements the specific functions of the miniprogram, and is usually coded by the creator of the miniprogram. The business logic code of a miniprogram can be obtained by the client from the server when the miniprogram is first launched, or it may be extracted from the client's cache file when it is launched for subsequent times.
[0069] In step S102, in response to the browser process executing the call code for the first rendering function within the business logic code, the browser process sends a call processing request to the client process.
[0070] To display the screen content of the mini-program, the business logic code calls a first rendering function to render the mini-program's page frames one by one or in parallel. It should be noted that the first rendering function is a graphics rendering function that can be called by the browser process, and the business logic code is executed by the browser process. When the browser process has executed up to the call code for the first rendering function in the business logic code, and the browser process has already executed the call code for the first rendering function in the service logic code, then if the browser process calls the first rendering function to perform page rendering, the memory occupied by the browser when the browser process calls the first rendering function to perform page rendering will become excessive, which is likely to cause the browser process to terminate. To avoid this situation, in the embodiment of the present invention, in response to the browser process executing up to the call code for the first rendering function in the business logic code, the electronic device forwards the call to the page rendering function in the browser process to the client process by a call processing request, thereby enabling the client to call the page rendering function. In this way, the browser can be viewed simply as an executor of business logic code, requiring only a small amount of pages to be loaded, thus reducing the browser's memory consumption.
[0071] In the embodiments of this invention, the browser process can send call processing requests to the client process in various ways.
[0072] Referring to Figure 5, Figure 5 is a flowchart 2 of a page rendering method according to an embodiment of the present invention. In some embodiments of the present invention, the process of step S102 in Figure 4, i.e., the step in which the browser process sends a call processing request to the client process in response to the browser process executing up to the call code for the first rendering function in the business logic code, can be realized by steps S1021 to S1022.
[0073] In step S1021, in response to the browser process executing the call code for the first rendering function within the business logic code, the browser process writes the call information for the first rendering function to the command buffer.
[0074] When the electronic device has executed the call code for the first rendering function within the business logic code, the browser process writes the call information for the first rendering function to a command buffer, and the command buffer records the call to the first rendering function. Here, the browser process may write the call information for all first rendering functions called for each page frame to the same command buffer, or it may write the call information for each first rendering function to its respective assigned command buffer (i.e., the browser process assigns a command buffer to each first rendering function, and each command buffer contains only the call information for the corresponding first rendering function).
[0075] In the embodiments of the present invention, the call information for the first rendering function must include at least the function identifier of the first rendering function and the call parameters of the first rendering function (which can also be understood as input parameters of the first rendering function). Here, the function identifier is used to distinguish different first rendering functions, and the function identifier may be the function name of the first rendering function or the function identifier of the first rendering function. The call parameters of the first rendering function may vary depending on the specific rendering function of the first rendering function. For example, if the first rendering function is a graphics drawing function, the call parameters of the first rendering function are the coordinates of each point in the graphics, and if the first rendering function is a shader function, the call parameters of the first rendering function are color codes.
[0076] It should be noted that the command buffer in the embodiment of this application may be created by the browser process itself, or it may be created by the client process and injected into the browser process.
[0077] In some embodiments, prior to step S1021 in Figure 5, that is, before the browser process writes the call information for the first rendering function to the command buffer in response to the browser process executing up to the call code for the first rendering function in the business logic code, the page rendering method may include the client process generating the script code for the command buffer and injecting the script code for the command buffer into the browser process.
[0078] To explain, the command buffer script code is used to create the command buffer and control the browser process to write the call information of the first rendering function to the command buffer. In other words, the client process generates an auto-executable script code, which generates a read / write command buffer, intercepts the call to the first rendering function, and controls the browser process to record the corresponding call information. Here, injecting the command buffer script code into the browser process can be achieved by creating a thread within the browser process and having that thread execute the command buffer script code, or by generating an executable file corresponding to the script code and using that executable file to replace the call code (or code segment) to the first rendering function within the browser process. In other words, the call code to the first rendering function is replaced with the executable file.
[0079] In step S1022, the browser process generates a call processing request for the command buffer and sends the call processing request to the client process.
[0080] The electronic device writes the call information for the first rendering function to a command buffer via a browser process. The browser process then generates a call request for the first rendering function, packages the command buffer containing the call information into the call request, and sends the call request to the client process via inter-process communication. As a result, the client process, upon receiving the call request, parses it to obtain the command buffer and the call information for the first rendering function.
[0081] It should be explained that in the embodiments of the present invention, the electronic device may, after the browser process has written the call information for the first rendering function to the command buffer, immediately generate a call processing request to the command buffer and send it to the client process, or, after the browser process has written the call information for the first rendering function to the command buffer, when certain request transmission conditions are met (i.e., when it is necessary to send a call processing request), the browser process may generate a call processing request to the command buffer and send it to the client.
[0082] Here, the request transmission conditions may be that the first rendering function is a synchronous rendering function that has a return value (e.g., the gl.creatBuffer function), or that the call information of all first rendering functions called on the page frame is recorded in the command buffer, and are not limited to the embodiments of the present application.
[0083] In some embodiments, step S1022 in Figure 5, i.e., the browser process generating a call processing request to the command buffer and sending the call processing request to the client process, can be achieved by the browser process generating the call processing request to the command buffer and sending the call processing request to the client process, provided that the first rendering function called by the business logic code is a synchronous rendering function that has a return value.
[0084] One thing to explain is that the return value of the synchronous rendering function must be obtained in order to continue execution. Otherwise, it will remain in a paused state, waiting for the return value. Therefore, if the first rendering function is a synchronous rendering function that has a return value, the command buffer must be promptly passed to the client process so that the client process generates and returns the return value to the first rendering function, thereby allowing the first rendering function to continue execution.
[0085] In some other embodiments, step S1022 in Figure 5, namely, the browser process generating a call processing request to the command buffer and sending the call processing request to the client process, can be further achieved by the browser process generating a call processing request to the command buffer and sending the call processing request to the client process if the call information for each of the multiple first rendering functions that need to be called when the page frame is rendered is all recorded in the command buffer.
[0086] Understandably, inter-process communication requires a certain amount of time to be executed, while a single page frame may require the invocation of multiple, for example, dozens or hundreds, of first rendering functions to perform graphic rendering. All of these first rendering functions can be considered as first rendering functions that need to be called when the page frame is rendered. Only when all the call information for each of these first rendering functions is recorded in the command buffer will the electronic device, via the browser process, generate a call processing request to the command buffer and send it to the client process. This allows all the calls to the first rendering functions required for a single page frame to be sent to the client process in one go, thereby reducing the number of inter-process communications and improving the processing efficiency of page frames during graphic rendering.
[0087] It should be explained that, in the embodiments of this application, sending a call processing request to a client process may be achieved by an XMLHttpRequest (XHR) request, or by using a technology such as the WebSocket protocol, and is not limited to the embodiments of this application.
[0088] In some embodiments, sending a call processing request to a client process can be achieved by the browser process setting the access address of the call processing request to the service address of the client process, and the client process intercepting the call processing request at the service address and sending the call processing request to the client process.
[0089] In other words, the browser process directly uses the client process's service address as the access address for the call processing request. Then, the client process intercepts the request sent from the browser process at that service address using a request intercept control (e.g., the WKURLSchemeHandler control), thereby achieving inter-process communication between the browser process and the client process and executing the transmission of the call processing request.
[0090] In step S103, in response to the call processing request, the client process determines the second rendering function corresponding to the first rendering function and calls the second rendering function.
[0091] The electronic device responds to a call processing request from the client process and determines a second rendering function that has the same graphic rendering capabilities as the first rendering function, and the second rendering function is a graphic rendering function that the client process can call. Subsequently, the electronic device realizes that the call to the first rendering function is converted to a call to the second rendering function by the client process calling the second rendering function, which is advantageous for subsequently using the second rendering function to render the page frame of the miniprogram.
[0092] In other words, in the embodiments of the present invention, the first rendering function and the second rendering function have the same executable graphics rendering capabilities, but they are called in different ways. For example, if the first rendering function is a function that creates a buffer area object (e.g., the WebGL creatBuffer function), then the second rendering function is also a function that creates a buffer area object (e.g., the OpenGL buffer area object creation function).
[0093] It should be explained that the second rendering function may be selected by the client process from existing graphic rendering functions that can be called by the client process, based on the functionality of the first rendering function. In implementation, a correspondence table may be established in advance between each graphic rendering function that can be called by the browser process and the graphic rendering function that can be called by the client process, and then the second rendering function corresponding to the first rendering function may be queried from this correspondence table. In some embodiments, the second rendering function may be obtained by the client process converting and rewriting the first rendering function, and is not limited to the embodiments of this application.
[0094] In the embodiments of the present invention, when the call information includes call parameters, calling the second rendering function can be achieved by the client process parsing the command buffer to obtain the call parameters of the first rendering function and converting the call parameters of the first rendering function to the call parameters of the second rendering function, and by the client process transmitting the call parameters of the second rendering function to the second rendering function and executing the call of the second rendering function.
[0095] The electronic device, through a client process, parses the call processing request to obtain a command buffer, parses the command buffer to obtain the call parameters for the first rendering function, converts them into call parameters usable by the second rendering function, and finally transmits the converted call parameters to the second rendering function as input parameters to realize the call to the second rendering function. For example, if the call parameters for the first rendering function are the coordinate points of the graphic to be drawn, the electronic device, through a client process, converts those coordinate points based on the second rendering function parameter format, inputs the conversion result into the second rendering function, and performs the call.
[0096] It should be explained that when converting the call parameters of the first rendering function to call parameters usable in the second rendering function, you can refer to the official documentation and guides corresponding to the second rendering function to ensure that you correctly understand and use the parameters and their meanings of the different functions. Compare each call parameter that needs to be converted between the first and second rendering functions, paying attention to the differences and similarities of the corresponding parameters, and make appropriate corrections and adjustments. Since there may be slight differences in the order of call parameters between the first and second rendering functions, in order to ensure that the order of parameter transfer is correct, the converted call parameters must be arranged according to the function parameter order required by the second rendering function, thereby ensuring that the second rendering function operates correctly and achieves the same graphic rendering effect.
[0097] In step S104, the second rendering function performs graphic rendering on the miniprogram's page frame to obtain the rendering result of the miniprogram's page frame.
[0098] The electronic device uses a second rendering function to perform graphic rendering for each page frame of the miniprogram, for example, by drawing patterns, applying shading, etc., for each page frame. After completing the graphic rendering, it can obtain the rendering result for each page frame.
[0099] Understandably, in related technologies, the browser process calls a graphics rendering function to render the miniprogram's page frame, leading to excessive browser memory usage and a high risk of the miniprogram being terminated. In contrast, in the embodiment of the present invention, when a user launches a miniprogram, the electronic device first launches a browser process via a client process, and the browser executes the miniprogram's business logic code. If the business logic code requires a call to a first rendering function, the browser process sends a call request to the client process, which converts the browser process's call to the first rendering function into a call to a second rendering function by the client process, and the second rendering function graphically renders the miniprogram's page frame. By offloading the graphics rendering process of the miniprogram's page frame to the client, the browser functions solely as the executor of the business logic code, eliminating the need to invoke the resource overhead required by the graphics processor. This significantly reduces the browser's memory consumption, decreases the likelihood of the browser process being forcibly terminated, and ultimately reduces the risk of the miniprogram being terminated. Furthermore, by offloading the graphic rendering process for the mini-program's page frames to the client, the graphic rendering of the browser's page frames is separated from that of the mini-program. This ensures that even if performance issues arise due to browser upgrades, the graphic rendering of the mini-program's page frames will not be affected, thus guaranteeing the normal operation of the mini-program.
[0100] It should be explained that in the above solution, if the first rendering function is a synchronous rendering function that returns a value, the browser process immediately includes the command buffer in the call request and sends it to the client process, thereby passing the command buffer and continuing subsequent execution only after the return value is obtained. As can be seen from the above, this method has an impact on execution efficiency because it still takes some time to write the call information for the subsequent first rendering function to the command buffer and pass the command buffer, since it is necessary to wait for the return value to be returned.
[0101] Based on the above, referring to Figure 6, Figure 6 is a flowchart 3 of a page rendering method according to an embodiment of the present application. In some embodiments of the present application, before step S1022 in Figure 5, that is, before the browser process generates a call processing request to the command buffer and sends the call processing request to the client process, the page rendering method may further include the following steps.
[0102] In step S1023, if the first rendering function is a synchronous rendering function that has a return value, in response to the browser process executing the call code for the first rendering function within the business logic code, the browser process returns a virtual return value to the first rendering function and writes both the virtual return value and the call information for the first rendering function to the command buffer.
[0103] In other words, if the first rendering function is a synchronous rendering function that has a return value, the electronic device, by first generating a virtual return value for the first rendering function through the browser process, and then returning this virtual return value to the first rendering function, thereby allowing the first rendering function to continue execution. This eliminates the need for the browser process to wait for a return value from the first rendering function, allowing it to continue recording information about subsequent calls to other first rendering functions, and after recording information about all calls to the first rendering function for the page frame is complete, it can submit the command buffer to the client process all at once. Here, the virtual return value may be randomly generated by the browser process based on the format of the return value of the first rendering function, or it may be a past return value of the first rendering function, and is not limited to the embodiments of this application.
[0104] To explain further, in order for subsequent client processes to correctly translate the call to the first rendering function into a call to the second rendering function, the electronic device, via the browser process, writes the call information (i.e., function identifier, call parameters, etc.) and virtual return value of the first rendering function to a command buffer, so that subsequent client processes can parse the command buffer to obtain the call information and virtual return value of the first rendering function.
[0105] If a virtual return value of the first rendering function exists in the command buffer, in some embodiments of the present invention, the second rendering function performs graphic rendering on the page frame of the miniprogram, and after obtaining the rendering result of the page frame of the miniprogram, the page rendering method further includes the steps of: the client process analyzing the call processing request to obtain a command buffer and extracting a virtual return value from the command buffer; and the client process setting the return value of the second rendering function as the actual return value of the first rendering function and establishing a mapping relationship between the actual return value and the virtual return value.
[0106] Here, the mapping relationship is used to determine the corresponding actual return value for a virtual return value in the command buffer in the future.
[0107] It should be explained that in the embodiments of this application, a call to the first rendering function is translated into a call to the second rendering function, so the second rendering function has the same functionality as the first rendering function. Therefore, the return value of the second rendering function can be used as the actual return value of the first rendering function. For example, if the function of the first rendering function is the creation of a buffer area object, then the function of the second rendering function is also the creation of a buffer area object, so the return value of the second rendering function can be an identifier for the buffer area object (e.g., bufferID), and the return value of the first rendering function should also be an identifier for the buffer area object. Therefore, the electronic device binds the actual return value and the virtual return value by the client process directly determining the return value of the second rendering function as the actual return value of the first rendering function and establishing a mapping relationship between the actual return value and the virtual return value. This allows the browser process to then transmit the virtual return value to the client process again for the first rendering function, and the client process can then use this mapping relationship to directly determine the actual return value for the first rendering function, facilitating the execution of subsequent functions.
[0108] The following describes exemplary application examples of the embodiments of this application in actual application scenarios.
[0109] The embodiment of this invention is implemented in a scene that renders the game screen (referred to as a page frame) of a mini-game (referred to as a mini-program). In the embodiment of this invention, the rendering of the mini-game screen is switched from a WebView (referred to as a browser) to a client of a social application.
[0110] Figure 7 is a schematic diagram illustrating the rendering of the game screen of a mini-game according to an embodiment of the present invention. Referring to Figure 7, in the embodiment of the present invention, the call to the first rendering function 73 (exemplarily, the first rendering function may be a WebGL function) within the browser process 71 (also called the WebView process) is implemented by transferring it to the client process 72 via inter-process communication. On the other hand, the business logic code of the mini-game, i.e., the JS code 74, is still executed in the browser process 71, and simultaneously, the application programming interface 75 calls the client process 72 to implement file reading and writing, information login, etc.
[0111] However, the WebGL function interface is numerous, and the JS code may need to make tens to hundreds of calls for each frame of the game screen. If each WebGL function call needs to be forwarded to the client process via inter-process communication, the rendering performance of the mini-game screen becomes very poor. Therefore, in the embodiment of this application, the browser process records WebGL function calls in a command buffer and, when necessary, forwards all WebGL function calls to the client process at once via inter-process communication for batch processing.
[0112] During implementation, the client process injects script code into the command buffer of the browser process. This script code is used to intercept calls to WebGL functions in the JS code and to log the calls to WebGL functions into the command buffer.
[0113] As an example, Figure 8 is a schematic diagram illustrating the recording of a WebGL function call according to an embodiment of the present invention. When JS code executes a WebGL function, it is advantageous for the browser process to write the WebGL function call, i.e., the function ID (called the function identifier) and call parameters of the WebGL function, to a command buffer and pass them all at once thereafter.
[0114] When a frame finishes or encounters a call to a synchronous function (called a synchronous rendering function), it is necessary to pass the command buffer to the client process. In the embodiment of this invention, since the command buffer can be converted to binary data, inter-process communication can be implemented using the XHR method. That is, the browser process includes the command buffer data in an XHR request and passes it to the client process, and the client process intercepts this XHR request (called a call processing request) using WKURLSchemeHandler. Of course, inter-process communication may also be implemented using methods such as WebSocket, Prompt, or postMessage.
[0115] Normally, when calling a synchronous function that has a return value, for example, when calling gl.createBuffer, the browser process passes the command buffer and then waits for the return value, resulting in low rendering efficiency. In contrast, in the embodiment of the present invention, when calling a synchronous function that has a return value, the call can be written to the command buffer without triggering a pass to synchronization. In this case, when calling this synchronous function, the browser process returns a dummy BufferID (called a virtual return value) and writes both the dummy BufferID and the function call to the command buffer. After the client process parses the command buffer and generates a true BufferID (called the actual return value), it maps the true BufferID to the dummy BufferID, and then, when the browser process passes the dummy BufferID again, the client process directly replaces the dummy BufferID with the true BufferID based on this mapping relationship to realize the function.
[0116] For illustrative purposes, Figure 9 is another schematic diagram illustrating the recording of a WebGL function call according to an embodiment of the present invention. The command buffer not only records the function identifier (i.e., function ID) and call parameters of a WebGL function that does not have a return value, but also records a virtual return value (i.e., a dummy BufferID) for the command buffer (createBuffer) function to facilitate communication to the client process.
[0117] When rendering, that is, when the client process receives an instruction from the browser process indicating that a canvas needs to be created and calls a WebGL function using getContext (the client process does not execute the instruction at this point), the client creates the corresponding drawing layer (e.g., EAGLView) and creates an EAGLContext. Subsequently, after receiving the command buffer, the client process performs rendering by converting the WebGL function call to an OpenGL ES function (called the second rendering function).
[0118] Ultimately, the browser only acts as an executor of the JS code, in which case it only needs to load very little, and therefore only a blank HTML page (as long as it can guarantee the successful execution of the JS code), thus eliminating GPU resource-related overhead. This significantly reduces the memory consumption of the WebView itself. At the same time, since rendering by the browser is unnecessary, it avoids the impact of browser upgrade issues on the rendering of the minigame's game screen.
[0119] The following describes exemplary configurations in which the page rendering device 455 provided in the embodiments of the present application is implemented as a software module. In some embodiments, as shown in Figure 3, the software module in the page rendering device 455 stored in memory 450 may include a process startup module 4551, a request transmission module 4552, a call processing module 4553, and a graphics rendering module 4554.
[0120] The process startup module 4551 is configured to start the browser process of the browser via the application client's client process in response to a startup operation for the miniprogram, and to execute the business logic code of the miniprogram via the browser process, the miniprogram is executed on the application client, The request sending module 4552 is configured to send a call processing request to the client process by the browser process in response to the browser process executing up to the call code for the first rendering function in the business logic code, the first rendering function being a graphics rendering function called by the browser process, and the first rendering function being used to render the page frame of the miniprogram. The call processing module 4553 is configured to respond to the call processing request by determining a second rendering function corresponding to the first rendering function by the client process and to call the second rendering function, wherein the graphic rendering capabilities of the second rendering function and the first rendering function are the same. The graphics rendering module 4554 is configured to perform graphics rendering on the page frame of the miniprogram using the second rendering function and to obtain the rendering result of the page frame of the miniprogram.
[0121] In some embodiments of the present invention, the request sending module 4552 is further configured to write the call information for the first rendering function to a command buffer by the browser process in response to the browser process executing up to the call code for the first rendering function in the business logic code, generate the call processing request to the command buffer by the browser process, and send the call processing request to the client process.
[0122] In some embodiments of the present invention, the request sending module 4552 is further configured to generate the call processing request to the command buffer and send the call processing request to the client process if the first rendering function is a synchronous rendering function having a return value.
[0123] In some embodiments of the present invention, the request sending module 4552 is further configured such that, if the call information for each of a plurality of first rendering functions that need to be called when rendering the page frame is all recorded in the command buffer, the browser process generates the call processing request to the command buffer and sends the call processing request to the client process.
[0124] In some embodiments of the present invention, the page rendering device 455 further comprises a scripting module 4555 configured to generate script code for the command buffer by the client process and to inject the script code for the command buffer into the browser process, the script code for the command buffer being used to create the command buffer and to control the browser process to write the call information for the first rendering function into the command buffer.
[0125] In some embodiments of the present invention, the script processing module 4555 is further configured to create a thread within the browser process, use the thread to execute the script code in the command buffer, or generate an executable file corresponding to the script code in the command buffer, and replace the call code to the first rendering function with the executable file.
[0126] In some embodiments of the present application, the request sending module 4552 is further configured to send the call processing request to the client process by having the browser process set the access address of the call processing request to the service address of the client process, and by having the client process intercept the call processing request at the service address.
[0127] In some embodiments of the present invention, the request transmission module 4552 is further configured such that, if the first rendering function is a synchronous rendering function having a return value, the browser process returns a virtual return value to the first rendering function in response to the browser process executing up to the call code for the first rendering function in the business logic code, and writes both the virtual return value and the call information for the first rendering function to the command buffer.
[0128] In some embodiments of the present invention, the page rendering apparatus 455 further comprises a mapping generation module 4556 configured to analyze the call processing request by the client process to obtain the command buffer, extract the virtual return value from the command buffer, and establish a mapping relationship between the actual return value and the virtual return value by the client process, wherein the mapping relationship is used to determine the corresponding actual return value for the virtual return value in the command buffer.
[0129] In some embodiments of the present application, the call information includes call parameters, and the call processing module 4553 is further configured to allow the client process to parse from the command buffer to obtain the call parameters for the first rendering function, convert the call parameters for the first rendering function into call parameters for the second rendering function, and allow the client process to transmit the call parameters for the second rendering function to the second rendering function and perform the call to the second rendering function.
[0130] Embodiments of the present application provide a computer program product including a computer program or computer executable instructions, the computer program or computer executable instructions being stored in a computer-readable storage medium. The processor of an electronic device reads the computer executable instructions from the computer-readable storage medium, and the processor executes the computer executable instructions, thereby causing the electronic device to perform the oppage rendering method described in embodiments of the present application.
[0131] Embodiments of the present invention provide a computer-readable storage medium in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, the processor causes the processor to execute a page rendering method provided in embodiments of the present invention, for example, the page rendering method shown in Figure 4.
[0132] In some embodiments, the computer-readable storage medium may be memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic memory, optical disk, or CD-ROM, and may be a variety of devices including one or any combination of the above-mentioned memories.
[0133] In some embodiments, computer executable instructions can take the form of programs, software, software modules, scripts, or code, and can be written in any form of programming language (including compiled or interpreted languages, declarative or procedural languages), and can be arranged in any form, including independent programs, modules, components, subroutines, or other units suitable for use in a computing environment.
[0134] For example, computer executable instructions do not necessarily correspond to files in a file system, but may be stored in one or more scripts within a file that holds other programs or data, such as an HTML document; they may be stored in a single file dedicated to the program being discussed; or they may be stored in multiple collaborative files (such as files that store one or more modules, subroutines, or code sections).
[0135] For example, a computer executable instruction may be configured to run on one electronic device, on multiple electronic devices located at one location, or on multiple electronic devices distributed across multiple locations and interconnected by a communication network.
[0136] As described above, according to the embodiment of the present invention, when a user launches a miniprogram, the electronic device first launches a browser process via a client process, and the browser executes the business logic code of the miniprogram. When the business logic code needs to call a first rendering function, the browser process sends a call processing request to the client process, which converts the browser process's call to the first rendering function into a call to a second rendering function via the client process, and the second rendering function graphically renders the miniprogram's page frame. By offloading the graphic rendering process of the miniprogram's page frame to the client, the browser functions solely as the executor of the business logic code, thereby significantly reducing the browser's memory consumption, decreasing the possibility of the browser process being forcibly terminated, and ultimately reducing the risk of the miniprogram being forcibly terminated. Furthermore, because the graphic rendering process of the miniprogram's page frame is offloaded to the client, the graphic rendering of the browser's page frame and the miniprogram's page frame are separated. As a result, even if execution problems occur due to a browser upgrade, it will not affect the graphic rendering of the miniprogram's page frame, thus guaranteeing the normal use of the miniprogram.
[0137] The foregoing is merely an example of the present application and is not intended to limit the scope of protection. Any modifications, equivalent substitutions, and improvements made in the spirit and within the scope of the present application shall be included within the scope of protection. [Explanation of Symbols]
[0138] 11. Business logic code 12 API 13 Rendering Functions 71 Browser Process 72 Client Processes 73 First Rendering Function 74 JS code 75 Application Programming Interfaces 100-page rendering system 200 servers 300 Networks 400 devices 410 Processor 420 (Wired or Wireless) Network Interface 430 User Interfaces 431 Output device 432 Input device 440 bus system 440 Second Bus System 450 memory 451 Operating Systems 452 Network Communication Module 453 Display Module 454 Input Processing Module 455 Page Rendering Device 500 databases 4551 Process Startup Module 4552 Request transmission module 4553 Processing Module 4554 Graphics Rendering Module 4555 Script Processing Module 4556 Mapping Generation Module
Claims
1. A page rendering method performed by an electronic device, wherein the electronic device includes an application client and a browser, and the page rendering method is Steps include: launching a browser process of an application client in response to a launch operation for a miniprogram, and executing the business logic code of the miniprogram by the browser process, wherein the miniprogram is executed on the application client; The steps include: a step in which, in response to the browser process executing up to the call code for a first rendering function within the business logic code, the browser process sends a call processing request to the client process, wherein the first rendering function is a graphics rendering function called by the browser process, and the first rendering function is used to render the page frame of the miniprogram; In response to the aforementioned call processing request, the client process determines a second rendering function corresponding to the first rendering function and calls the second rendering function, wherein the graphic rendering functions of the second rendering function and the first rendering function are the same. A page rendering method comprising the steps of performing graphic rendering on the page frame of the miniprogram using the second rendering function and obtaining the rendering result of the page frame of the miniprogram.
2. The step of sending a call processing request to the client process by the browser process in response to the browser process executing up to the call code for the first rendering function within the business logic code is as follows: In response to the browser process executing the call code for the first rendering function within the business logic code, the browser process writes the call information for the first rendering function to the command buffer. The browser process includes the steps of generating the call processing request for the command buffer and sending the call processing request to the client process, The page rendering method according to claim 1.
3. The steps of the browser process generating the call processing request for the command buffer and sending the call processing request to the client process are as follows: If the first rendering function is a synchronous rendering function that has a return value, the browser process includes the steps of generating the call processing request for the command buffer and sending the call processing request to the client process, The page rendering method according to claim 1 or 2.
4. The steps of the browser process generating the call processing request for the command buffer and sending the call processing request to the client process are as follows: If the call information for each of the multiple first rendering functions that need to be called when rendering the page frame is all recorded in the command buffer, the browser process includes the steps of generating the call processing request for the command buffer and sending the call processing request to the client process, A page rendering method according to any one of claims 1 to 3.
5. In response to the browser process executing up to the call code for the first rendering function within the business logic code, the page rendering method, before the browser process writes the call information for the first rendering function to the command buffer, The client process generates the script code for the command buffer, A step of injecting the script code of the command buffer into the browser process, wherein the script code of the command buffer is used to create the command buffer, The further step includes controlling the browser process to write the call information of the first rendering function to the command buffer, A page rendering method according to any one of claims 1 to 4.
6. The step of injecting the script code of the command buffer into the browser process is: A step of creating a thread within the browser process and using that thread to execute the script code in the command buffer, or The steps include generating an executable file corresponding to the script code in the command buffer and replacing the call code for the first rendering function in the executable file, A page rendering method according to any one of claims 1 to 5.
7. The step of sending the aforementioned call processing request to the client process is: The steps include: setting the access address of the call processing request to the service address of the client process by the browser process; The steps include: having the client process intercept the call processing request at the service address and thereby transmit the call processing request to the client process; A page rendering method according to any one of claims 1 to 6.
8. Before the browser process generates the call processing request for the command buffer and sends the call processing request to the client process, the page rendering method: If the first rendering function is a synchronous rendering function that has a return value, the browser process, in response to the browser process executing up to the call code for the first rendering function within the business logic code, further includes the step of the browser process returning a virtual return value to the first rendering function and writing both the virtual return value and the call information for the first rendering function to the command buffer. A page rendering method according to any one of claims 1 to 7.
9. The second rendering function performs graphic rendering on the page frame of the miniprogram, and after obtaining the rendering result of the page frame of the miniprogram, the page rendering method is The client process analyzes the call processing request to obtain the command buffer and extracts the virtual return value from the command buffer. The client process further includes the step of setting the return value of the second rendering function as the actual return value of the first rendering function and establishing a mapping relationship between the actual return value and the virtual return value, The mapping relationship is used to determine the corresponding actual return value for the virtual return value in the command buffer. A page rendering method according to any one of claims 1 to 8.
10. The aforementioned call information includes call parameters, and the step of calling the second rendering function is: The client process performs the steps of: analyzing the command buffer to obtain the call parameters for the first rendering function, and converting the call parameters for the first rendering function to the call parameters for the second rendering function; The client process includes the steps of: transmitting the call parameters for the second rendering function to the second rendering function and performing the call to the second rendering function; A page rendering method according to any one of claims 1 to 9.
11. A page rendering device, It comprises a process startup module, a request transmission module, a call processing module, and a graphics rendering module. The process startup module is configured to start the browser process of the browser via the application client's client process in response to a startup operation for the miniprogram, and to execute the business logic code of the miniprogram via the browser process, and the miniprogram is executed on the application client. The request sending module is configured such that, in response to the browser process executing up to the call code for the first rendering function within the business logic code, the browser process sends a call processing request to the client process, the first rendering function being a graphics rendering function called by the browser process, and the first rendering function being used to render the page frame of the miniprogram. The call processing module is configured to respond to the call processing request by the client process to determine a second rendering function corresponding to the first rendering function, and to call the second rendering function, wherein the graphic rendering functions of the second rendering function and the first rendering function are the same. The graphic rendering module is configured to perform graphic rendering on the page frame of the miniprogram using the second rendering function and to obtain the rendering result of the page frame of the miniprogram, thereby forming a page rendering device.
12. An electronic device comprising memory and a processor, The memory is configured to store computer executable instructions or computer programs. Electronic device wherein the processor is configured to implement the page rendering method described in any one of claims 1 to 10 when executing computer executable instructions or computer programs stored in the memory.
13. A computer-readable storage medium storing computer-executable instructions or computer programs, wherein the computer-executable instructions, when executed by a processor, realize the page rendering method described in any one of claims 1 to 10.
14. A computer program product comprising a computer program or a computer executable instruction, wherein the computer program or computer executable instruction, when executed by a processor, implements the page rendering method described in any one of claims 1 to 10.