CN111666020B - Method and device for switching document pages, electronic equipment and storage medium - Google Patents

Method and device for switching document pages, electronic equipment and storage medium Download PDF

Info

Publication number
CN111666020B
CN111666020B CN201910166878.5A CN201910166878A CN111666020B CN 111666020 B CN111666020 B CN 111666020B CN 201910166878 A CN201910166878 A CN 201910166878A CN 111666020 B CN111666020 B CN 111666020B
Authority
CN
China
Prior art keywords
page
memory
current
loaded
pages
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.)
Active
Application number
CN201910166878.5A
Other languages
Chinese (zh)
Other versions
CN111666020A (en
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.)
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Kingsoft Mobile Technology Co Ltd
Original Assignee
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Kingsoft Mobile Technology 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 Beijing Kingsoft Office Software Inc, Zhuhai Kingsoft Office Software Co Ltd, Guangzhou Kingsoft Mobile Technology Co Ltd filed Critical Beijing Kingsoft Office Software Inc
Priority to CN201910166878.5A priority Critical patent/CN111666020B/en
Publication of CN111666020A publication Critical patent/CN111666020A/en
Application granted granted Critical
Publication of CN111666020B publication Critical patent/CN111666020B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention provides a method and a device for switching document pages, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a page switching instruction aiming at a current document, wherein the page switching instruction comprises a target page identifier; acquiring a target page from a page loaded in a memory according to a target page identifier contained in the page switching instruction; switching a document target page into a current page; and loading the page after the reference page into the memory by taking the current page as the reference page until the utilization rate of the memory by the current program reaches a preset threshold value of the utilization rate of the memory by the current program, wherein the current program is a program for opening the current document. Therefore, when the user switches the document page, the target page is directly obtained from the page pre-loaded in the memory, such as the memory of a computer or the RAM of the mobile terminal, according to the page switching instruction, and the switching speed of switching from the current page to the target page is improved.

Description

Method and device for switching document pages, electronic equipment and storage medium
Technical Field
The present invention relates to the field of document page switching technologies, and in particular, to a method and an apparatus for document page switching, an electronic device, and a storage medium.
Background
At present, when a user browses a document, the user can switch the document from a current page to a target page by sliding the page upwards or downwards or clicking a document page switching key to switch the page of the document.
Specifically, the process of switching pages of a document generally includes the following steps:
firstly, leaving the position of the current page of the document, and switching to the position of the target page of the document; then, loading the contents of the document target page obtained from a hard disk of the computer or a ROM or a Flash of the mobile terminal into a memory of the computer or an RAM of the mobile terminal; and finally, displaying the content of the target page and finishing the switching from the current page to the target page.
In the above process, since time is required in the process of loading the content of the target page, the time for switching from the current page to the target page is long, and the switching speed is slow.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for switching document pages, electronic equipment and a storage medium, so as to improve the switching speed of switching from a current page to a target page. The specific technical scheme is as follows:
in a first aspect, the present invention provides a method for switching document pages, where the method includes:
acquiring a page switching instruction aiming at a current document, wherein the page switching instruction comprises a target page identifier;
acquiring a target page from a page loaded in a memory according to a target page identifier contained in the page switching instruction;
switching a document target page into a current page;
and loading the page after the reference page into the memory by taking the current page as the reference page until the utilization rate of the memory by the current program reaches a preset threshold value of the utilization rate of the memory by the current program, wherein the current program is a program for opening the current document.
Optionally, before the step of loading the page after the reference page into the memory by using the current page as the reference page until the usage rate of the memory by the current program reaches a preset threshold of the usage rate of the memory by the current program, the method further includes:
acquiring the current utilization rate of a current program to a memory;
judging whether the current utilization rate of the current program to the memory reaches a preset threshold value of the current program to the memory utilization rate;
and if not, executing the current page as the reference page, and loading the page behind the reference page into the memory until the utilization rate of the current program to the memory reaches a preset threshold value of the current program to the memory utilization rate.
Optionally, before the step of determining whether the current usage rate of the memory by the current program reaches the threshold of the usage rate of the memory by the current program, the method further includes:
acquiring the residual amount of the current total memory;
judging whether the residual amount of the current total memory is smaller than a preset threshold value of the memory utilization rate of the current program;
if yes, the remaining amount of the current total memory is used as a preset threshold value of the memory utilization rate of the current program.
Optionally, the step of loading the page after the reference page into the memory by using the current page as the reference page until the usage rate of the memory by the current program reaches a preset threshold of the usage rate of the memory by the current program includes:
judging whether an unloaded page exists after the page of the loaded current document in the memory;
if yes, sequentially loading the pages behind the loaded pages until the utilization rate of the current program to the memory reaches the threshold value.
Optionally, after the step of sequentially loading the pages after the loaded page until the usage rate of the memory by the current program reaches the threshold, the method further includes:
judging whether a page behind the reference page is loaded with less than a preset minimum preloaded page number or not;
if the number of the pages is less than the preset minimum pre-loaded number of pages, judging whether the reference page has a loaded page before;
if so, sequentially deleting the pages farthest from the reference page, and releasing the memory occupied by the pages farthest from the reference page until the utilization rate of the memory by the current program is less than the threshold value;
and executing the step of judging whether the page of the loaded current document in the memory is followed by the unloaded page.
Optionally, the method further includes:
if the current utilization rate of the current program to the memory reaches a preset threshold value of the current program to the memory utilization rate, judging whether an unloaded page exists behind a page of a loaded current document in the memory;
if so, judging whether the page behind the reference page is loaded with less than the preset minimum preloaded page number or not;
if the number of the pages is less than the preset minimum pre-loaded number of pages, judging whether the reference page has a loaded page before;
if so, sequentially deleting the pages farthest from the reference page, and releasing the memory occupied by the pages farthest from the reference page until the utilization rate of the memory by the current program is less than the threshold value;
and executing the current page as a reference page, and loading the page after the reference page into the memory until the utilization rate of the current program to the memory reaches a preset threshold value of the current program to the memory utilization rate.
Optionally, the step of obtaining a page switching instruction for the current document includes:
judging whether a user clicks a page switching key of the current document or executes page up and down sliding operation;
if yes, determining a target page according to user operation, and acquiring a target page identifier;
and generating a page switching instruction containing the target page identifier.
In a second aspect, the present invention provides an apparatus for switching pages of a document, the apparatus comprising:
the instruction obtaining module is used for obtaining a page switching instruction aiming at the current document, and the page switching instruction comprises a target page identifier;
a target page obtaining module, configured to obtain a target page from a page loaded in a memory according to a target page identifier included in the page switching instruction;
the page switching module is used for switching the document target page into a current page;
and the page loading module is used for loading the page after the reference page into the memory by taking the current page as the reference page until the utilization rate of the memory by the current program reaches a preset threshold value of the utilization rate of the memory by the current program, wherein the current program is a program for opening the current document.
Optionally, the apparatus further comprises:
the current utilization rate acquisition module is used for loading the page behind the reference page into the memory by using the current page as the reference page in the page loading module until the utilization rate of the memory by the current program reaches a preset threshold value of the memory utilization rate by the current program, and acquiring the current utilization rate of the memory by the current program;
the first judgment module is used for judging whether the current utilization rate of the current program to the memory reaches a preset threshold value of the current program to the memory utilization rate; and if the current page is not reached, triggering the page loading module to load the page behind the reference page into the memory by taking the current page as the reference page until the utilization rate of the current program to the memory reaches a preset threshold value of the current program to the utilization rate of the memory.
Optionally, the apparatus further comprises:
the memory surplus obtaining module is used for obtaining the surplus of the current total memory before the first judging module judges whether the current utilization rate of the current program to the memory reaches the preset threshold value of the current program to the memory utilization rate;
the second judgment module is used for judging whether the residual amount of the current total memory is smaller than a preset threshold value of the memory utilization rate of the current program; if yes, the remaining amount of the current total memory is used as a preset threshold value of the memory utilization rate of the current program.
Optionally, the page loading module is specifically configured to:
judging whether an unloaded page exists after the page of the loaded current document in the memory; if yes, sequentially loading the pages behind the loaded pages until the utilization rate of the current program to the memory reaches the threshold value.
Optionally, the apparatus further comprises:
the third judging module is used for sequentially loading the pages behind the loaded pages in the page loading module until the utilization rate of the current program on the memory reaches the threshold value, and judging whether the pages behind the reference page are loaded with the minimum pre-loaded pages or not;
the fourth judging module is used for judging whether a loaded page exists before the reference page if the number of the loaded pages is less than the preset minimum number of the preloaded pages;
the first page deleting module is used for sequentially deleting the pages farthest from the reference page if the pages exist, and releasing the memory occupied by the pages farthest from the reference page until the utilization rate of the memory by the current program is smaller than the threshold value; and triggering the page loading module to judge whether an unloaded page exists after the page of the loaded current document in the memory.
Optionally, the apparatus further comprises:
a fifth judging module, configured to judge whether an unloaded page exists after a page of a current document loaded in the memory if a current usage rate of the current program for the memory reaches a preset threshold of the current usage rate of the current program for the memory;
a sixth judging module, configured to judge whether a page subsequent to the reference page is loaded with less than a preset minimum preloaded page number if the page is loaded with less than the preset minimum preloaded page number;
the seventh judging module is used for judging whether a loaded page exists before the reference page if the number of the loaded pages is less than the preset minimum number of the preloaded pages;
the second page deleting module is used for sequentially deleting the pages farthest from the reference page if the pages exist, and releasing the memory occupied by the pages farthest from the reference page until the utilization rate of the memory by the current program is smaller than the threshold; and triggering the page loading module to load the page behind the reference page into the memory by taking the current page as the reference page until the utilization rate of the current program to the memory reaches a preset threshold value of the current program to the memory utilization rate.
Optionally, the instruction obtaining module is specifically configured to:
judging whether a user clicks a page switching key of the current document or executes page up and down sliding operation; if yes, determining a target page according to user operation, and acquiring a target page identifier; and generating a page switching instruction containing the target page identifier.
In a third aspect, the present invention provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
a processor for implementing any of the method steps of claim document page switching when executing a program stored on the memory.
In a fourth aspect, the present invention provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the method steps of any one of the claims document page switching.
The method, the device, the electronic equipment and the storage medium for switching the document page provided by the embodiment of the invention can obtain the page switching instruction aiming at the current document, wherein the page switching instruction comprises the target page identifier; acquiring a target page from a page loaded in a memory according to a target page identifier contained in the page switching instruction; switching a document target page into a current page; and loading the page after the reference page into the memory by taking the current page as the reference page until the utilization rate of the memory by the current program reaches a preset threshold value of the utilization rate of the memory by the current program, wherein the current program is a program for opening the current document. Therefore, when the user switches the document page, the method and the device do not need to load the content of the document target page into the memory of the computer or the RAM of the mobile terminal from the ROM or the Flash of the hard disk of the computer or the mobile terminal according to the page switching instruction, and then obtain the target page from the memory of the computer or the RAM of the mobile terminal; but according to the page switching instruction, the page switching instruction is directly loaded in the memory in advance, such as: the target page is obtained from the page in the RAM of the computer or the RAM of the mobile terminal, so that the switching speed of switching from the current page to the target page is improved.
Of course, not all of the advantages described above need to be achieved at the same time in the practice of any one product or method of the invention.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flowchart of a method for switching pages of a document according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a specific step S101 in the embodiment shown in FIG. 1;
FIG. 3 is another flowchart of a document page switching method according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a method for switching pages of a document according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a document page switching apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. 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 invention.
The method for switching the document page provided by the embodiment of the invention can be applied to any electronic equipment needing to switch the document page, and is not particularly limited herein. For convenience of description, the electronic device is hereinafter referred to simply as an electronic device.
As shown in fig. 1, a specific processing flow of the method for switching document pages provided by the embodiment of the present invention includes:
step S101, a page switching instruction for the current document is obtained, wherein the page switching instruction comprises a target page identifier.
The embodiment of the invention can be applied to various electronic devices, such as: computers or mobile terminals, etc.
In practice, the electronic device may obtain a page switching instruction for the current document, where the page switching instruction may include the target page identifier.
Step S102, obtaining a target page from the page loaded in the memory according to the target page identifier included in the page switching instruction.
In an implementation, the target page may have been previously loaded in the memory, and the target page may be obtained from the memory according to the target page identifier included in the page switching instruction.
In step S103, the target page of the document is switched to the current page.
Step S104, taking the current page as a reference page, and loading the page after the reference page into the memory until the utilization rate of the memory by the current program reaches a preset threshold value of the utilization rate of the memory by the current program, wherein the current program is a program for opening the current document.
In the embodiment of the invention, the page behind the reference page can be preloaded after each page switching, so that the target page can be obtained from the page loaded in the memory when the page switching is carried out next time.
In an implementation manner, the threshold of the memory usage rate of the current program may be preset, and specifically, in order to enable the electronic device to have enough memory space for running other programs, the threshold of the memory usage rate of the current program may be set to 30%.
Therefore, when the user switches the document page, the method and the device do not need to load the content of the document target page into the memory of the computer or the RAM of the mobile terminal from the ROM or the Flash of the hard disk of the computer or the mobile terminal according to the page switching instruction, and then obtain the target page from the memory of the computer or the RAM of the mobile terminal; but according to the page switching instruction, the page switching instruction is directly loaded in the memory in advance, such as: the target page is obtained from the page in the RAM of the computer or the RAM of the mobile terminal, and the switching speed of switching from the current page to the target page is improved.
Specifically, the specific implementation process of step S101 in the embodiment shown in fig. 1 can be seen in fig. 2. Fig. 2 is a specific flowchart of step S101 in the embodiment shown in fig. 1, which includes:
step S201, judging whether the user clicks the page switching key of the current document or executes the page up and down sliding operation.
The electronic device may determine whether the user clicks a page switch button of the current document or performs a page up/down sliding operation.
If the result is yes, i.e. the user clicks the page switching key of the current document or performs the page up/down sliding operation, then step S202 is performed; if the judgment result is negative, namely the user does not click the page switching key of the current document or execute the page up and down sliding operation, the operation is ended.
Step S202, determining a target page according to user operation, and obtaining a target page identifier.
Step S203, a page switching instruction including the target page identifier is generated.
The process of generating a page switch instruction containing a target page identifier shown in fig. 2 can be applied to various electronic devices, for example: computers or mobile terminals, etc.
Another flowchart of the method for switching document pages provided in the embodiment of the present invention, as shown in fig. 3, includes:
step S301, a page switching instruction for the current document is obtained, wherein the page switching instruction comprises a target page identifier.
The specific implementation process of this step may be the same as the process shown in fig. 2, and is not described here again.
Step S302, obtaining a target page from the page loaded in the memory according to the target page identifier included in the page switching instruction.
Step S303, the target page of the document is switched to the current page.
Step S304, obtaining the current utilization rate of the current program for opening the current document to the memory.
Specifically, if the computer is used, the current utilization rate of the memory by the current program can be obtained by reading the memory occupied by the current program in the task management; if the mobile terminal is the mobile terminal, the current utilization rate of the memory by the current program can be obtained by reading the memory occupied by the current program in the storage space information and calculating.
In step S305, the remaining amount of the current total memory is obtained.
The method includes the following steps that (1) the implementation can be carried out, specifically, if the computer is used, the residual amount of the current total internal memory can be obtained through reading the internal memory occupied by each program in task management; if the mobile terminal is the mobile terminal, the residual amount of the current total memory can be obtained by reading the memory occupied by each program in the storage space information.
Step S306, determine whether the remaining amount of the current total memory is smaller than a preset threshold of the memory usage rate of the current program.
If the determination result is yes, that is, the remaining amount of the current total memory is smaller than the preset threshold of the memory usage rate of the current program, executing step S307; if the determination result is negative, that is, the remaining amount of the current total memory is not less than the preset threshold of the memory usage rate of the current program, step S308 is executed.
Step S307, the remaining amount of the current total memory is used as a preset threshold of the memory usage rate of the current program.
In this case, the remaining amount of the current total memory may be used as the preset threshold of the current program for the memory usage rate.
Step S308, determine whether the current utilization rate of the memory by the current program reaches a preset threshold of the memory utilization rate by the current program.
If the judgment result is yes, namely the current utilization rate of the current program to the memory reaches a preset threshold value of the current program to the memory utilization rate, ending the operation and waiting for the next operation instruction; if the determination result is negative, that is, the current usage rate of the memory by the current program is smaller than the preset threshold of the usage rate of the memory by the current program, step S309 is executed.
Step S309, determine whether there is an unloaded page after the page of the loaded current document in the memory.
If the determination result is yes, that is, there is an unloaded page after the page of the loaded current document in the memory, executing step S310; if the judgment result is negative, namely no unloaded page exists after the loaded page of the current document in the memory, ending the operation and waiting for the next operation instruction.
Step S310, sequentially loading the pages subsequent to the loaded page until the utilization rate of the memory by the current program reaches the threshold.
The page after the loaded page may be sequentially loaded until the usage rate of the memory by the current program reaches the threshold, and certainly, the page after the loaded page is sequentially loaded, and when all the pages of the current document are loaded into the memory and do not reach the threshold, the loading is stopped, the operation is ended, and a next operation instruction is waited.
Therefore, when the user switches the document page, the method and the device do not need to load the content of the document target page into the memory of the computer or the RAM of the mobile terminal from the ROM or the Flash of the hard disk of the computer or the mobile terminal according to the page switching instruction, and then obtain the target page from the memory of the computer or the RAM of the mobile terminal; but directly from the pre-loaded memory according to the page switch instruction, such as: the target page is obtained from the page in the RAM of the computer or the RAM of the mobile terminal, and the switching speed of switching from the current page to the target page is improved.
In addition, in this embodiment, the remaining amount of the current total memory may be obtained in advance, so that the memory occupied by page loading does not exceed the remaining amount of the total memory, and the problems of system crash and the like may be avoided.
Still another flowchart of the method for switching document pages provided in the embodiment of the present invention, as shown in fig. 4, includes:
step S401, a page switching instruction for the current document is obtained, wherein the page switching instruction comprises a target page identifier.
The specific implementation process of this step may be the same as the process shown in fig. 2, and is not described here again.
Step S402, obtaining a target page from the page loaded in the memory according to the target page identifier included in the page switching instruction.
In step S403, the document target page is switched to the current page.
Step S404, obtaining the current utilization rate of the current program for opening the current document to the memory.
In step S405, the remaining amount of the current total memory is obtained.
Step S406, determine whether the remaining amount of the current total memory is smaller than a preset threshold of the memory usage rate of the current program.
If the determination result is yes, that is, the remaining amount of the current total memory is smaller than the preset threshold of the memory usage rate of the current program, executing step S407; if the result of the determination is negative, that is, the remaining amount of the current total memory is not less than the preset threshold of the memory usage rate of the current program, step S408 is executed.
Step S407, the remaining amount of the current total memory is used as a preset threshold of the memory usage rate of the current program.
In step S408, it is determined whether the current utilization rate of the memory by the current program reaches a preset threshold of the memory utilization rate by the current program.
If the determination result is yes, that is, the current utilization rate of the memory by the current program reaches the preset threshold value of the current utilization rate of the memory by the current program, then step S409 is executed; if the determination result is negative, that is, the current utilization rate of the memory by the current program is smaller than the preset threshold of the current utilization rate of the memory by the current program, step S410 is executed.
Step S409, determining whether there is an unloaded page after the page of the loaded current document in the memory.
If the determination result is yes, that is, there is an unloaded page after the page of the loaded current document in the memory, execute step S412; if the judgment result is negative, that is, there is no unloaded page behind the page of the loaded current document in the memory, the operation is ended, and a next operation instruction can be waited.
In step S410, it is determined whether there is an unloaded page after the page of the loaded current document in the memory.
If the determination result is yes, that is, there is an unloaded page after the page of the loaded current document in the memory, executing step S411; if the judgment result is negative, that is, there is no unloaded page behind the page of the loaded current document in the memory, the operation is ended, and a next operation instruction can be waited.
Step S411, sequentially loading the pages subsequent to the loaded page until the utilization rate of the memory by the current program reaches the threshold.
In step S412, it is determined whether the page following the reference page has been loaded with less than the preset minimum number of preloaded pages.
It may be implemented that the preset minimum number of preloaded pages may be 20 pages.
If the judgment result is negative, namely the page behind the reference page is loaded with the minimum pre-loaded page number which is not less than the preset minimum pre-loaded page number, ending the operation and waiting for the next operation instruction; if the judgment result is yes, that is, the page following the reference page has been loaded with less than the preset minimum number of preloaded pages, step S413 is executed.
In step S413, it is determined whether there is a loaded page before the reference page.
If the result of the determination is yes, that is, there is a loaded page before the reference page, step S414 is executed; if the judgment result is negative, namely the reference page has no loaded page before, ending the operation and waiting for the next operation instruction.
Step S414, sequentially deleting the pages farthest from the reference page, and releasing the memory occupied by the pages farthest from the reference page until the usage rate of the memory by the current program is less than the threshold.
In an implementation, the page farthest from the reference page may be sequentially deleted, and the memory occupied by the page farthest from the reference page is released until the utilization rate of the memory by the current program is less than the threshold.
After the step is executed, the step returns to the step S410, and the step of determining whether there is an unloaded page after the page of the current document loaded in the memory is executed.
Therefore, when the user switches the document page, the method and the device do not need to load the content of the document target page into the memory of the computer or the RAM of the mobile terminal from the ROM or the Flash of the hard disk of the computer or the mobile terminal according to the page switching instruction, and then obtain the target page from the memory of the computer or the RAM of the mobile terminal; but directly from the pre-loaded memory according to the page switch instruction, such as: the target page is obtained from the page in the RAM of the computer or the RAM of the mobile terminal, and the switching speed of switching from the current page to the target page is improved.
Moreover, in this embodiment, the remaining amount of the current total memory may be obtained in advance, so that the memory occupied by page loading does not exceed the remaining amount of the total memory, and the problems of system crash and the like are avoided.
In addition, in this embodiment, a minimum pre-loaded page number is also preset, and when a page is located before the reference page and a page loaded after the reference page is less than the minimum pre-loaded page number, the page before the reference page is deleted to ensure that the page after the reference page reaches the minimum pre-loaded page number, so that a situation that the page before the reference page occupies a memory so that the usage rate of the memory by the current program reaches the threshold value and a target page after the reference page is not loaded is avoided as much as possible, and a switching speed from the current page to the target page is ensured as much as possible.
As shown in fig. 5, a schematic structural diagram of a device for switching document pages provided in an embodiment of the present invention includes:
an instruction obtaining module 501, configured to obtain a page switching instruction for a current document, where the page switching instruction includes a target page identifier;
a target page obtaining module 502, configured to obtain a target page from a page loaded in a memory according to a target page identifier included in the page switching instruction;
a page switching module 503, configured to switch a document target page to a current page;
a page loading module 504, configured to load a page after the reference page into the memory by using the current page as the reference page until a usage rate of the memory by the current program reaches a preset threshold of the usage rate of the memory by the current program, where the current program is a program for opening the current document.
Optionally, the apparatus further comprises:
the current utilization rate acquisition module is used for loading the page behind the reference page into the memory by using the current page as the reference page in the page loading module until the utilization rate of the memory by the current program reaches a preset threshold value of the memory utilization rate by the current program, and acquiring the current utilization rate of the memory by the current program;
the first judgment module is used for judging whether the current utilization rate of the current program to the memory reaches a preset threshold value of the current program to the memory utilization rate; and if the current page is not reached, triggering the page loading module to load the page behind the reference page into the memory by taking the current page as the reference page until the utilization rate of the current program to the memory reaches a preset threshold value of the current program to the utilization rate of the memory.
Optionally, the apparatus further comprises:
the memory surplus obtaining module is used for obtaining the surplus of the current total memory before the first judging module judges whether the current utilization rate of the current program to the memory reaches the preset threshold value of the current program to the memory utilization rate;
the second judgment module is used for judging whether the residual amount of the current total memory is smaller than a preset threshold value of the memory utilization rate of the current program; if yes, the remaining amount of the current total memory is used as a preset threshold value of the memory utilization rate of the current program.
Optionally, the page loading module is specifically configured to:
judging whether an unloaded page exists after the page of the loaded current document in the memory; if yes, sequentially loading the pages behind the loaded pages until the utilization rate of the current program to the memory reaches the threshold value.
Optionally, the apparatus further comprises:
the third judging module is used for sequentially loading the pages behind the loaded pages in the page loading module until the utilization rate of the current program on the memory reaches the threshold value, and judging whether the pages behind the reference page are loaded with the minimum pre-loaded pages or not;
the fourth judging module is used for judging whether a loaded page exists before the reference page if the number of the loaded pages is less than the preset minimum number of the preloaded pages;
the first page deleting module is used for sequentially deleting the pages farthest from the reference page if the pages exist, and releasing the memory occupied by the pages farthest from the reference page until the utilization rate of the memory by the current program is smaller than the threshold value; and triggering the page loading module to judge whether an unloaded page exists after the page of the loaded current document in the memory.
Optionally, the apparatus further comprises:
a fifth judging module, configured to judge whether an unloaded page exists after a page of a current document loaded in the memory if a current usage rate of the current program for the memory reaches a preset threshold of the current usage rate of the current program for the memory;
a sixth judging module, configured to judge whether a page subsequent to the reference page is loaded with less than a preset minimum preloaded page number if the page is loaded with less than the preset minimum preloaded page number;
the seventh judging module is used for judging whether a loaded page exists before the reference page if the number of the loaded pages is less than the preset minimum number of the preloaded pages;
the second page deleting module is used for sequentially deleting the pages farthest from the reference page if the pages exist, and releasing the memory occupied by the pages farthest from the reference page until the utilization rate of the memory by the current program is smaller than the threshold; and triggering the page loading module to load the page behind the reference page into the memory by taking the current page as the reference page until the utilization rate of the current program to the memory reaches a preset threshold value of the current program to the memory utilization rate.
Optionally, the instruction obtaining module is specifically configured to:
judging whether a user clicks a page switching key of the current document or executes page up and down sliding operation; if yes, determining a target page according to user operation, and acquiring a target page identifier; and generating a page switching instruction containing the target page identifier.
Therefore, when the user switches the document page, the method and the device do not need to load the content of the document target page into the memory of the computer or the RAM of the mobile terminal from the ROM or the Flash of the hard disk of the computer or the mobile terminal according to the page switching instruction, and then obtain the target page from the memory of the computer or the RAM of the mobile terminal; but according to the page switching instruction, the page switching instruction is directly loaded in the memory in advance, such as: the target page is obtained from the page in the RAM of the computer or the RAM of the mobile terminal, and the switching speed of switching from the current page to the target page is improved.
An embodiment of the present invention further provides an electronic device, as shown in fig. 6, including a processor 601, a communication interface 602, a memory 603, and a communication bus 604, where the processor 601, the communication interface 602, and the memory 603 complete mutual communication through the communication bus 604,
a memory 603 for storing a computer program;
the processor 601 is configured to implement the following steps when executing the program stored in the memory 603:
acquiring a page switching instruction aiming at a current document, wherein the page switching instruction comprises a target page identifier;
acquiring a target page from a page loaded in a memory according to a target page identifier contained in the page switching instruction;
switching a document target page into a current page;
and loading the page after the reference page into the memory by taking the current page as the reference page until the utilization rate of the memory by the current program reaches a preset threshold value of the utilization rate of the memory by the current program, wherein the current program is a program for opening the current document.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In another embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of any one of the above-mentioned methods for document page switching.
In yet another embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the method of any one of the above embodiments of document page switching.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, 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 identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for embodiments such as the apparatus, the electronic device, the computer-readable storage medium, and the computer program product, since they are substantially similar to the method embodiments, the description is simple, and for relevant points, reference may be made to part of the description of the method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (12)

1. A method for switching pages of a document, comprising:
acquiring a page switching instruction aiming at a current document, wherein the page switching instruction comprises a target page identifier;
acquiring a target page from a page loaded in a memory according to a target page identifier contained in the page switching instruction; the target page is as follows: the page which is loaded in the memory needs to be switched to the page of the current display page;
switching a document target page into a current page;
acquiring the current utilization rate of a current program to a memory, and acquiring the residual amount of the current total memory;
judging whether the residual amount of the current total memory is smaller than a preset threshold value of the memory utilization rate of the current program;
if yes, taking the residual amount of the current total memory as a preset threshold value of the memory utilization rate of the current program;
judging whether the current utilization rate of the current program to the memory reaches a preset threshold value of the current program to the memory utilization rate;
and if not, loading the page behind the reference page into the memory by taking the current page as the reference page until the utilization rate of the memory by the current program reaches a preset threshold value of the utilization rate of the memory by the current program, wherein the current program is a program for opening the current document.
2. The method according to claim 1, wherein the step of loading the page after the reference page into the memory by using the current page as the reference page until the usage rate of the memory by the current program reaches a preset threshold of the usage rate of the memory by the current program comprises:
judging whether an unloaded page exists after the page of the loaded current document in the memory;
if yes, sequentially loading the pages behind the loaded pages until the utilization rate of the current program to the memory reaches the threshold value.
3. The method according to claim 2, wherein after the step of sequentially loading the pages subsequent to the loaded page until the usage rate of the memory by the current program reaches the threshold, further comprising:
judging whether a page behind the reference page is loaded with less than a preset minimum preloaded page number or not;
if the number of the pages is less than the preset minimum pre-loaded number of pages, judging whether the reference page has a loaded page before;
if so, sequentially deleting the pages farthest from the reference page, and releasing the memory occupied by the pages farthest from the reference page until the utilization rate of the memory by the current program is less than the threshold value;
and executing the step of judging whether the page of the loaded current document in the memory is followed by the unloaded page.
4. The method of claim 1, further comprising:
if the current utilization rate of the current program to the memory reaches a preset threshold value of the current program to the memory utilization rate, judging whether an unloaded page exists behind a page of a loaded current document in the memory;
if so, judging whether the page behind the reference page is loaded with less than the preset minimum preloaded page number or not;
if the number of the pages is less than the preset minimum pre-loaded number of pages, judging whether the reference page has a loaded page before;
if so, sequentially deleting the pages farthest from the reference page, and releasing the memory occupied by the pages farthest from the reference page until the utilization rate of the memory by the current program is less than the threshold value;
and executing the current page as a reference page, and loading the page after the reference page into the memory until the utilization rate of the current program to the memory reaches a preset threshold value of the current program to the memory utilization rate.
5. The method of claim 1, wherein the step of obtaining page switching instructions for the current document comprises:
judging whether a user clicks a page switching key of the current document or executes page up and down sliding operation;
if yes, determining a target page according to user operation, and acquiring a target page identifier;
and generating a page switching instruction containing the target page identifier.
6. An apparatus for switching pages of a document, comprising:
the instruction obtaining module is used for obtaining a page switching instruction aiming at the current document, and the page switching instruction comprises a target page identifier;
a target page obtaining module, configured to obtain a target page from a page loaded in a memory according to a target page identifier included in the page switching instruction; the target page is as follows: the page which is loaded in the memory needs to be switched to the page of the current display page;
the page switching module is used for switching the document target page into a current page;
the memory surplus obtaining module is used for obtaining the current utilization rate of the current program to the memory and obtaining the surplus of the current total memory;
the second judgment module is used for judging whether the residual amount of the current total memory is smaller than a preset threshold value of the memory utilization rate of the current program; if yes, taking the residual amount of the current total memory as a preset threshold value of the memory utilization rate of the current program;
the first judgment module is used for judging whether the current utilization rate of the current program to the memory reaches a preset threshold value of the current program to the memory utilization rate;
and the page loading module is used for loading the page behind the reference page into the memory by taking the current page as the reference page until the utilization rate of the current program to the memory reaches the preset threshold value of the current program to the utilization rate of the memory, wherein the current program is a program for opening the current document.
7. The apparatus of claim 6, wherein the page loading module is specifically configured to:
judging whether an unloaded page exists after the page of the loaded current document in the memory; if yes, sequentially loading the pages behind the loaded pages until the utilization rate of the current program to the memory reaches the threshold value.
8. The apparatus of claim 7, further comprising:
the third judging module is used for sequentially loading the pages behind the loaded pages in the page loading module until the utilization rate of the current program on the memory reaches the threshold value, and judging whether the pages behind the reference page are loaded with the minimum pre-loaded pages or not;
the fourth judging module is used for judging whether a loaded page exists before the reference page if the number of the loaded pages is less than the preset minimum number of the preloaded pages;
the first page deleting module is used for sequentially deleting the pages farthest from the reference page if the pages exist, and releasing the memory occupied by the pages farthest from the reference page until the utilization rate of the memory by the current program is smaller than the threshold value; and triggering the page loading module to judge whether an unloaded page exists after the page of the loaded current document in the memory.
9. The apparatus of claim 6, further comprising:
a fifth judging module, configured to judge whether an unloaded page exists after a page of a current document loaded in the memory if a current usage rate of the current program for the memory reaches a preset threshold of the current usage rate of the current program for the memory;
a sixth judging module, configured to judge whether a page subsequent to the reference page is loaded with less than a preset minimum preloaded page number if the page is loaded with less than the preset minimum preloaded page number;
the seventh judging module is used for judging whether a loaded page exists before the reference page if the number of the loaded pages is less than the preset minimum number of the preloaded pages;
the second page deleting module is used for sequentially deleting the pages farthest from the reference page if the pages exist, and releasing the memory occupied by the pages farthest from the reference page until the utilization rate of the memory by the current program is smaller than the threshold; and triggering the page loading module to load the page behind the reference page into the memory by taking the current page as the reference page until the utilization rate of the current program to the memory reaches a preset threshold value of the current program to the memory utilization rate.
10. The apparatus of claim 6, wherein the instruction obtaining module is specifically configured to:
judging whether a user clicks a page switching key of the current document or executes page up and down sliding operation; if yes, determining a target page according to user operation, and acquiring a target page identifier; and generating a page switching instruction containing the target page identifier.
11. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 5 when executing a program stored in the memory.
12. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of the claims 1-5.
CN201910166878.5A 2019-03-06 2019-03-06 Method and device for switching document pages, electronic equipment and storage medium Active CN111666020B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910166878.5A CN111666020B (en) 2019-03-06 2019-03-06 Method and device for switching document pages, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910166878.5A CN111666020B (en) 2019-03-06 2019-03-06 Method and device for switching document pages, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111666020A CN111666020A (en) 2020-09-15
CN111666020B true CN111666020B (en) 2022-05-03

Family

ID=72381720

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910166878.5A Active CN111666020B (en) 2019-03-06 2019-03-06 Method and device for switching document pages, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111666020B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112199618A (en) * 2020-10-22 2021-01-08 Oppo广东移动通信有限公司 File page pre-reading method and device, terminal and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103365545A (en) * 2013-08-07 2013-10-23 浙江宇天科技股份有限公司 Method and device for loading data onto pages
CN105955599A (en) * 2016-05-13 2016-09-21 锐达互动科技股份有限公司 Realization method for simulating document reading mode in electronic device
CN108108205A (en) * 2016-11-25 2018-06-01 腾讯科技(深圳)有限公司 Application page surface treatment method and apparatus
CN108762831A (en) * 2018-05-15 2018-11-06 Oppo广东移动通信有限公司 Application program preloads method, apparatus, storage medium and terminal

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105095250A (en) * 2014-05-05 2015-11-25 北京大学 Page scheduling processing method and device
US20180018063A1 (en) * 2016-07-14 2018-01-18 Intent Media, Inc. Graphical user interface and system for viewing landing page content

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103365545A (en) * 2013-08-07 2013-10-23 浙江宇天科技股份有限公司 Method and device for loading data onto pages
CN105955599A (en) * 2016-05-13 2016-09-21 锐达互动科技股份有限公司 Realization method for simulating document reading mode in electronic device
CN108108205A (en) * 2016-11-25 2018-06-01 腾讯科技(深圳)有限公司 Application page surface treatment method and apparatus
CN108762831A (en) * 2018-05-15 2018-11-06 Oppo广东移动通信有限公司 Application program preloads method, apparatus, storage medium and terminal

Also Published As

Publication number Publication date
CN111666020A (en) 2020-09-15

Similar Documents

Publication Publication Date Title
CN109144392B (en) Method and device for processing gesture conflict and electronic equipment
CN109117153B (en) Application processing method, device, terminal and storage medium
CN111159160B (en) Version rollback method and device, electronic equipment and storage medium
CN111666020B (en) Method and device for switching document pages, electronic equipment and storage medium
CN108293197B (en) Resource statistical method, device and terminal
CN111400091B (en) Factory setting restoration method, factory setting restoration device and mobile terminal
CN109710128B (en) Shortcut key display method and device
CN109783718B (en) Repeat request judgment method and device
CN109981873B (en) Address book permission opening method and device and electronic equipment
CN109656936A (en) Method of data synchronization, device, computer equipment and storage medium
CN113064801B (en) Data point burying method and device, readable storage medium and computer equipment
CN111399832B (en) Page editing method and device
CN111160956A (en) Advertisement playing method and device, electronic equipment and medium
CN108804195B (en) Page display method and device, server and client
CN108845845B (en) Shortcut key creation method and device, electronic equipment and storage medium
CN110888690A (en) Application starting method and device, electronic equipment and storage medium
CN108647197B (en) Information processing method, device and storage medium
CN111736973A (en) Service starting method, device, server and storage medium
CN112256654A (en) Document sharing method and device
CN107220093B (en) Process processing method and device
CN111400037A (en) Memory management method and device, computer storage medium and terminal
CN111142727A (en) Application icon management method, mobile terminal and readable storage medium
CN111258676A (en) Module preloading method, device, equipment and readable storage medium
CN111090515A (en) Access control method, device, terminal equipment and storage medium
CN111666733B (en) Method and device for processing cells in document

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
GR01 Patent grant
GR01 Patent grant