A page rendering method, apparatus and device
By creating a proxy webpage view control on the mobile device and obtaining view tree attribute information, the rendering anomaly caused by memory reclamation in WebView was resolved, enabling rapid recovery of page rendering and seamless business continuity.
Patent Information
- Application Number
- CN202310600887.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-25
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2043-05-25
AI Technical Summary
The rendering anomalies caused by memory reclamation in mobile WebViews are not applicable to the independent WebView process rendering architecture due to the existing operating system view reconstruction mechanism.
By creating a proxy webpage view control on the target page, detecting memory reclamation events, obtaining the attribute information of the child webpage view from the view tree, and loading the target attribute information using the proxy webpage view control, the child webpage view can be quickly reconstructed.
This avoids rendering anomalies caused by memory reclamation, and the reconstruction process is imperceptible to upper-layer business logic, enabling rapid recovery of page rendering.
Smart Images

Figure CN116628371B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of page display, and in particular to a page rendering method, device and equipment. BACKGROUND
[0002] The mobile terminal Android & iOS page is designed as a view page structure based on View. Thus, after the memory of the operating system is recycled, the UI of the view View will be reconstructed when the page is re-rendered. Since the WebView is an independent process rendering mechanism on the mobile terminal, the view reconstruction mechanism designed by the operating system is not applicable to the independent WebView process rendering architecture, so the rendering abnormal phenomenon caused by the recycling of the WebView memory often occurs on the mobile terminal. SUMMARY
[0003] Therefore, the present application provides a page rendering method, device and client to solve the rendering abnormal problem caused by the recycling of the operating system memory.
[0004] The first aspect of the present application provides a page rendering method applied to a client, and the method comprises:
[0005] After loading a target page by using a global web view control, a proxy web view control is created on the target page;
[0006] When detecting a memory recycling event for a target sub-web view on the target page, target attribute information corresponding to the target sub-web view is obtained from the attribute information of each sub-web view on the view tree corresponding to the target page which has been saved;
[0007] The target attribute information is loaded by using the proxy web view control to reconstruct the target sub-web view.
[0008] Further, the attribute information of each sub-web view on the view tree corresponding to the target page is saved when the proxy web view control is created;
[0009] Or;
[0010] The attribute information of each sub-web view on the view tree corresponding to the target page is saved when the target page is loaded.
[0011] Further, the loading of the attribute information of the target sub-web view by using the proxy web view control comprises:
[0012] When detecting a memory recycling event for a target sub-web view on the target page, the state parameter of the target sub-web view is marked as a dirty state;
[0013] When the page switches back to the foreground, the attribute information of the target sub-page view is loaded by using the proxy web view control for the target sub-page view with the state parameter being the dirty state.
[0014] Further, the life cycle of the proxy web view control is the same as that of the global web view control, and the functions that can be called by the proxy web view control are the same as those that can be called by the global web view control.
[0015] Further, the step of loading the target page by using the global web view control comprises:
[0016] obtaining the attribute information of each sub-page view on the view tree corresponding to the target page;
[0017] loading the attribute information to load the target page.
[0018] The second aspect of the application provides a page rendering device, the device is applied to the client, the device comprises a creating module, an obtaining module and a rebuilding module; wherein,
[0019] The creating module is used to create a proxy web view control on the target page after loading the target page by using the global web view control.
[0020] The obtaining module is used to obtain target attribute information corresponding to a target sub-page view from the attribute information of each sub-page view on the view tree corresponding to the target page that has been saved when detecting a memory recycling event for the target sub-page view on the target page.
[0021] The rebuilding module is used to load the target attribute information by using the proxy web view control to rebuild the target sub-page.
[0022] Further, the attribute information of each sub-page view on the view tree corresponding to the target page is saved when the proxy web view control is created.
[0023] Or;
[0024] The attribute information of each sub-page view on the view tree corresponding to the target page is saved when the target page is loaded.
[0025] Further, the rebuilding module is specifically used to mark the state parameter of the target sub-page as a dirty state when detecting a memory recycling event for the target sub-page view on the target page, and load the attribute information of the target sub-page view by using the proxy web view control for the target sub-page with the state parameter being the dirty state when the page switches back to the foreground.
[0026] Further, the proxy web view control has the same life cycle as the global web view control, and the proxy web view control can call the same functions as the global web view control.
[0027] Further, the reconstruction module is further configured to acquire attribute information of each sub-web view on the view tree corresponding to the target page, and load the attribute information to load the target page.
[0028] The third aspect of the present application provides a client, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any of the methods provided in the first aspect of the present application.
[0029] The fourth aspect of the present application provides a computer readable storage medium, which stores a computer program, wherein the program is executed by a processor to implement the steps of any of the methods provided in the first aspect of the present application.
[0030] The page rendering method, device and client provided in the present application can quickly reconstruct the target sub-web view, avoid rendering abnormal problems caused by memory recycling, and the reconstruction process is not sensed by the upper layer business. BRIEF DESCRIPTION OF DRAWINGS
[0031] Figure 1 is a flowchart of the page rendering method provided in the first embodiment of the present application;
[0032] Figure 2 is a flowchart of the page rendering method provided in the second embodiment of the present application;
[0033] Figure 3 is a hardware structure diagram of a client where the page rendering device provided in the present application is located;
[0034] Figure 4 is a structural schematic diagram of the page rendering device provided in the first embodiment of the present application. DETAILED DESCRIPTION
[0035] The exemplary embodiments will be described in detail herein with reference to the attached drawings. In the following description, like reference numerals refer to like elements, unless the context clearly dictates otherwise. The following description of exemplary embodiments is not intended to represent all embodiments in accordance with the present application. Rather, they are merely examples in accordance with some aspects of the present application as detailed in the appended claims.
[0036] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0037] It is to be understood that the singular forms "a", "an", and "the" include plural referents unless the context clearly dictates otherwise. It is to be further understood that the term "or" as used herein encompasses both exclusive and inclusive or unless otherwise indicated herein. It is to be further understood that the terms "comprises", "comprising", "includes", "including", "has", "having" and the like are inclusive and are intended to be equivalent to the term "consisting of".
[0038] The present application provides a page rendering method, device and equipment to solve the rendering abnormal problem caused by memory recycling of operating system.
[0039] The present application provides a page rendering method and device, which is applied to a client. The client can be an App client. In the present application, the specific form of the client is not limited. For example, in a possible implementation, the client can be a Momo client.
[0040] The page rendering method provided by the present application can quickly reconstruct the target sub-web view after loading the target page by using the global web view control, avoid the rendering abnormal problem caused by memory recycling, and the reconstruction process is not sensed by the upper layer service.
[0041] Several specific embodiments are given below to explain the technical solutions of the present application in detail.
[0042] Figure 1 The flowchart of the page rendering method embodiment provided in the present application is shown in FIG. 1. Figure 1 The method provided in the present application can include the following steps.
[0043] S101, after loading a target page by using a global web view control, creating a proxy web view control on the target page.
[0044] It should be noted that the target page corresponds to a view tree, and each node on the view tree contains a sub-web page. Further, the global web view control refers to a system web view control, specifically, a webview control that can be called by any client.
[0045] Further, the proxy web view control can be created by using a related web view control creation method, and in the present embodiment, the specific creation method is not limited.
[0046] Optionally, in a possible implementation, the life cycle of the proxy web view control is the same as that of the global web view control, and the functions that can be called by the proxy web view control are the same as those that can be called by the global web view control.
[0047] Specifically, by setting the life cycle of the proxy web view control to be the same as that of the global web view control, and by making the functions that can be called by the proxy web view control the same as those that can be called by the global web view control, the upper-layer business code can use the proxy web view control as if it uses the global web view control, and the smooth replacement of the business can be ensured.
[0048] S102, after detecting a memory recycling event for a target sub-web view on the target page, obtaining target attribute information corresponding to the target sub-web view from the saved attribute information of each sub-web view on the view tree corresponding to the target page.
[0049] Specifically, the client detects the memory recycling event in real time or according to a preset time interval. In addition, the saved attribute information of each sub-web view on the view tree corresponding to the target page can be saved when the proxy web view control is created, or can be saved when the target page is loaded, and in the present embodiment, this is not limited. Further, the attribute information of each sub-web view on the view tree corresponding to the target page can be saved in a specified location, and in the present application, the specified location is not limited.
[0050] It should be noted that by loading the attribute information of any sub-web view, the purpose of loading the sub-web view can be achieved. The attribute information can include parameter information, state information, and width and height dimensions of the sub-web view.
[0051] S103, loading the target attribute information by using the agent web view control, to reconstruct the target sub-web page.
[0052] In a specific implementation, after detecting the memory recycling event for the target sub-web page view, the state parameter of the sub-web page view is updated to the dirty state, and then when the page switches back to the foreground, for the sub-web page view with the dirty state parameter, the sub-web page view is reconstructed according to the attribute parameter of the sub-web page view, so as to achieve the effect of restoring the page rendering.
[0053] The method provided in this embodiment, after loading the target page by using the global web view control, creates an agent web view control on the target page, and then after detecting the memory recycling event for the target sub-web page view on the target page, obtains the target attribute information corresponding to the target sub-web page view from the attribute information of each sub-web page view on the view tree corresponding to the target page that has been saved, and loads the target attribute information by using the agent web view control. In this way, the target sub-web page view can be quickly reconstructed, rendering abnormal problems caused by memory recycling can be avoided, and the reconstruction process is not sensitive to the upper-layer business.
[0054] Figure 2 The flowchart of the second embodiment of the page rendering method provided in this application is shown in FIG. 2. Figure 2 The method provided in this embodiment, on the basis of the above-mentioned embodiments, the step of loading the target page by using the global web view control can include:
[0055] S201, obtaining the attribute information of each sub-web page view on the view tree corresponding to the target page.
[0056] S202, loading the attribute information to load the target page.
[0057] Specifically, the attribute information of each sub-web page view on the view tree corresponding to the target page can be obtained from a server. Further, the attribute information is loaded to achieve the purpose of loading the target page.
[0058] The method provided in this embodiment gives a method of loading a target page by using a global web view control, and by using the method, the page rendering can be achieved.
[0059] Corresponding to the above-mentioned embodiments of the page rendering method, the application further provides an embodiment of a page rendering device.
[0060] Embodiments of the page rendering apparatus of the present application can be applied on a client. The apparatus embodiments can be implemented by software, or by hardware, or by a combination of software and hardware. Taking the software implementation as an example, as a logical apparatus, it is formed by reading the corresponding computer program instructions in the non-volatile memory into the memory for execution by the processor of the client where the apparatus is located. From the hardware perspective, as shown in Figure 3 FIG. 1 is a hardware structure diagram of a client where the page rendering apparatus of the present application is located. In addition to the processor, the memory, the network interface, and the storage shown in Figure 3 , the client where the apparatus is located in the embodiments can also include other hardware according to the actual functions of the page rendering apparatus, and further description is omitted.
[0061] Figure 4 FIG. 2 is a structure diagram of the page rendering apparatus embodiment one provided by the present application. Please refer to Figure 4 The page rendering apparatus provided by the present embodiment can include a creating module 410, an obtaining module 420, and a reconstructing module 430, wherein,
[0062] The creating module 410 is configured to create a proxy web view control on a target page after loading the target page by using a global web view control.
[0063] The obtaining module 420 is configured to obtain target attribute information corresponding to a target sub-web view from attribute information of each sub-web view on a view tree corresponding to the target page that has been saved after detecting a memory recycling event for the target sub-web view on the target page.
[0064] The reconstructing module 430 is configured to load the target attribute information by using the proxy web view control to reconstruct the target sub-web page.
[0065] The implementation process of the functions and roles of each unit in the above apparatus is specifically described in the implementation process of the corresponding steps in the above method, and further description is omitted.
[0066] Further, the attribute information of each sub-web view on the view tree corresponding to the target page is saved when the proxy web view control is created.
[0067] Or
[0068] The attribute information of each sub-web view on the view tree corresponding to the target page is saved when the target page is loaded.
[0069] Further, the reconstructing module 430 is configured to mark a state parameter of the target sub-web page as dirty when detecting a memory recycling event for the target sub-web view on the target page.
[0070] The reconstruction module 430 is further configured to load attribute information of the target sub-page view by using the proxy page view control for the target sub-page with the state parameter being the dirty state when the page switches back to the foreground.
[0071] Further, the life cycle of the proxy page view control is the same as that of the global page view control, and the functions that can be invoked by the proxy page view control are the same as those that can be invoked by the global page view control.
[0072] Further, the reconstruction module 430 is further configured to acquire attribute information of each sub-page view on a view tree corresponding to the target page, and load the attribute information to load the target page.
[0073] For the device embodiment, since it basically corresponds to the method embodiment, the relevant part can be referred to the part of the method embodiment. The device embodiment described above is merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed to multiple network units. According to actual needs, part or all of the modules can be selected to achieve the purpose of the present application. Those skilled in the art can understand and implement it without creative labor.
[0074] The above only describes the preferred embodiment of the present application and is not used to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A page rendering method, characterized in that, The method is applied to a client, and the method includes: After loading the target page using the global webpage view control, a proxy webpage view control is created on the target page; When a memory reclamation event is detected for a target sub-page view on the target page, the target attribute information corresponding to the target sub-page view is obtained from the attribute information of each sub-page view in the view tree corresponding to the target page that has been saved. The target attribute information is loaded using the proxy webpage view control to reconstruct the target subpage, wherein when a memory reclamation event for the target subpage view on the target page is detected, the state parameter of the target subpage is marked as dirty. When the page switches back to the foreground, for the target subpage whose status parameter is dirty, the attribute information of the target subpage view is loaded using the proxy webpage view control.
2. The method according to claim 1, characterized in that, The attribute information of each sub-page view in the view tree corresponding to the target page is saved when the proxy page view control is created; or; The attribute information of each sub-page view in the view tree corresponding to the target page is saved when the target page is loaded.
3. The method according to claim 1, characterized in that, The lifecycle of the proxy webpage view control is the same as that of the global webpage view control, and the functions that the proxy webpage view control can call are the same as those that the global webpage view control can call.
4. The method according to claim 1, characterized in that, The steps for loading a target page using a global webpage view control include: Obtain the attribute information of each sub-page view in the view tree corresponding to the target page; Load the attribute information to load the target page.
5. A page rendering device, characterized in that, The device is applied to a client and includes a creation module, an acquisition module, and a reconstruction module; wherein... The creation module is used to create a proxy webpage view control on the target page after the target page is loaded using the global webpage view control. The acquisition module is used to acquire the target attribute information corresponding to the target sub-page view from the attribute information of each sub-page view in the view tree corresponding to the target page when a memory reclamation event for the target sub-page view on the target page is detected. The reconstruction module is used to load the target attribute information using the proxy webpage view control to reconstruct the target sub-webpage, wherein when a memory reclamation event is detected for the target sub-webpage view on the target page, the status parameter of the target sub-webpage is marked as dirty. When the page switches back to the foreground, for the target subpage whose status parameter is dirty, the attribute information of the target subpage view is loaded using the proxy webpage view control.
6. The apparatus according to claim 5, characterized in that, The attribute information of each sub-page view in the view tree corresponding to the target page is saved when the proxy page view control is created; or; The attribute information of each sub-page view in the view tree corresponding to the target page is saved when the target page is loaded.
7. The apparatus according to claim 5, characterized in that, The reconstruction module is specifically used to mark the state parameter of the target sub-page as dirty when a memory reclamation event is detected for the target sub-page view on the target page, and to load the attribute information of the target sub-page view using the proxy webpage view control when the page switches back to the foreground for the target sub-page whose state parameter is dirty.
8. A client device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method according to any one of claims 1-4.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by a processor, it implements the steps of the method according to any one of claims 1-4.
Citation Information
Patent Citations
Display device for three-dimensional webpage and application of display device
CN102867026A
Page rendering method and device
CN108170497A