CN113127780A - Page loading method and device and electronic equipment - Google Patents

Page loading method and device and electronic equipment Download PDF

Info

Publication number
CN113127780A
CN113127780A CN202110310567.9A CN202110310567A CN113127780A CN 113127780 A CN113127780 A CN 113127780A CN 202110310567 A CN202110310567 A CN 202110310567A CN 113127780 A CN113127780 A CN 113127780A
Authority
CN
China
Prior art keywords
node
page
data
target
node tree
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110310567.9A
Other languages
Chinese (zh)
Inventor
方晓华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Priority to CN202110310567.9A priority Critical patent/CN113127780A/en
Publication of CN113127780A publication Critical patent/CN113127780A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The application discloses a page loading method and device and electronic equipment, belongs to the technical field of communication, and solves the problems that page jamming is caused in the page loading process of the electronic equipment, and even the electronic equipment is jammed or crashed. Specifically, the method comprises the following steps: under the condition that a target page is displayed on a target interface, acquiring a node tree corresponding to the target page, wherein the node tree comprises at least one node; under the condition that a preset condition is met, removing a target node corresponding to the page content which is not displayed in the visual area of the target interface; wherein the target node is a node in the node tree. The application is applied to the page loading process.

Description

Page loading method and device and electronic equipment
Technical Field
The application belongs to the technical field of communication, and particularly relates to a page loading method and device and electronic equipment.
Background
With the development of computer technology and communication technology, more and more services are implemented through web pages of electronic devices. In the related art, the fast presentation of the web page is usually realized by the hypertext 5.0(HTML5, H5) technology. Meanwhile, when the electronic device displays the H5 long page, the user can trigger the electronic device to load the page content of the H5 long page by performing a slide-down operation on the display screen.
However, when the duration of the roll-down operation is too long, the page length of the H5 long page is increased, so that data required by the electronic device to render and redraw the H5 long page is also increased, and further, the memory and cpu performance required by the electronic device are also increased, and finally the long page is stuck or even the web client corresponding to the page is stuck or rushed.
Disclosure of Invention
The embodiment of the application aims to provide a page loading method and device and electronic equipment, and the page loading method and device and the electronic equipment can solve the problems that the page is stuck and even the electronic equipment is stuck or crashed in the page loading process of the electronic equipment.
In order to solve the technical problem, the present application is implemented as follows:
in a first aspect, an embodiment of the present application provides a page loading method, where the method includes: under the condition that a target page is displayed on a target interface, acquiring a node tree corresponding to the target page, wherein the node tree comprises at least one node; under the condition that a preset condition is met, removing a target node corresponding to the page content which is not displayed in the visual area of the target interface; and the target nodes are nodes in a node tree.
In a second aspect, an embodiment of the present application provides a page loading apparatus, including: the acquisition module is used for acquiring a node tree corresponding to a target page under the condition that the target page is displayed on a target interface, wherein the node tree comprises at least one more node; the removing module is used for removing the target node which is obtained by the obtaining module and corresponds to the page content which is not displayed in the visual area of the target interface under the condition that a preset condition is met; and the target nodes are nodes in a node tree.
In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program stored on the memory and executable on the processor, and when the program is executed by the processor, the method according to the first aspect is implemented.
In a fourth aspect, the present application provides a readable storage medium, on which a program is stored, which when executed by a processor implements the steps of the method according to the first aspect.
In a fifth aspect, an embodiment of the present application provides a chip, where the chip includes a processor and a communication interface, where the communication interface is coupled to the processor, and the processor is configured to run a program to implement the method according to the first aspect.
In a sixth aspect, the present application provides a computer program product stored on a non-volatile storage medium, the program product being executed by at least one processor to implement the method according to the first aspect.
In the embodiment of the application, under the condition that the target page is displayed on the target interface, the electronic device obtains the node tree corresponding to the target page, and as more nodes are in the node tree, the consumed memory and cpu performance of the electronic device are higher, so that under the condition that the preset condition is met, the nodes in the node tree corresponding to the page content which is not displayed in the visible area of the target interface are removed, and thus the memory is released, the memory and cpu performance of the electronic device are prevented from being consumed by the target node, and the problems that the page is jammed and even the web client corresponding to the page is jammed or crashed in the page loading process of the electronic device are avoided. Meanwhile, in the page loading process, the number of the nodes in the node tree is controlled, so that the node tree is always kept at a lower number level, and the memory and the cpu performance consumed by the electronic equipment are always controlled to be kept within a certain range, and therefore, the page content to be checked by a user is smoothly loaded and displayed on a target interface of the electronic equipment.
Drawings
Fig. 1 is a schematic flowchart of a page loading method according to an embodiment of the present application;
fig. 2 is a schematic view of a display effect of a content block of a target page in a target interface, which corresponds to the page loading method provided in the embodiment of the present application;
fig. 3 is one of schematic content block movement diagrams corresponding to a page loading method provided in the embodiment of the present application;
fig. 4 is a second schematic diagram of moving content blocks corresponding to the page loading method according to the embodiment of the present application;
fig. 5 is a third schematic diagram illustrating a content block movement corresponding to a page loader according to an embodiment of the present application;
fig. 6 is a second schematic flowchart of a page loading method according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a page loading apparatus according to an embodiment of the present application;
fig. 8 is a second schematic structural diagram of a page loading apparatus according to an embodiment of the present application;
fig. 9 is a hardware schematic diagram of an electronic device according to an embodiment of the present application;
fig. 10 is a second hardware schematic diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms first, second and the like in the description and in the claims of the present application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that embodiments of the application may be practiced in sequences other than those illustrated or described herein, and that the terms "first," "second," and the like are generally used herein in a generic sense and do not limit the number of terms, e.g., the first term can be one or more than one. In addition, "and/or" in the specification and claims means at least one of connected objects, a character "/" generally means that a preceding and succeeding related objects are in an "or" relationship.
Technical terms mentioned in the embodiments of the present application will be exemplified below.
1) Node tree
Illustratively, a node tree is a data structure tree, which is a set having a hierarchical relationship and composed of n (n > ═ 1) finite nodes, and generally includes a DOM tree, a CSSOM tree, and the like.
Generally, a page corresponds to a node tree, and each node tree includes a plurality of nodes.
2) Data queue
Generally, a node tree corresponds to a data queue, a plurality of data are stored in the data queue, and one data corresponds to one node in the node tree.
Generally, if a page is to be loaded, first, data in a data list corresponding to the page needs to be acquired from a server, then the acquired data is added to a data queue corresponding to the page, corresponding nodes are generated based on the data in the data queue, then a node tree is constructed based on the obtained nodes, and finally the node tree is rendered into a complete page (i.e., the page to be loaded).
The following will take H5 long page as an example, and an exemplary description will be given to the process of acquiring the data queue of the page.
For example 1, after receiving a page loading request of an H5 long page, the page loading apparatus may obtain, from the server, first page data in a data list corresponding to the H5 long page, where the first page data includes multiple pieces of data (e.g., includes 10 pieces of data). Then, a data queue corresponding to the H5 long page is generated according to the plurality of pieces of data in the first page of data, and the data in the data queue is sorted according to the arrangement order of the data in the first page of data. Then, when the page loading device receives a request that the user continues to view the H5 long page, the page loading device acquires the second page data in the data list corresponding to the H5 long page from the server, and adds the data in the second page data to the data queue.
Further, the following will illustrate how to obtain the rendered H5 long page by using the data queue of the H5 long page in conjunction with the above example 1.
Example 2, the page loading apparatus combines data in the data queue with a preset HTML template to obtain a node corresponding to each piece of data in the data queue, then constructs a corresponding DOM tree based on the nodes, and finally renders the DOM tree to obtain a rendered H5 long page (i.e., an H5 long page to be loaded). Further, after rendering the DOM tree, a page content block corresponding to each node in the DOM tree is obtained (note that the page content block is page content that can be directly displayed after rendering). For example, if the DOM tree contains X nodes, X page content blocks are obtained.
It should be noted that all page content blocks in the embodiments of the present application may be simply referred to as content blocks.
The page loading method provided by the embodiment of the present application is described in detail below with reference to the accompanying drawings through specific embodiments and application scenarios thereof.
The embodiment of the application provides a page loading method. As shown in fig. 1, the method may include steps 101 to 102 described below.
Step 101, a page loading device acquires a node tree corresponding to a target page under the condition that the target page is displayed on a target interface.
In an embodiment of the present application, the node tree includes at least one node.
Optionally, in this embodiment of the application, the target page may be a long page (e.g., H5 long page). Illustratively, when a user loads an H5 long page through a web client, a target interface displays a target page, and the page loading device obtains a node tree corresponding to the target page, thereby obtaining nodes in the node tree.
Optionally, in this embodiment of the application, the target page is composed of a plurality of content blocks.
It should be noted that the node tree of the target page includes a plurality of nodes, and each node generates a content block after corresponding data in the data queue of the target page is rendered, that is, each node corresponds to a content block.
It should be noted that, in this embodiment of the application, before the target interface displays the target page, the page loading apparatus may first calculate the height of the visible area (i.e., screen _ right), then obtain the target data meeting the specific condition in the data queue corresponding to the target page based on the height of the visible area, and finally display the page content block corresponding to the target data meeting the specific condition on the visible area of the target interface. The sum of the minimum heights (which may be referred to as min _ height) of the page content blocks corresponding to the target data is greater than or equal to screen _ right. It is understood that the sum of the minimum heights of the content blocks corresponding to the nodes contained in the target page is greater than or equal to the height of the visible area of the target interface, such as the height sum of the content blocks 1 to 4 in fig. 2 is greater than the height of the visible area.
For example, assuming that a data queue corresponding to an H5 long page contains 10 pieces of data, if the page loading apparatus selects the first 4 consecutive pieces of data from the data queue, the page content block corresponding to the 4 pieces of data is displayed on the visible area of the target interface. Specifically, with reference to example 1, after the page loading apparatus receives the page loading request of the H5 long page, the page loading apparatus calculates the height of the visible area (i.e., screen _ right), and then determines whether the 4 pieces of data satisfy the specific condition based on the screen _ right, for example, if the min _ height of the page content blocks corresponding to the 4 pieces of data is added to 300+300+200+400 — 1200px, and 1200px is greater than 1000px (i.e., screen _ right), it is determined that the 4 pieces of data satisfy the specific condition.
102, under the condition that a preset condition is met, removing a target node corresponding to page content which is not displayed in a visible area of a target interface by a page loading device; and the target node is a node in the node tree.
In this embodiment of the application, the visual area is an area in which a user can view a target page through a visual window of the electronic device. In general, for a user, the content of a page that the user is interested in is only the content of the page corresponding to the part of the node displayed in the visible area of the target interface, and other parts (i.e., target nodes in the node tree that is not displayed in the visible area of the target interface) belong to hidden or occluded parts that are not interested by the user, and may not need to be rendered in the node tree of the page. Therefore, the page loading device removes the target node in the node tree which is not displayed in the visible area of the target interface, and avoids the situation that the concerned node consumes memory and cpu performance.
Optionally, in an embodiment of the present application, the satisfaction of the predetermined condition includes any one of: the number of the nodes contained in the node tree meets the preset number, and the page loading device receives a first input of a user.
Illustratively, the first input is for inserting a first node into the node tree.
In one example, the first input may be a gesture input, a voice input, or other feasibility input. Specifically, the gesture input may include a sliding input (e.g., a sliding input on the target interface) or a clicking input at a corresponding position in the target interface (e.g., a clicking input on the upper half or a clicking input on the lower half of the target interface).
In one example, the first input is: and in the case of displaying the target page, continuing to load the input of the page content of the target page. For example, when the user needs to continue to view the page content, the user may perform a downslide operation in the visible area, so that the page content in the visible area is updated in real time along with the downslide operation of the user, and meanwhile, the number of nodes in the node tree may also increase in real time.
It should be noted that the predetermined number may be set according to the memory of the electronic device and the cpu performance, specifically, the predetermined number may be set based on the principle that page content can be normally loaded and the memory of the electronic device and the cpu performance are prevented from being excessively occupied. Therefore, the preset quantity with different sizes is set according to the conditions of different electronic devices, and when the quantity of the nodes in the node tree meets the preset quantity, the page loading device removes the target nodes in the node tree which are not displayed in the visible area of the target interface.
Optionally, in this embodiment of the present application, the target node is: and nodes corresponding to the content blocks to be hidden in the visual area of the current target interface.
Illustratively, the above content blocks to be hidden are: the page loading device is used for monitoring the distance between the top and the bottom of each content block displayed in the visible area and the head of the visible area and the distance between the top and the bottom of each content block and the tail of the visible area.
Illustratively, the page loading device monitors the location of each piece of content within the viewable area in real time as the user views the page content. As shown in fig. 5, taking the content block 3 as an example, the page loading device monitors, in real time, a distance 1 between the top of the content block 3 and the head of the visible area (which may be referred to as top _ gap _1), a distance 2 between the bottom of the content block 3 and the head of the visible area (which may be referred to as top _ gap _2), a distance 3 between the top of the content block 3 and the tail of the visible area (which may be referred to as bottom _ gap _1), and a distance 4 between the bottom of the content block 3 and the tail of the visible area (which may be referred to as bottom _ gap _ 2).
For example, taking the first input as a sliding input of sliding upwards as an example, as shown in fig. 3, when the user slides the page upwards, according to the monitored values of top _ gap _1, top _ gap _2, bottom _ gap _1, and bottom _ gap _2 of each content block, it is determined whether the target node corresponding to each content block is completely hidden outside the window (i.e., not displayed in the visible area of the target interface), and the target node satisfying a predetermined condition among the nodes that are hidden (i.e., not displayed in the visible area of the target interface) is removed from the node tree of the page. For example, referring to fig. 3, as shown in fig. 5, during the process of sliding the page upward by the content block 2 in fig. 5, the value of top _ gap _2 (i.e. the distance 2 of the content block 2 in fig. 5) gradually decreases, and when the value is less than or equal to 0, the node corresponding to the content block 2 (i.e. the target node) may be removed from the DOM tree of the page to release the memory.
For example, taking the first input as a sliding input of sliding down as an example, as shown in fig. 4, when the user slides down the page, the distances between the top and the bottom of each content block and the head and the tail of the visible area are reversely determined to determine whether the target node corresponding to each content block is completely hidden outside the window, and the target node satisfying a predetermined condition among the hidden nodes is removed from the node tree of the page. For example, referring to fig. 5 in conjunction with fig. 4, in the process of the content block 5 in fig. 5 sliding down the page, the value of bottom _ gap _1 (i.e. the distance 3 of the content block 5 in fig. 5) gradually decreases, and when the value is less than or equal to 0, the node corresponding to the content block 5 (i.e. the target node) may be removed from the DOM tree of the page to release the memory.
Therefore, by removing the hidden target node in the node tree, the situation that the concerned node consumes the memory and the cpu performance is avoided, and the problem that the page is more and more clamped can be avoided in the page loading process.
Optionally, in this embodiment of the present application, the target node is: a target node satisfying a first condition at a first time. Wherein, the first time of any node is: a duration of time during which any of the nodes is not displayed within the viewable area.
In one example, different first conditions may be set for different nodes.
For example, for a node which is repeatedly checked (i.e., a node which is hidden and then reloaded and checked and then is hidden again), a first condition may be set according to a time interval between a time when the node is hidden for the first time and a time when the node is hidden for the second time after the node is reviewed again by a user, so that the node which is possibly repeatedly checked by the user is prevented from being deleted, reloaded during subsequent repeated checking is prevented, and page loading time is saved.
If the time interval from the time when the node 1 is hidden for the first time to the time when the node 1 is hidden for the second time after the user reviews the node for the second time is 5min, the node 1 can be removed from the node tree when the duration that the node 1 is not displayed in the visible area is detected to exceed 5 min. It will be appreciated that when the duration of time for which node 1 is not displayed within the above-mentioned viewing area exceeds 5min, the user will not have a need to look at node 1 again within a predetermined time. Therefore, the method and the device for checking the historical page content meet the requirement of a user for quickly checking the historical page content, reasonably utilize the memory, and avoid the phenomenon that the page content which is not concerned by the user consumes the memory and the cpu performance.
According to the page loading method provided by the embodiment of the application, under the condition that a target page is displayed on a target interface, a page loading device obtains a node tree corresponding to the target page, wherein the node tree comprises a plurality of nodes; under the condition that the preset condition is met, the page loading device removes the target node in the node tree which is not displayed in the visible area of the target interface, so that the problems that the page is stuck and even a web client corresponding to the page is stuck or crashed in the page loading process of the page loading device are solved. In the page loading process, the number of the nodes in the node tree is controlled through the page loading device, and then the memory and the cpu performance consumed by the electronic equipment are controlled to be always kept in a certain range, so that the page content to be checked by a user is smoothly loaded and displayed on a target interface.
Optionally, in this embodiment of the present application, the node tree is generated based on a data queue of a target page; wherein the data queue comprises M first data groups; each first data group comprises at least two pieces of data; the sequence of the M first data groups in the data queue and the sequence of each piece of data in each first data group are arranged according to the position of the page content of the target page, and M is a positive integer; one node corresponds to one first data set.
Illustratively, a first data group includes at least two pieces of data, that is, a node corresponds to at least two pieces of data, so that the node inserted into the node tree or the node removed from the node tree by the page loading apparatus is a node obtained based on at least two pieces of data. Furthermore, when the frequency of the page content loading requirement is high, frequent updating (node insertion or node removal) of the node tree is avoided, and the embodiment seeks a balance between the level number of the DOM tree and the operation frequency of the DOM tree by the page loading device, so that a better performance is achieved when a user slides the page up and down frequently, and the user experience is improved.
Further optionally, in this embodiment of the application, in order to quickly display the page content, the page loading apparatus further inserts a node to be displayed, which needs to be displayed in the visual area, into the node tree.
For example, based on this, as shown in fig. 6, in the embodiment of the present application, after the step 101 and before the step 102, steps 201 to 202 are further included.
Step 201, the page loading device receives a second input of the user.
Wherein the second input is used for inserting a node into the node tree. For example, the second input may be a gesture input or a voice input or other feasible input.
Step 202, the page loading apparatus generates, in response to the second input, second nodes corresponding to the N first data groups in the data queue, respectively, based on the N first data groups in the data queue, and inserts the second nodes into the node tree.
Wherein N is a positive integer greater than or equal to 1 and less than M.
It can be understood that the second nodes are nodes corresponding to the N first data groups, so that when a user views the page content corresponding to the second node, the page content corresponding to the second node can be ensured to be rapidly displayed on the target interface by inserting the second nodes into the node tree in advance.
Illustratively, the page loading means inserts the second node into the node tree after receiving the second input, in combination with distances from the top and bottom of the last content block of the currently rendered page to the head and tail of the viewable area, respectively.
For example, taking the node tree as the DOM as an example, assuming that the second input is a sliding-up input, referring to fig. 5 in conjunction with fig. 3, according to a bottom _ gap _2 value of the last content block 5 of the target page (i.e. the distance 4 of the content block 5 in fig. 5), when the value is close to the threshold (the threshold may be set to 0), one or more first data groups subsequent to the first data group corresponding to the content block 5 in the data queue are simultaneously rendered into the DOM, inserted into the bottom of the DOM tree of the target page, and when the user continues to slide down, the above operations are performed in the same way.
For example, taking the node tree as the DOM as an example, assuming that the second input is a downward sliding input, with reference to fig. 5, according to a top _ gap _1 value (i.e. a distance 1 of the content block 2 in fig. 5) of a first content block (e.g. fig. 4, the first content block is a content block 2, i.e. the content block 2 is a last content block of the target page), when the distance is close to a threshold (the threshold may be set to 0), the content block in the data queue corresponds to a previous one or more first data groups of the data groups, and is simultaneously rendered into the DOM, inserted into the foremost part of the DOM tree of the page, and is terminated when the user continues to slide down until the first data group in the data queue is also rendered into the page.
Further optionally, in order to improve performance of the embodiment of the present application, the method further includes step 301 and step 302.
Step 301, the page loading apparatus executes a first operation through the secondary thread.
Step 302, the page loading apparatus executes a second operation through the main thread.
Wherein, the first operation may be: adding a rendering mark to a data group corresponding to an inserted node or a second node to be inserted in the node tree; the second operation may be: removing a node in the node tree or inserting a second node into the node tree.
For example, a rendering flag may be added to a corresponding data group of the data queue, for example, isRender ═ false or isRender ═ true may be added to the corresponding data group, where false indicates unrendered and true indicates rendered.
For example, the first operation may add a rendering flag to a data group corresponding to an inserted node in the node tree, where the inserted node is before being inserted into the node tree, and the first operation has previously added a rendering flag isRender ═ true to the data group corresponding to the node.
Illustratively, the first operation may further include: after the target node is removed from the node tree, changing the isRender mark of the removed target node in the corresponding first data group in the data queue from true to false; or before the second node to be inserted is inserted into the node tree, changing the isRender mark of the first data group corresponding to the second node to be inserted from false to true.
Illustratively, the first operation may further include: and in the working process of the page loading device, data is searched in the data queue, and the data is combined with the corresponding template.
Illustratively, the second operation may further include: and rendering the node tree.
Therefore, in the page loading process, different operations are executed through the secondary thread and the main thread, and the page loading reliability is improved.
It should be noted that, the steps 301 and 302 are not limited to a specific execution sequence, and may be continuously performed during the target page loading process.
It should be noted that, in the page loading method provided in the embodiment of the present application, the execution main body may be an apparatus, an electronic device, or a control module in the electronic device for executing the page loading method. The embodiment of the present application describes an electronic device for implementing a page loading method, by taking an example of the electronic device executing the page loading method.
As shown in fig. 7, an embodiment of the present application provides a page loading apparatus. The page loading device comprises: an acquisition module 401 and a removal module 402, wherein:
an obtaining module 401, configured to obtain a node tree corresponding to a target page under a condition that the target page is displayed on a target interface, where the node tree includes at least one node.
A removing module 402, configured to remove a target node corresponding to the page content that is not displayed in the visible area of the target interface and is obtained by the obtaining module, when a predetermined condition is met; and the target node is a node in the node tree.
Optionally, the target node is: a target node in the node tree meeting a first condition at a first time; wherein, the first time of any node is: a duration of time during which any of the nodes is not displayed within the viewable area.
Optionally, the predetermined condition may be satisfied by any one of: the number of nodes contained in the node tree meets a preset number; a first input is received from a user.
Wherein the first input is for inserting a first node into the node tree.
Optionally, the node tree is generated based on a data queue of the target page.
Wherein the data queue comprises M first data groups; each first data group comprises at least two pieces of data; the sequence of the M first data groups in the data queue and the sequence of each piece of data in each first data group are arranged according to the position of the page content of the target page, and M is a positive integer; one node corresponds to one first data set.
Optionally, as shown in fig. 8, the apparatus may further include: a receiving module and a generating module, wherein:
a receiving module 403, configured to receive a second input from the user.
A generating module 404, configured to generate, in response to the second input received by the receiving module, second nodes corresponding to the N first data groups in the data queue, based on the N first data groups, and insert the second nodes into the node tree obtained by the obtaining module.
Wherein, the second node is a node to be displayed in the visible area in the node tree; n is a positive integer greater than or equal to 1 and less than M.
Optionally, the apparatus may further include: and the execution module is used for executing the first operation through the secondary thread and executing the second operation through the primary thread.
Wherein the first operation is: adding a rendering mark for a data group corresponding to an inserted node or a node to be inserted in the node tree; the second operation is: removing nodes in the node tree or inserting nodes into the node tree.
According to the page loading device provided by the embodiment of the application, under the condition that the target page is displayed on the target interface, the page loading device can obtain the node tree corresponding to the target page, and under the condition that the preset condition is met, the target node in the node tree which is not displayed in the visible area of the target interface is removed, so that the memory is released, and the target node is prevented from consuming the memory and cpu performance of the electronic equipment. Therefore, the problems that the page is jammed and even the web client corresponding to the page is jammed or crashed in the page loading process of the electronic equipment are solved. Meanwhile, in the page loading process, the page loading device controls the number of nodes in the node tree, so that the memory consumed by the electronic equipment and the cpu performance are always controlled to be within a certain range, and therefore, the page content to be checked by a user is smoothly loaded and displayed on a target interface of the electronic equipment.
The page loading device in the embodiment of the present application may be a device, and may also be a component, an integrated circuit, or a chip in a terminal. The device can be mobile electronic equipment or non-mobile electronic equipment. For example, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm top computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), and the like, and the non-mobile electronic device may be a Personal Computer (PC), a Television (TV), a teller machine, a self-service machine, and the like, and the embodiments of the present application are not limited in particular.
The page loading device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system (Android), an iOS operating system, or other possible operating systems, which is not specifically limited in the embodiments of the present application.
The page loading device provided in the embodiment of the present application can implement each process implemented by the above method embodiment, and is not described here again to avoid repetition.
Optionally, as shown in fig. 9, an electronic device 500 is further provided in this embodiment of the present application, and includes a processor 501, a memory 502, and a program or an instruction stored in the memory 502 and capable of being executed on the processor 501, where the program or the instruction is executed by the processor 501 to implement each process of the above-mentioned page loading method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
It should be noted that the electronic device in the embodiment of the present application includes the mobile electronic device and the non-mobile electronic device described above.
Fig. 10 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
The electronic device 1000 includes, but is not limited to: a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010.
Those skilled in the art will appreciate that the electronic device 1000 may further comprise a power source (e.g., a battery) for supplying power to various components, and the power source may be logically connected to the processor 1010 through a power management system, so as to implement functions of managing charging, discharging, and power consumption through the power management system. The electronic device structure shown in fig. 10 does not constitute a limitation of the electronic device, and the electronic device may include more or less components than those shown, or combine some components, or arrange different components, and thus, the description is not repeated here.
Wherein, the processor 1010 is configured to: under the condition that a target page is displayed on a target interface, acquiring a node tree corresponding to the target page, wherein the node tree comprises a plurality of nodes; under the condition that a preset condition is met, removing a target node corresponding to the page content which is not displayed in the visual area of the target interface; and the target node is a node in the node tree.
In the embodiment of the application, the electronic device can remove the target node in the node tree which is not displayed in the visible area of the target interface under the condition of meeting the preset condition, and based on the scheme, the number of the nodes in the node tree is controlled, so that the node tree is guaranteed to be always kept at a lower number level, and further the memory and the cpu performance consumed by the electronic device are always controlled to be always kept within a certain range.
It should be understood that, in the embodiment of the present application, the radio frequency unit 1001 may be used for receiving and sending signals during a message transmission or a call, and specifically, receives downlink data from a base station and then processes the received downlink data to the processor 1010; in addition, the uplink data is transmitted to the base station. In general, radio frequency unit 1001 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like. Further, the radio frequency unit 1001 may also communicate with a network and other devices through a wireless communication system.
The electronic device provides wireless broadband internet access to the user through the network module 1002, such as assisting the user in sending and receiving e-mails, browsing web pages, and accessing streaming media.
The audio output unit 1003 may convert audio data received by the radio frequency unit 1001 or the network module 1002 or stored in the memory 1009 into an audio signal and output as sound. Also, the audio output unit 1003 may also provide audio output related to a specific function performed by the electronic apparatus 1000 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit 1003 includes a speaker, a buzzer, a receiver, and the like.
It should be understood that in the embodiment of the present application, the input Unit 1004 may include a Graphics Processing Unit (GPU) 10041 and a microphone 10042, and the Graphics Processing Unit 10041 processes image data of still pictures or videos obtained by an image capturing device (such as a camera) in a video capturing mode or an image capturing mode. The display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 1007 includes a touch panel 10071 and other input devices 10072. The touch panel 10071 is also referred to as a touch screen. The touch panel 10071 may include two parts, a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail herein. The memory 1009 may be used to store software programs as well as various data, including but not limited to application programs and operating systems. Processor 1010 may integrate an application processor that handles primarily operating systems, user interfaces, applications, etc. and a modem processor that handles primarily wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 1010.
The interface unit 1008 is an interface for connecting an external device to the electronic apparatus 1000. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input/output (I/O) port, a video I/O port, an earphone port, and the like. The interface unit 1008 may be used to receive input from external devices (e.g., data information, power, etc.) and transmit the received input to one or more elements within the electronic device 1000 or may be used to transmit data between the electronic device 1000 and the external devices.
In addition, the electronic device 1000 includes some functional modules that are not shown, and are not described in detail herein.
The embodiments of the present application further provide a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or the instruction is executed by a processor, the process of the above-mentioned page loading method embodiment is implemented, and the same technical effect can be achieved, and in order to avoid repetition, details are not repeated here.
The processor is the processor in the electronic device described in the above embodiment. Readable storage media, including computer-readable storage media, such as Read-Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, etc.
The embodiment of the present application further provides a chip, where the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to run a program or an instruction, so as to implement each process of the above-mentioned page loading method embodiment, and achieve the same technical effect, and in order to avoid repetition, the description is omitted here.
It should be understood that the chips mentioned in the embodiments of the present application may also be referred to as system-on-chip, system-on-chip or system-on-chip, etc.
The embodiments of the present application provide a computer program product, where the program product is stored in a non-volatile storage medium, and the program product is executed by at least one processor to implement each process of the above-mentioned page loading method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element. Further, it should be noted that the scope of the methods and apparatus of the embodiments of the present application is not limited to performing the functions in the order illustrated or discussed, but may include performing the functions in a substantially simultaneous manner or in a reverse order based on the functions involved, e.g., the methods described may be performed in an order different than that described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (14)

1. A page loading method, characterized in that the method comprises:
under the condition that a target page is displayed on a target interface, acquiring a node tree corresponding to the target page, wherein the node tree comprises at least one node;
under the condition that a preset condition is met, removing a target node corresponding to the page content which is not displayed in the visual area of the target interface;
and the target nodes are nodes in a node tree.
2. The method according to claim 1, wherein the satisfaction of the predetermined condition comprises any one of:
the number of nodes contained in the node tree meets a preset number;
receiving a first input of a user;
wherein the first input is for inserting a first node into the node tree.
3. The method of claim 1, wherein the node tree is generated based on a data queue of the target page;
wherein the data queue comprises M first data groups;
each first data group comprises at least two pieces of data;
the sequence of the M first data groups in the data queue and the sequence of each piece of data in each first data group are arranged according to the position of the page content of the target page, and M is a positive integer;
one node corresponds to one first data set.
4. The method of claim 3, further comprising:
receiving a second input of the user;
responding to the second input, generating second nodes respectively corresponding to the N first data groups based on the N first data groups in the data queue, and inserting the second nodes into the node tree;
the second node is a node to be displayed in the visible area in the node tree; n is a positive integer greater than or equal to 1 and less than M.
5. The method of claim 3, further comprising:
executing a first operation by a secondary thread;
executing a second operation by the main thread;
wherein the first operation is: adding a rendering mark for a data group corresponding to an inserted node or a node to be inserted in the node tree;
the second operation is: removing nodes in the node tree or inserting nodes into the node tree.
6. The method of claim 1, wherein the target node is: a node in the node tree that satisfies a first condition at a first time;
wherein, the first time of any node is: a duration that said any node is not displayed within said viewable area.
7. An apparatus for page loading, the apparatus comprising:
the system comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring a node tree corresponding to a target page under the condition that the target page is displayed on a target interface, and the node tree comprises at least one node;
the removing module is used for removing the target node which is obtained by the obtaining module and corresponds to the page content which is not displayed in the visible area of the target interface under the condition that a preset condition is met;
wherein the target node is a node in the node tree.
8. The apparatus of claim 7, wherein the satisfaction of the predetermined condition comprises any one of:
the number of nodes contained in the node tree meets a preset number;
receiving a first input of a user;
wherein the first input is for inserting a first node into the node tree.
9. The apparatus of claim 7, wherein the node tree is generated based on a data queue of the target page;
wherein the data queue comprises M first data groups;
each first data group comprises at least two pieces of data;
the sequence of the M first data groups in the data queue and the sequence of each piece of data in each first data group are arranged according to the position of the page content of the target page, and M is a positive integer;
one node corresponds to one first data set.
10. The apparatus of claim 9, further comprising: a receiving module and a generating module, wherein:
the receiving module is used for receiving a second input of the user;
the generating module is configured to generate, in response to the second input received by the receiving module, second nodes corresponding to the N first data groups in the data queue, based on the N first data groups in the data queue acquired by the acquiring module, and insert the second nodes into the node tree acquired by the acquiring module;
the second node is a node to be displayed in the visible area in the node tree; n is a positive integer greater than or equal to 1 and less than M.
11. The apparatus of claim 9, further comprising: an execution module, wherein:
the execution module is used for executing a first operation through a secondary thread and executing a second operation through a primary thread;
wherein the first operation is: adding a rendering mark for a data group corresponding to an inserted node or a node to be inserted in the node tree;
the second operation is: removing nodes in the node tree or inserting nodes into the node tree.
12. The apparatus of claim 7,
the target node is as follows: a node in the node tree that satisfies a first condition at a first time;
wherein, the first time of any node is: a duration that said any node is not displayed within said viewable area.
13. An electronic device comprising a processor, a memory and a program stored on the memory and executable on the processor, the program, when executed by the processor, implementing the steps of the page loading method of any of claims 1 to 6.
14. A readable storage medium, on which a program is stored, which program, when executed by a processor, carries out the steps of the page loading method according to any one of claims 1 to 6.
CN202110310567.9A 2021-03-23 2021-03-23 Page loading method and device and electronic equipment Pending CN113127780A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110310567.9A CN113127780A (en) 2021-03-23 2021-03-23 Page loading method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110310567.9A CN113127780A (en) 2021-03-23 2021-03-23 Page loading method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN113127780A true CN113127780A (en) 2021-07-16

Family

ID=76774064

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110310567.9A Pending CN113127780A (en) 2021-03-23 2021-03-23 Page loading method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN113127780A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115455871A (en) * 2022-11-10 2022-12-09 北京云枢创新软件技术有限公司 Large scale integrated circuit hierarchical tree display system
CN115659087A (en) * 2022-11-28 2023-01-31 阿里巴巴(中国)有限公司 Page rendering method, system, device, storage medium and program product

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107977371A (en) * 2016-10-21 2018-05-01 阿里巴巴集团控股有限公司 Requesting method, display methods and the client of page elements
CN111258682A (en) * 2020-02-20 2020-06-09 四川长虹电器股份有限公司 Method for optimizing WebApp memory and nodes
CN111651700A (en) * 2020-06-05 2020-09-11 腾讯科技(深圳)有限公司 Message display method and device, electronic equipment and storage medium
CN111931097A (en) * 2020-09-24 2020-11-13 腾讯科技(深圳)有限公司 Information display method and device, electronic equipment and storage medium
CN112464121A (en) * 2020-11-27 2021-03-09 金蝶软件(中国)有限公司 Data loading method and device, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107977371A (en) * 2016-10-21 2018-05-01 阿里巴巴集团控股有限公司 Requesting method, display methods and the client of page elements
CN111258682A (en) * 2020-02-20 2020-06-09 四川长虹电器股份有限公司 Method for optimizing WebApp memory and nodes
CN111651700A (en) * 2020-06-05 2020-09-11 腾讯科技(深圳)有限公司 Message display method and device, electronic equipment and storage medium
CN111931097A (en) * 2020-09-24 2020-11-13 腾讯科技(深圳)有限公司 Information display method and device, electronic equipment and storage medium
CN112464121A (en) * 2020-11-27 2021-03-09 金蝶软件(中国)有限公司 Data loading method and device, computer equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115455871A (en) * 2022-11-10 2022-12-09 北京云枢创新软件技术有限公司 Large scale integrated circuit hierarchical tree display system
CN115455871B (en) * 2022-11-10 2023-03-24 北京云枢创新软件技术有限公司 Large scale integrated circuit hierarchical tree display system
CN115659087A (en) * 2022-11-28 2023-01-31 阿里巴巴(中国)有限公司 Page rendering method, system, device, storage medium and program product
CN115659087B (en) * 2022-11-28 2023-03-17 阿里巴巴(中国)有限公司 Page rendering method, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN113360238A (en) Message processing method and device, electronic equipment and storage medium
CN110673913B (en) Notification message display method and mobile terminal
US10643021B2 (en) Method and device for processing web page content
CN106708496B (en) Processing method and device for label page in graphical interface
CN113127780A (en) Page loading method and device and electronic equipment
CN109189303B (en) Text editing method and mobile terminal
CN108769822B (en) Video display method and terminal equipment
CN112783594A (en) Message display method and device and electronic equipment
CN112764624A (en) Information screen display method and device
CN111212316B (en) Video generation method and electronic equipment
CN109063076B (en) Picture generation method and mobile terminal
US20240089223A1 (en) Information display method and apparatus, and electronic device
CN105631059B (en) Data processing method, data processing device and data processing system
CN112422735B (en) Information prompting method and device
CN111857466B (en) Message display method and device
CN105095161B (en) Method and device for displaying rich text information
CN108011860B (en) Method, device and terminal for processing broadcast message
CN111049976B (en) Interface display method, electronic device and computer readable storage medium
CN109902232B (en) Display control method and terminal
CN109063079B (en) Webpage labeling method and electronic equipment
CN106339391B (en) Webpage display method and terminal equipment
CN111865763A (en) Message display method and device, electronic equipment and storage medium
CN109144860B (en) Operation method for control object and terminal equipment
CN110888572A (en) Message display method and terminal equipment
CN110795001B (en) Message processing method and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination