Page rendering method and apparatus, and electronic device, computer-readable storage medium and computer program product

By taking over page rendering of applets by the client process, the problem of excessive memory usage caused by the browser process to render the applets page frames is solved, and the operation stability of applets and the efficiency of browser resource utilization is improved.

WO2024260252A1PCT designated stage expired Publication Date: 2024-12-26TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/097277
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-06-19
Filing Date
2024-06-04
Publication Date
2024-12-26

AI Technical Summary

Technical Problem

In the prior art, rendering the page frame of the applet through the browser process will lead to excessive memory usage, increasing the risk of the browser process being forced to stop, and affecting the operating stability of the applet.

Method used

The browser process is started by the client process, and the browser process sends a call processing request to the client process, converting the browser process's call to the first rendering function into a client process's call to the second rendering function, and using the second rendering function Perform graphic rendering of page frames, transfer the rendering process to the client, and reduce the browser's memory consumption.

Benefits of technology

It effectively reduces the risk of forced stopping of the browser process, improves the running stability of the applet, and avoids the impact of browser upgrade on the rendering process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024097277_26122024_PF_FP_ABST
    Figure CN2024097277_26122024_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present application are a page rendering method and apparatus, and a device, a storage medium and a program product. The embodiments of the present application can be applied to page rendering scenarios of applets of application software, operating systems, etc. The method comprises: in response to a starting operation for an applet, starting a browser process of a browser by means of a client process of an application program client, and executing a service logic code of the applet by means of the browser process, wherein the applet runs in the application program client; in response to the browser process executing a calling code in the service logic code in respect of a first rendering function, sending a calling processing request to the client process by means of the browser process, wherein the first rendering function is a graphic rendering function that is called by the browser process, and the first rendering function is used for rendering a page frame of the applet; in response to the calling processing request, determining, by means of the client process, a second rendering function corresponding to the first rendering function, and calling the second rendering function, wherein the second rendering function and the first rendering function have the same graphic rendering function; and performing graphic rendering on the page frame of the applet by means of the second rendering function, so as to obtain a rendering result of the page frame of the applet.
Need to check novelty before this filing date? Find Prior Art

Description

Page rendering method, device, electronic device, computer-readable storage medium, and computer program product

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application is based on the Chinese patent application with application number 202310732158.7 and application date June 19, 2023, and claims the priority of the above Chinese patent application. The entire content of the above Chinese patent application is hereby introduced into this application as a reference. Technical Field

[0003] The present application relates to graphics processing technology, and in particular to a page rendering method, device, electronic device, computer-readable storage medium, and computer program product. Background Art

[0004] A mini program is an application that can be used without downloading and installing, thus providing great convenience for users in using different applications. In the related art, the operation of the mini program is achieved with the help of an embedded browser (such as WebView). That is, the business logic code of the mini program is interpreted and executed by the browser process, and the graphics rendering function is called by the browser process to render the page frame of the mini program. However, using the browser process to render the page frame of the mini program will increase the risk of the mini program being forced to close.

[0005] Summary of the Invention

[0006] The embodiments of the present application provide a page rendering method, device, electronic device, computer-readable storage medium, and computer program product, which can improve the operating stability of mini-programs.

[0007] The technical solution of the embodiment of the present application is implemented as follows:

[0008] The present application provides a page rendering method, which is applied to an electronic device and includes:

[0009] In response to a start operation for the applet, starting a browser process of the browser through a client process of the application client, and executing the business logic code of the applet through the browser process, so that the applet runs in the application client;

[0010] In response to the browser process executing a call code for a first rendering function in the business logic code, sending a call processing request to the client process through the browser 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 a page frame of the applet;

[0011] In response to the call processing request, determining, by the client process, a second rendering function corresponding to the first rendering function, and calling the second rendering function; wherein the second rendering function and the first rendering function have the same graphics rendering function;

[0012] The second rendering function is used to perform graphics rendering on the page frame of the mini program to obtain a rendering result of the page frame of the mini program.

[0013] The present invention provides a page rendering device, including:

[0014] a process startup module configured to, in response to a startup operation for a mini-program, start a browser process of a browser through a client process of an application client, and execute the business logic code of the mini-program through the browser process, so that the mini-program runs in the application client;

[0015] a request sending module configured to send a call processing request to the client process through the browser process in response to the browser process executing a call code for a first rendering function in the business logic code; 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 mini program;

[0016] a call processing module configured to, in response to the call processing request, determine, through the client process, a second rendering function corresponding to the first rendering function, and call the second rendering function; wherein the second rendering function and the first rendering function have the same graphics rendering function;

[0017] The graphics rendering module is configured to perform graphics rendering on the page frame of the mini program through the second rendering function to obtain a rendering result of the page frame of the mini program.

[0018] An embodiment of the present application provides an electronic device, including:

[0019] Memory for storing computer-executable instructions or computer programs;

[0020] The processor is used to implement the page rendering method provided in the embodiment of the present application when executing the computer executable instructions or computer program stored in the memory.

[0021] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions or a computer program, which is used to cause a processor to execute and implement the page rendering method provided in the embodiment of the present application.

[0022] An embodiment of the present application provides a computer program product, including a computer program or computer-executable instructions, which, when executed by a processor, implements the page rendering method provided in the embodiment of the present application.

[0023] The embodiments of the present application have the following beneficial effects: when the mini-program is started, the electronic device will first start the browser process through the application client process, execute the business logic code of the mini-program through the browser process, and when executing the call code for the first rendering function in the business logic code, send a call processing request to the client process through the browser process, so as to convert the browser process's call to the first rendering function into a client process's call to the second rendering function through the call processing request, and perform graphics rendering on the mini-program's page frame through the second rendering function. Since the second rendering function is a rendering function with the same graphics rendering function as the first rendering function, in this way, under the premise of ensuring that the graphics rendering function can be implemented normally, the graphics rendering process of the mini-program's page frame is transferred to the application client for implementation, so that the browser only serves as an executor of the business logic code, thereby greatly reducing the browser's memory consumption and reducing the possibility of the browser process being forced to stop, and ultimately reducing the risk of the mini-program being forced to close, thereby improving the running stability of the mini-program. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] FIG1 is a schematic diagram of the rendering of the page frame of the applet;

[0025] FIG2 is a schematic diagram of the architecture of a page rendering system provided in an embodiment of the present application;

[0026] FIG3 is a schematic structural diagram of the terminal in FIG2 provided in an embodiment of the present application;

[0027] FIG4 is a flow chart of a page rendering method according to an embodiment of the present application;

[0028] FIG5 is a second flow chart of the page rendering method provided in an embodiment of the present application;

[0029] FIG6 is a third flow chart of the page rendering method provided in an embodiment of the present application;

[0030] FIG7 is a schematic diagram showing the principle of rendering a game screen of a mini-game according to an embodiment of the present application;

[0031] FIG8 is a schematic diagram of recording calls to WebGL functions provided by an embodiment of the present application;

[0032] FIG9 is another schematic diagram of recording calls to WebGL functions provided by an embodiment of the present application. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solutions and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0034] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0035] In the following description, the terms "first\second" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It is understandable that "first\second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0036] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0037] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.

[0038] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0039] 1) Mini Programs, also known as Web Programs, are programs developed using a front-end language (such as JavaScript) that implement services within a Hypertext Markup Language (HTML) page. These programs are downloaded by clients via a network (such as the Internet) and interpreted and executed within the client's browser or embedded browser, eliminating the need for client-side installation. For example, a mini program for check-in or gaming services can be downloaded and run within a social networking client.

[0040] 2) Clients are applications that users need to download and install on their devices (e.g., smartphones) before they can use the app. For example, browser clients or social network clients.

[0041] 3) Client process: It is a process allocated to the client on the terminal and is used to implement various functions of the client.

[0042] 4) Embedded browser (WebView) is a browser embedded in native applications (applications 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 use UIWebView and WKWebview to display web pages.

[0043] 5) Browser process: This is a process assigned by the terminal's embedded browser and is used to implement various functions of the browser process.

[0044] 6) Page frame refers to the unit of rendering and display of the screen content of the mini program. That is, the screen content of the mini program is rendered in units of one page frame and displayed in units of one page frame. Therefore, by continuously displaying multiple page frames, the screen content of the mini program can be dynamically presented.

[0045] 7) In response, it is used to indicate the conditions or states on which the executed operations depend. When the dependent conditions or states are met, one or more operations executed can be real-time or have a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations executed are executed.

[0046] 8) Rendering functions are functions used in web or mini-program development to define and describe how a page should be displayed. They are typically responsible for converting data into a visual HTML structure and presenting it on the user interface. The implementation and concept of page rendering functions may vary across different frameworks and platforms, but their core purpose is similar: defining the page's display logic.

[0047] 9) Command cache, a cache space used to store call information of rendering functions.

[0048] 10) Business logic code is the code used to implement business logic. In this embodiment, it refers to the business logic code of the mini-program, that is, the code part that implements various functions and interactions in the mini-program. This code may include functions such as login verification, page jump, data request and processing, component operation, etc. Generally speaking, the business logic code of the mini-program mainly includes the following aspects:

[0049] 1. Page lifecycle function: Each page in the mini program has its own lifecycle function, including callback functions for different stages such as page loading, page display, page hiding, and page unloading. Various logical operations can be performed in these functions.

[0050] 2. Data request and processing: Mini programs need to interact with the server for data. They can use built-in request methods to send requests and process the returned data, including data parsing, data display, and other operations.

[0051] 3. Event monitoring and processing: The pages in the mini program can monitor various user interaction events, such as click events, sliding events, input events, etc., and can implement corresponding business logic through event processing functions.

[0052] 4. Page jump and parameter passing: If you need to jump between pages in the mini program, you can do so through the built-in Application Programming Interface (API) and pass data through parameters.

[0053] 5. Component operation: Various built-in components and custom components can be used in the mini program to implement different functions of the page, and the display, hiding, style and other operations of the components can be controlled through the relevant API.

[0054] In general, the business logic code of a mini program is the code part responsible for implementing the various functions and interactions of the mini program. Through these codes, various complex logics and interactive effects of the mini program can be realized.

[0055] Mini programs are apps that can be used without downloading or installing, providing users with significant convenience across various applications. For example, users can clock in and out through mini programs without installing the corresponding client, or play games and other entertainment without installing the corresponding client.

[0056] In related technologies, the operation of mini-programs is achieved by means of an embedded browser (such as WebView). That is, the browser process interprets and executes the business logic code of the mini-program, and calls the graphics rendering function to render the page frame of the mini-program.

[0057] For example, Figure 1 is a schematic diagram of the rendering of the page frame of the mini program. Referring to Figure 1, the code of the mini program is usually divided into business logic code (i.e., the code written by the creator of the mini program to implement the functions of the mini program) 11, an application programming interface (Application Programming Interface, API) 12 for calling the client, and a calling interface for the rendering function 13, which is used to render the page frame of the mini program. When the client detects the startup operation for the mini program, the client process will start the browser process of the embedded browser of the operating system. The browser process executes the business logic code 11 and calls the rendering function 13. At the same time, it will call the client process through the API 12 to implement file reading and writing, information logging, etc.

[0058] However, as the mini-program's usage time increases, the number of page frames required for rendering in this way also increases, causing the embedded browser's memory usage to become too high, which can lead to the browser process being forcibly stopped by the terminal, ultimately making the mini-program unusable. This shows that in related technologies, using the browser process to render the mini-program's page frames carries a high risk of the mini-program being forcibly closed.

[0059] In addition, the embedded browser may be upgraded along with the terminal's operating system (i.e., when the operating system is upgraded, the embedded browser may also be upgraded accordingly). However, the upgrade of the embedded browser may bring some operational failures (bugs). Thus, when the browser process is used to render the page frame of the mini program, failures may also occur, thereby affecting the normal use of the mini program.

[0060] The embodiments of the present application provide a page rendering method, apparatus, device, computer-readable storage medium, and computer program product, which can reduce the risk of a mini-program being forcibly closed. The following describes an exemplary application of an electronic device for page rendering provided by an embodiment of the present application. The electronic device provided by an embodiment of the present application can be implemented as various types of terminals such as a laptop computer, a tablet computer, a desktop computer, a set-top box, a mobile device (for example, a mobile phone, a portable music player, a personal digital assistant, a dedicated messaging device, a portable gaming device), and can also be implemented as a server. Below, an exemplary application when the electronic device is implemented as a terminal will be described.

[0061] See Figure 2, which is a schematic diagram of the architecture of the page rendering system provided in an embodiment of the present application. In order to support a page rendering application, in the page rendering system 100, the terminal (terminal 400-1 and terminal 400-2 are shown as examples) is connected to the server 200 via a network 300. The network 300 can be a wide area network or a local area network, or a combination of the two. In the page rendering system 100, a database 500 is also provided for providing data support to the server 200. Among them, the database 500 can be independent of the server 200, or it can be configured in the server 200. Figure 2 shows a situation where the database 500 is independent of the server 200.

[0062] Terminal 400-1 and terminal 400-2 are respectively used to respond to the user's startup operation for the mini-program on the graphical interface 410-1 and the graphical interface 410-2, download the program code of the mini-program from the server 200 through the client process and start the browser process of the browser, and execute the business logic code in the program code of the mini-program through the browser process; in response to the business logic code, call the first rendering function for the page frame of the mini-program, send a call processing request to the client process through the browser process, wherein the first rendering function is a graphics rendering function that can be called by the browser process; in response to the call processing request, determine the corresponding second rendering function for the first rendering function through the client process, and call the second rendering function; wherein the second rendering function is a graphics rendering function that can be called by the client process; through the second rendering function, perform graphics rendering on the page frame of the mini-program to obtain the rendering result of the page frame of the mini-program; and display the rendering result of each page frame in sequence on the graphical interface 410-1 and the graphical interface 410-2.

[0063] The server 200 is used to send the program code of the mini-program to the terminal 400 - 1 and the terminal 400 - 2 .

[0064] The embodiments of the present application can be implemented with the help of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network within a wide area network or a local area network to realize data calculation, storage, processing, and sharing.

[0065] Cloud computing is a general term for network technologies, information technology, integration technologies, management platforms, and application technologies used in the cloud computing business model. These technologies can form resource pools that are used on demand and are flexible and convenient. Cloud computing technology will become a crucial support. System backend services within technical networks require extensive computing and storage resources, which must be implemented through cloud computing.

[0066] Exemplarily, server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides 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, CDN, and big data and artificial intelligence platforms. Terminals 400-1 and 400-2 can be smart phones, tablet computers, laptops, desktop computers, smart speakers, smart watches, smart home appliances, car terminals, etc., but are not limited to these. The terminals and servers can be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.

[0067] Referring to Figure 3, Figure 3 is a schematic diagram of the structure of the terminal (an implementation of an electronic device) in Figure 2 provided in an embodiment of the present application. The terminal 400 shown in Figure 3 includes: at least one processor 410, a memory 450, at least one network interface 420 and a user interface 430. The various components in the terminal 400 are coupled together through a bus system 440. It can be understood that the bus system 440 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are labeled as bus system 440 in Figure 3.

[0068] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0069] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0070] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.

[0071] The memory 450 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.

[0072] In some embodiments, the memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.

[0073] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, and driver layer, which are used to implement various basic services and process hardware-based tasks;

[0074] A network communication module 452 for reaching other computing devices via one or more (wired or wireless) network interfaces 420 , exemplary network interfaces 420 including Bluetooth, WiFi, and USB;

[0075] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., a display screen, a speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripheral devices and displaying content and information);

[0076] The input processing module 454 is configured to detect one or more user inputs or interactions from one of the one or more input devices 432 and to translate the detected inputs or interactions.

[0077] In some embodiments, the page rendering device provided in the embodiments of the present application can be implemented in software. FIG3 shows a page rendering device 455 stored in memory 450. The page rendering device 455 can be software in the form of a program or plug-in, and includes the following software modules: a process startup module 4551, a request sending module 4552, a call processing module 4553, a graphics rendering module 4554, a script processing module 4555, and a mapping generation module 4556. These modules are logical and can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.

[0078] In other embodiments, the page rendering device provided in the embodiments of the present application can be implemented in hardware. As an example, the page rendering device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the page rendering method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt 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 components.

[0079] In some embodiments, a terminal or server (both are possible implementations of electronic devices) can implement the page rendering method provided in the embodiments of the present application by running a computer program. For example, the computer program can be a native program or software module in the operating system; it can be a native application (APP, Application), that is, a program that needs to be installed in the operating system to run, such as a social networking APP or an instant messaging APP; it can also be a small program, that is, a program that can be run only by downloading it into a browser environment; it can also be a small program that can be embedded in any APP. In short, the above-mentioned computer program can be an application, module or plug-in in any form.

[0080] The embodiments of the present application can be applied to the page rendering scenarios of small programs of application software, operating systems, etc. Below, the page rendering method provided by the embodiments of the present application is described. As mentioned above, the electronic device that implements the page rendering method of the embodiments of the present application can be a terminal, a server, or a combination of the two. Therefore, the execution entity of each step will not be repeated below.

[0081] The page rendering method provided in the embodiment of the present application will be described in combination with the exemplary application and implementation of the electronic device provided in the embodiment of the present application.

[0082] Refer to Figure 4, which is a flow chart of the page rendering method provided in an embodiment of the present application. The steps shown in Figure 4 will be described below.

[0083] S101. In response to a start operation for a mini-program, start a browser process of a browser through a client process of an application client, and execute a business logic code of the mini-program through the browser process.

[0084] The embodiment of the present application is implemented in the scenario of performing graphics rendering on the page frame of the mini-program. The page frame after graphics rendering is used to present the screen content of the mini-program. In the embodiment of the present application, the electronic device will detect in real time whether a startup operation for the mini-program has been received. When the startup operation for the mini-program is received and the mini-program is triggered to run, the browser process of the browser will be started through the client process of the application client, and the business logic code of the mini-program will be interpreted and executed through the browser process, thereby realizing the business function of the mini-program.

[0085] The mini-program in the embodiment of the present application can be a game mini-program (also called a mini-game), an office software mini-program, or various types of mini-programs such as music, and the embodiment of the present application does not limit this.

[0086] It should be noted that, in the embodiments of the present application, the client process refers to the process of the client of the application program embedded with the mini program, that is, the mini program is running in the application client, and thus, the startup operation for the mini program refers to the operation of entering the mini program triggered on the application client (hereinafter referred to as the client). The startup operation can be achieved by clicking the icon of the mini program, scanning the QR code of the mini program, etc. Among them, the above-mentioned application can refer to a social networking application, or it can be a music application, a game application, etc., and thus, the client can be a social networking client, a music client, a game client, etc. The mini program can be embedded in these clients and run to provide the functions of the mini program to users who have installed these clients.

[0087] The browser in the embodiment of the present application can be a browser provided by the client, or an embedded browser provided by the operating system of the electronic device, which is not limited in the embodiment of the present application. The browser process refers to the process assigned by the electronic device to the browser.

[0088] The business logic code of a mini program is the code used to implement the mini program's specific functions and is generally written by the mini program's creator. The mini program's business logic code is retrieved from the server by the client when the mini program is first launched. It can also be retrieved from the client's cached files during non-initial launches.

[0089] S102: In response to the browser process executing the calling code for the first rendering function in the business logic code, sending a call processing request to the client process through the browser process.

[0090] In order to display the screen content of the mini program, the business logic code will call the first rendering function to render the page frames of the mini program 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 executes the calling code for the first rendering function in the business logic code, the browser process executes the calling code for the first rendering function in the business logic code, which means that the browser process has executed the calling code for the first rendering function. At this time, if the first rendering function is called by the browser process to perform page rendering. Then, since the browser process calls the first rendering function to render the page, it is easy to cause the memory occupied by the browser to be too large, causing the browser process to be forced to stop. To avoid this situation, in an embodiment of the present application, in response to the browser process executing the calling code for the first rendering function in the business logic code, the electronic device will forward the page rendering function call in the browser process to the client process through a call processing request, so that the page rendering function call is implemented through the client. In this way, the browser can be regarded as only an executor of the business logic code, and only a very small number of pages need to be loaded, thereby reducing the browser's memory consumption.

[0091] In the embodiment of the present application, the browser process can send a call processing request to the client process in a variety of ways.

[0092] See Figure 5, which is a second flow chart of a page rendering method provided by an embodiment of the present application. In some embodiments of the present application, the process of S102 in Figure 4, i.e., in response to the browser process executing the calling code for the first rendering function in the business logic code, sending a call processing request to the client process through the browser process, can be implemented through S1021 to S1022 as follows:

[0093] S1021: In response to the browser process executing a calling code for a first rendering function in the business logic code, the browser process writes calling information of the first rendering function into a command cache.

[0094] When the electronic device executes the calling code for the first rendering function in the business logic code, it writes the calling information of the first rendering function to the command cache through the browser process, thereby recording the calling of the first rendering function through the command cache. The browser process may write the calling information of all first rendering functions called for each page frame into the same command cache, or it may write the calling information of each first rendering function into its assigned command cache (i.e., the browser process allocates a command cache for each first rendering function, and only the calling information of the corresponding first rendering function is written into each command cache).

[0095] In an embodiment of the present application, the calling information of the first rendering function needs to include at least the function identifier of the first rendering function and the calling parameters of the first rendering function (which can also be understood as the input parameters of the first rendering function). The function identifier is used to distinguish different first rendering functions. The function identifier can be the function name of the first rendering function or the function identifier of the first rendering function. The calling parameters of the first rendering function can vary according to the specific rendering function of the first rendering function. For example, when the first rendering function is a graphics drawing function, the calling parameters of the first rendering function are the coordinates of each point of the graphics. When the first rendering function is a shading function, the calling parameters of the first rendering function are the color code.

[0096] It should be noted that the command cache in the embodiment of the present application can be created by the browser process itself, or it can be created by the client process and injected into the browser process.

[0097] In some embodiments, before S1021 in Figure 5, that is, in response to the browser process executing the calling code for the first rendering function in the business logic code, before the browser process writes the calling information of the first rendering function in the command cache, the method may also include the following processing: generating the script code of the command cache through the client process, and injecting the script code of the command cache into the browser process.

[0098] It should be noted that the script code of the command cache is used to create the command cache and control the browser process to write the call information of the first rendering function into the command cache. That is, the client process generates a section of script code that can be automatically executed. The script code is used to open a command cache that can be read and written, intercept the call of the first rendering function, and control the browser process to record the corresponding call information. Among them, injecting the script code of the command cache into the browser process can be achieved by creating a thread in the browser process and making the thread execute the script code of the command cache. It can also be achieved by generating an executable file corresponding to the script code and using the executable file to replace the call code (or code segment) for the first rendering function in the browser process, that is, replacing the call code for the first rendering function with the executable file.

[0099] S1022: Generate a call processing request for the command cache through the browser process, and send the call processing request to the client process.

[0100] After the electronic device writes the call information of the first rendering function into the command buffer via the browser process, the browser process generates a call processing request for the first rendering function, packages the command buffer containing the call information into the call processing request, and sends the call processing request to the client process via inter-process communication. Thus, after receiving the call processing request, the client process can parse the command buffer and obtain the call information of the first rendering function.

[0101] It should be noted that in an embodiment of the present application, the electronic device can, after the browser process writes the call information of the first rendering function into the command cache, immediately generate a call processing request for the command cache through the browser process and send it to the client process, or after the browser process writes the call information of the first rendering function into the command cache, when certain request sending conditions are met (that is, when the call processing request needs to be sent), generate a call processing request for the command cache through the browser process and send it to the client.

[0102] Among them, the request sending condition may mean that the first rendering function is a synchronous rendering function with a return value (such as the gl.createBuffer function), or that the call information of all first rendering functions called for the page frame has been recorded in the command cache. The embodiment of this application does not limit this.

[0103] In some embodiments, S1022 in Figure 5, that is, generating a call processing request for the command cache through the browser process, and sending the call processing request to the client process, can be achieved by the following processing: when the first rendering function called by the business logic code is a synchronous rendering function with a return value, generating the call processing request for the command cache through the browser process, and sending the call processing request to the client process.

[0104] It should be noted that synchronous rendering functions must receive a return value before continuing to execute; otherwise, they will remain suspended, waiting for the return value. Therefore, when the first rendering function is a synchronous rendering function with a return value, the command buffer must be submitted to the client process in a timely manner so that the client process can generate the corresponding return value for the first rendering function and return it, allowing the first rendering function to continue executing.

[0105] In other embodiments, S1022 in Figure 5, that is, generating a call processing request for the command cache through the browser process and sending the call processing request to the client process, can also be achieved through the following processing: when the call information of each of the multiple first rendering functions that need to be called when the page frame is rendered has been recorded in the command cache, generating a call processing request for the command cache through the browser process, and sending the call processing request to the client process.

[0106] It is understandable that cross-process communication takes a certain amount of time to implement, and a page frame may need to call multiple, for example dozens or hundreds of first rendering functions, to complete graphics rendering. These first rendering functions can all be regarded as the first rendering functions that the page frame needs to call when rendering. When the call information of each of these first rendering functions has been recorded in the command cache, the electronic device will generate a call processing request for the command cache through the browser process and send it to the client process. In this way, the calls of all the first rendering functions required for a page frame can be submitted to the client process in batches, thereby reducing the number of cross-process communications and improving the processing efficiency of the page frame during graphics rendering.

[0107] It should be noted that in the embodiment of the present application, sending the call processing request to the client process can be implemented through an XMLHttpRequest (XHR) request, or based on technologies such as the WebSocket protocol, which is not limited in the embodiment of the present application.

[0108] In some embodiments, sending the call processing request to the client process can be achieved through the following processing: through the browser process, the access address of the call processing request is set to the service address of the client process; through the client process, the call processing request is intercepted at the service address to complete the sending of the call processing request to the client process.

[0109] That is, the browser process directly uses the service address of the client process as the access address for calling the processing request. Then the client process can intercept the request sent by the browser process at its service address through the request interception control (such as the WKURLSchemeHandler control) to achieve cross-process communication between the browser process and the client process, and complete the sending of the call processing request.

[0110] S103: In response to the call processing request, determine, through the client process, a second rendering function corresponding to the first rendering function, and call the second rendering function.

[0111] The electronic device responds to the call processing request through the client process and determines a second rendering function that has the same graphics rendering functionality as the first rendering function, and the second rendering function is an image rendering function that can be called by the client process. The electronic device then calls the second rendering function through the client process, thereby converting the call to the first rendering function into a call to the second rendering function, so that the second rendering function can subsequently be used to render the page frame of the mini program.

[0112] That is, in the embodiments of the present application, the first rendering function and the second rendering function can perform the same graphics rendering function, but differ in how they are called. For example, if the first rendering function is a function that creates a buffer object (such as the creatBuffer function in WebGL), the second rendering function is also a function that creates a buffer object (such as the function used to create a buffer object in OpenGL).

[0113] It should be noted that the second rendering function can be obtained by the client process based on the functionality of the first rendering function, by selecting from existing graphics rendering functions that can be called by the client process. During implementation, a correspondence table can be pre-established between various graphics rendering functions with the same graphics rendering functionality that can be called by the browser process and graphics rendering functions that can be called by the client process. The second rendering function corresponding to the first rendering function can then be queried from this correspondence table. In some embodiments, the second rendering function can also be obtained by converting and rewriting the first rendering function by the client process, but this is not a limitation in the present embodiment.

[0114] In an embodiment of the present application, when the call information includes call parameters, calling the second rendering function can be implemented by the following processing: parsing the call parameters of the first rendering function from the command cache through the client process, and converting the call parameters of the first rendering function into call parameters of the second rendering function; passing the call parameters of the second rendering function to the second rendering function through the client process, thereby completing the call to the second rendering function.

[0115] 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 of the first rendering function, converts the call parameters into call parameters usable by the second rendering function, and finally passes the converted call parameters to the second rendering function as input parameters to complete the call of the second rendering function. For example, when the call parameters of the first rendering function are the coordinate points of the graphics to be drawn, the electronic device will convert them into the second rendering function parameter format through the client process and enter the conversion results into the second rendering function parameters to complete the call.

[0116] It should be noted that when converting the call parameters of the first rendering function to call parameters that can be used by the second rendering function, you can refer to the official documentation and guidelines corresponding to the second rendering function to ensure that you correctly understand and use the parameters of different functions and their meanings. Compare the call parameters that need to be converted in the first rendering function and the second rendering function one by one, pay attention to the differences and similarities between the corresponding parameters, and make appropriate modifications and adjustments. The call parameters may have slightly different order in the first and second rendering functions. To ensure that the order of parameter passing is correct, it is also necessary to arrange the converted call parameters in the function parameter order required by the second rendering function to ensure that the second rendering function can run normally and achieve the same graphics rendering effect.

[0117] S104: Perform graphics rendering on the page frame of the mini-program through a second rendering function to obtain a rendering result of the page frame of the mini-program.

[0118] The electronic device uses the second rendering function to perform graphics rendering processing on each page frame of the mini program, such as drawing patterns and coloring each page frame. After completing the graphics rendering, the rendering result of each page frame can be obtained.

[0119] It is understandable that compared with the related art, calling the graphics rendering function through the browser process to render the page frame of the mini program will cause the browser's memory usage to be too high, thereby making the mini program at a higher risk of being forced to close. In the embodiment of the present application, the electronic device will first start the browser process through the client process when the user starts the mini program, execute the business logic code of the mini program through the browser, and when the business logic code needs to call the first rendering function, send a call processing request to the client process through the browser process, so as to convert the browser process's call to the first rendering function into a client process's call to the second rendering function through the call processing request, and perform graphics rendering on the mini program's page frame through the second rendering function. In this way, the graphics rendering process of the mini program's page frame can be transferred to the client implementation, so that the browser only acts as an executor of the business logic code without the need to call the resource overhead required by the graphics processor, thereby greatly reducing the browser's memory consumption, reducing the possibility of the browser process being forced to stop, and ultimately reducing the risk of the mini program being forced to close. In addition, the graphics rendering process of the mini-program's page frame is transferred to the client, which unbinds the browser and the mini-program's page frame graphics rendering. In this way, even if the browser upgrade may cause operational failures, it will not affect the graphics rendering of the mini-program's page frame, thereby ensuring the normal use of the mini-program.

[0120] It's important to note that in the above solution, when the first rendering function is a synchronous rendering function with a return value, the browser process immediately sends the command buffer along with the call request to the client process to commit the command buffer. Subsequent execution will only continue after receiving the return value. This approach requires waiting for the return value, so it still takes some time to write the subsequent first rendering function call information to the command buffer and commit the command buffer, which reduces operational efficiency.

[0121] In this regard, see Figure 6, which is a third flow chart of a page rendering method provided in 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 for the command cache and sends the call processing request to the client process, the method may further include the following processing:

[0122] S1023. When the first rendering function is a synchronous rendering function with a return value, in response to the browser process executing the calling code for the first rendering function in the business logic code, a virtual return value is returned for the first rendering function through the browser process, and the virtual return value and the calling information of the first rendering function are written into the command cache together.

[0123] That is, when the first rendering function is a synchronous rendering function with a return value, the electronic device will first generate a virtual return value for the first rendering function through the browser process, and return the virtual return value to the first rendering function, so that the first rendering function can continue to run. In this way, the browser process does not need to wait for the return value of the first rendering function, and can continue to record the call information of other subsequent first rendering functions. After completing the recording of the call information of all first rendering functions for the page frame, the command cache is submitted to the client process at one time. Among them, the virtual return value can be randomly generated by the browser process according to the format of the return value of the first rendering function, or it can be a historical return value of the first rendering function, which is not limited in this embodiment of the present application.

[0124] It should be noted that in order to enable the subsequent client process to correctly convert the call to the first rendering function into a call to the second rendering function, the electronic device will write the call information (i.e. function identifier, call parameters, etc.) and virtual return value of the first rendering function into the command cache through the browser process, so that the subsequent client process can parse the call information and virtual return value of the first rendering function from the command cache.

[0125] When there is a virtual return value of the first rendering function in the command cache, in some embodiments of the present application, after performing graphics rendering on the page frame of the mini program through the second rendering function and obtaining the rendering result of the page frame of the mini program, the method further includes: parsing the command cache from the call processing request through the client process, and extracting the virtual return value from the command cache; through the client process, using the return value of the second rendering function as the real return value of the first rendering function, and establishing a mapping relationship between the real return value and the virtual return value.

[0126] The mapping relationship is used to determine the corresponding real return value for the virtual return value in the command cache at a future time.

[0127] It should be noted that, in the embodiment of the present application, since a call to the first rendering function is converted into a call to the second rendering function, the second rendering function has the same functionality as the first rendering function. Therefore, the return value of the second rendering function can serve as the actual return value of the first rendering function. For example, if the function of the first rendering function is to create a buffer object, the function of the second rendering function will also be to create a buffer object. Therefore, the return value of the second rendering function can be the identifier of the buffer object (e.g., bufferID), and the return value of the first rendering function should also be the identifier of the buffer object. Therefore, the electronic device, through the client process, directly determines the return value of the second rendering function as the actual return value of the first rendering function and binds the actual return value and the virtual return value by establishing a mapping relationship between the actual return value and the virtual return value. In this way, when the browser process again transmits the virtual return value of the first rendering function to the client process in the future, the client process can use this mapping relationship to directly determine the actual return value for the first rendering function, facilitating subsequent functions.

[0128] The following describes an exemplary application of the embodiments of the present application in a practical application scenario.

[0129] The embodiment of the present application is implemented in the scenario of rendering the game screen (called page frame) of a small game (called a mini program). In the embodiment of the present application, the rendering of the game screen of the small game is switched from WebView (called a browser) to the client of the social application.

[0130] Figure 7 is a schematic diagram of the principle of rendering the game screen of a mini-game provided by an embodiment of the present application. Referring to Figure 7, in this embodiment of the present application, the call of the first rendering function 73 (illustratively, the first rendering function can be a WebGL function) within the browser process 71 (also referred to as the WebView process) is forwarded to the client process 72 through cross-process communication. The business logic code of the mini-game, namely the JS code 74, still runs in the browser process 71 and simultaneously calls the client process 72 through the application programming interface 75 to implement file reading and writing, information logging, etc.

[0131] However, WebGL has numerous function interfaces, and the JS code may need to call dozens or even hundreds of times for each frame of the game screen. If each WebGL function call needs to be forwarded to the client process via cross-process communication, the rendering performance of the mini-game screen will be very poor. Therefore, in the embodiments of the present application, the browser process records the WebGL function calls in the command cache. When submission is required, the WebGL function calls are submitted to the client process in batches through cross-process communication for batch processing.

[0132] During implementation, the client process injects script code of the command cache into the browser process. The script code is used to intercept the call of the WebGL function of the JS code and record the call of the WebGL function in the command cache.

[0133] For example, Figure 8 is a schematic diagram of recording WebGL function calls provided by an embodiment of the present application. When the JS code executes a WebGL function, the browser process writes the WebGL function call, namely the WebGL function's function ID (called function identifier) ​​and call parameters, to the command buffer for subsequent batch submission.

[0134] When a frame ends or a synchronous function (called a synchronous rendering function) is called, the command cache needs to be submitted to the client process. In the embodiment of the present application, the command cache can be converted into binary data, so that cross-process communication can be implemented using XHR. That is, the browser process will carry the command cache data through an XHR request and submit it to the client process. The client process intercepts the XHR request (called a call processing request) through WKURLSchemeHandler. Of course, cross-process communication can also be implemented through WebScoket, Prompt, postMessage, etc.

[0135] Under normal circumstances, when a synchronous function with a return value is called, such as calling gl.createBuffer, the browser process will submit the command cache once and wait for the return value, which makes the rendering efficiency not very high. In this regard, in an embodiment of the present application, when a synchronous function with a return value is called, the call can be written to the command cache without triggering a synchronous submission. At this time, when the synchronous function is called, the browser process will return a false BufferID (called a virtual return value) and write the false BufferID together with the function call to the command cache. After the client process parses the command cache and generates a true BufferID (called a real return value), it will map the true BufferID and the false BufferID. Afterwards, when the browser process passes the false BufferID again, the client process can directly replace the false BufferID with the true BufferID based on the mapping relationship to achieve the function.

[0136] For example, Figure 9 is another schematic diagram of recording WebGL function calls provided by an embodiment of the present application. In the command buffer, in addition to recording the function identifiers (i.e., function IDs) and call parameters of some WebGL functions that do not have return values, a dummy return value (i.e., a fake BufferID) is also recorded for the create command buffer (createBuffer) function so that it can be passed to the client process.

[0137] When the client process is rendering, that is, when the client process receives instructions from the browser process indicating that a canvas needs to be created and calls a WebGL function through getContext (the client process does not execute the instructions at this time), the corresponding drawing layer (such as EAGLView) and EAGLContext are created on the client side. After that, after receiving the command buffer, the client process converts the WebGL function call into an OpenGL ES function (called the second rendering function) to achieve rendering.

[0138] Ultimately, the browser only serves as an executor of the JS code. At this point, the browser only needs to load a very small, or even blank, HTML page (just enough to ensure the normal execution of the JS code), without any GPU resource overhead. This can greatly reduce the memory consumption of the WebView itself. At the same time, since the browser is no longer required to render, the impact of browser upgrade failures on the rendering of the game screen can be avoided.

[0139] The following further describes an exemplary structure of the page rendering device 455 provided in an embodiment of the present application implemented as a software module. In some embodiments, as shown in FIG3 , the software module stored in the page rendering device 455 of the memory 450 may include:

[0140] A process startup module 4551 is configured to, in response to a startup operation for a mini-program, start a browser process of a browser through a client process of an application client, and execute the business logic code of the mini-program through the browser process, so that the mini-program runs in the application client;

[0141] a request sending module 4552 configured to send a call processing request to a client process via the browser process in response to the browser process executing a call code for a first rendering function in the business logic code; wherein the first rendering function is a graphics rendering function called by the browser process, and the first rendering function is used to render a page frame of the mini-program;

[0142] a call processing module 4553 configured to, in response to the call processing request, determine, through the client process, a second rendering function corresponding to the first rendering function, and call the second rendering function; wherein the second rendering function and the first rendering function have the same graphics rendering function;

[0143] The graphics rendering module 4554 is configured to perform graphics rendering on the page frame of the mini program through the second rendering function to obtain a rendering result of the page frame of the mini program.

[0144] In some embodiments of the present application, the request sending module 4552 is also configured to, in response to the browser process executing the calling code for the first rendering function in the business logic code, write the calling information of the first rendering function in the command cache through the browser process; generate the call processing request for the command cache through the browser process, and send the call processing request to the client process.

[0145] In some embodiments of the present application, the request sending module 4552 is also configured to generate the call processing request for the command cache through the browser process when the first rendering function is a synchronous rendering function with a return value, and send the call processing request to the client process.

[0146] In some embodiments of the present application, the request sending module 4552 is also configured to generate the call processing request for the command cache through the browser process and send the call processing request to the client process when the call information of each of the multiple first rendering functions that need to be called when the page frame is rendered has been recorded in the command cache.

[0147] In some embodiments of the present application, the page rendering device 455 also includes: a script processing module 4555, configured to generate the script code of the command cache through the client process, and inject the script code of the command cache into the browser process; the script code of the command cache is used to create the command cache, and control the browser process to write the call information of the first rendering function into the command cache.

[0148] In some embodiments of the present application, the script processing module 4555 is further configured to create a thread in the browser process and use the thread to execute the script code in the command cache; or, generate an executable file corresponding to the script code in the command cache and replace the calling code for the first rendering function with the executable file.

[0149] In some embodiments of the present application, the request sending module 4552 is also configured to set the access address of the call processing request to the service address of the client process through the browser process; intercept the call processing request at the service address through the client process, and complete sending the call processing request to the client process.

[0150] In some embodiments of the present application, the request sending module 4552 is also configured to, in response to the browser process executing the calling code for the first rendering function in the business logic code, return a virtual return value for the first rendering function through the browser process when the first rendering function is a synchronous rendering function with a return value, and write the virtual return value and the calling information of the first rendering function into the command cache together.

[0151] In some embodiments of the present application, the page rendering device 455 also includes: a mapping generation module 4556, configured to parse the command cache from the call processing request through the client process, and extract the virtual return value from the command cache; through the client process, use the return value of the second rendering function as the real return value of the first rendering function, and establish a mapping relationship between the real return value and the virtual return value; wherein, the mapping relationship is used to determine the corresponding real return value for the virtual return value in the command cache at a future time.

[0152] In some embodiments of the present application, the call information includes: call parameters; the call processing module 4553 is further configured to parse the call parameters of the first rendering function from the command cache through the client process, and convert the call parameters of the first rendering function into call parameters of the second rendering function; and pass the call parameters of the second rendering function to the second rendering function through the client process to complete the call to the second rendering function.

[0153] An embodiment of the present application provides a computer program product, which includes a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the page rendering method described above in the embodiment of the present application.

[0154] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will execute the page rendering method provided by an embodiment of the present application, for example, the page rendering method shown in Figure 4.

[0155] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or various devices including one or any combination of the above memories.

[0156] In some embodiments, computer-executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0157] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).

[0158] By way of example, computer-executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed across multiple sites and interconnected by a communication network.

[0159] In summary, through the embodiments of the present application, when the user starts the applet, the electronic device will first start the browser process through the client process, execute the business logic code of the applet through the browser, and when the business logic code needs to call the first rendering function, send a call processing request to the client process through the browser process, so as to convert the browser process's call to the first rendering function into a call to the second rendering function by the client process through the call processing request, and perform graphics rendering on the applet's page frame through the second rendering function. In this way, the graphics rendering process of the applet's page frame can be transferred to the client implementation, so that the browser only acts as an executor of the business logic code, thereby greatly reducing the browser's memory consumption and reducing the possibility of the browser process being forced to stop, and ultimately reducing the risk of the applet being forced to close. In addition, the graphics rendering process of the applet's page frame is transferred to the client implementation, which realizes the unbinding of the graphics rendering of the browser and the applet's page frame. In this way, even if the browser upgrade may cause an operational failure, it will not affect the graphics rendering of the applet's page frame, thereby ensuring the normal use of the applet.

[0160] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.

Claims

1. A page rendering method, applied to an electronic device, wherein the electronic device includes an application client and a browser, and the method comprises: In response to a start operation for the applet, a browser process of the browser is started through a client process of the application client, and a business logic code of the applet is executed through the browser process, and the applet runs in the application client; In response to the browser process executing a calling code for a first rendering function in the business logic code, sending a calling processing request to a client process through the browser 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 a page frame of the applet; In response to the call processing request, determining, through the client process, a second rendering function corresponding to the first rendering function, and calling the second rendering function; wherein the second rendering function and the first rendering function have the same graphics rendering function; The second rendering function is used to perform graphics rendering on the page frame of the mini program to obtain a rendering result of the page frame of the mini program.

2. The method according to claim 1, wherein: In response to the browser process executing the calling code for the first rendering function in the business logic code, sending a calling processing request to the client process through the browser process includes: In response to the browser process executing a calling code for a first rendering function in the business logic code, writing calling information of the first rendering function into a command cache through the browser process; The call processing request is generated for the command cache through the browser process, and the call processing request is sent to the client process.

3. The method according to claim 1 or 2, wherein: The step of generating the call processing request for the command cache through the browser process and sending the call processing request to the client process includes: When the first rendering function is a synchronous rendering function having a return value, the browser process generates the call processing request for the command cache, and sends the call processing request to the client process.

4. The method according to any one of claims 1 to 3, wherein: The step of generating the call processing request for the command cache through the browser process and sending the call processing request to the client process includes: When the calling information of each of the multiple first rendering functions required to be called when rendering the page frame has been recorded in the command cache, the browser process generates the calling processing request for the command cache and sends the calling processing request to the client process.

5. The method according to any one of claims 1 to 4, wherein: In response to the browser process executing the calling code for the first rendering function in the business logic code, before the browser process writes the calling information of the first rendering function in the command cache, the method further includes: Generate script code for the command cache through the client process; Injecting the script code of the command cache into the browser process; the script code of the command cache is used to create the command cache; Control the browser process to write the calling information of the first rendering function into the command cache.

6. The method according to any one of claims 1 to 5, wherein injecting the script code of the command cache into the browser process comprises: Creating a thread in the browser process, and using the thread to execute the script code in the command cache; or, An executable file corresponding to the script code of the command cache is generated, and the calling code for the first rendering function is replaced with the executable file.

7. The method according to any one of claims 1 to 6, wherein: The sending the call processing request to the client process includes: By means of the browser process, setting the access address of the call processing request to the service address of the client process; The call processing request is intercepted at the service address through the client process, and the call processing request is sent to the client process.

8. The method according to any one of claims 1 to 7, wherein: Before generating the call processing request for the command cache through the browser process and sending the call processing request to the client process, the method further includes: When the first rendering function is a synchronous rendering function with a return value, in response to the browser process executing the calling code for the first rendering function in the business logic code, a virtual return value is returned for the first rendering function through the browser process, and the virtual return value and the calling information of the first rendering function are written into the command cache together.

9. The method according to any one of claims 1 to 8, wherein: After performing graphics rendering on the page frame of the mini-program through the second rendering function to obtain the rendering result of the page frame of the mini-program, the method further includes: By means of the client process, the command cache is parsed from the call processing request, and the virtual return value is extracted from the command cache; By means of the client process, taking the return value of the second rendering function as the real return value of the first rendering function, and establishing a mapping relationship between the real return value and the virtual return value; The mapping relationship is used to determine the corresponding real return value for the virtual return value in the command cache.

10. The method according to any one of claims 1 to 9, wherein: The calling information includes: calling parameters; the calling of the second rendering function includes: By means of the client process, the calling parameters of the first rendering function are parsed from the command cache, and the calling parameters of the first rendering function are converted into calling parameters of the second rendering function; The calling parameter of the second rendering function is passed to the second rendering function through the client process to complete the calling of the second rendering function.

11. A page rendering device, the device comprising: A process startup module, configured to, in response to a startup operation for a mini-program, start a browser process of a browser through a client process of an application client, and execute the business logic code of the mini-program through the browser process, wherein the mini-program runs in the application client; A request sending module, configured to send a call processing request to a client process through the browser process in response to the browser process executing a call code for a first rendering function in the business logic code; wherein the first rendering function is a graphics rendering function called by the browser process, and the first rendering function is used to render a page frame of the applet; a calling processing module configured to, in response to the calling processing request, determine, through the client process, a second rendering function corresponding to the first rendering function, and call the second rendering function; wherein the second rendering function and the first rendering function have the same graphics rendering function; The graphics rendering module is configured to perform graphics rendering on the page frame of the mini program through the second rendering function to obtain a rendering result of the page frame of the mini program.

12. An electronic device, comprising: Memory for storing computer executable instructions or computer programs; The processor is used to execute the computer executable instructions or computer programs stored in the memory to achieve The page rendering method according to any one of claims 1 to 10.

13. A computer-readable storage medium storing computer-executable instructions or a computer program, wherein the computer-executable instructions, when executed by a processor, implement the page rendering method according to 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 the computer executable instruction, when executed by a processor, implements the page rendering method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Remote 3D instruction rendering system and method

    CN102254292A

  • Small program component rendering method, client, electronic device and storage medium

    CN110704136A

  • Method for detecting webgl context on universal browser

    CN113791789A

  • Small program canvas rendering method and device, equipment and storage medium

    CN114371838A

  • Web 3d-image display system

    JP2005165873A