CN113467854B - Application program starting method and device, electronic equipment and storage medium - Google Patents
Application program starting method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113467854B CN113467854B CN202110611062.6A CN202110611062A CN113467854B CN 113467854 B CN113467854 B CN 113467854B CN 202110611062 A CN202110611062 A CN 202110611062A CN 113467854 B CN113467854 B CN 113467854B
- Authority
- CN
- China
- Prior art keywords
- engine
- target
- state
- engines
- cache pool
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 65
- 230000008569 process Effects 0.000 claims abstract description 14
- 238000012544 monitoring process Methods 0.000 claims description 12
- 230000006378 damage Effects 0.000 claims description 10
- 238000004590 computer program Methods 0.000 claims description 6
- 238000005516 engineering process Methods 0.000 abstract description 10
- 238000004891 communication Methods 0.000 description 10
- 238000012545 processing Methods 0.000 description 9
- 230000003287 optical effect Effects 0.000 description 5
- 230000009471 action Effects 0.000 description 4
- 238000011161 development Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 230000005236 sound signal Effects 0.000 description 4
- 230000001133 acceleration Effects 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000007726 management method Methods 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 238000004140 cleaning Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000003384 imaging method Methods 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44505—Configuring for program initiating, e.g. using registry, configuration files
Abstract
The disclosure relates to an application program starting method, an application program starting device, electronic equipment and a storage medium, wherein the method comprises the following steps: when the target application program is detected to enter a target page in the starting process of the target application program, if the JS engine in a ready state does not exist in a cache pool of the terminal, creating a target JS engine; wherein the JS engine in the ready state is a JS engine which is created and not used; and storing the target JS engine into a cache pool of the terminal, and loading a JS Bundle file corresponding to the target page through the target JS engine. According to the method and the device, the target JS engine is created and stored in the cache pool of the terminal, so that the JS Bundle file corresponding to the target page is loaded through the target JS engine, and the problem of the page white screen possibly caused by using the same JS engine in the related technology can be well solved.
Description
Technical Field
The disclosure relates to the field of computer technology, and in particular, to an application program starting method, an application program starting device, electronic equipment and a storage medium.
Background
The Real Native (RN) is a mobile terminal hybrid framework which is commonly used at present, and is usually applied to a mobile terminal, and has strong cross-platform characteristics because the Real Native (RN) can be directly used in platforms such as Android and iOS. In the development of the Native APP (Application program), the real Native development is usually used in a mixed manner, and a module developed by the real Native needs to be printed into a JS Bundle file before being debugged, and then the APP can load and display the JS Bundle file.
While an app developed by real Native needs to parse and load the entire JS Bundle file when it is first started, parsing and loading the JS Bundle file is a relatively time-consuming operation. In the prior art, when the JS Bundle file is loaded through the JS engine, conflicts are easily caused when the same dependency library is loaded between businesses, so that the problem of page white screen usually occurs in the process from loading the JS Bundle file to rendering the corresponding reactive Native page.
Disclosure of Invention
In order to overcome the problems in the related art, the present disclosure provides an application program starting method, an apparatus, an electronic device, and a storage medium.
According to a first aspect of an embodiment of the present disclosure, there is provided an application program starting method, including:
When the target application program is detected to enter a target page in the starting process of the target application program, if the JS engine in a ready state does not exist in a cache pool of the terminal, creating a target JS engine; wherein the JS engine in the ready state is a JS engine which is created and not used;
and storing the target JS engine into a cache pool of the terminal, and loading a JS Bundle file corresponding to the target page through the target JS engine.
Optionally, the method further comprises:
acquiring the number of JS engines in an occupied state in the cache pool, wherein the JS engines in the occupied state are the JS engines in use;
if the number of the engines in the occupied state is larger than a first preset threshold, if the JS engines in the released state exist in the cache pool, destroying the JS engines in the released state; wherein the JS engine in the released state is a used JS engine;
and executing the step of creating the target JS engine when the number of the engines in the occupied state is not greater than a first preset threshold.
Optionally, the method further comprises:
when the creation of the target JS engine is detected to be completed, setting the state of the target JS engine to be ready;
And when the target JS engine is detected to load the corresponding JS Bundle file, the state of the target engine is adjusted from the ready state to the occupied state.
Optionally, the method further comprises:
when the target application program is detected to exit the target page, acquiring the use state of the target JS engine;
and destroying the target JS engine when the use state of the target JS engine is a released state.
Optionally, the method further comprises:
if the JS engines in the ready state exist in the cache pool of the terminal, acquiring the quantity of the JS engines in the ready state in the cache pool;
when the number of the engines in the ready state is larger than a second preset threshold value, acquiring the creation time length of the JS engines in the ready state;
and destroying the JS engines which are created in the cache pool and have the time length longer than the preset time length.
Optionally, the method further comprises:
monitoring the memory prompt information of the terminal;
when receiving prompt information containing insufficient memory, if the JS engine in the occupied state exists in the cache pool, destroying the JS engine in the occupied state in the cache pool;
and when the JS engines in the ready state exist in the cache pool and the quantity of the JS engines in the ready state is larger than a third threshold value, destroying the JS engines in the ready state in the cache pool so that the quantity of the JS engines in the ready state in the cache pool is not larger than the third threshold value.
Optionally, the method further comprises:
monitoring whether multi-engine configuration information issued by a server is received or not;
and when receiving the multi-engine configuration information issued by the server, creating a target JS engine.
According to a second aspect of the embodiments of the present disclosure, there is provided an application program starting apparatus, applied to a terminal, the apparatus including:
the engine creation module is configured to create a target JS engine when the target application program is detected to enter a target page and the JS engine in a ready state does not exist in a cache pool of the terminal in the process of starting the target application program; wherein the JS engine in the ready state is a JS engine which is created and not used;
the storage module is configured to store the target JS engine into a cache pool of the terminal;
and the loading module is configured to load the JS Bundle file corresponding to the target page through the target JS engine. Optionally, the apparatus further comprises:
the quantity acquisition module is configured to acquire the quantity of the JS engines in the occupied state in the cache pool, wherein the JS engines in the occupied state are the JS engines which are being used;
The engine destroying module is configured to destroy the JS engines in the released state when the number of the engines in the occupied state is larger than a first preset threshold value and the JS engines in the released state exist in the cache pool; wherein the JS engine in the released state is a used JS engine;
the engine creation module is further configured to execute the step of creating the target JS engine when the number of engines in the occupied state is not greater than a first preset threshold.
Optionally, the apparatus further comprises:
a state setting module configured to set a state of the target JS engine to a ready state upon detecting completion of creation of the target JS engine;
and the state adjustment module is configured to adjust the state of the target JS engine from a ready state to an occupied state when the target JS engine is detected to load the corresponding JS Bundle file.
Optionally, the apparatus further comprises:
the state acquisition module is configured to acquire the use state of the target JS engine when the target application program is detected to exit the target page;
the engine destruction module is further configured to destroy the target JS engine when the usage state of the target JS engine is a released state.
Optionally, the apparatus further comprises:
the acquisition module is configured to acquire the number of the JS engines in the ready state in the cache pool when the JS engines in the ready state exist in the cache pool of the terminal;
the time length acquisition module is configured to acquire the creation time length of the JS engines in the ready state when the number of the engines in the ready state is larger than a second preset threshold value;
and the engine destroying module is configured to destroy the JS engine which is created in the cache pool and is ready and has a time length longer than a preset time length.
Optionally, the apparatus further comprises:
the monitoring module is configured to monitor the memory prompt information of the terminal;
the engine destruction module is configured to destroy the JS engines in the occupied state in the cache pool if the JS engines in the occupied state exist in the cache pool when the prompt information containing insufficient memory is received;
and the engine destruction module is further configured to destroy the JS engines in the ready state in the cache pool when the ready state JS engines exist in the cache pool and the number of the ready state JS engines is greater than a third threshold, so that the number of the ready state JS engines in the cache pool is not greater than the third threshold.
Optionally, the apparatus further comprises:
the information monitoring module is configured to monitor whether the multi-engine configuration information issued by the server is received or not; and triggering an engine creation module to execute the step of creating the target JS engine when the multi-engine configuration information issued by the server is received.
According to a third aspect of embodiments of the present disclosure, there is provided an electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform any of the application launch methods described above.
In a fourth aspect of embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium, which when executed by a processor of a mobile terminal, enables the mobile terminal to perform an application launch method as described above.
According to a fifth aspect of embodiments of the present disclosure, there is provided an application/computer program product, which when run on a computer, causes the computer to perform the steps of the application launch method according to any one of the embodiments described above.
The technical scheme provided by the embodiment of the disclosure can comprise the following beneficial effects:
in the starting process of the target application program, when the target application program is detected to enter the target page, whether a JS engine in a ready state exists in a cache pool of the terminal is checked, if the target engine is not created, the target engine is stored in the cache pool. According to the embodiment of the disclosure, the target JS engine is created and stored in the cache pool of the terminal, so that the JS Bundle file corresponding to the target page is loaded through the target JS engine, and the problem of the page white screen possibly caused by using the same JS engine in the related technology can be well solved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a flowchart illustrating an application launch method according to an exemplary embodiment;
FIG. 2 is another flow chart illustrating an application launch according to an exemplary embodiment;
FIG. 3 is a block diagram of an application launch device according to an exemplary embodiment;
fig. 4 is a block diagram of an electronic device, according to an example embodiment.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
Fig. 1 is a flowchart illustrating an application program starting method, as shown in fig. 1, which is used in a terminal, according to an exemplary embodiment, may include the steps of:
in step S110, when it is detected that the target application enters the target page during the start-up of the target application, if there is no JS engine in the ready state in the cache pool of the terminal, the target JS engine is created.
Wherein the ready state JS engine is a JS engine that is created and not used.
In the embodiment of the disclosure, the target application program may be an application program developed based on a real Native development platform, where real Native is a platform-wide mobile application development framework with open source, and real Native supports mobile applications developed using JavaScript (JS) language and supporting IOS, android and Web platforms. In the starting process of the application developed based on the real Native, if a certain page is entered, a corresponding JS Bundle file needs to be loaded through a JS engine, the JS Bundle file can be simply called a JS package, the JS package can comprise a JS core package and a JS service package, the JS core package can be a JS core library, the JS service package can be a JS service library, and the library comprises classes required to be called when the page is loaded. While the existing mode generally loads the corresponding JS packet based on the same JS engine, once the JS engine is occupied, conflict is easily caused when the same business library is loaded between businesses, and therefore the phenomenon of page white screen occurs.
Therefore, in the starting process of the target application program, if the target application program is detected to enter the target page and the related real Native page, the embodiment of the disclosure firstly detects whether the JS engine in the ready state exists in the cache pool of the terminal, and if the JS engine does not exist, the JS engine is created. Of course, if the existence of the JS engine in the ready state is detected in the cache pool of the terminal, the JS engine in the ready state can be directly used, and then a new JS engine is not required to be created.
The embodiment of the disclosure does not adopt the mode of sharing one engine to load the corresponding JS package, but adopts a single engine to load the corresponding JS package every time an application program enters a page, so that the page white screen display caused by the existing problems can be well avoided. The created JS engine will be stored in the cache of the terminal for later use in the embodiment.
Thus, in the embodiment of the present disclosure, there may be three types of JS engines in the cache pool: a ready state JS engine, an occupied state JS engine, and a released state JS engine. The ready state JS engine is a JS engine which is created and not used, the occupied state JS engine is a JS engine which is being used, and the released state JS engine is a JS engine after being used.
In the embodiment of the disclosure, if the JS engine in the ready state does not exist in the cache pool of the terminal, a target JS engine is created; of course, if the JS engine in the ready state exists in the cache pool of the terminal, the JS packet corresponding to the target page may be directly loaded by the JS engine in the ready state.
As an implementation of an embodiment of the present disclosure, before creating the target JS engine, the method may further include the steps of:
monitoring whether multi-engine configuration information issued by a server is received or not;
and when receiving the multi-engine configuration information issued by the server, creating a target JS engine.
In this implementation, it may be implemented whether the background server controls the terminal to use the configuration switch of multiple engines, and when the background server allows the terminal to use the configuration switch of multiple engines, the terminal creates the target JS engine, otherwise the terminal does not create the JS engine.
In step S120, the target JS engine is stored in the cache pool of the terminal, and the JS Bundle file corresponding to the target page is loaded by the target JS engine.
The embodiments of the present disclosure provide for subsequent use by creating a JS engine and storing the created JS engine in a cache pool. Based on the three states of the JS engine set forth in the above, the current state of the JS engine can be updated according to the use condition of the JS engine, so the method can further include, when it is detected that the creation of the target JS engine is completed, setting the state of the target JS engine to a ready state; and when the target JS engine is detected to load the corresponding JS Bundle file, the state of the target engine is adjusted from the ready state to the occupied state. In addition, when the application program is detected to be out of the target page, the state of the target engine is adjusted from the occupied state to the released state.
In addition, in yet another embodiment provided by the present disclosure, the method may further include the steps of: when the application program is detected to exit the target page, acquiring the use state of the target JS engine; and destroying the target JS engine when the use state of the target JS engine is the released state. In this way, the embodiment of the disclosure can timely improve the utilization rate of the space of the cache pool by destroying the released state target JS engines, so that the problem that the newly created JS engines cannot be stored because the cache pool stores a large number of released state JS engines is avoided.
In the method for starting the application program provided by the embodiment of the disclosure, when the target application program is detected to enter the target page in the starting process of the target application program, whether a JS engine in a ready state exists in a cache pool of the terminal is checked first, if no target engine is created, and the target engine is stored in the cache pool. According to the embodiment of the disclosure, the target JS engine is created and stored in the cache pool of the terminal, so that the JS Bundle file corresponding to the target page is loaded through the target JS engine, and the problem of the page white screen possibly caused by using the same JS engine in the related technology can be well solved.
Based on the above embodiment, in still another embodiment provided in the present disclosure, as shown in fig. 2, the method may further include the steps of:
in step S131, the number of JS engines in the occupied state in the cache pool is acquired.
Wherein the JS engine in the occupied state is the JS engine being used.
In the embodiment of the disclosure, as more JS engines may be created, the JS engines stored in the cache pool cannot be increased without limit due to the capacity in the cache pool, so the number of JS engines in the cache pool needs to be controlled. It should be noted that, the size of the buffer pool is specifically determined by the hardware of the terminal, for example, the size of the memory of the terminal, and the buffer pool may be located in the memory of the terminal.
With the start of the application program, if more and more pages are loaded, occupied pages in the cache pool are occupied
In step S132, if the number of the engines in the occupied state is greater than the first preset threshold, if there is a JS engine in the released state in the cache pool, the JS engine in the released state is destroyed. In addition, in step S133, when the number of engines in the occupied state is not greater than the first preset threshold, step S110 is performed.
The released JS engine is a used JS engine.
The setting of the first preset threshold in the embodiment of the present disclosure may be set according to a hardware condition of the terminal, for example, the larger the memory of the terminal is, the first threshold may be correspondingly increased, that is, more JS engines may be simultaneously accommodated in the cache pool of the terminal. Otherwise, the first preset threshold needs to be reduced in size.
Therefore, if the released JS engines exist in the cache pool when the number of engines in the cache pool is greater than the first preset threshold, the released JS engines need to be destroyed. Therefore, the JS engines in the released states can be prevented from occupying the space of the cache pool when not used, and the utilization rate of the space of the cache pool is improved by destroying the engines in the released states. In addition, if the number of the engines in the occupied state is not greater than the first preset threshold, which indicates that the space of the cache pool is not occupied, the step of creating the target engine in step S110 may be performed, so as to avoid that a new JS engine cannot be created when the space of the cache pool is occupied due to too many JS engines in the cache pool.
Based on the above embodiment, in yet another embodiment provided by the present disclosure, the method may further include the steps of:
s141, if the JS engines in the ready state exist in the cache pool of the terminal, acquiring the quantity of the JS engines in the ready state in the cache pool.
S142, when the number of the engines in the ready state is larger than a second preset threshold value, acquiring the creation duration of the JS engines in the ready state.
S143, destroying the JS engines which are ready and have the time length longer than the preset time length and are created in the cache pool.
In the embodiment, as more pages are opened, more JS engines need to be created, and more JS engines in corresponding occupied states are needed. Therefore, although the JS engines in the ready state can be used at any time, if the creation time of the JS engines in the ready state is too long to be used, which means that the JS engines do not need to be used currently, the ready JS engines with creation time longer than the preset time period can be destroyed to improve the space utilization of the cache pool.
Based on the above embodiment, in yet another embodiment provided by the present disclosure, the method may further include the steps of:
s151, monitoring memory prompt information of the terminal.
Because the memory space of the terminal is limited, the terminal in the embodiment of the disclosure can monitor the use condition of the memory space at any time, and once the memory use rate of the terminal is too large and exceeds the early warning value, prompt information of insufficient memory can be sent out.
S152, when the prompt message containing insufficient memory is received, if the JS engine in the occupied state exists in the cache pool, destroying the JS engine in the occupied state in the cache pool.
When the prompt message containing the memory shortage is received, the memory utilization rate of the terminal is seriously insufficient, and the memory needs to be cleaned so as to be blocked. Therefore, when the prompt message containing insufficient memory is received, if the JS engines in the occupied state exist in the cache pool, the JS engines in the occupied state in the cache pool are all destroyed, so that the terminal is prevented from being blocked. The method belongs to a more aggressive mode of cleaning the cache pool, but can effectively reduce the occupancy rate of the memory, avoid the problems of dead halt or blocking of the terminal and the like, and can re-create the JS engine to load the relevant JS packets after the occupancy rate of the memory is improved.
And S153, when the JS engines in the ready state exist in the cache pool and the number of the JS engines in the ready state is larger than a third threshold value, destroying the JS engines in the ready state in the cache pool so that the number of the JS engines in the ready state in the cache pool is not larger than the third threshold value.
In the embodiment, if the ready JS engines exist in the cache pool and the number of the ready JS engines is greater than the third threshold, it is indicated that there are more ready JS engines in the cache pool, and only one ready JS engine can be reserved at this time, and the other ready JS engines are destroyed, so that the subsequent use of the ready JS engines can be ensured, and the occupancy rate of the terminal memory can be reduced.
Fig. 3 is a block diagram of a program launch device according to an exemplary embodiment. Referring to fig. 3, the apparatus includes an engine creation module 10, a storage module 20, and a loading module 30.
The engine creation module 10 is configured to create a target JS engine when it is detected that the target application enters a target page and there is no JS engine in a ready state in a cache pool of the terminal during the start of the target application; wherein the JS engine in the ready state is a JS engine which is created and not used;
a storage module 20 configured to store the target JS engine into a cache pool of the terminal;
and the loading module 30 is configured to load the JS Bundle file corresponding to the target page through the target JS engine.
Optionally, the apparatus further comprises:
the quantity acquisition module is configured to acquire the quantity of the JS engines in the occupied state in the cache pool, wherein the JS engines in the occupied state are the JS engines which are being used;
the engine destroying module is configured to destroy the JS engines in the released state when the number of the engines in the occupied state is larger than a first preset threshold value and the JS engines in the released state exist in the cache pool; wherein the JS engine in the released state is a used JS engine;
The engine creation module is further configured to execute the step of creating the target JS engine when the number of engines in the occupied state is not greater than a first preset threshold.
Optionally, the apparatus further comprises:
a state setting module configured to set a state of the target JS engine to a ready state upon detecting completion of creation of the target JS engine;
and the state adjustment module is configured to adjust the state of the target JS engine from a ready state to an occupied state when the target JS engine is detected to load the corresponding JS Bundle file.
Optionally, the apparatus further comprises:
the state acquisition module is configured to acquire the use state of the target JS engine when the target application program is detected to exit the target page;
the engine destruction module is further configured to destroy the target JS engine when the usage state of the target JS engine is a released state.
Optionally, the apparatus further comprises:
the acquisition module is configured to acquire the number of the JS engines in the ready state in the cache pool when the JS engines in the ready state exist in the cache pool of the terminal;
The time length acquisition module is configured to acquire the creation time length of the JS engines in the ready state when the number of the engines in the ready state is larger than a second preset threshold value;
and the engine destroying module is configured to destroy the JS engine which is created in the cache pool and is ready and has a time length longer than a preset time length.
Optionally, the apparatus further comprises:
the monitoring module is configured to monitor the memory prompt information of the terminal;
the engine destruction module is configured to destroy the JS engines in the occupied state in the cache pool if the JS engines in the occupied state exist in the cache pool when the prompt information containing insufficient memory is received;
and the engine destruction module is further configured to destroy the JS engines in the ready state in the cache pool when the ready state JS engines exist in the cache pool and the number of the ready state JS engines is greater than a third threshold, so that the number of the ready state JS engines in the cache pool is not greater than the third threshold.
Optionally, the apparatus further comprises:
the information monitoring module is configured to monitor whether the multi-engine configuration information issued by the server is received or not; and triggering an engine creation module to execute the step of creating the target JS engine when the multi-engine configuration information issued by the server is received.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
In the application program starting device provided by the embodiment of the disclosure, when detecting that the target application program enters the target page in the starting process of the target application program, firstly checking whether a JS engine in a ready state exists in a cache pool of the terminal, if not, creating the target engine, and storing the target engine in the cache pool. According to the embodiment of the disclosure, the target JS engine is created and stored in the cache pool of the terminal, so that the JS Bundle file corresponding to the target page is loaded through the target JS engine, and the problem of the page white screen possibly caused by using the same JS engine in the related technology can be well solved.
In addition, the embodiment of the disclosure destroys the released JS engines by determining that the number of engines in the cache pool is greater than a first preset threshold, and when there are released JS engines in the cache pool. Therefore, the JS engines in the released states can be prevented from occupying the space of the cache pool when not used, and the utilization rate of the space of the cache pool is improved by destroying the engines in the released states. In addition, if the number of the engines in the occupied state is not greater than the first preset threshold, the step of creating the target engine is performed to indicate that the space of the cache pool is not occupied, so that the problem that a new JS engine cannot be created when the space of the cache pool is occupied due to too many JS engines in the cache pool is avoided.
Fig. 4 is a block diagram illustrating an apparatus 800 for application launch according to an exemplary embodiment. For example, apparatus 800 is an electronic device, which may be specifically a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 4, apparatus 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and a communication component 816.
The processing component 802 generally controls overall operation of the apparatus 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interactions between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phonebook data, messages, pictures, videos, and the like. The memory 804 may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The power supply component 806 provides power to the various components of the device 800. The power components 806 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the device 800.
The multimedia component 808 includes a screen between the device 800 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or slide action, but also the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and/or a rear camera. The front camera and/or the rear camera may receive external multimedia data when the device 800 is in an operational mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 further includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 814 includes one or more sensors for providing status assessment of various aspects of the apparatus 800. For example, the sensor assembly 814 may detect an on/off state of the device 800, a relative positioning of the components, such as a display and keypad of the apparatus 800, the sensor assembly 814 may also detect a change in position of the apparatus 800 or one component of the apparatus 800, the presence or absence of user contact with the apparatus 800, an orientation or acceleration/deceleration of the apparatus 800, and a change in temperature of the apparatus 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate communication between the apparatus 800 and other devices, either in a wired or wireless manner. The device 800 may access a wireless network based on a communication standard, such as WiFi, an operator network (e.g., 2G, 3G, 4G, or 5G), or a combination thereof. In one exemplary embodiment, the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements for performing the … method described above.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 804 including instructions executable by processor 820 of apparatus 800 to perform the above-described method. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
Embodiments of the present disclosure also provide a non-transitory computer-readable storage medium, which when executed by a processor of a mobile terminal, enables the mobile terminal to perform an application program starting method as described above.
There is further provided in accordance with an embodiment of the present disclosure an application/computer program product, in yet another embodiment of the present disclosure, a computer program product comprising instructions which, when run on a computer, cause the computer to perform the steps of the application launch method of any one of the embodiments described above.
In the above embodiments, it may be implemented in whole or in part 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, produces a flow or function in accordance with embodiments of the present disclosure, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, DSL (Digital Subscriber Line, digital subscriber line)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., a floppy Disk, a hard Disk, a magnetic tape), an optical medium (e.g., a DVD (Digital Versatile Disc, digital versatile Disk)), or a semiconductor medium (e.g., an SSD (Solid State Disk)), or the like.
It is noted that relational terms such as first and second, and the like are 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. Moreover, 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (11)
1. An application program starting method, which is applied to a terminal, comprises the following steps:
when the target application program is detected to enter a target page in the starting process of the target application program, if the JS engine in a ready state does not exist in a cache pool of the terminal, creating a target JS engine; wherein the JS engine in the ready state is a JS engine which is created and not used; the JS engine in the cache pool includes: the ready state JS engine, the occupied state JS engine and the released state JS engine, wherein the occupied state JS engine is a used JS engine, and the released state JS engine is a used JS engine;
storing the target JS engine into the cache pool of the terminal, and loading a JS Bundle file corresponding to the target page through the target JS engine;
the method further comprises the steps of:
Acquiring the number of JS engines in the occupied state in the cache pool;
if the number of the JS engines in the occupied state is larger than a first preset threshold, destroying the JS engines in the released state if the JS engines in the released state exist in the cache pool;
executing the step of creating the target JS engine when the number of the JS engines in the occupied state is not greater than a first preset threshold;
when the creation of the target JS engine is detected to be completed, setting the state of the target JS engine to be ready;
when the target JS engine is detected to load a corresponding JS Bundle file, the state of the target engine is adjusted from a ready state to an occupied state;
when the target application program is detected to exit the target page, acquiring the use state of the target JS engine;
and destroying the target JS engine when the use state of the target JS engine is a released state.
2. The method according to claim 1, wherein the method further comprises:
if the JS engines in the ready state exist in the cache pool of the terminal, acquiring the quantity of the JS engines in the ready state in the cache pool;
When the number of the JS engines in the ready state is larger than a second preset threshold value, acquiring the creation time length of the JS engines in the ready state;
and destroying the JS engines which are created in the cache pool and have the time length longer than the preset time length.
3. The method according to claim 1, wherein the method further comprises:
monitoring the memory prompt information of the terminal;
when receiving prompt information containing insufficient memory, if the JS engine in the occupied state exists in the cache pool, destroying the JS engine in the occupied state in the cache pool;
and when the JS engines in the ready state exist in the cache pool and the number of the JS engines in the ready state is larger than a third threshold value, destroying the JS engines in the ready state in the cache pool so that the number of the JS engines in the ready state in the cache pool is not larger than the third threshold value.
4. The method according to claim 1, wherein the method further comprises:
monitoring whether multi-engine configuration information issued by a server is received or not;
and when receiving the multi-engine configuration information issued by the server, creating the target JS engine.
5. An application launching device, for application to a terminal, the device comprising:
the engine creation module is configured to create a target JS engine when the target application program is detected to enter a target page and the JS engine in a ready state does not exist in a cache pool of the terminal in the process of starting the target application program; wherein the JS engine in the ready state is a JS engine which is created and not used; the JS engine in the cache pool includes: the ready state JS engine, the occupied state JS engine and the released state JS engine, wherein the occupied state JS engine is a used JS engine, and the released state JS engine is a used JS engine;
the storage module is configured to store the target JS engine into the cache pool of the terminal;
the loading module is configured to load the JS Bundle file corresponding to the target page through the target JS engine;
the apparatus further comprises:
the quantity acquisition module is configured to acquire the quantity of JS engines in the occupied state in the cache pool;
the engine destruction module is configured to destroy the JS engines in the released state when the number of the JS engines in the occupied state is larger than a first preset threshold value and the JS engines in the released state exist in the cache pool;
The engine creating module is further configured to execute the step of creating the target JS engine when the number of JS engines in the occupied state is not greater than a first preset threshold;
a state setting module configured to set a state of the target JS engine to a ready state upon detecting completion of creation of the target JS engine;
the state adjustment module is configured to adjust the state of the target JS engine from a ready state to an occupied state when the target JS engine is detected to load a corresponding JS Bundle file;
the state acquisition module is configured to acquire the use state of the target JS engine when the target application program is detected to exit the target page;
the engine destruction module is further configured to destroy the target JS engine when the usage state of the target JS engine is a released state.
6. The apparatus of claim 5, wherein the apparatus further comprises:
the acquisition module is configured to acquire the number of the JS engines in the ready state when the JS engines in the ready state exist in the cache pool of the terminal;
the time length acquisition module is configured to acquire the creation time length of the JS engines in the ready state when the number of the engines in the ready state is larger than a second preset threshold value;
And the engine destroying module is configured to destroy the JS engine which is created in the cache pool and is ready and has a time length longer than a preset time length.
7. The apparatus of claim 5, wherein the apparatus further comprises:
the monitoring module is configured to monitor the memory prompt information of the terminal;
the engine destruction module is configured to destroy the JS engine in the occupied state in the cache pool if the JS engine in the occupied state exists in the cache pool when the prompt message containing insufficient memory is received;
and the engine destruction module is further configured to destroy the JS engines in the ready state in the cache pool when the JS engines in the ready state exist in the cache pool and the number of the JS engines in the ready state is greater than a third threshold, so that the number of the JS engines in the ready state in the cache pool is not greater than the third threshold.
8. The apparatus of claim 5, wherein the apparatus further comprises:
the information monitoring module is configured to monitor whether the multi-engine configuration information issued by the server is received or not; and when receiving the multi-engine configuration information issued by the server, triggering an engine creation module to execute the step of creating the target JS engine.
9. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the application launch method of any one of claims 1-4.
10. A non-transitory computer readable storage medium, characterized in that instructions in the storage medium, when executed by a processor of a mobile terminal, enable the mobile terminal to perform an application launch method, the method comprising the steps of the application launch method of any one of claims 1-4.
11. An application/computer program product, which when run on a computer causes the computer to perform the steps of the application launch method of any one of claims 1-4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110611062.6A CN113467854B (en) | 2021-06-01 | 2021-06-01 | Application program starting method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110611062.6A CN113467854B (en) | 2021-06-01 | 2021-06-01 | Application program starting method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113467854A CN113467854A (en) | 2021-10-01 |
CN113467854B true CN113467854B (en) | 2023-10-24 |
Family
ID=77871980
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110611062.6A Active CN113467854B (en) | 2021-06-01 | 2021-06-01 | Application program starting method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113467854B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107577509A (en) * | 2017-08-28 | 2018-01-12 | 深圳市金立通信设备有限公司 | A kind of method, terminal and computer-readable recording medium for loading application interface |
CN111722903A (en) * | 2020-06-16 | 2020-09-29 | 北京达佳互联信息技术有限公司 | Data processing method and device, electronic equipment and storage medium |
CN111797388A (en) * | 2020-06-12 | 2020-10-20 | 武汉大学 | JavaScript engine memory information leakage defense method and system based on runtime randomization |
CN111880799A (en) * | 2020-07-30 | 2020-11-03 | 浪潮云信息技术股份公司 | Method and device for generating number-taking client program and readable medium |
CN112612531A (en) * | 2019-09-19 | 2021-04-06 | 北京京东尚科信息技术有限公司 | Application program starting method and device, electronic equipment and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA2513019A1 (en) * | 2005-07-22 | 2007-01-22 | Research In Motion Limited | A method for communicating state information between a server and a mobile device browser with version handling |
-
2021
- 2021-06-01 CN CN202110611062.6A patent/CN113467854B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107577509A (en) * | 2017-08-28 | 2018-01-12 | 深圳市金立通信设备有限公司 | A kind of method, terminal and computer-readable recording medium for loading application interface |
CN112612531A (en) * | 2019-09-19 | 2021-04-06 | 北京京东尚科信息技术有限公司 | Application program starting method and device, electronic equipment and storage medium |
CN111797388A (en) * | 2020-06-12 | 2020-10-20 | 武汉大学 | JavaScript engine memory information leakage defense method and system based on runtime randomization |
CN111722903A (en) * | 2020-06-16 | 2020-09-29 | 北京达佳互联信息技术有限公司 | Data processing method and device, electronic equipment and storage medium |
CN111880799A (en) * | 2020-07-30 | 2020-11-03 | 浪潮云信息技术股份公司 | Method and device for generating number-taking client program and readable medium |
Also Published As
Publication number | Publication date |
---|---|
CN113467854A (en) | 2021-10-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107357613B (en) | Application updating method and device and computer readable storage medium | |
CN106547547B (en) | data acquisition method and device | |
CN112506553B (en) | Upgrading method and device for data surface container of service grid and electronic equipment | |
CN106708967B (en) | Page display method and device | |
CN108446226B (en) | Application exception processing method | |
CN107506496B (en) | Defragmentation method, defragmentation device and computer-readable storage medium | |
CN107239307B (en) | Version updating information display method and device | |
CN109901886B (en) | Page language switching method, system, device and computer readable storage medium | |
CN112685269A (en) | Data acquisition method and device, electronic equipment and storage medium | |
CN113467854B (en) | Application program starting method and device, electronic equipment and storage medium | |
CN113778687B (en) | Memory allocation information processing method and device, electronic equipment and storage medium | |
CN106354595B (en) | Mobile terminal, hardware component state detection method and device | |
CN110502714B (en) | Information detection method and device, electronic equipment and storage medium | |
CN112817844A (en) | Background process residence test method, device, equipment and storage medium | |
CN111597106A (en) | Point burying management method and device | |
CN112883314A (en) | Request processing method and device | |
CN112632184A (en) | Data processing method and device, electronic equipment and storage medium | |
CN107257384B (en) | Service state monitoring method and device | |
CN114077461A (en) | Application program running method, device, equipment and storage medium | |
CN111767063A (en) | Resource updating method, device and equipment for application program | |
CN110659081B (en) | File processing method and device for program object and electronic equipment | |
CN113946346B (en) | Data processing method and device, electronic equipment and storage medium | |
CN112068975B (en) | Information processing method and device | |
CN114531493B (en) | Request processing method and device, electronic equipment and storage medium | |
CN110362451B (en) | Monitoring method, device and medium |
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 |