CN113568679A - Plug-in loading method and device, storage medium and electronic equipment - Google Patents
Plug-in loading method and device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN113568679A CN113568679A CN202110817460.3A CN202110817460A CN113568679A CN 113568679 A CN113568679 A CN 113568679A CN 202110817460 A CN202110817460 A CN 202110817460A CN 113568679 A CN113568679 A CN 113568679A
- Authority
- CN
- China
- Prior art keywords
- plug
- information
- serialization
- loaded
- loading
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000011068 loading method Methods 0.000 title claims abstract description 66
- 238000000034 method Methods 0.000 claims abstract description 36
- 230000008569 process Effects 0.000 claims abstract description 12
- 238000012545 processing Methods 0.000 claims description 43
- 238000004590 computer program Methods 0.000 claims description 13
- 238000006243 chemical reaction Methods 0.000 claims description 8
- 238000007726 management method Methods 0.000 description 26
- 230000006870 function Effects 0.000 description 12
- 238000010586 diagram Methods 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 5
- 238000004458 analytical method Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 230000006978 adaptation Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000007599 discharging Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
Images
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/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
- G06F9/44526—Plug-ins; Add-ons
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The application discloses a plug-in loading method, a plug-in loading device, a storage medium and electronic equipment, which relate to the technical field of computers, and the method comprises the following steps: acquiring plug-in package information of a target plug-in; serializing the plug-in package information to obtain serialized information; caching the serialization information in a local cache so as to read the serialization information from the local cache when the target plug-in is loaded; and loading the target plug-in according to the read serialization information. According to the method and the device, the time consumption for calling the plug-in information and the occupation of a CPU are effectively reduced, the possibility of performance problems of a system layer in the plug-in loading process is reduced, and the plug-in loading reliability is effectively improved.
Description
Technical Field
The application relates to the technical field of computers, in particular to a plug-in loading method, a plug-in loading device, a storage medium and electronic equipment.
Background
With the development of application development technology, plug-in technology is more and more popular, and plug-in technology generally needs to be designed and loaded to run plug-ins when needed. At present, for the loading of plug-ins, the plug-in package information is obtained through a system interface at the same time when the plug-in package information is obtained every time, and the plug-ins are loaded according to the plug-in package information.
Under the current scheme, because the plug-in package information generally has the requirement of high-frequency acquisition, the problems of time consumption in calling and great occupation of a CPU (central processing unit) exist in the process of acquiring through a system interface, and the performance problem of a system layer in the plug-in loading process is easily caused, so that the plug-in loading reliability is poor.
Disclosure of Invention
The embodiment of the application provides a scheme, which can effectively reduce the time consumption for calling the plug-in information and the occupation of a CPU (central processing unit), reduce the possibility of performance problems of a system layer in the plug-in loading process, and effectively improve the plug-in loading reliability.
In order to solve the above technical problem, an embodiment of the present application provides the following technical solutions:
according to one embodiment of the present application, a plug-in loading method includes: acquiring plug-in package information of a target plug-in; serializing the plug-in package information to obtain serialized information; caching the serialization information in a local cache so as to read the serialization information from the local cache when the target plug-in is loaded; and loading the target plug-in according to the read serialization information.
In some embodiments of the present application, the serializing the package information to obtain serialized information includes: performing byte conversion processing on the plug-in package information to obtain binary byte information corresponding to the plug-in package information; and using the binary byte information as the serialization information.
In some embodiments of the present application, the reading the serialization information from the local cache includes: and sequentially reading each byte in the binary byte information from the local cache according to the byte sequence, or reading all bytes in the binary byte information from the local cache.
In some embodiments of the present application, the loading the target plug-in according to the read serialization information includes: performing deserialization processing on the read serialized information; and loading the target plug-in according to the plug-in package information obtained by the deserialization processing.
In some embodiments of the present application, after the target plug-in is loaded according to the plug-in package information obtained by deserialization, the method further includes: determining resources to be loaded corresponding to the target plug-in; and carrying out reflective calling on the resource to be loaded so as to run the target plug-in based on the called resource to be loaded.
In some embodiments of the present application, the making a reflective call to the resource to be loaded includes: performing reflection processing on the system resource management class to replace the system resource management class with a reflection type resource management class; and calling the resource to be loaded based on the reflective resource management class.
In some embodiments of the present application, the obtaining plug-in package information of the target plug-in includes: determining plug-in information of the target plug-in; determining a plug-in resource file corresponding to the plug-in information; and acquiring the plug-in package information from the plug-in resource file.
According to an embodiment of the present application, a plug-in loading device includes: the acquisition module is used for acquiring the plug-in package information of the target plug-in; the processing module is used for carrying out serialization processing on the plug-in package information to obtain serialization information; the cache module is used for caching the serialization information in a local cache so as to read the serialization information from the local cache when the target plug-in is loaded; and the loading module is used for loading the target plug-in according to the read serialization information.
According to another embodiment of the present application, a storage medium has stored thereon a computer program which, when executed by a processor of a computer, causes the computer to perform the method of an embodiment of the present application.
According to another embodiment of the present application, an electronic device may include: a memory storing a computer program; and the processor reads the computer program stored in the memory to execute the method in the embodiment of the application.
In the embodiment of the application, the plug-in package information of the target plug-in is obtained; serializing the plug-in package information to obtain serialized information; caching the serialization information in a local cache so as to read the serialization information from the local cache when the target plug-in is loaded; and loading the target plug-in according to the read serialization information.
In this way, after the plug-in package information is obtained, the plug-in package information is serialized to obtain serialized information, the size of the plug-in package information can be effectively reduced, then the serialized information is cached in a local cache, the serialized information is read from the local cache when a target plug-in is loaded, the plug-in package information can be read at high frequency, the calling time and the CPU occupation of the plug-in information are extremely small, the possibility of performance problems of a system layer in the plug-in loading process is reduced, the target plug-in can be efficiently and stably loaded based on the read serialized information, and the plug-in loading reliability is effectively improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 shows a schematic diagram of a system to which embodiments of the present application may be applied.
FIG. 2 shows a flow diagram of a plug-in loading method according to one embodiment of the present application.
FIG. 3 shows a block diagram of a plug-in loading device according to one embodiment of the present application.
FIG. 4 shows a block diagram of an electronic device according to an embodiment of the application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, 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 application.
In the description that follows, specific embodiments of the present application will be described with reference to steps and symbols executed by one or more computers, unless otherwise indicated. Accordingly, these steps and operations will be referred to, several times, as being performed by a computer, the computer performing operations involving a processing unit of the computer in electronic signals representing data in a structured form. This operation transforms the data or maintains it at locations in the computer's memory system, which may be reconfigured or otherwise altered in a manner well known to those skilled in the art. The data maintains a data structure that is a physical location of the memory that has particular characteristics defined by the data format. However, the principles of the present application are described in the foregoing text and are not meant to be limiting, as those of ordinary skill in the art will appreciate that various steps and operations described below may be implemented in hardware.
FIG. 1 shows a schematic diagram of a system 100 to which embodiments of the present application may be applied. As shown in fig. 1, the system 100 may include a server 101 and a terminal 102. The terminal 102 may be any computer device, such as a computer, a mobile phone, a smart watch, a home appliance, and the like. The server 101 may be a server cluster or a cloud server, etc. In one example, the terminal 102 is a user terminal, and the server 101 is a cloud server. The server 101 and the terminal 102 may be connected by a wired or wireless connection.
The terminal 102 may be installed with an application program, which may be a corresponding application program such as a home control application or a video playing application, and the application program may be used as a main program and may provide a plug-in interface, and by performing plug-in loading, a plug-in may be loaded to the main application through the plug-in interface, thereby implementing "running without being installed on an operating system".
When the functions need to be added to the main application, only one plug-in interface needs to be written in the main application, and a plug-in is developed or modified for access according to the interface requirements provided by the main application, so that the new functions of the main application access are completed.
The plug-in package resource file related to the plug-in can be issued by the server 101 to the terminal 102 or the terminal 102 requests the plug-in package resource file of the required plug-in from the server 101.
In one embodiment of this example, the terminal 102 may obtain the plug-in package information of the target plug-in; serializing the plug-in package information to obtain serialized information; caching the serialization information in a local cache so as to read the serialization information from the local cache when the target plug-in is loaded; and loading the target plug-in according to the read serialization information.
In this way, after the plug-in package information is obtained, the plug-in package information is serialized to obtain serialized information, the size of the plug-in package information can be effectively reduced, then the serialized information is cached in a local cache, the serialized information is read from the local cache when a target plug-in is loaded, the plug-in package information can be read at high frequency, the calling time and the CPU occupation of the plug-in information are extremely small, the possibility of performance problems of a system layer in the plug-in loading process is reduced, the target plug-in can be efficiently and stably loaded based on the read serialized information, and the plug-in loading reliability is effectively improved.
FIG. 2 schematically shows a flow diagram of a plug-in loading method according to an embodiment of the present application. The execution subject of the plug-in loading method may be any device, such as the first terminal 102 shown in fig. 1.
As shown in fig. 2, the plug-in loading method may include steps S210 to S240.
Step S210, obtaining the plug-in package information of the target plug-in;
step S220, serialization processing is carried out on the plug-in package information to obtain serialization information;
step S230, caching the serialization information in a local cache so as to read the serialization information from the local cache when the target plug-in is loaded;
and step S240, loading the target plug-in according to the read serialization information.
The following describes a specific process of each step performed when the plug-in is loaded.
In step S210, plug-in package information of the target plug-in is acquired.
In the embodiment of the present example, the plug-in is loaded, that is, the plug-in runs in an operating system (for example, an android system) without being installed, and the target plug-in is a plug-in to be loaded, for example, a certain plug-in is a plug-in that can provide a video playing function, and can be loaded to a certain home application (that is, a host application) to implement the video playing function for the home application.
The plug-in package resource file of the target plug-in can be issued to the terminal for installing the main application in real time through the cloud, or the terminal can request the server according to the requirement, and the plug-in package resource file can comprise plug-in package information. The plug-in package information is description information of the plug-in, and the plug-in package information may include description information such as package name, version number, version code, system component, and the like. In one example, the plug-in package information may be obtained by obtaining a PackageInfo object, and the plug-in package information such as a package name, a version number, a version code, and a system component may be obtained by the PackageInfo object.
When the terminal starts to load the target plug-in, the plug-in package information needs to be read first, so that the plug-in is loaded according to the plug-in package information. Reading the information of the plug-in package usually carries out high-frequency reading, and in the related technology, the information of the plug-in package is obtained through a system interface at the same time when being obtained every time, but the method has the problem of high obtaining frequency, and the CPU is greatly occupied, and the performance problem can occur when the CPU is loaded every time.
In this example, before the plug-in is loaded, the plug-in package information is first obtained from the plug-in package resource file to perform serialization processing in the subsequent steps.
In one embodiment, step S210, acquiring plug-in package information of the target plug-in, includes: determining plug-in information of a target plug-in; determining a plug-in resource file corresponding to the plug-in information; and acquiring the plug-in package information from the plug-in resource file.
When preparing to load the plug-in, a user can select to load a target plug-in a main application on the terminal, and then the terminal can obtain plug-in information such as a plug-in name, loading time and loading position of the target plug-in, and then perform resource file matching according to the plug-in information, determine a resource file matched with the plug-in information, wherein the matched resource file is a plug-in resource file of the target plug-in, and after determining the plug-in resource file, the plug-in package information can be obtained from the plug-in resource file according to a mark (such as a name suffix) of a plug-in package information storage file.
In step S220, the package information is serialized to obtain serialized information.
In the embodiment of the present example, the package information of the plug-in is usually a relatively large package, the larger the package is, the more time consuming the system is to load the package information, the slower the analysis is, and the larger the CPU is occupied, and by performing the serialization processing on the package information of the plug-in, the initial package information of the plug-in can be processed into the extremely small serialization information, so that the analysis can be efficiently invoked when the package information is actually invoked.
In one embodiment, step S220 is to perform serialization processing on the package information to obtain serialization information, and the serialization processing includes: performing byte conversion processing on the plug-in package information to obtain binary byte information corresponding to the plug-in package information; the binary byte information is taken as serialization information.
The method has the advantages that byte conversion processing is carried out on the plug-in package information, namely the instantiated plug-in package information is converted into binary bytes, serialized plug-in package information can be formed through the binary bytes, namely the binary byte information, and the accuracy of the serialized information is guaranteed while the size of the plug-in package information is reduced.
In one example, the plug-in package information may be obtained by obtaining a PackageInfo object, and the obtained PackageInfo object may be converted into binary byte information by byte conversion.
In step S230, the serialization information is cached in the local cache to read the serialization information from the local cache when the target plug-in is loaded.
In the embodiment of the present example, after the plug-in package information is serialized to obtain the serialization information, the serialization information is cached in the local cache, and the local cache may specifically be the local disk content.
In one embodiment, reading serialized information from a local cache comprises: and sequentially reading each byte in the binary byte information from the local cache according to the byte order, or reading all bytes in the binary byte information from the local cache.
When reading the serialization information in the local cache, reading can be performed according to bytes one by one, that is, each byte in the binary byte information is sequentially read from the local cache according to the byte order, and the parsing can be performed while reading. All bytes can also be read at once, i.e. all bytes in the binary byte information are read in the local cache.
In step S240, the target plug-in is loaded according to the read serialization information.
In the embodiment of the present example, after the serialization information is read, description information such as a package name, a version number, a version code, and a system component may be obtained from the serialization information, and then, the plug-in resource may be adaptively loaded from the plug-in resource file according to the description information, and then, the target plug-in may be loaded to the host application for running.
In one embodiment, step S240, loading the target plug-in according to the read serialization information includes: performing deserialization processing on the read serialized information; and loading the target plug-in according to the plug-in package information obtained by the deserialization processing.
And performing deserialization on the read serialized information, namely deserializing the serialized information into unprocessed information. Furthermore, initial plug-in package information can be obtained through deserialization, and the target plug-in can be loaded according to the initial plug-in package information.
In this way, based on steps S210 to S240, after the plug-in package information is obtained, the plug-in package information is serialized to obtain serialized information, which can effectively reduce the size of the plug-in package information, then the serialized information is cached in the local cache, and when a target plug-in is loaded, the serialized information is read from the local cache, so that the plug-in package information can be read at high frequency, the calling time and the CPU occupation of the plug-in information are both extremely small, the possibility of performance problems occurring in the system layer in the plug-in loading process is reduced, and further, the target plug-in can be loaded efficiently and stably based on the read serialized information, and the plug-in loading reliability is effectively improved.
In one embodiment, in step S240, after loading the target plug-in according to the plug-in package information obtained by deserialization, the method further includes:
determining resources to be loaded corresponding to the target plug-in; and carrying out reflective calling on the resource to be loaded so as to run the target plug-in based on the called resource to be loaded.
The resources to be loaded corresponding to the target plug-in can be determined according to the description information in the plug-in package information, the resources to be loaded such as pictures, page layout and the like, the target plug-in operates as an application which needs to load the resources during operation, and the resources to be loaded can be stored in a plug-in resource file.
After the resources to be loaded are determined, the resources to be loaded are called, the method and the device for calling the resources to be loaded perform reflective calling on the resources to be loaded, can bypass the calling mode of a system interface, can efficiently call the resources to be loaded with low CPU occupation, further improve the system performance and improve the plug-in loading reliability.
In the related technology, in the step of loading the resources, the resources are directly called based on a system interface, and when the resources are loaded, the performance is seriously low, the starting speed is slow, and the CPU occupation is high.
In one embodiment, making a reflective call to a resource to be loaded includes:
performing reflection processing on the system resource management class to replace the system resource management class with a reflection type resource management class; and calling the resources to be loaded based on the reflective resource management class.
The reflection processing is to establish a reflection type calling mechanism based on the system resource management class, replace the system resource management class with the reflection type resource management class, perform hook on the system resource management class, perform reflection type calling based on the reflection type resource management class, and bypass the calling of a system interface.
The system resource management class can be an AssetManager class, the reflective resource management class can be a user-defined AssetManager class, the management class of the system resources is hook, the original mode of being called by a getResourceForapplication system is realized in a hook mode, the system interface calling is bypassed, and the problems of time consumption, CPU occupation and the like are avoided.
In order to better implement the plug-in loading method provided by the embodiment of the present application, the embodiment of the present application further provides a plug-in loading device based on the plug-in loading method. The terms are the same as those in the plug-in loading method, and the specific implementation details can refer to the description in the method embodiment. FIG. 3 shows a block diagram of a plug-in loading device according to one embodiment of the present application.
As shown in fig. 3, the plug-in loading device 300 may include an obtaining module 310, a processing module 320, a caching module 330, and a loading module 340.
The obtaining module 310 may be configured to obtain plug-in package information of the target plug-in; the processing module 320 may be configured to perform serialization processing on the plug-in package information to obtain serialization information; the caching module 330 may be configured to cache the serialization information in a local cache, so as to read the serialization information from the local cache when the target plug-in is loaded; the loading module 340 may be configured to load the target plug-in according to the read serialization information.
In some embodiments of the present application, the processing module 320 includes: the byte conversion processing unit is used for carrying out byte conversion processing on the plug-in package information to obtain binary byte information corresponding to the plug-in package information; an information determination unit for using the binary byte information as the serialization information.
In some embodiments of the present application, the cache module 330 includes: a byte sequence reading unit, configured to read each byte in the binary byte information sequentially according to a byte sequence from the local cache, or a byte one-time reading unit, configured to read all bytes in the binary byte information from the local cache.
In some embodiments of the present application, the loading module 340 includes: the deserializing unit is used for deserializing the read serialized information; and the target plug-in loading unit is used for loading the target plug-in according to the plug-in package information obtained by the deserialization processing.
In some embodiments of the present application, after the target plug-in is loaded according to the plug-in package information obtained by deserialization, the apparatus further includes: a resource to be loaded determining unit, configured to determine a resource to be loaded corresponding to the target plug-in; and the reflective calling unit is used for carrying out reflective calling on the resource to be loaded so as to run the target plug-in based on the called resource to be loaded.
In some embodiments of the present application, the reflective call unit includes: the reflection processing subunit is used for performing reflection processing on the system resource management class so as to replace the system resource management class with a reflection type resource management class; and the reflection calling subunit is used for calling the resource to be loaded based on the reflection type resource management class.
In some embodiments of the present application, the obtaining module 310 includes: the plug-in information determining unit is used for determining the plug-in information of the target plug-in; the plug-in resource file determining unit is used for determining a plug-in resource file corresponding to the plug-in information; and the plug-in package information reading unit is used for acquiring the plug-in package information from the plug-in resource file.
In this way, based on the plug-in loading device 300, after the plug-in package information is obtained, the plug-in package information is serialized to obtain serialized information, so that the size of the plug-in package information can be effectively reduced, then the serialized information is cached in the local cache, the serialized information is read from the local cache when the target plug-in is loaded, the plug-in package information can be read at high frequency, the calling time and the CPU occupation of the plug-in information are extremely small, the possibility of performance problems of a system layer in the plug-in loading process is reduced, then the target plug-in can be loaded efficiently and stably based on the read serialized information, and the plug-in loading reliability is effectively improved.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
In addition, an embodiment of the present application further provides an electronic device, where the electronic device may be a terminal or a server, as shown in fig. 4, which shows a schematic structural diagram of the electronic device according to the embodiment of the present application, and specifically:
the electronic device may include components such as a processor 401 of one or more processing cores, memory 402 of one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will appreciate that the electronic device configuration shown in fig. 4 does not constitute a limitation of the electronic device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the processor 401 is a control center of the electronic device, connects various parts of the entire computer device using various interfaces and lines, and performs various functions of the computer device and processes data by operating or executing software programs and/or modules stored in the memory 402 and calling data stored in the memory 402, thereby integrally monitoring the electronic device. Optionally, processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly handles operating systems, user pages, application programs, and the like, and the modem processor mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 401.
The memory 402 may be used to store software programs and modules, and the processor 401 executes various functional applications and data processing by operating the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the computer device, and the like. Further, the memory 402 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 access to the memory 402.
The electronic device further comprises a power supply 403 for supplying power to the various components, and preferably, the power supply 403 is logically connected to the processor 401 through a power management system, so that functions of managing charging, discharging, and power consumption are realized through the power management system. The power supply 403 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
The electronic device may further include an input unit 404, and the input unit 404 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
Although not shown, the electronic device may further include a display unit and the like, which are not described in detail herein. Specifically, in this embodiment, the processor 401 in the electronic device loads the executable file corresponding to the process of one or more computer programs into the memory 402 according to the following instructions, and the processor 401 runs the computer program stored in the memory 402, so as to implement various functions, for example, the processor 401 may execute the following steps:
acquiring plug-in package information of a target plug-in; serializing the plug-in package information to obtain serialized information; caching the serialization information in a local cache so as to read the serialization information from the local cache when the target plug-in is loaded; and loading the target plug-in according to the read serialization information.
In some embodiments of the present application, when performing serialization processing on the plug-in package information to obtain serialization information, the processor 401 may perform: performing byte conversion processing on the plug-in package information to obtain binary byte information corresponding to the plug-in package information; and using the binary byte information as the serialization information.
In some embodiments of the present application, when reading the serialized information from the local cache, the processor 401 may perform: and sequentially reading each byte in the binary byte information from the local cache according to the byte sequence, or reading all bytes in the binary byte information from the local cache.
In some embodiments of the present application, when the target plug-in is loaded according to the read serialization information, the processor 401 may perform: performing deserialization processing on the read serialized information; and loading the target plug-in according to the plug-in package information obtained by the deserialization processing.
In some embodiments of the present application, after the target plug-in is loaded according to the plug-in package information obtained by deserialization, the processor 401 may perform: determining resources to be loaded corresponding to the target plug-in; and carrying out reflective calling on the resource to be loaded so as to run the target plug-in based on the called resource to be loaded.
In some embodiments of the present application, when performing a reflective call to the resource to be loaded, the processor 401 may perform: performing reflection processing on the system resource management class to replace the system resource management class with a reflection type resource management class; and calling the resource to be loaded based on the reflective resource management class.
In some embodiments of the present application, when obtaining the plug-in package information of the target plug-in, the processor 401 may perform: determining plug-in information of the target plug-in; determining a plug-in resource file corresponding to the plug-in information; and acquiring the plug-in package information from the plug-in resource file.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by a computer program, which may be stored in a computer-readable storage medium and loaded and executed by a processor, or by related hardware controlled by the computer program.
To this end, the present application further provides a storage medium, in which a computer program is stored, where the computer program can be loaded by a processor to execute the steps in any one of the methods provided in the present application.
Wherein the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the computer program stored in the storage medium can execute the steps in any method provided in the embodiments of the present application, the beneficial effects that can be achieved by the methods provided in the embodiments of the present application can be achieved, for details, see the foregoing embodiments, and are not described herein again.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains.
It will be understood that the present application is not limited to the embodiments that have been described above and shown in the drawings, but that various modifications and changes can be made without departing from the scope thereof.
Claims (10)
1. A method for loading a plug-in, comprising:
acquiring plug-in package information of a target plug-in;
serializing the plug-in package information to obtain serialized information;
caching the serialization information in a local cache so as to read the serialization information from the local cache when the target plug-in is loaded;
and loading the target plug-in according to the read serialization information.
2. The method of claim 1, wherein the serializing the plug-in package information to obtain serialized information comprises:
performing byte conversion processing on the plug-in package information to obtain binary byte information corresponding to the plug-in package information;
and using the binary byte information as the serialization information.
3. The method of claim 2, wherein reading the serialization information from the local cache comprises:
and sequentially reading each byte in the binary byte information from the local cache according to the byte sequence, or reading all bytes in the binary byte information from the local cache.
4. The method of claim 1, wherein loading the target plug-in according to the read serialization information comprises:
performing deserialization processing on the read serialized information;
and loading the target plug-in according to the plug-in package information obtained by the deserialization processing.
5. The method of claim 4, wherein after the target plug-in is loaded with the plug-in package information obtained from the deserialization process, the method further comprises:
determining resources to be loaded corresponding to the target plug-in;
and carrying out reflective calling on the resource to be loaded so as to run the target plug-in based on the called resource to be loaded.
6. The method of claim 5, wherein making a reflected call to the resource to be loaded comprises:
performing reflection processing on the system resource management class to replace the system resource management class with a reflection type resource management class;
and calling the resource to be loaded based on the reflective resource management class.
7. The method of claim 1, wherein the obtaining the plug-in package information of the target plug-in comprises:
determining plug-in information of the target plug-in;
determining a plug-in resource file corresponding to the plug-in information;
and acquiring the plug-in package information from the plug-in resource file.
8. A card loading device, comprising:
the acquisition module is used for acquiring the plug-in package information of the target plug-in;
the processing module is used for carrying out serialization processing on the plug-in package information to obtain serialization information;
the cache module is used for caching the serialization information in a local cache so as to read the serialization information from the local cache when the target plug-in is loaded;
and the loading module is used for loading the target plug-in according to the read serialization information.
9. A storage medium having stored thereon a computer program which, when executed by a processor of a computer, causes the computer to perform the method of any one of claims 1 to 7.
10. An electronic device, comprising: a memory storing a computer program; a processor reading a computer program stored in the memory to perform the method of any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110817460.3A CN113568679A (en) | 2021-07-20 | 2021-07-20 | Plug-in loading method and device, storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110817460.3A CN113568679A (en) | 2021-07-20 | 2021-07-20 | Plug-in loading method and device, storage medium and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113568679A true CN113568679A (en) | 2021-10-29 |
Family
ID=78165628
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110817460.3A Pending CN113568679A (en) | 2021-07-20 | 2021-07-20 | Plug-in loading method and device, storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113568679A (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090328001A1 (en) * | 2008-06-27 | 2009-12-31 | Microsoft Corporation | Unloadable managed code |
CN102662703A (en) * | 2012-03-29 | 2012-09-12 | 奇智软件(北京)有限公司 | Method and device for loading application program plugins |
CN103530156A (en) * | 2013-10-17 | 2014-01-22 | 北京奇虎科技有限公司 | Method and device for dynamically loading and calling program |
CN104216741A (en) * | 2014-08-25 | 2014-12-17 | 华中科技大学 | Android plug-in implementation method and device based on APK (Android Package) dynamic loading and interaction method |
CN104391716A (en) * | 2014-11-14 | 2015-03-04 | 百度在线网络技术(北京)有限公司 | Plug-in-based application program implementing method and device |
CN110430180A (en) * | 2019-07-29 | 2019-11-08 | 贵州航天智慧农业有限公司 | A kind of platform of internet of things and implementation method based on hot plug |
CN110647278A (en) * | 2019-09-05 | 2020-01-03 | 珠海格力电器股份有限公司 | Method and device for controlling plug-in display, computing equipment and storage medium |
CN112000320A (en) * | 2020-08-27 | 2020-11-27 | 中国平安财产保险股份有限公司 | Automatic code generation method, device, equipment and storage medium |
-
2021
- 2021-07-20 CN CN202110817460.3A patent/CN113568679A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090328001A1 (en) * | 2008-06-27 | 2009-12-31 | Microsoft Corporation | Unloadable managed code |
CN102662703A (en) * | 2012-03-29 | 2012-09-12 | 奇智软件(北京)有限公司 | Method and device for loading application program plugins |
CN103530156A (en) * | 2013-10-17 | 2014-01-22 | 北京奇虎科技有限公司 | Method and device for dynamically loading and calling program |
CN104216741A (en) * | 2014-08-25 | 2014-12-17 | 华中科技大学 | Android plug-in implementation method and device based on APK (Android Package) dynamic loading and interaction method |
CN104391716A (en) * | 2014-11-14 | 2015-03-04 | 百度在线网络技术(北京)有限公司 | Plug-in-based application program implementing method and device |
CN110430180A (en) * | 2019-07-29 | 2019-11-08 | 贵州航天智慧农业有限公司 | A kind of platform of internet of things and implementation method based on hot plug |
CN110647278A (en) * | 2019-09-05 | 2020-01-03 | 珠海格力电器股份有限公司 | Method and device for controlling plug-in display, computing equipment and storage medium |
CN112000320A (en) * | 2020-08-27 | 2020-11-27 | 中国平安财产保险股份有限公司 | Automatic code generation method, device, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20150186161A1 (en) | Platform system, method for changing support hardware configuration of universal extensible firmware interface basic input output system and computer program product | |
US9043806B2 (en) | Information processing device and task switching method | |
US8490118B2 (en) | Wait on address synchronization interface | |
US11016769B1 (en) | Method and apparatus for processing information | |
CN109522128B (en) | Segmented multithreading task execution method and device | |
CN116414472A (en) | Method, system, equipment and storage medium for starting up server rapidly | |
CN114237743B (en) | Interface loading method and device, electronic equipment and storage medium | |
CN111966508A (en) | Message batch sending method and device, computer equipment and storage medium | |
CN113568679A (en) | Plug-in loading method and device, storage medium and electronic equipment | |
CN114327508A (en) | Software loading method and related device | |
CN114817160A (en) | File decompression method and device, electronic equipment and computer readable storage medium | |
CN114791854A (en) | User-state virtual machine task scheduling method, device, equipment and storage medium | |
CN112564924B (en) | Computer expansion card and block chain terminal equipment | |
CN114637969A (en) | Target object authentication method and device | |
CN113849161A (en) | Application control method and device, storage medium and electronic equipment | |
CN111192063A (en) | Online customer service queuing processing method and device and electronic equipment | |
CN112817769B (en) | Game resource dynamic caching method and device, storage medium and electronic equipment | |
US11675599B2 (en) | Systems and methods for managing system rollup of accelerator health | |
CN113704187B (en) | Method, apparatus, server and computer readable medium for generating file | |
WO2021121188A1 (en) | Configuration file processing method, apparatus and system, and storage medium | |
CN113986284A (en) | System application upgrading method and device, storage medium and electronic equipment | |
CN117170697A (en) | Display interface updating method and device, storage medium and electronic equipment | |
CN114090054A (en) | Intelligent equipment upgrading method and device, storage medium and electronic equipment | |
CN115016851A (en) | BIOS loading method, bridge chip, BMC, device and mainboard thereof | |
CN116382800A (en) | Data processing method, device, electronic equipment and storage 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 |