Page rendering method, device, equipment and medium
By creating a Webview child process in the main process and updating the rendering mode when rendering fails, the lag and crash issues caused by Webview functionality in existing technologies are resolved, improving the reliability of page rendering and user experience.
Patent Information
- Application Number
- CN202311182202.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-13
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2043-09-13
AI Technical Summary
In existing technologies, application software renders pages by directly embedding Webview functionality, which can easily lead to software lag, abnormal page rendering, or even crashes, resulting in a poor user experience.
The main process creates an independent WebView child process, which is used to render the page. If rendering fails, the rendering mode is updated and the child process is restarted until rendering is complete.
This effectively avoids lag and crashes caused by the main process rendering the page, improving the reliability of page rendering and user experience.
Smart Images

Figure CN117312708B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to page rendering methods, apparatus, devices and media. Background Technology
[0002] Currently, due to the flexibility and convenience of WebView, more and more application software is integrating WebView functionality to achieve page rendering and display. However, the inventors have found through research that application software in related technologies usually integrates WebView functionality by direct embedding, but this method is prone to problems such as software lag, abnormal page rendering, and even software crashes, resulting in poor reliability and a poor user experience. Summary of the Invention
[0003] In order to solve the above-mentioned technical problems, or at least partially solve the above-mentioned technical problems, this disclosure provides a page rendering method, apparatus, device and medium.
[0004] According to one aspect of this disclosure, a page rendering method is provided, comprising: a main process corresponding to a target application creating a Webview subprocess; the main process determining a target rendering mode corresponding to the Webview subprocess and passing the target rendering mode and a Uniform Resource Locator (URL) to the Webview subprocess; the Webview subprocess rendering the page corresponding to the URL based on the target rendering mode; and if the main process determines that the page rendering has failed, updating the target rendering mode and restarting the Webview subprocess to render the page based on the updated target rendering mode, until the page rendering is completed.
[0005] According to another aspect of this disclosure, a page rendering apparatus is provided, comprising: a subprocess creation module for creating a Webview subprocess by a main process corresponding to a target application; a transmission module for the main process to determine a target rendering mode corresponding to the Webview subprocess and transmit the target rendering mode and a Uniform Resource Locator (URL) to the Webview subprocess; and a rendering module for the Webview subprocess to render a page corresponding to the URL based on the target rendering mode, wherein if the main process determines that the page rendering has failed, it updates the target rendering mode and restarts the Webview subprocess to render the page based on the updated target rendering mode until the page rendering is completed.
[0006] According to another aspect of this disclosure, an electronic device is provided, comprising: a processor; and a memory storing a program, wherein the program includes instructions that, when executed by the processor, cause the processor to perform a page rendering method.
[0007] According to another aspect of this disclosure, a computer-readable storage medium is provided, wherein the storage medium stores a computer program for performing the above-described page rendering method.
[0008] The technical solution provided in this embodiment allows the main process to directly create a WebView subprocess and determine the target rendering mode corresponding to the WebView subprocess. The WebView subprocess can then render the page based on the target rendering mode and URL information passed by the main process. Furthermore, if page rendering fails, the main process can update the target rendering mode and restart the WebView subprocess for page rendering. In this approach, instead of directly embedding WebView functionality within the main process for page rendering, the main process creates an independent WebView subprocess for page rendering. This effectively avoids the stuttering and crashes that can easily occur when the main process renders the page. Moreover, the main process can change the target rendering mode and restart the WebView subprocess for page rendering if page rendering fails, ensuring the reliability of page rendering and effectively improving the user experience.
[0009] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0010] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0011] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 A flowchart illustrating a page rendering method provided in an embodiment of this disclosure;
[0013] Figure 2 This is a schematic diagram illustrating the integration of a Webview function according to an embodiment of the present disclosure;
[0014] Figure 3 This is a schematic diagram of the structure of a page rendering apparatus provided in an embodiment of the present disclosure;
[0015] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0016] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0017] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0018] The term "comprising" and its variations as used in this disclosure are open-ended, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc., mentioned in this disclosure are used only to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies.
[0019] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0020] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0021] Applications in related technologies typically integrate WebView functionality through direct embedding. Specifically, these technologies directly utilize the application's main process to handle WebView-related tasks, such as rendering WebView pages. Furthermore, the main process employs a preset, fixed rendering mode for WebView page rendering. However, different user devices have varying machine environments, and some may not support this rendering mode, leading to software crashes or rendering anomalies. Additionally, if the machine's performance is poor, rendering pages using WebView can consume excessive resources in the main process, causing issues like interface lag and stuttering. Therefore, while applications in these technologies can integrate WebView functionality for page rendering, their reliability is low, resulting in a poor user experience.
[0022] The aforementioned deficiencies in the related technologies are the result of the applicant's practical experience and careful research. Therefore, the discovery process of these deficiencies and the solutions proposed by the present disclosure embodiments below should be considered as contributions made by the applicant to this application. To improve at least one of the above problems, the present disclosure embodiments provide a page rendering method, apparatus, device, and medium, which will be described in detail below.
[0023] Figure 1 This is a flowchart illustrating a page rendering method provided in an embodiment of the present disclosure. The method can be executed by a page rendering device, which can be implemented in software and / or hardware, and is generally integrated into an electronic device, such as a user device, specifically applicable to a client. Figure 1 As shown, the method mainly includes the following steps S102 to S106:
[0024] Step S102: The main process corresponding to the target application creates a Webview child process. This Webview child process handles Webview-related tasks, such as page rendering based on the Webview control. This embodiment of the disclosure does not limit the target application; any program that needs to integrate Webview functionality can be used. In practical applications, the main process can create a child process containing a Webview window during the loading of the Uniform Resource Locator (URL) information; this child process is the Webview child process.
[0025] In this embodiment, instead of directly using the main process to handle WebView-related tasks, an independent WebView child process is created from the main process. This allows the WebView child process to independently handle WebView-related tasks such as page rendering. This not only effectively avoids consuming too many resources of the main process, but also effectively reduces the impact of the child process on the main process when rendering pages. In particular, it avoids the impact of page rendering errors on the main process, prevents the current main interface corresponding to the main process from experiencing blocking or lag, and effectively prevents the main process from crashing.
[0026] In step S104, the main process determines the target rendering mode corresponding to the Webview child process and passes the target rendering mode and the Uniform Resource Locator (URL) information to the Webview child process.
[0027] In practical applications, the target rendering mode is the rendering mode required by the Webview child process. The main process can determine the target rendering mode in advance and pass the target rendering mode and URL information to the Webview child process through IPC (Interprocess Communication).
[0028] In some implementation examples, the steps for the main process to determine the target rendering mode corresponding to the WebView child process can be performed in the following two ways:
[0029] Scenario 1: If the main process is launching for the first time, the default rendering mode will be used as the target rendering mode for the WebView child process. When the main process launches for the first time, it is usually unclear which rendering modes the WebView child process supports; that is, it is unclear which rendering mode the WebView child process can successfully use to render the page. In practice, which rendering modes the WebView child process supports depends primarily on the current machine environment, specifically on the current software and / or hardware configuration. For example, whether the WebView child process can successfully render the page using a certain rendering mode is affected by factors such as device performance and drivers. Therefore, when the main process is unaware of the rendering modes supported by the WebView child process, a default rendering mode is specified first. For example, the default rendering mode specified when the main process launches for the first time could be the OpenGL rendering mode. This allows the WebView child process to first attempt to render the page using the default rendering mode. If the default rendering mode is not supported, the main process can then change the rendering mode until a rendering mode supported by the WebView child process is found.
[0030] Scenario 2: If the main process is not starting for the first time, it retrieves the pre-stored rendering modes supported by the WebView child process and uses these modes as the target rendering mode. The rendering modes supported by the WebView child process are determined and stored by the main process during its initial startup, and these modes are the ones used by the WebView child process to complete page rendering. Successful page rendering is considered as completing page rendering.
[0031] If the main process is not launching for the first time, such as when the user has launched the target application before, the rendering mode supported by the Webview child process, which was determined and stored by the main process during the first launch, can be directly obtained and passed as the target rendering mode to the Webview child process so that the Webview child process can successfully apply the target rendering mode to complete the page rendering.
[0032] In step S106, the Webview subprocess renders the page corresponding to the URL information based on the target rendering mode. If the main process determines that the page rendering has failed, it updates the target rendering mode and restarts the Webview subprocess to render the page based on the updated target rendering mode until the page rendering is complete.
[0033] If page rendering fails, it indicates that the WebView subprocess does not support the current target rendering mode, meaning the current machine environment does not support it. Therefore, the main process can update the target rendering mode again and restart the WebView subprocess to render the page based on the updated target rendering mode (i.e., the latest target rendering mode). In practice, the main process can pass the updated target rendering mode and URL information to the restarted WebView subprocess, enabling it to render the page corresponding to the URL based on the updated target rendering mode. If the restarted WebView subprocess fails to render the page based on the updated target rendering mode, the main process can change the target rendering mode again and restart the WebView subprocess, repeating this process until the WebView subprocess can successfully complete page rendering based on the latest target rendering mode. At this point, the rendering mode used by the WebView subprocess to complete page rendering can be recorded and stored.
[0034] In practical applications, if the main process is launched for the first time, the WebView child process may experience page rendering failure, meaning that the WebView child process may not support the default rendering mode passed by the main process. However, if the main process is not launched for the first time, and the main process passes the WebView child process a rendering mode supported by the WebView child process when it is not launched for the first time, then under normal circumstances, page rendering failure will not occur, and page rendering efficiency can be fully guaranteed.
[0035] In some specific implementation examples, the target rendering mode can be updated based on a set of preset candidate rendering modes. For example, the candidate rendering modes include at least an OpenGL rendering mode and a CPU rendering mode. The OpenGL rendering mode is the mode for rendering pages using OpenGL, and the CPU rendering mode is the mode for rendering pages using the CPU; it can also be called a software rendering mode. When page rendering fails, it indicates that the Webview subprocess does not support the current target rendering mode. Therefore, the main process can switch the target rendering mode based on a variety of preset candidate rendering modes. For example, the order of the candidate rendering modes can be preset, and then a new target rendering mode can be determined from the candidate rendering modes based on the order. For example, the order of the candidate rendering modes is mode 1, mode 2, mode 3... mode n. First, the main process sets mode 1 as the target rendering mode and passes mode 1 and URL information to the Webview subprocess. If it is determined that the Webview subprocess fails to render the page using mode 1, the main process sets mode 2 as the new target rendering mode and restarts the Webview subprocess, passing mode 2 and URL information to the Webview subprocess so that the restarted Webview subprocess can use mode 2 to render the page again. This process continues until the Webview subprocess successfully completes page rendering using a suitable rendering mode.
[0036] In the above method, instead of directly embedding WebView functionality in the main process for page rendering, the main process creates an independent WebView child process and directly uses the WebView child process for page rendering. This effectively avoids problems such as lag or even crashes that can easily occur when the main process renders the page. Moreover, the main process can change the target rendering mode and restart the WebView child process for page rendering if the page rendering fails, which fully ensures the reliability of page rendering and can effectively improve the user experience.
[0037] This disclosure also provides specific implementation examples of the main process obtaining the page rendering result. For example, the method provided in this disclosure further includes: the main process obtaining the rendering result of the Webview subprocess on the page corresponding to the URL information based on the latest target rendering mode, so as to determine whether the page rendering has failed or succeeded based on the result. It is understood that the main process may change the target rendering mode passed to the Webview subprocess; therefore, the main process obtains the rendering result of the Webview subprocess on the page corresponding to the URL information based on the latest target rendering mode. This result can indicate whether the page rendering has failed or succeeded. In some specific implementation examples, the main process can refer to the following steps a and b to obtain the rendering result of the Webview subprocess on the page corresponding to the URL information based on the latest target rendering mode, including:
[0038] Step a: Upon receiving a rendering completion message from the WebView child process after rendering the page corresponding to the URL information based on the latest target rendering mode, the main process determines that it has obtained a result indicating that the page rendering is complete. In other words, if the main process receives a rendering completion message from the WebView child process, it means that the WebView child process supports the current target rendering mode, and the main process can then determine that the WebView child process has completed page rendering.
[0039] Step b involves determining if a crash occurs during the rendering of the page corresponding to the URL information by the WebView subprocess based on the latest target rendering mode, or if an exception message is received from the WebView subprocess during the rendering of the page corresponding to the URL information based on the latest target rendering mode. For example, if the target rendering mode is OpenGL, a missing OpenGL dynamic library on the device may cause the WebView subprocess to crash. Similarly, if the device's graphics card driver is incompatible with the OpenGL version used by WebView, the WebView subprocess may fail to create the OpenGL context and will actively report an exception message to the main process. Upon detecting a WebView subprocess crash or receiving an exception message from it, the main process can determine that the WebView subprocess has failed to render the page and can then take further measures, such as updating the target rendering mode or restarting the WebView subprocess to render the page using the updated target rendering mode.
[0040] In practical applications, the main process can obtain the WebView window handle corresponding to the WebView child process, and then display the page rendered by the WebView child process at the target location based on the WebView window handle. Specifically, the main process can obtain the WebView window handle corresponding to the WebView child process through IPC and embed it at the location (target location) that the main process needs to display, thus achieving the effect of displaying the child process page in the main process.
[0041] This embodiment integrates WebView functionality by creating an additional WebView subprocess from the main process. This allows for page rendering using a separate WebView subprocess. For example, the main process and the WebView subprocess communicate via IPC, specifically using Socket. The HTML page and the WebView page communicate via WebChannel. In practical applications, upon detecting events such as user-triggered events, the WebView can be reloaded to refresh the page, load a new URL, obtain the page loading status, and communicate with the web page to transmit interface data and other related messages. No further limitations are imposed here.
[0042] Based on the foregoing, we can refer to, for example Figure 2 The diagram illustrates the integration of WebView functionality. It shows how the main process integrates WebView functionality by creating a WebView subprocess. The main process can utilize the WebView subprocess to render the page based on rendering mode 1, rendering mode 2, ... up to rendering mode n. It should be noted that the WebView subprocess does not need to utilize all n rendering modes; it only needs to find a supported rendering mode that can complete the page rendering. On initial startup, the main process can attempt to get the WebView subprocess to use the target rendering mode specified by the main process. If this fails, the main process can update the target rendering mode based on the available n rendering modes and restart the WebView subprocess to try again, until the WebView subprocess successfully renders the page. The main process can store the rendering modes supported by the WebView subprocess (i.e., the rendering mode used by the WebView subprocess to complete the page rendering). On subsequent startups, the main process directly calls the rendering mode supported by the WebView subprocess as the target rendering mode, enabling the WebView subprocess to successfully complete the page rendering in one attempt based on that target rendering mode. In addition, it should be noted that the Webview subprocess can perform other tasks, such as event handling. For example, the Webview subprocess can handle user-triggered events accordingly, without limitation.
[0043] In summary, the page rendering method provided in this embodiment does not use the main process to directly embed Webview functionality for page rendering. Instead, it has the main process create an independent Webview subprocess and directly use the Webview subprocess for page rendering. This effectively avoids problems such as lag or even crashes that are easily caused by the main process rendering the page. Moreover, the main process can change the target rendering mode and restart the Webview subprocess for page rendering if page rendering fails, which fully ensures the reliability of page rendering and effectively improves the user experience.
[0044] Corresponding to the aforementioned page rendering method, this disclosure also provides a page rendering apparatus. Figure 3 This is a schematic diagram of a page rendering apparatus provided in an embodiment of the present disclosure. The apparatus can be implemented by software and / or hardware, and is generally integrated into an electronic device. Figure 3 As shown, the page rendering device 300 includes:
[0045] The subprocess creation module 302 is used to create a Webview subprocess from the main process corresponding to the target application. The Webview subprocess is used to handle Webview-related tasks.
[0046] The delivery module 304 is used by the main process to determine the target rendering mode corresponding to the Webview child process and to pass the target rendering mode and the Uniform Resource Locator (URL) information to the Webview child process.
[0047] The rendering module 306 is used by the Webview subprocess to render the page corresponding to the URL information based on the target rendering mode. If the main process determines that the page rendering has failed, it updates the target rendering mode and restarts the Webview subprocess to render the page based on the updated target rendering mode until the page rendering is complete.
[0048] In the aforementioned device, instead of directly embedding the WebView functionality into the main process for page rendering, the main process creates an independent WebView subprocess and directly uses the WebView subprocess for page rendering. This effectively avoids the stuttering or even crashes that can easily occur when the main process renders the page. Furthermore, the main process can switch the target rendering mode and restart the WebView subprocess for page rendering if page rendering fails, fully ensuring the reliability of page rendering and effectively improving the user experience.
[0049] In some implementations, the transmission module 304 is specifically used to: if the main process is starting for the first time, use a preset default rendering mode as the target rendering mode corresponding to the Webview subprocess; if the main process is not starting for the first time, obtain the pre-stored rendering modes supported by the Webview subprocess, and use the rendering modes supported by the Webview subprocess as the target rendering mode; wherein, the rendering modes supported by the Webview subprocess are determined and stored by the main process during the first startup, and the rendering modes supported by the Webview subprocess are the modes used by the Webview subprocess to complete page rendering.
[0050] In some embodiments, the apparatus further includes a result determination module, used by the main process to obtain the result of the Webview subprocess rendering the page corresponding to the URL information based on the latest target rendering mode, so as to determine whether the page rendering has failed or the page rendering has been completed based on the result.
[0051] In some implementations, the result determination module is specifically used to: determine that the page rendering is complete when receiving a rendering completion message reported by the Webview subprocess after rendering the page corresponding to the URL information based on the latest target rendering mode; and determine that the page rendering has failed when detecting a crash during the rendering of the page corresponding to the URL information by the Webview subprocess based on the latest target rendering mode, or when receiving an exception message reported by the Webview subprocess during the rendering of the page corresponding to the URL information based on the latest target rendering mode.
[0052] In some implementations, the rendering module 306 is specifically used to: update the target rendering mode based on a preset number of candidate rendering modes.
[0053] In some implementations, the multiple candidate rendering modes include OpenGL rendering mode and CPU rendering mode.
[0054] In some embodiments, the apparatus further includes a display module, used by the main process to obtain the Webview window handle corresponding to the Webview child process, so as to display the page rendered by the Webview child process at the target location based on the Webview window handle.
[0055] The page rendering apparatus provided in this disclosure can execute the page rendering method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of executing the method.
[0056] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device embodiments can be referred to the corresponding process in the method embodiments, and will not be repeated here.
[0057] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only, and are not intended to imply otherwise.
[0058] Exemplary embodiments of this disclosure also provide an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to cause the electronic device to perform a method according to an embodiment of this disclosure.
[0059] Exemplary embodiments of this disclosure also provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a computer's processor, is used to cause the computer to perform a method according to embodiments of this disclosure.
[0060] Exemplary embodiments of this disclosure also provide a computer program product, including a computer program, wherein, when executed by a processor of a computer, the computer program is used to cause the computer to perform a method according to an embodiment of this disclosure.
[0061] The computer program product can be written in any combination of one or more programming languages to perform the operations of the embodiments of this disclosure. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on a user's computing device, partially on a user's computing device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0062] Furthermore, embodiments of this disclosure can also be computer-readable storage media storing computer program instructions that, when executed by a processor, cause the processor to perform the page rendering method provided in embodiments of this disclosure. The computer-readable storage medium can be any combination of one or more readable media. A readable medium can be a readable signal medium or a readable storage medium. A readable storage medium can be, for example, including but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0063] refer to Figure 4 The present invention describes a structural block diagram of an electronic device 400 that can serve as a server or client of the present disclosure, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0064] like Figure 4 As shown, the electronic device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. The RAM 403 may also store various programs and data required for the operation of the device 400. The computing unit 401, ROM 402, and RAM 403 are interconnected via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0065] Multiple components in electronic device 400 are connected to I / O interface 405, including: input unit 406, output unit 407, storage unit 408, and communication unit 409. Input unit 406 can be any type of device capable of inputting information to electronic device 400. Input unit 406 can receive input digital or character information and generate key signal inputs related to user settings and / or function control of electronic device. Output unit 407 can be any type of device capable of presenting information and may include, but is not limited to, a display, speaker, video / audio output terminal, vibrator, and / or printer. Storage unit 408 may include, but is not limited to, disks and optical discs. Communication unit 409 allows electronic device 400 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers, and / or chipsets, such as Bluetooth™ devices, WiFi devices, WiMa4 devices, cellular communication devices, and / or the like.
[0066] The computing unit 401 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 401 performs the various methods and processes described above. For example, in some embodiments, the page rendering method can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 408. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 400 via ROM 402 and / or communication unit 409. In some embodiments, the computing unit 401 can be configured to perform the page rendering method by any other suitable means (e.g., by means of firmware).
[0067] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0068] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0069] As used in this disclosure, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or apparatus (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including machine-readable media that receive machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0070] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0071] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0072] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.
[0073] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0074] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A page rendering method, comprising: The main process of the target application creates a WebView child process; If the main process is being launched for the first time, the main process will use the preset default rendering mode as the target rendering mode for the Webview child process; If the main process is not starting for the first time, the main process obtains the rendering modes supported by the Webview subprocess that are pre-stored, and uses the rendering modes supported by the Webview subprocess as the target rendering mode; wherein, the rendering modes supported by the Webview subprocess are determined and stored by the main process during the first startup, and the rendering modes supported by the Webview subprocess are the modes used by the Webview subprocess to complete page rendering. The main process passes the target rendering mode and the Uniform Resource Locator (URL) information to the Webview child process. The Webview subprocess renders the page corresponding to the URL information based on the target rendering mode. If the main process determines that the page rendering has failed, it updates the target rendering mode and restarts the Webview subprocess to render the page based on the updated target rendering mode until the page rendering is complete.
2. The page rendering method as described in claim 1, wherein, The method further includes: The main process obtains the result of the Webview subprocess rendering the page corresponding to the URL information based on the latest target rendering mode, and determines whether the page rendering has failed or the page rendering has been completed based on the result.
3. The page rendering method as described in claim 2, wherein, The step of obtaining the result of the Webview subprocess rendering the page corresponding to the URL information based on the latest target rendering mode includes: Upon receiving a rendering completion message reported by the Webview subprocess after rendering the page corresponding to the URL information based on the latest target rendering mode, it is determined that a result indicating that the page rendering is complete has been obtained. If a crash is detected during the rendering of the page corresponding to the URL information by the Webview subprocess based on the latest target rendering mode, or if an exception message is received from the Webview subprocess during the rendering of the page corresponding to the URL information based on the latest target rendering mode, it is determined that a result indicating that the page rendering has failed is obtained.
4. The page rendering method as described in claim 1, wherein, The step of updating the target rendering mode includes: The target rendering mode is updated based on a variety of preset candidate rendering modes.
5. The page rendering method as described in claim 4, wherein, The various candidate rendering modes include OpenGL rendering mode and CPU rendering mode.
6. The page rendering method as described in claim 1, wherein, The method further includes: The main process obtains the Webview window handle corresponding to the Webview child process, and displays the page rendered by the Webview child process at the target location based on the Webview window handle.
7. A page rendering apparatus, comprising: The child process creation module is used to create WebView child processes from the main process of the target application. The delivery module is used so that if the main process is starting for the first time, the main process will use the preset default rendering mode as the target rendering mode corresponding to the Webview child process. If the main process is not starting for the first time, the main process obtains the pre-stored rendering modes supported by the WebView child process and uses the rendering modes supported by the WebView child process as the target rendering mode; wherein, the rendering modes supported by the WebView child process are determined and stored by the main process during the first startup, and the rendering modes supported by the WebView child process are the modes used by the WebView child process to complete page rendering; the main process passes the target rendering mode and the Uniform Resource Locator (URL) information to the WebView child process; The rendering module is used by the Webview subprocess to render the page corresponding to the URL information based on the target rendering mode, and when the main process determines that the page rendering has failed, it updates the target rendering mode and restarts the Webview subprocess to render the page based on the updated target rendering mode until the page rendering is completed.
8. An electronic device, comprising: processor; as well as Stored program memory, The program includes instructions that, when executed by the processor, cause the processor to perform the page rendering method according to any one of claims 1-6.
9. A computer-readable storage medium, wherein, The storage medium stores a computer program for executing the page rendering method according to any one of claims 1-6.
Citation Information
Patent Citations
User page processing method and device, electronic equipment and storage medium
CN110806905A
Page rendering method and device, electronic equipment and storage medium
CN114218890A