CN106055367B - Script file loading method and device - Google Patents

Script file loading method and device Download PDF

Info

Publication number
CN106055367B
CN106055367B CN201610388331.6A CN201610388331A CN106055367B CN 106055367 B CN106055367 B CN 106055367B CN 201610388331 A CN201610388331 A CN 201610388331A CN 106055367 B CN106055367 B CN 106055367B
Authority
CN
China
Prior art keywords
service
script file
loading
loaded
database
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
CN201610388331.6A
Other languages
Chinese (zh)
Other versions
CN106055367A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201610388331.6A priority Critical patent/CN106055367B/en
Publication of CN106055367A publication Critical patent/CN106055367A/en
Application granted granted Critical
Publication of CN106055367B publication Critical patent/CN106055367B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention provides a script file loading method and a device, wherein the method comprises the following steps: when a first service is in a running state, acquiring a second service associated with the first service; judging whether the current user of the first service is a history identification user of the second service; and if the current user of the first service is the history identification user of the second service, loading at least one script file of the second service into an operation database. The embodiment of the invention can intelligently load the script file, shorten the loading time and further improve the processing efficiency.

Description

Script file loading method and device
Technical Field
The invention relates to the technical field of internet, in particular to a script file loading method and device.
Background
With the rapid development of mobile internet, various types of applications applied to user terminals (e.g., mobile phones, wearable devices, etc.) are in the endlessly. Generally, one application has a plurality of service forms, and can run a plurality of services, for example, a social application can run a chat service, a dynamic sharing service, a game service, a reading service, and the like. When a trigger instruction for a certain service in a certain application program is received, a script file (such as an lua file and the like) of the service, which is downloaded and decompressed from a server of the application program, is decrypted, and after the decryption is completed, the script file is analyzed and loaded into an operation database (such as an Objective-C runtime library), and finally the script file is called to operate the service. If the script file of the service is large and many, the above process will last for a long time, and further the output of the service window is slow. Therefore, the existing script file loading method depends on a trigger instruction input by a user, and the loading time is long.
Disclosure of Invention
The embodiment of the invention provides a script file loading method and device, which can intelligently load a script file, shorten the loading time and further improve the processing efficiency.
In a first aspect of the embodiments of the present invention, a method for loading a script file is provided, where the method includes:
when a first service is in a running state, acquiring a second service associated with the first service;
judging whether the current user of the first service is a history identification user of the second service;
and if the current user of the first service is the history identification user of the second service, loading at least one script file of the second service into an operation database.
Wherein the determining whether the current user of the first service is the history identification user of the second service includes:
judging whether the current user of the first service is a history identification user of the second service according to the use information of the current user of the first service for the second service in a preset time period;
and if the use information exists in the preset time period, determining that the current user of the first service is the history identification user of the second service.
Wherein the loading at least one script file of the second service into an operation database comprises:
acquiring at least one script file of the second service;
generating a pre-loading list of the second service according to at least one script file of the second service;
and sequentially analyzing and loading at least one script file of the second service into an operation database according to the sequence of the preloading list of the second service.
Wherein the generating a pre-loaded list of the second service according to the at least one script file of the second service comprises:
and sequencing the at least one script file of the second service according to the inclusion relationship among the at least one script file of the second service to generate a preloading list of the second service.
Wherein the loading at least one script file of the second service into an operation database comprises:
and monitoring the thread state of the first service, and loading at least one script file of the second service into an operation database when the thread state is an idle state.
Wherein, when the thread state is an idle state, loading at least one script file of the second service into an operation database, including:
when the thread state of the first service is monitored to be an idle state, loading a script file of the second service into an operation database, and stopping monitoring the thread state of the first service in the loading process;
and after loading a script file of the second service into the running database, restoring and monitoring the thread state of the first service.
When a trigger instruction input aiming at the second service is received, judging whether at least one script file of the second service is completely loaded into the operation database;
and if the second service is completely loaded into the operation database, operating the second service according to at least one script file of the completely loaded second service.
Wherein, after judging whether all the at least one script file of the second service has been loaded into the operation database, the method further comprises:
if not, loading the script file which is not loaded in at least one script file of the second service into the operation database;
and when the at least one script file of the second service is completely loaded into the operation database, operating the second service according to the at least one script file of the second service which is completely loaded.
Wherein, after the second service is executed according to the at least one script file of the second service that has been completely loaded, the method further includes:
emptying the pre-loading list of the second service;
or emptying the pre-loading list of the second service and releasing the monitoring of the thread state of the first service.
Accordingly, a second aspect of the embodiments of the present invention provides a script file loading apparatus, including:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a second service related to a first service when the first service is in a running state;
a judging unit, configured to judge whether a current user of the first service is a history identifier user of the second service;
and the loading unit is used for loading at least one script file of the second service into an operation database if the current user of the first service is the history identification user of the second service.
The determining unit is specifically configured to determine whether the current user of the first service is the history identifier user of the second service according to whether the usage information of the current user of the first service for the second service exists within a preset time period, and if the usage information exists within the preset time period, determine that the current user of the first service is the history identifier user of the second service.
Wherein the loading unit includes:
the script obtaining unit is used for obtaining at least one script file of the second service;
the list generating unit is used for generating a pre-loaded list of the second service according to at least one script file of the second service;
and the analysis loading unit is used for sequentially loading at least one script file of the second service into an operation database according to the sequence of the preloading list of the second service.
The list generating unit is specifically configured to sort the at least one script file of the second service according to an inclusion relationship between the at least one script file of the second service to generate a pre-loading list of the second service.
The loading unit is specifically configured to monitor a thread state of the first service, and load at least one script file of the second service into an operation database when the thread state is an idle state.
The loading unit is specifically configured to load a script file of the second service into an operation database when it is monitored that the thread state of the first service is an idle state, and stop monitoring the thread state of the first service in a loading process; and after loading a script file of the second service into the running database, restoring and monitoring the thread state of the first service.
The judging unit is further configured to judge whether at least one script file of the second service is completely loaded into the operation database when a trigger instruction input for the second service is received;
the device further comprises an operation unit, which is used for operating the second service according to at least one script file of the second service which is completely loaded if the second service is completely loaded into the operation database.
The loading unit is further configured to load, if all the script files are not loaded into the operation database, script files that are not loaded in at least one script file of the second service into the operation database;
the running unit is further configured to run the second service according to the at least one completely loaded script file of the second service when the at least one completely loaded script file of the second service is completely loaded into the running database.
The device further comprises a clearing unit, which is used for clearing the pre-loading list of the second service; or, the clearing unit is configured to clear the pre-loading list of the second service and release monitoring of the thread state of the first service.
Accordingly, a second aspect of the embodiments of the present invention provides a script file loading apparatus, which includes an interface circuit, a memory and a processor, wherein the memory stores a set of program codes, and the processor is configured to call the program codes stored in the memory for executing the method provided by the first aspect of the embodiments of the present invention.
In the embodiment of the invention, when the first service is in the running state, the second service associated with the first service is obtained, whether the current user of the first service is the history identification user of the second service is judged, and if the current user of the first service is the history identification user of the second service, at least one script file of the second service is loaded into the running database, so that the loading of the script file is intelligently realized, the loading time is shortened, and the processing efficiency is further improved.
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 schematic flowchart of a script file loading method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating another script file loading method according to an embodiment of the present invention;
fig. 3 is a flowchart illustrating a script file loading method according to another embodiment of the present invention;
fig. 4 is a schematic structural diagram of a script file loading apparatus according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a load unit according to the embodiment shown in FIG. 4;
fig. 6 is a schematic structural diagram of another script file loading apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of another script file loading apparatus 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 script file loading method provided by the embodiment of the present invention may be applied to a scenario where a script file is loaded by an application program having a plurality of service windows, for example, when a first service is in a running state, a script file loading apparatus acquires a second service associated with the first service, and determines whether a current user of the first service is a history identifier user of the second service, and if the current user of the first service is the history identifier user of the second service, loads at least one script file of the second service into a scenario where a database is running. According to the embodiment of the invention, before the history identification user inputs the trigger instruction aiming at the second service, at least one script file of the second service is preloaded, so that the intelligence and the flexibility of the script file loading device are improved, the loading time of the script file is shortened, the processing efficiency of the script file loading device is improved, the service window of the second service is rapidly output, and the waiting time of the user is saved.
The script file loading device in the embodiment of the present invention may be a part or all of a user terminal, and the user terminal may include, but is not limited to, an electronic device such as a mobile phone, a PAD (PAD), a smart wearable device, and a personal computer. The script loading method provided by the embodiment of the invention can be applied to various terminal operating systems, and can include but is not limited to: android system, saiban system, Windows system, IOS (mobile operating system developed by apple inc.) system, and the like.
The script loading method provided by the embodiment of the present invention will be described in detail below with reference to fig. 1 to 3.
Referring to fig. 1, a flowchart of a script loading method according to an embodiment of the present invention is shown, where the method includes steps S101 to S103.
101, when a first service is in a running state, acquiring a second service associated with the first service.
In the specific implementation, a plurality of services of the application program are presented to the user in the form of service windows, and each service can be switched by switching instructions of the service windows, and one service window jumps to another service window, so that the switching from the operation of one service to the operation of the next service is realized. It should be noted that a service form may have multiple display interfaces, for example, a chat service form includes a contact interface, a session list interface, and the like, and a reading service form includes a book list interface, a book reading interface, and the like.
In a possible implementation manner, the first service is a service corresponding to a main service window of the application program, for example, the main service window of the social application program is a chat service window, the main service window further includes display interfaces of other service identifiers, and the user terminal can jump to the display interfaces of other service windows according to a click instruction input by the user for the display interfaces. In another possible implementation manner, the first service is a service corresponding to a service window running on the application program, at this time, a display interface of the service window includes a touch identifier that jumps to another service window, and the user terminal may jump to the display interface of another service according to a click instruction input by the user for the touch identifier. The first possible implementation is preferred. In the process of jumping to a certain service window, a script file loading device is required to load the step files of the services corresponding to the service window so as to output a series of display interfaces of the services.
When the first service is in a running state, that is, the first service is running on an application program, the first service may be a main service of the application program, or may be any one of non-main services of the application program, and at this time, the script file loading device obtains a second service associated with the first service. The second service and the first service belong to different services of the same application program, and different functions are realized. If the first service can be switched to M services and the second service can be switched to N services, the M services include the second service, the N services include the first service, and M and N may be equal or unequal, that is, the second service and the first service can be switched to each other. For example, the social application program, when the first service is a chat service, the second service may be one of a reading service, a game service, a shopping service, and the like.
And 102, judging whether the current user of the first service is the history identification user of the second service.
In a specific implementation, the script file loading device judges whether the current user of the first service is a history identification user of the second service according to the use information of the current user of the first service for the second service in a preset time period, and if the use information exists in the preset time period, the current user of the first service is determined to be the history identification user of the second service. The current user of the first service may be a user who is operating on a service window of the first service. Optionally, the current user of the first service logs in the application programs to which the first service and the second service belong through the account password, so that the user terminal can record the operation record of the current user on the application program according to the account of the current user. Optionally, the account password for logging in the first service by the current user of the first service may be different from the account passwords for logging in the application programs to which the first service and the second service belong, or different from the account password for logging in the second service, so as to expand the application range of the embodiment of the present invention.
In a possible implementation manner, the script file loading device records and stores the usage information each time the user uses the application program to which the first service and the second service belong, for example, user a enters the reading service window to read page 1 of book a in 2016, 5, 25, 17:45, exits the reading service window in 18:20, and the page number of book a stored in the exiting is 13 pages, where the usage information may include usage time period of 2016, 5, 25, 17:45-18:20, usage object is the reading service, and usage footprint of 13 pages of book a. The script file loading device acquires the use information of the current user of the first service aiming at the second service, judges whether the use time period in the use information exists in a preset time period, and determines that the current user of the first service is the history identification user of the second service if the use time period exists. The preset time period refers to a time period which is separated from the time of acquiring the second service, and may be one week, 24 hours, 48 hours, and the like, and specific numerical values are not limited herein.
In another possible implementation, the usage information includes usage identification, usage object, and usage footprint. And B is marked by the script file loading device when the user operates the use object, and as time goes on, if the user does not use the second service within a preset time period from the moment of marking B, B is marked, and the use identifier can be represented by B. The script file loading device acquires the use information of the current user of the first service aiming at the second service, judges whether a use identifier exists in the use information in a preset time period, and determines that the current user of the first service is a history identifier user of the second service if the use identifier exists.
It will be appreciated that the history of the second service identifies the user as a user using the second service for a preset period of time.
103, if the current user of the first service is the history identification user of the second service, loading at least one script file of the second service into an operation database.
In a specific implementation, if the current user of the first service is the history identification user of the second service, the script file loading device preloads the script file of the second service, and loads at least one script file of the second service into the operation database. In the prior art, the script file loading device loads the script file of a certain service according to a trigger instruction of a user to the service, and in the embodiment of the invention, the user does not need to input the trigger instruction to the service, and the script file of the service is preloaded when the current user is identified as a history identification user of the service, so that the intelligence and the flexibility of the script file loading device are improved. It can be understood that the preloading process does not need to leave the service window of the first service, the script file is loaded in the background of the script file loading device, and the second service can be quickly run when the trigger instruction for the second service is received, so that the processing efficiency is improved.
Illustratively, the script file may be a lua file. The lua file is a file encoded by a lua scripting language, which is a small scripting language designed to be embedded in an application to provide flexible extension and customization functions for the application. The lua script file can be easily called by C/C + + codes and can also call C/C + + functions in reverse. lua provides a very easy-to-use extension interface and mechanism that can be compiled and run on almost any operating system and platform.
In a possible implementation manner, the script file loading device obtains at least one script file of the second service, generates a preloading list of the second service according to the at least one script file of the second service, and then sequentially parses and loads the at least one script file of the second service into the operation database according to the order of the preloading list of the second service.
In another possible implementation manner, the script file loading device monitors the thread state of the first service, and loads at least one script file of the second service into the running database when the thread state is an idle state, so that the normal running of the first service is not affected. Optionally, when the thread state of the first service is monitored to be an idle state, loading a script file of the second service into the running database, stopping monitoring the thread state of the first service in the loading process, and after the script file of the second service is loaded into the running database, resuming monitoring the thread state of the first service. When the thread state is monitored to be in an idle state for the ith time, loading the ith script file in at least one script file of the second service into the running database, and stopping monitoring the thread state in the loading process; and after the ith script file is loaded into the running database, restoring the thread monitoring state, and loading the (i + 1) th script file in at least one script file of the second service into the running database when the (i + 1) th script file in the thread monitoring state is in an idle state for the first time, wherein i is an integer greater than or equal to 1.
Illustratively, the runtime database may be an Objective-C runtime library, which is a library written in C-speech and assembly languages and capable of providing object-oriented capabilities for C-language. Class information, allocation methods, execution methods, and the like may be loaded using the runtime library. Objective-C is a generic, high-level, object-oriented programming language that extends the standard ANSI C programming language, incorporating message passing mechanisms into ANSI C.
In the embodiment of the invention, when the first service is in the running state, the second service associated with the first service is obtained, whether the current user of the first service is the history identification user of the second service is judged, and if the current user of the first service is the history identification user of the second service, at least one script file of the second service is loaded into the running database, so that the loading of the script file is intelligently realized, the loading time is shortened, and the processing efficiency is further improved.
Referring to fig. 2, a flowchart of another script loading method according to an embodiment of the present invention is shown, where the method includes steps S201 to S210.
201, when a first service is in a running state, a second service associated with the first service is acquired.
202, judging whether the current user of the first service is the history identification user of the second service.
The implementation processes of step 201 and step 202 in the embodiment of the present invention may refer to the detailed descriptions of step 101 and step 102 in the embodiment shown in fig. 1, and are not described herein again.
And 203, if the current user of the first service is the history identification user of the second service, acquiring at least one script file of the second service.
In a specific implementation, if the current user of the first service is the history identification user of the second service, the script file loading device obtains at least one script file of the second service. If at least one script file of the second service does not exist on the user terminal, the script file loading device sends a downloading request to an application program server to which the first service and the second service belong, the application program server feeds back at least one script file of the second service to the script file loading device, and the script file loading device receives the at least one script file of the second service fed back by the application program and decompresses the at least one script file of the second service. And if at least one script file of the second service exists on the user terminal, the script file loading device directly reads the decompressed at least one script file of the second service from the user terminal.
And 204, generating a pre-loading list of the second service according to at least one script file of the second service.
In a specific implementation, after at least one decompressed script file of the second service is acquired, if the at least one script file of the second service is an encrypted file, the script file loading device decrypts the acquired at least one script file of the second service, and generates a preloaded list of the second service according to the at least one script file of the second service after decryption; and if the at least one script file of the second service is not encrypted, generating a preloading list of the second service according to the at least one script file of the second service.
And the script file loading device sequences at least one script file of the second service according to the inclusion relationship among the at least one script file of the second service to generate a preloading list of the second service. For example, if the script file 2 needs to call the script file 1 and the script file 3 needs to call the script file 2, the script file 3 contains the script file 2 and the script file 2 contains the script file 1, and the generated preloading list sequentially includes the script file 1, the script file 2 and the script file 3, that is, the script file to be called is arranged in front of the preloading list, so that the script file can be loaded orderly and quickly when being loaded into the operation database during analysis, and the processing efficiency is improved. Optionally, the script file loading device sorts the at least one script file of the second service according to the execution sequence of the at least one script file of the second service to generate a preloading list of the second service. Optionally, the script file loading device sorts the at least one script file of the second service according to the file identifier of the at least one script file of the second service to generate a pre-loading list of the second service.
And 205, sequentially parsing and loading at least one script file of the second service into an operation database according to the sequence of the pre-loaded list of the second service.
In specific implementation, the script file loading device sequentially analyzes and loads at least one script file of the second service into the running database according to the sequence of the pre-loading list of the second service, and the sequential analysis and loading can improve the processing efficiency. If the script file is loaded out of order, the script file loading device needs to search the script file to be called when loading a certain script file, so that the processing time is prolonged. The loading device parses and loads a certain script file into the runtime database, for example, converts the script file language into an Objective-C language and adds the converted script file language into the Objective-C runtime database, so as to quickly load the second service when a trigger instruction for the second service is received.
206, when receiving a trigger instruction for the second service input, determining whether at least one script file of the second service is completely loaded into the operation database.
In a specific implementation, during the execution of step 205 or after the execution of step 205, the user may input a trigger instruction to the second service, and optionally, the trigger instruction is a click operation input to the second service identifier. When a trigger instruction for a second service input is received, at least one script of the second service may be completely loaded into the operation database; it is also possible that a part of the script files is loaded into the operation database, and another part of the script files is not loaded into the operation database, so that the script file loading device determines whether all of the at least one script file of the second service is loaded into the operation database when receiving the trigger instruction.
And 207, if all the second services are loaded into the running database, running the second services according to at least one script file of the all-loaded second services.
In a specific implementation, if at least one script file of the second service is completely loaded into the running database, the script file loading device runs the second service according to the at least one script file of the completely loaded second service, that is, the loaded script file is converted into a programming language executable by the running database, and the second service is run according to the converted programming language.
And 208, if not all the script files are loaded into the running database, loading the script files which are not loaded in at least one script file of the second service into the running database.
In a specific implementation, if at least one script file of the second service is not completely loaded into the running database, the script file loading device completely loads the script file which is not loaded into the running database. Unlike step 205, in which step 205 is a sequential parsing of the load according to the pre-load list, step 208 loads all the unloaded script files into the runtime database at once regardless of the order.
209, when the at least one script file of the second service has been completely loaded into the operation database, operating the second service according to the at least one script file of the second service that has been completely loaded.
In a specific implementation, when at least one script file of the second service is completely loaded into the running database, the script file loading device runs the second service according to the at least one script file of the completely loaded second service, that is, the loaded script file is converted into a programming language executable by the running database, and the second service is run according to the converted programming language.
And 210, emptying the pre-loading list of the second service.
In a specific implementation, the preloading list includes at least one script file of the second service, occupies a certain memory and is not helpful for running the second service, so that the preloading list of the second service is emptied after the at least one script file of the second service is completely loaded into the running database, so as to facilitate the execution of the next preloading process.
In the embodiment of the invention, when the current user is identified as the history identification user of the second service, at least one script file of the second service is sequentially loaded into the running database according to the sequence of the pre-loading list, so that the sequential loading of the script files is realized, and the processing efficiency is improved.
Referring to fig. 3, a flowchart of another script loading method according to an embodiment of the present invention is shown, where the method includes steps S301 to S308.
301, when a first service is in a running state, acquiring a second service associated with the first service.
And 302, judging whether the current user of the first service is the history identification user of the second service.
The implementation processes of step 301 and step 302 in the embodiment of the present invention may refer to the detailed descriptions of step 101 and step 102 in the embodiment shown in fig. 1, and are not described herein again.
303, if the current user of the first service is the history identification user of the second service, monitoring the thread state of the first service, and loading at least one script file of the second service into an operation database when the thread state is an idle state.
In a specific implementation, if the current user of the first service is the history identification user of the second service, the script file loading device monitors the thread state of the first service, and loads at least one script file of the second service into the running database when the thread state is the idle state. And when the thread state is an idle state, loading the script file, so that the operation of the first service is not influenced, and the idle time can be fully utilized. It is to be understood that the idle state is a state in which the first service does not accept or send messages.
And when the thread state of the first service is monitored to be an idle state, loading a script file of the second service into the running database, stopping monitoring the thread state of the first service in the loading process, and recovering the thread state for monitoring the first service after the script file of the second service is loaded into the running database. When the thread state is monitored to be in an idle state for the ith time, loading the ith script file in at least one script file of the second service into the running database, and stopping monitoring the thread state in the loading process; and after the ith script file is loaded into the running database, restoring the thread monitoring state, and loading the (i + 1) th script file in at least one script file of the second service into the running database when the (i + 1) th script file in the thread monitoring state is in an idle state for the first time, wherein i is an integer greater than or equal to 1. That is, a script file is loaded in an idle state, the loading time of each script file is controlled to be about 10ms, so as to ensure that the loading of the script file can be completed in the idle state, the control time is 10ms for example, and the specific numerical value is not limited herein. Illustratively, when the Runloop of the thread of the first service issues BeforeWaiting, that is, the thread state of the first service is an idle state at this time, a script file is loaded, and when the thread state of the next Runloop cycle is an idle state, a next script file is loaded. Optionally, when it is monitored that the thread state is in the idle state for the ith time, the script file loading device loads the ith script file in the preloading list into the running database according to the sequence of the preloading list of the second service, stops monitoring the thread state in the loading process, restores the thread monitoring state after the ith script file is loaded into the running database, and loads the (i + 1) th script file in the preloading list into the running database when it is monitored that the thread state is in the idle state for the (i + 1) th time.
304, when a trigger instruction for the second service input is received, determining whether at least one script file of the second service is completely loaded into the operation database.
In a specific implementation, during the execution of step 303 or after the execution of step 303, the user may input a trigger instruction to the second service, and optionally, the trigger instruction is a click operation input to the second service identifier. When a trigger instruction for a second service input is received, at least one script of the second service may be completely loaded into the operation database; it is also possible that a part of the script files is loaded into the operation database, and another part of the script files is not loaded into the operation database, so that the script file loading device determines whether all of the at least one script file of the second service is loaded into the operation database when receiving the trigger instruction.
305, if the second service is completely loaded into the running database, running the second service according to at least one script file of the completely loaded second service.
In a specific implementation, if at least one script file of the second service is completely loaded into the running database, the script file loading device runs the second service according to the at least one script file of the completely loaded second service, that is, the loaded script file is converted into a programming language executable by the running database, and the second service is run according to the converted programming language.
And 306, if not all the script files are loaded into the running database, loading the script files which are not loaded in at least one script file of the second service into the running database.
In a specific implementation, if at least one script file of the second service is not completely loaded into the running database, the script file loading device completely loads the script file which is not loaded into the running database. The difference from step 303 is that step 303 loads the script file according to the idle state, and step 306 loads all the unloaded script files into the running database at one time regardless of whether the thread state is idle or not.
307, when the at least one script file of the second service is completely loaded into the running database, running the second service according to the at least one script file of the second service that is completely loaded.
In a specific implementation, when at least one script file of the second service is completely loaded into the running database, the script file loading device runs the second service according to the at least one script file of the completely loaded second service, that is, the loaded script file is converted into a programming language executable by the running database, and the second service is run according to the converted programming language.
And 308, emptying the preloading list of the second service and releasing the monitoring on the thread state of the first service.
In a specific implementation, the preloading list includes at least one script file of the second service, occupies a certain memory and is not helpful for running the second service, so that the preloading list of the second service is emptied after the at least one script file of the second service is completely loaded into the running database, so as to facilitate the execution of the next preloading process. Since the monitoring of the thread state of the first service is started in step 303, after at least one script file of the second service is completely loaded into the operation database, the script file does not need to be loaded according to the monitored thread state, and thus the monitoring of the thread state of the first service is released while the pre-loading list of the second service is emptied, that is, the thread state of the first service is not monitored any more in the operation process of the second service.
In the embodiment of the invention, when the current user is identified as the history identification user of the second service, at least one script file of the second service is loaded into the operation database according to the thread state of the first service, and the idle time is fully utilized while the operation of the first service is not influenced.
Referring to fig. 4, which is a schematic structural diagram of a script file loading apparatus according to an embodiment of the present invention, the script file loading apparatus 40 may include an obtaining unit 401, a determining unit 402, and a loading unit 403.
An obtaining unit 401, configured to obtain, when a first service is in a running state, a second service associated with the first service.
A determining unit 402, configured to determine whether the current user of the first service is a history identifier user of the second service.
The determining unit 402 is specifically configured to determine whether the current user of the first service is the history identifier user of the second service according to whether the usage information of the current user of the first service for the second service exists within a preset time period, and if the usage information exists within the preset time period, determine that the current user of the first service is the history identifier user of the second service.
A loading unit 403, configured to load at least one script file of the second service into an operation database if the current user of the first service is the history identifier user of the second service.
In a possible implementation manner, please refer to fig. 5, which is a schematic structural diagram of a loading unit provided in the embodiment shown in fig. 4, where the loading unit 403 includes a script obtaining unit 4031, a list generating unit 4032, and a parsing loading unit 4033.
A script obtaining unit 4031, configured to obtain at least one script file of the second service.
A list generating unit 4032, configured to generate a pre-loading list of the second service according to at least one script file of the second service.
And an analysis loading unit 4033, configured to sequentially load at least one script file of the second service into an operation database according to the sequence of the preloaded list of the second service.
The script obtaining unit 4031, the list generating unit 4032, and the analysis loading unit 4033 are used to respectively implement step 203, step 204, and step 205 in the embodiment shown in fig. 3, and are not described again here.
In a possible implementation manner, the loading unit 403 is specifically configured to monitor a thread state of the first service, and load at least one script file of the second service into a running database when the thread state is an idle state. At this time, the loading unit 403 is used for implementing step 303 in the embodiment shown in fig. 4, and is not described herein again.
The script file loading apparatus shown in fig. 4 is used to implement the script file loading method shown in fig. 1, and for details, reference is made to the detailed description of fig. 1 for details of the principle, which is not described herein again.
Referring to fig. 6, which is a schematic structural diagram of another script file loading apparatus according to an embodiment of the present invention, the script file loading apparatus 60 may include an obtaining unit 601, a determining unit 602, a loading unit 603, an operating unit 604, and a clearing unit 605. The specific structures of the obtaining unit 601, the determining unit 602, and the loading unit 603 may refer to the obtaining unit 401, the determining unit 402, and the loading unit 403 in the embodiment shown in fig. 4, which is not described herein again.
An obtaining unit 601, configured to obtain a second service associated with a first service when the first service is in a running state.
A determining unit 602, configured to determine whether a current user of the first service is a history identifier user of the second service.
A loading unit 603, configured to load at least one script file of the second service into an operation database if the current user of the first service is the history identifier user of the second service.
The determining unit 602 is further configured to determine, when receiving a trigger instruction input for the second service, whether all of the at least one script file of the second service has been loaded into the operation database.
An operation unit 604, configured to, if all of the second services are loaded into the operation database, operate the second service according to at least one script file of the all of the loaded second services.
The loading unit 603 is further configured to load, if all of the script files are not loaded into the operation database, the script files that are not loaded in the at least one script file of the second service into the operation database.
The running unit 604 is further configured to run the second service according to the at least one completely loaded script file of the second service when the at least one completely loaded script file of the second service is completely loaded into the running database.
A clearing unit 605, configured to clear the pre-load list of the second service; or, the clearing unit 605 is configured to clear the pre-loading list of the second service and release monitoring of the thread state of the first service.
The script file loading apparatus shown in fig. 6 is used to implement the script file loading method shown in fig. 2 and fig. 3, and for details, please refer to the detailed description of fig. 2 and fig. 3, which is not described herein again.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a script file loading apparatus according to another embodiment of the present invention. As shown in fig. 7, the apparatus includes a processor 701 and an interface circuit 702, and a memory 703 and a bus 704 are shown, wherein the processor 701, the interface circuit 702 and the memory 703 are connected via the bus 704 and communicate with each other.
The processor 701 is configured to perform the following operation steps:
when a first service is in a running state, acquiring a second service associated with the first service;
judging whether the current user of the first service is a history identification user of the second service;
and if the current user of the first service is the history identification user of the second service, loading at least one script file of the second service into an operation database.
When the processor 701 executes the operation of determining whether the current user of the first service is the history identification user of the second service, the following operation steps are specifically executed:
judging whether the current user of the first service is a history identification user of the second service according to the use information of the current user of the first service for the second service in a preset time period;
and if the use information exists in the preset time period, determining that the current user of the first service is the history identification user of the second service.
When the processor 701 loads the at least one script file of the second service into the operation database, the following operation steps are specifically executed:
acquiring at least one script file of the second service;
generating a pre-loading list of the second service according to at least one script file of the second service;
and sequentially analyzing and loading at least one script file of the second service into an operation database according to the sequence of the preloading list of the second service.
When the processor 701 executes the generation of the preloaded list of the second service according to at least one script file of the second service, the following operation steps are specifically executed:
and sequencing the at least one script file of the second service according to the inclusion relationship among the at least one script file of the second service to generate a preloading list of the second service.
When the processor 701 loads the at least one script file of the second service into the operation database, the following operation steps are specifically executed:
and monitoring the thread state of the first service, and loading at least one script file of the second service into an operation database when the thread state is an idle state.
When the thread state is the idle state, the processor 701 specifically executes the following operation steps when loading at least one script file of the second service into the operation database:
when the thread state of the first service is monitored to be an idle state, loading a script file of the second service into an operation database, and stopping monitoring the thread state of the first service in the loading process;
and after loading a script file of the second service into the running database, restoring and monitoring the thread state of the first service.
When receiving a trigger instruction input for the second service, the processor 701 specifically executes the following operation steps when determining whether at least one script file of the second service is completely loaded into the operation database:
and if the second service is completely loaded into the operation database, operating the second service according to at least one script file of the completely loaded second service.
The processor 701 further performs the following operation steps:
if not, loading the script file which is not loaded in at least one script file of the second service into the operation database;
and when the at least one script file of the second service is completely loaded into the operation database, operating the second service according to the at least one script file of the second service which is completely loaded.
The processor 701 further performs the following operation steps:
emptying the pre-loading list of the second service;
or emptying the pre-loading list of the second service and releasing the monitoring of the thread state of the first service.
It should be noted that the processor 701 may be a single processing element or may be a general term for multiple processing elements. For example, the Processing element may be a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC),
the device may also include input and output devices coupled to the bus 704 for coupling to the processor 701, among other components, via the bus. The input and output device can provide an input interface for an operator so that the operator can select a control item through the input interface, and can also be other interfaces through which other equipment can be externally connected.
Or one or more integrated circuits configured to implement embodiments of the invention, such as: one or more microprocessors (digital signal processors, DSPs), or one or more Field Programmable Gate Arrays (FPGAs).
The memory 703 may be a storage device or a combination of storage elements, and is used for storing executable program codes or parameters, data, and the like required by the running device of the application program. And the memory 703 may include a Random Access Memory (RAM) or a non-volatile memory (non-volatile memory), such as a magnetic disk memory, a Flash memory (Flash), and the like.
The bus 704 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus 704 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 7, but this is not intended to represent only one bus or type of bus.
It should be noted that, for simplicity of description, the above-mentioned embodiments of the method are described as a series of acts or combinations, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable storage medium, and the storage medium may include: flash Memory disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The content downloading method, the related device and the system provided by the embodiment of the present invention are described in detail above, and a specific example is applied in the text to explain the principle and the embodiment of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (18)

1. A script file loading method, comprising:
when a first service is in an operating state, acquiring a second service associated with the first service, wherein the second service and the first service belong to different services which are operated in different service windows in the same application program and are independent of each other, and the service windows are provided with a plurality of display interfaces;
judging whether the current user of the first service is a history identification user of the second service according to the use information of the current user of the first service for the second service in a preset time period;
if the use information exists in the preset time period, determining that the current user of the first service is a historical identification user of the second service, wherein the account password for logging in the first service by the current user of the first service is different from the account passwords for logging in the application programs to which the first service and the second service belong, or the account passwords for logging in the second service are different;
and if the current user of the first service is the history identification user of the second service, sequentially loading at least one script file of the second service into an operation database according to the execution sequence of the second service under the condition of not leaving the service window of the first service, so that the service window of the second service is quickly loaded when a trigger instruction aiming at the second service is received.
2. The method according to claim 1, wherein sequentially loading at least one script file of the second service into a running database according to the execution sequence of the second service comprises:
acquiring at least one script file of the second service;
generating a pre-loading list of the second service according to at least one script file of the second service;
and sequentially analyzing and loading at least one script file of the second service into an operation database according to the sequence of the preloading list of the second service.
3. The method of claim 2, wherein the generating a pre-loaded list of the second service according to the at least one script file of the second service comprises:
and sequencing the at least one script file of the second service according to the inclusion relationship among the at least one script file of the second service to generate a preloading list of the second service.
4. The method according to claim 1, wherein sequentially loading at least one script file of the second service into a running database according to the execution sequence of the second service comprises:
and monitoring the thread state of the first service, and loading at least one script file of the second service into an operation database when the thread state is an idle state.
5. The method of claim 4, wherein loading at least one script file of the second service into a runtime database when the thread state is an idle state comprises:
when the thread state of the first service is monitored to be an idle state, loading a script file of the second service into an operation database, and stopping monitoring the thread state of the first service in the loading process;
and after loading a script file of the second service into the running database, restoring and monitoring the thread state of the first service.
6. The method of claim 1, further comprising:
when a trigger instruction input aiming at the second service is received, judging whether at least one script file of the second service is completely loaded into the operation database;
and if the second service is completely loaded into the operation database, operating the second service according to at least one script file of the completely loaded second service.
7. The method of claim 6, wherein after determining whether all of the at least one script file of the second service has been loaded into the runtime database, further comprising:
if not, loading the script file which is not loaded in at least one script file of the second service into the operation database;
and when the at least one script file of the second service is completely loaded into the operation database, operating the second service according to the at least one script file of the second service which is completely loaded.
8. The method according to claim 6 or 7, wherein after the running the second service according to the at least one script file of the second service that has been loaded in its entirety, further comprising:
emptying the pre-loading list of the second service;
or emptying the pre-loading list of the second service and releasing the monitoring of the thread state of the first service.
9. A script file loading apparatus, comprising:
the device comprises an acquisition unit, a processing unit and a display unit, wherein the acquisition unit is used for acquiring a second service related to a first service when the first service is in an operating state, the second service and the first service belong to different services which are operated in different service windows in the same application program and are independent from each other, and the service windows are provided with a plurality of display interfaces;
a determining unit, configured to determine whether a current user of the first service is a history identifier user of the second service according to whether usage information of the current user of the first service for the second service exists within a preset time period, and if the usage information exists within the preset time period, determine that the current user of the first service is the history identifier user of the second service, where an account password for logging in the first service by the current user of the first service is different from account passwords for logging in application programs to which the first service and the second service belong, or is different from account passwords for logging in the second service;
and the loading unit is used for sequentially loading at least one script file of the second service into the operation database according to the execution sequence of the second service under the condition that the current user of the first service is the history identification user of the second service without leaving the service window of the first service, so that the service window of the second service is quickly loaded when a trigger instruction aiming at the second service is received.
10. The apparatus of claim 9, wherein the loading unit comprises:
the script obtaining unit is used for obtaining at least one script file of the second service;
the list generating unit is used for generating a pre-loaded list of the second service according to at least one script file of the second service;
and the analysis loading unit is used for sequentially loading at least one script file of the second service into an operation database according to the sequence of the preloading list of the second service.
11. The apparatus according to claim 10, wherein the list generating unit is specifically configured to sort the at least one script file of the second service according to a containment relationship between the at least one script file of the second service to generate a preloaded list of the second service.
12. The apparatus according to claim 9, wherein the loading unit is specifically configured to monitor a thread state of the first service, and load at least one script file of the second service into a runtime database when the thread state is an idle state.
13. The apparatus according to claim 12, wherein the loading unit is specifically configured to, when it is monitored that the thread state of the first service is an idle state, load a script file of the second service into a running database, and stop monitoring the thread state of the first service during loading; and after loading a script file of the second service into the running database, restoring and monitoring the thread state of the first service.
14. The apparatus of claim 9,
the judging unit is further configured to judge whether at least one script file of the second service is completely loaded into the operation database when a trigger instruction input for the second service is received;
the device further comprises:
and the operation unit is used for operating the second service according to at least one script file of the second service which is completely loaded if the second service is completely loaded into the operation database.
15. The apparatus of claim 14,
the loading unit is further configured to load, if all of the script files are not loaded into the operation database, script files that are not loaded in at least one script file of the second service into the operation database;
the running unit is further configured to run the second service according to the at least one completely loaded script file of the second service when the at least one completely loaded script file of the second service is completely loaded into the running database.
16. The apparatus of claim 14 or 15, further comprising:
a clearing unit, configured to clear the pre-loaded list of the second service;
or, the clearing unit is configured to clear the pre-loading list of the second service and release monitoring of the thread state of the first service.
17. A script file loading apparatus comprising an interface circuit, a memory and a processor, wherein the memory stores a set of program code and the processor is configured to call the program code stored in the memory for performing the method of any one of claims 1 to 8.
18. A computer-readable storage medium, characterized in that a program for executing the script file loading method according to any one of claims 1 to 8 is stored in the computer-readable storage medium.
CN201610388331.6A 2016-06-01 2016-06-01 Script file loading method and device Active CN106055367B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610388331.6A CN106055367B (en) 2016-06-01 2016-06-01 Script file loading method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610388331.6A CN106055367B (en) 2016-06-01 2016-06-01 Script file loading method and device

Publications (2)

Publication Number Publication Date
CN106055367A CN106055367A (en) 2016-10-26
CN106055367B true CN106055367B (en) 2021-06-18

Family

ID=57169401

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610388331.6A Active CN106055367B (en) 2016-06-01 2016-06-01 Script file loading method and device

Country Status (1)

Country Link
CN (1) CN106055367B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109117339A (en) * 2017-06-26 2019-01-01 北京京东尚科信息技术有限公司 A kind of method and system that daily record data saves
CN109714373B (en) * 2017-10-25 2021-10-12 北京嘀嘀无限科技发展有限公司 Script cooperation method and device
CN113971059A (en) * 2020-07-22 2022-01-25 北京奇虎科技有限公司 Method, device, equipment and storage medium for recovering equipment connection state

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101632071A (en) * 2007-02-20 2010-01-20 雅虎公司 System and method for preloading content on the basis of user context
CN102819555A (en) * 2012-06-27 2012-12-12 北京奇虎科技有限公司 Method and device for loading recommended information in read mode of webpage
CN103116609A (en) * 2013-01-18 2013-05-22 北京奇虎科技有限公司 Server, client-side, system and method of achieving page load of browser
CN103488411A (en) * 2012-06-13 2014-01-01 腾讯科技(深圳)有限公司 Method and device for switching pages
CN105373420A (en) * 2014-08-28 2016-03-02 北京奇虎科技有限公司 Data transmission method and apparatus

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7747749B1 (en) * 2006-05-05 2010-06-29 Google Inc. Systems and methods of efficiently preloading documents to client devices
US20080189593A1 (en) * 2006-11-20 2008-08-07 Tim Baker System and method for enabling flash playback of MP3 files available on a web page
KR100866627B1 (en) * 2007-01-29 2008-11-03 삼성전자주식회사 Method for page preload using control flow and system thereof
CN101667147A (en) * 2009-07-27 2010-03-10 浪潮电子信息产业股份有限公司 Multitasking controllable automatic snapshot method
US20120167122A1 (en) * 2010-12-27 2012-06-28 Nokia Corporation Method and apparatus for pre-initializing application rendering processes
US8949781B1 (en) * 2011-08-10 2015-02-03 Zynga Inc. Injecting features into an application
CN102957712B (en) * 2011-08-17 2016-04-20 阿里巴巴集团控股有限公司 Site resource loading method and system
US9210217B2 (en) * 2012-03-10 2015-12-08 Headwater Partners Ii Llc Content broker that offers preloading opportunities
CN103838720B (en) * 2012-11-20 2018-09-07 腾讯科技(深圳)有限公司 Page file, which is loaded into, executes method and apparatus
CN104572230B (en) * 2015-02-13 2020-02-07 小米科技有限责任公司 Script file loading method and device and script file generating method and device
CN105528254B (en) * 2015-12-07 2019-02-22 贵阳朗玛信息技术股份有限公司 A kind of method for processing business and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101632071A (en) * 2007-02-20 2010-01-20 雅虎公司 System and method for preloading content on the basis of user context
CN103488411A (en) * 2012-06-13 2014-01-01 腾讯科技(深圳)有限公司 Method and device for switching pages
CN102819555A (en) * 2012-06-27 2012-12-12 北京奇虎科技有限公司 Method and device for loading recommended information in read mode of webpage
CN103116609A (en) * 2013-01-18 2013-05-22 北京奇虎科技有限公司 Server, client-side, system and method of achieving page load of browser
CN105373420A (en) * 2014-08-28 2016-03-02 北京奇虎科技有限公司 Data transmission method and apparatus

Also Published As

Publication number Publication date
CN106055367A (en) 2016-10-26

Similar Documents

Publication Publication Date Title
CN108845930B (en) Interface operation test method and device, storage medium and electronic device
CN110188135B (en) File generation method and equipment
CN106055367B (en) Script file loading method and device
CN112416318B (en) Micro-service development method and device, storage medium and electronic equipment
CN110795353B (en) Quick application debugging method, device, equipment and storage medium
CN111782523B (en) Cloud service deployment testing method and device, electronic equipment and storage medium
CN107045475B (en) Test method and device
US20070038975A1 (en) Systems, methods and computer program products for safety checking executable application programs in a module
CN110597564A (en) Installation package construction and service component loading method, device and terminal equipment
CN111367531B (en) Code processing method and device
CN113934913A (en) Data capture method and device, storage medium and electronic equipment
CN110362416B (en) Page component loading method and device, electronic equipment and storage medium
CN111427738B (en) Display method, application monitoring module, byte code enhancement module and display system
CN110580221A (en) Control testing method and device, storage medium and electronic equipment
CN111399926A (en) Method and device for downloading starting program
US9940218B2 (en) Debugging optimized code using fat binary
CN109977331B (en) Method and device for controlling execution of page resources
CN113515299A (en) Software development kit SDK hot upgrading method, device, equipment and storage medium
CN108255667B (en) Service monitoring method and device and electronic equipment
CN113139190A (en) Program file detection method and device, electronic equipment and storage medium
CN110825599A (en) Information management system monitoring method, device, medium, electronic equipment and system
CN113656106B (en) Plug-in loading method, device, electronic equipment and computer readable storage medium
CN108881585B (en) Built-in application program test processing method and device, electronic equipment and storage medium
CN110413530B (en) Behavior execution method and device
CN112100622A (en) Data processing method and equipment

Legal Events

Date Code Title Description
C06 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