# US 2021/0081219 A1 · Plugin loading method and apparatus, terminal, and storage medium

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0081219 A1
- Document ID: US20210081219A1
- Status: Published application
- Kind: A1
- Application number: 17/108,197
- Filed: 2020-12-01
- Published: 2021-03-18
- Earliest claimed: 2016-12-05
- Assignees: Tencent Technology (Shenzhen) Company Limited
- Applicants: Tencent Technology (Shenzhen) Company Limited
- Inventors: Shidong SHENG
- Web page: https://patentgrep.com/patent/US20210081219A1

## CPC

- G06F 9/44526: {Plug-ins; Add-ons}
- G06F 9/4881: {Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues}
- G06F 9/5055: {considering software capabilities, i.e. software resources associated or available to the machine}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The present disclosure discloses a method for plugin loading. The method includes obtaining an identifier of a plugin component of a plugin from a threading module, recording the identifier of the plugin component, and replacing the identifier of the plugin component with an identifier of a host component of an application program. The method also includes sending the identifier of the host component to a threading module, to perform system permission verification and receiving runnable notification information when passing the verification. The method further includes in response to the received runnable notification information, replacing the identifier of the host component with the identifier of the plugin component according to the recorded identifier of the plugin component; and sending the identifier of the plugin component to the threading module, to load the plugin. The present invention further discloses an apparatus and a storage medium for plugin loading.

## Claims

### Claim 1

A method for loading a plugin, the method comprising:
sending, by a device comprising a memory and a processor in communication with the memory, an identifier of a host component of an application program to a threading module, to perform system permission verification, the threading module being a parent class component of a host module, and the application program being a host program of the plugin;
receiving, by the device, runnable notification information from the threading module when the identifier of the host component passes the system permission verification, the runnable notification information containing the identifier of the host component;
replacing, by the device, the identifier of the host component contained in the runnable notification information with an identifier of a plugin component of the plugin; and
sending, by the device, the runnable notification information to the threading module, so that the threading module is configured to construct the plugin component based on the identifier of the plugin component contained in the runnable notification information, to load the plugin.

### Claim 2 (depends on 1)

The method according to claim 1, further comprising:
when the plugin is started, obtaining, by the device, the identifier of the plugin component of the plugin from the threading module;
recording, by the device, the identifier of the plugin component;
replacing, by the device, the identifier of the plugin component of the plugin with the identifier of the host component; and
constructing, by the device based on a parents delegation model, the host module corresponding to the threading module.

### Claim 3 (depends on 1)

The method according to claim 1, further comprising:
obtaining, by the device, new-version information of the plugin from a server;
parsing, by the device, the new-version information;
obtaining, by the device, a new-version class loader and a new-version resource manager of a new-version plugin corresponding to the new-version information; and
replacing, by the device, a class loader and a resource manager of the plugin with the new-version class loader and the new-version resource manager of the new-version plugin.

### Claim 4 (depends on 1)

The method according to claim 1, wherein:
the host component of the application program is pre-registered with the host program.

### Claim 5 (depends on 1)

The method according to claim 1, wherein the sending, by the device, the identifier of the host component to the threading module, to perform system permission verification comprises:
sending, by the device, the identifier of the host component to the threading module;
sending, by the threading module, the identifier of the host component to a system service module;
determining, by the system service module, whether the identifier of the host component passes the system permission verification;
in response to the determination that the identifier of the host component passes the system permission verification, sending, by the system service module, the runnable notification information to the threading module; and
forwarding, by the threading module, the runnable notification information to the host module.

### Claim 6 (depends on 1)

The method according to claim 1, further comprising:
constructing, by the threading module, the plugin component based on the identifier of the plugin component to load the plugin; and
separately loading, by the threading module, a code and a resource of the plugin component based on the identifier of the plugin component, to load the plugin.

### Claim 7 (depends on 1)

The method according to claim 1, wherein, when the threading module constructs the plugin component based on the identifier of the plugin component to load the plugin, the method further comprises:
loading, by the threading module, a plugin code of the plugin component based on the identifier of the plugin component by using a class loader; and
loading, by the threading module, a plugin resource of the plugin based on the identifier of the plugin component by using a newly-added plugin path method in a resource manager.

### Claim 8

An apparatus for loading a plugin, the apparatus comprising:
a memory storing instructions; and
a processor in communication with the memory, wherein, when the processor executes the instructions, the processor is configured to cause the apparatus to:
send an identifier of a host component of an application program to a threading module, to perform system permission verification, the threading module being a parent class component of a host module, and the application program being a host program of the plugin,
receive runnable notification information from the threading module when the identifier of the host component passes the system permission verification, the runnable notification information containing the identifier of the host component,
replace the identifier of the host component contained in the runnable notification information with an identifier of a plugin component of the plugin, and
send the runnable notification information to the threading module, so that the threading module is configured to construct the plugin component based on the identifier of the plugin component contained in the runnable notification information, to load the plugin.

### Claim 9 (depends on 8)

The apparatus according to claim 8, wherein, when the processor executes the instructions, the processor is configured to further cause the apparatus to:
when the plugin is started, obtain the identifier of the plugin component of the plugin from the threading module;
record the identifier of the plugin component;
replace the identifier of the plugin component of the plugin with the identifier of the host component; and
constructing, based on a parents delegation model, the host module corresponding to the threading module.

### Claim 10 (depends on 8)

The apparatus according to claim 8, wherein, when the processor executes the instructions, the processor is configured to further cause the apparatus to:
obtain new-version information of a plugin from a server;
parse the new-version information;
obtain a new-version class loader and a new-version resource manager of a new-version plugin corresponding to the new-version information; and
replace a class loader and a resource manager of the plugin with the new-version class loader and the new-version resource manager of the new-version plugin.

### Claim 11 (depends on 8)

The apparatus according to claim 8, wherein the host component of the application program is pre-registered with the host program.

### Claim 12 (depends on 8)

The apparatus according to claim 8, wherein, when the processor is configured to cause the apparatus to send the identifier of the host component to the threading module, to perform system permission verification, the processor is configured to cause the apparatus to:
send the identifier of the host component to the threading module, so that:
the threading module is configured to send the identifier of the host component to a system service module,
the system service module is configured to determine whether the identifier of the host component passes the system permission verification,
in response to the determination that the identifier of the host component passes the system permission verification, the system service module send the runnable notification information to the threading module, and
the threading module forwards the runnable notification information to the host module.

### Claim 13 (depends on 8)

The apparatus according to claim 8, wherein, when the threading module is configured to construct the plugin component based on the identifier of the plugin component to load the plugin, the threading module is configured to:
separately load a code and a resource of the plugin component based on the identifier of the plugin component, to load the plugin.

### Claim 14 (depends on 8)

The apparatus according to claim 8, wherein, when the threading module is configured to construct the plugin component based on the identifier of the plugin component to load the plugin, the threading module is configured to:
load a plugin code of the plugin component based on the identifier of the plugin component by using a class loader; and
load a plugin resource of the plugin based on the identifier of the plugin component by using a newly-added plugin path method in a resource manager.

### Claim 15

A non-transitory computer readable storage medium storing instructions, wherein the instructions, when executed by a processor, cause the processor to:
send an identifier of a host component of an application program to a threading module, to perform system permission verification, the threading module being a parent class component of a host module, and the application program being a host program of the plugin;
receive runnable notification information from the threading module when the identifier of the host component passes the system permission verification, the runnable notification information containing the identifier of the host component;
replace the identifier of the host component contained in the runnable notification information with an identifier of a plugin component of the plugin; and
send the runnable notification information to the threading module, so that the threading module is configured to construct the plugin component based on the identifier of the plugin component contained in the runnable notification information, to load the plugin.

### Claim 16 (depends on 15)

The non-transitory computer readable storage medium according to claim 15, wherein the instructions, when executed by the processor, further cause the processor to:
when the plugin is started, obtain the identifier of the plugin component of the plugin from the threading module;
record the identifier of the plugin component;
replace the identifier of the plugin component of the plugin with the identifier of the host component; and
constructing, based on a parents delegation model, the host module corresponding to the threading module.

### Claim 17 (depends on 15)

The non-transitory computer readable storage medium according to claim 15, wherein the instructions, when executed by the processor, further cause the processor to:
obtain new-version information of the plugin from a server;
parse the new-version information;
obtain a new-version class loader and a new-version resource manager of a new-version plugin corresponding to the new-version information; and
replace a class loader and a resource manager of the plugin with the new-version class loader and the new-version resource manager of the new-version plugin.

### Claim 18 (depends on 15)

The non-transitory computer readable storage medium according to claim 15, wherein
the host component of the application program is pre-registered with the host program.

### Claim 19 (depends on 15)

The non-transitory computer readable storage medium according to claim 15, wherein, when the instructions cause the processor to perform sending the identifier of the host component to the threading module, to perform system permission verification, the instructions cause the processor to:
send the identifier of the host component to the threading module, so that:
the threading module is configured to send the identifier of the host component to a system service module,
the system service module is configured to determine whether the identifier of the host component passes the system permission verification,
in response to the determination that the identifier of the host component passes the system permission verification, the system service module send the runnable notification information to the threading module, and
the threading module forwards the runnable notification information to the host module.

### Claim 20 (depends on 15)

The non-transitory computer readable storage medium according to claim 15, wherein, when the threading module is configured to construct the plugin component based on the identifier of the plugin component to load the plugin, the threading module is configured to:
load a plugin code of the plugin component based on the identifier of the plugin component by using a class loader; and
load a plugin resource of the plugin based on the identifier of the plugin component by using a newly-added plugin path method in a resource manager.
