Information processing method and device, equipment and storage medium
By running the first part of the front-end code file in the main thread and using the function dependency information generated by the background thread, the problems of latency and low efficiency of information processing in the traditional cross-end technology framework are solved, and more efficient information processing and view updates are achieved.
Patent Information
- Application Number
- CN202510099428.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-05-06
AI Technical Summary
When updating application views, the traditional cross-end technology framework requires multiple cross-thread communications, resulting in latency and inefficiency in information processing, especially in terms of gesture processing and animation frame rate.
By obtaining the compiled file corresponding to the application front-end code file, it is divided into the first and second parts. The first part is run in the main thread, and the second part is function dependency information generated by the background thread is used for the operation of the main thread.
It reduces the number of cross-thread communication between the background thread and the main thread, improves the efficiency of information processing, and reduces the problems of gesture processing delay and low animation frame rate.
Smart Images

Figure CN119938208A_ABST
Abstract
Description
Technical Field
[0001] Example embodiments of the present disclosure generally relate to the field of computers, and more particularly, to information processing methods, apparatuses, devices, and computer-readable storage media. Background Art
[0002] With the rapid development of technology, users have higher and higher requirements for the interactivity and visual quality of the view interface, and the interactive functions of the view interface are involved in many fields such as games, virtual reality, augmented reality, mobile applications and web design. How to perform efficient information processing for view display is a focus of attention. Summary of the invention
[0003] In a first aspect of the present disclosure, an information method is provided. The method includes: obtaining a compiled file corresponding to a front-end code file of an application, the compiled file including a first part and a second part, the first part being generated based on an implementation code associated with a target function in the front-end code file, and the second part being generated based on declaration information associated with the target function; registering a main thread function corresponding to the first part of the compiled file in a main thread of the application; obtaining function dependency information associated with the target function from a background thread of the application by the main thread, the function dependency information being generated by the background thread based on the second part; and running a main thread function corresponding to the target function in the main thread based on the function dependency information.
[0004] In a second aspect of the present disclosure, a device for information processing is provided. The device includes: a first acquisition module, configured to acquire a compiled file corresponding to a front-end code file of an application, the compiled file including a first part and a second part, the first part is generated based on an implementation code associated with a target function in the front-end code file, and the second part is generated based on declaration information associated with the target function; a registration module, configured to register a main thread function corresponding to the first part of the compiled file in the main thread of the application; a second acquisition module, configured to acquire function dependency information associated with the target function from a background thread of the application by the main thread, the function dependency information being generated by the background thread based on the second part; and a running module, configured to run the main thread function corresponding to the target function in the main thread based on the function dependency information.
[0005] In a third aspect of the present disclosure, an electronic device is provided. The device includes at least one processing unit; and at least one memory, the at least one memory is coupled to the at least one processing unit and stores instructions for execution by the at least one processing unit. When the instructions are executed by the at least one processing unit, the device executes the method of the first aspect.
[0006] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein a computer program is stored on the computer-readable storage medium, and the computer program can be executed by a processor to implement the method of the first aspect.
[0007] In a fifth aspect of the present disclosure, a computer program product is provided, which includes computer executable instructions, and when the instructions are executed by a processor, the method according to the first aspect of the present disclosure is implemented.
[0008] It should be understood that the contents described in this content section are not intended to limit the key features or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:
[0010] Figure 1 A schematic diagram showing an example environment in which embodiments of the present disclosure can be implemented;
[0011] Figure 2 A flowchart showing a process of information processing according to some embodiments of the present disclosure;
[0012] Figure 3 A flowchart of compiling a front-end code file according to some embodiments of the present disclosure is shown;
[0013] Figure 4 A flowchart of a view update process according to some embodiments of the present disclosure is shown;
[0014] Figure 5 A flowchart showing a reference counting process according to some embodiments of the present disclosure is shown;
[0015] Figure 6 A schematic diagram of a system for environmental enhancement according to an embodiment of the present disclosure is shown;
[0016] Figure 7 A schematic structural block diagram of an apparatus for information processing according to some embodiments of the present disclosure is shown;
[0017] Figure 8 A block diagram of an electronic device capable of implementing various embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0018] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0019] It should be noted that the titles of any sections / subsections provided herein are not restrictive. Various embodiments are described throughout this article, and any type of embodiment may be included under any section / subsection. In addition, the embodiments described in any section / subsection may be combined in any manner with any other embodiments described in the same section / subsection and / or different sections / subsections.
[0020] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may be included below. The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may be included below.
[0021] The embodiments of the present disclosure may involve user data, data acquisition and / or use, etc. These aspects are subject to the corresponding laws, regulations and relevant provisions. In the embodiments of the present disclosure, all data collection, acquisition, processing, processing, forwarding, use, etc. are carried out on the premise that the user knows and confirms. Accordingly, when implementing each embodiment of the present disclosure, the type, scope of use, usage scenario, etc. of the data or information that may be involved should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with the relevant laws and regulations. The specific notification and / or authorization method can vary according to the actual situation and application scenario, and the scope of the present disclosure is not limited in this respect.
[0022] In this specification and the embodiments, if personal information processing is involved, it will be processed on the premise of having a legal basis (such as obtaining the consent of the subject of personal information, or it is necessary to perform a contract, etc.), and will only be processed within the scope of regulations or agreements. If a user refuses to process personal information other than the necessary information for basic functions, it will not affect the user's use of basic functions.
[0023] In the traditional cross-end technology framework, the code file used to update the application's view runs in the background thread, which is separated from the actual rendering thread (main thread). When a scheduled event occurs in the main thread, the background thread needs to be notified through the main thread. After the background thread generates a view based on the scheduled event, it sends the view to the main thread so that the main thread can render. From the above description, it can be seen that the traditional solution requires at least two cross-thread communications from the main thread to the background thread, and then from the background thread back to the main thread. This method will cause delays in information processing, and then lead to low efficiency in information processing. Especially for gesture-triggered events that pursue high efficiency, the traditional method will cause delays in gesture processing, and there will also be problems such as low animation frame rate and lack of hand tracking.
[0024] The embodiment of the present disclosure proposes a scheme for information processing. According to the scheme, a compiled file corresponding to the front-end code file of the application is obtained, the compiled file includes a first part and a second part, the first part is generated based on the implementation code associated with the target function in the front-end code file, and the second part is generated based on the declaration information associated with the target function; the main thread function corresponding to the first part of the compiled file is registered in the main thread of the application; the main thread obtains the function dependency information associated with the target function from the background thread of the application, and the function dependency information is generated by the background thread based on the second part; and in the main thread, the main thread function corresponding to the target function is run based on the function dependency information.
[0025] Based on this approach, the embodiments of the present disclosure can run the first part of the front-end code file in the main thread, which can reduce the number of cross-thread communications between the background thread and the main thread, and effectively improve the efficiency of information processing.
[0026] Example Environment
[0027] Figure 1 1 is a schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented. Figure 1 As shown, example environment 100 may include electronic device 110 .
[0028] In this example environment 100, the electronic device 110 may run an application 120 that supports interface interaction. The application 120 may be any appropriate type of cross-platform application for interface interaction, examples of which may include but are not limited to: game applications, video applications, social applications, or other appropriate applications with view display functions. The user 140 may interact with the application 120 via the electronic device 110 and / or its attached devices.
[0029] exist Figure 1In the environment 100, if the application 120 is in an active state, the electronic device 110 can present an interface 150 for supporting interface interaction through the application 120.
[0030] In some embodiments, the electronic device 110 communicates with the server 130 to provide services for the application 120. The electronic device 110 can be any type of mobile terminal, fixed terminal or portable terminal, including a mobile phone, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a media computer, a multimedia tablet, a handheld computer, a portable game terminal, a VR / AR device, a personal communication system (PCS) device, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio receiver, an e-book device, a game device, or any combination of the foregoing, including accessories and peripherals of these devices or any combination thereof. In some embodiments, the electronic device 110 can also support any type of interface for the user (such as a "wearable" circuit, etc.).
[0031] The server 130 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks, and big data and artificial intelligence platforms. The server 130 may include, for example, a computing system / server, such as a mainframe, an edge computing node, a computing device in a cloud environment, etc. The server 130 may provide background services for the application 120 that supports virtual scenes in the electronic device 110.
[0032] A communication connection may be established between the server 130 and the electronic device 110. The communication connection may be established in a wired manner or a wireless manner. The communication connection may include, but is not limited to, a Bluetooth connection, a mobile network connection, a Universal Serial Bus (USB) connection, a Wireless Fidelity (WiFi) connection, etc., and the embodiments of the present disclosure are not limited in this respect. In the embodiments of the present disclosure, the server 130 and the electronic device 110 may implement signaling interaction through the communication connection between the two.
[0033] It should be understood that the structure and function of the various elements in the environment 100 are described for exemplary purposes only and do not imply any limitation on the scope of the present disclosure.
[0034] Some example embodiments of the present disclosure will be described below with continued reference to the accompanying drawings.
[0035] Example Process
[0036] Figure 2 FIG. 2 is a flowchart showing a process 200 of information processing according to some embodiments of the present disclosure. The process 200 may be implemented at the electronic device 110. Figure 1 Process 200 is described.
[0037] In box 210, a compilation file corresponding to the front-end code file of the application is obtained, and the compilation file includes a first part and a second part. The first part is generated based on the implementation code associated with the target function in the front-end code file, and the second part is generated based on the declaration information associated with the target function.
[0038] In some embodiments, the application may be any appropriate cross-platform application. The front-end code file may be any appropriate type of code file, such as javascript.
[0039] In some embodiments, the implementation code is the code portion corresponding to the target function, which defines the specific behavior of the target function, that is, the operation performed when the target function is called. The implementation code may include all execution details of the target function, including calculations, logical judgments, data processing, etc. In some embodiments, the declaration information associated with the target function is used to define a grammatical structure corresponding to the target function, which may indicate the name of the target function, the type of the target function, the function dependency information corresponding to the target function, etc. The declaration information associated with the target function may also be referred to as a function declaration.
[0040] In some embodiments, the front-end code file may include a preset indicator associated with the target function. The preset indicator may be set at a predetermined location where the target function is located. The preset indicator is a standard for compiling the front-end code file to obtain the first part and the second part, that is, when the electronic device compiles the front-end code file, it can identify the implementation code associated with the target function and the declaration information associated with the target function based on the preset indicator in the front-end code file.
[0041] In some embodiments, the declaration information may indicate context information that the execution implementation code depends on. The context information may be any appropriate information, such as function dependency information.
[0042] In some embodiments, the first part may also include runtime information associated with the target function. The runtime information represents the software environment required for the code execution, which provides all the support and resources required for the code to run.
[0043] Figure 3 A flowchart of compiling a front-end code file according to some embodiments of the present disclosure is shown. Figure 3 Provide explanation.
[0044] In some embodiments, the electronic device may compile the front-end code file 301 and analyze its corresponding implementation code 302 and function declaration 303 .
[0045] As an example, a developer can add a preset indicator associated with the target function in an initial code file running in a background thread to obtain a front-end code file, wherein the initial code file includes the target function and declaration information corresponding to the target function. Specifically, the indicator identifier can be added to the position corresponding to the target function in the initial code file. Further, the electronic device can compile the front-end code file and identify the implementation code 302 and the function declaration 303 corresponding to the front-end code file 301 based on the preset indicator associated with the target function.
[0046] In some embodiments, the electronic device can determine the main thread data block 305 in combination with the runtime information 304 and the implementation code 302. In some embodiments, the electronic device can determine the application service file 306 (app-service.js) based on the function declaration. In some embodiments, the electronic device can encode based on the main thread data block 305 and the application service file 306 to generate an executable compiled file 307 (template.js).
[0047] In block 220 , the electronic device registers a main thread function corresponding to the first portion of the compiled file in the main thread of the application.
[0048] In some embodiments, the first part and the second part are associated with the same identifier, and the main thread function is registered based on the identifier. Specifically, the identifier can be an identifier set for the target function, and the first part can be associated with the second part based on the identifier.
[0049] In some embodiments, the first part may include a registration function, and the registration function includes a registration code and an implementation code. Specifically, the electronic device may run the registration function in the main thread to register the main thread function in the main thread based on the registration code. As an example, when the electronic device registers the main thread function in the main thread, the identifier corresponding to the target function may be stored in the global mapping table, that is, the correspondence between the target function and its corresponding identifier is stored in the global mapping table.
[0050] In block 230 , the electronic device obtains function dependency information associated with the target function from a background thread of the application by a main thread, where the function dependency information is generated by the background thread based on the second part.
[0051] In some embodiments, the second part may include function dependency information associated with the target function, wherein the second part may be sent to the background thread. Further, the background thread may identify the function dependency information in the declaration information and send the function dependency information to the main thread.
[0052] Specifically, in order to facilitate the main thread to establish the connection between the first part and the second part, the background thread can send function dependency information and an identifier to the main thread, and the identifier can be an identifier corresponding to the target function. The identifier can be identified by the background thread based on the declaration information. Furthermore, the electronic device can bind the function dependency information to the main thread function based on the identifier by the main thread, that is, establish an association relationship between the function dependency information and the implementation code based on the identifier. Specifically, the electronic device can match the identifier corresponding to the target function sent by the background thread with the identifier corresponding to the target function stored in the global mapping table of the main thread. In response to determining that the identifier corresponding to the target function sent by the background thread successfully matches the identifier corresponding to the target function stored in the global mapping table, an association relationship between the function dependency information and the implementation code is established.
[0053] In block 240 , the electronic device runs a main thread function corresponding to the target function in the main thread based on the function dependency information.
[0054] In some embodiments, the electronic device may update the view of the application in response to the main thread function being executed. Specifically, the electronic device may generate the main thread function based on the function dependency information and the target function. Further, the electronic device may execute the main thread function in the main thread to update the view of the application.
[0055] In some embodiments, the function dependency information may change during the process of updating the application's view. In response to the change in the function dependency information, the electronic device may send an identifier and the changed function dependency information to the main thread by a background thread. Further, the electronic device may bind the changed function dependency information to the main thread function based on the identifier by the main thread. Further, the electronic device may update the application's view in response to the new main thread function being executed.
[0056] Figure 4 A flowchart of a view update process according to some embodiments of the present disclosure is shown. Figure 4 To illustrate, the main thread data block is sent to the main thread, and the application service file is sent to the background thread.
[0057] In block 401 , the electronic device may load a runtime environment corresponding to the main thread in the main thread.
[0058] Specifically, the electronic device may load the runtime environment based on the main thread data block sent to the main thread.
[0059] In some embodiments, the runtime environment may also be referred to as runtime information, which may support the software environment required for the characterization code execution, and it provides all the support and resources required for the code execution. Specifically, the runtime environment may also provide the ability to load the master data block shown in block 402.
[0060] In block 402, the electronic device may load implementation code in a main thread.
[0061] In some embodiments, the implementation code may include all execution details of the target function, including calculations, logical judgments, data processing, etc. This implementation code is similar to Figure 3 The implementation code 302 in the compilation process shown is the same.
[0062] In block 403, the electronic device may register a main thread function corresponding to the implementation code in the main thread.
[0063] Specifically, in response to the main thread function being registered, the electronic device may store the correspondence between the target function and the identifier in the global mapping table in the main thread.
[0064] In block 404 , in response to receiving a rendering instruction in a background thread, the electronic device may determine a function declaration based on the application service file, and further determine an identifier of a target function indicated in the function declaration and function dependency information.
[0065] In some embodiments, the application service file is Figure 3 The same as the application service file 306 in the compilation process shown. In some embodiments, the function declaration information is used to define a grammatical structure corresponding to the target function, which can indicate the name of the target function, the type of the target function, the function dependency information corresponding to the target function, etc. The declaration information associated with the target function can also be called function declaration information.
[0066] In some embodiments, the electronic device may obtain the identifier and function dependency information from the background thread by the main thread.
[0067] In block 405 , the electronic device may use the conversion work unit to bind the function dependency information and the implementation code based on the identifier of the target function sent by the background process and the identifier corresponding to the target function stored in the global mapping table.
[0068] Specifically, the electronic device can use the conversion work unit in the main thread to determine whether the identifier of the target function sent by the background process and the identifier corresponding to the target function stored in the global mapping table match. Further, the electronic device can respond to the identifier of the target function sent by the background process and the identifier corresponding to the target function stored in the global mapping table to build an association relationship between the function dependency information and the implementation code.
[0069] In block 406, the electronic device may determine, through the main thread, that the function dependency is successfully bound to the implementation code, and generate a main thread function.
[0070] Specifically, the electronic device can generate a main thread function based on the function dependency information and the implementation code. Further, the electronic device can run the main thread function in the main thread to update the view of the application.
[0071] In block 407 , the electronic device may update the function dependency information in the implementation code in response to receiving the rendering instruction again in the background thread.
[0072] Furthermore, the electronic device may obtain the updated function dependency information and the identifier of the target function sent by the background thread through the main thread.
[0073] In block 408, the electronic device may use the conversion work unit to bind the updated function dependency information and the implementation code based on the identifier of the target function sent by the background process and the identifier corresponding to the target function stored in the global mapping table to obtain a new main thread function. The main thread function is the main thread function corresponding to the target function.
[0074] Since the implementation code may also include a reference to the additional function, the electronic device may also, during the compilation process, send the additional function as part of the declaration information in the second part to the background thread, that is, the additional function may be configured to run in the background thread. The function dependency information may also include reference information associated with the running result of the additional function in the background thread.
[0075] After the function dependency information and / or additional function corresponding to the declaration information in the background thread is sent to the main thread, the main thread can determine the main thread function based on the function dependency information and / or additional function, which is equivalent to the generation of the main thread function relying on the additional function of the background thread, but the background thread does not know that it is relied on by the main thread, so there may be a risk that the additional function is released. In order to avoid the risk of the additional function being released, the electronic device can record the reference information of the main thread function to the additional function. Specifically, the electronic device can count the number of times the additional function is referenced in the background process, so that when the number of references is greater than a predetermined threshold, the additional function is controlled not to be released. Specifically, when the additional function is referenced by the main thread once, the number of references counted by the background thread by the electronic device can be added by 1. Further, the electronic device can respond to the number of references counted by the background thread not being 0, and control the additional function not to be released.
[0076] In some embodiments, the electronic device may remove the recorded reference information in response to the object in the main thread function that references the additional function being released.
[0077] In some embodiments, the electronic device may monitor whether the object that references the additional function is released in the main thread based on a monitor. Specifically, the main thread may monitor whether the object that references the additional function is released based on a predetermined monitoring method. Further, the electronic device may send a target prompt message to the background thread in response to the object that references the additional function in the main thread function being released, and the target prompt message may indicate that the object of the additional function is released. In response to receiving the target prompt message, the background thread may reduce the number of references counted by the background thread by 1.
[0078] Figure 5 A flowchart of a reference counting process according to some embodiments of the present disclosure is shown. Figure 5 Provide explanation.
[0079] In block 501, Map<ExecId,RcCount> A global mapping table may be represented for storing each execution identifier (ExecId) and its corresponding reference count (RcCount).
[0080] Specifically, when the reference count increases (+rc), it indicates that a new reference points to the ExecId. When the reference count decreases (-rc), it indicates that a reference no longer points to the ExecId. When the reference count of the ExecId drops to 0, the electronic device can send a message to the code file context to notify that the main thread function corresponding to the ExecId can be released.
[0081] At block 502, FinalizationRegistry <execid>Represents a FinalizationRegistry, which is used to clean up when ExecId is no longer referenced. Specifically, when the reference count of ExecId drops to 0, FinalizationRegistry triggers the cleanup operation.
[0082] In block 503, JsFnHandles is a collection of JsFnHandle objects, each of which represents a function handle. When the main process function is actually executed, its context environment is restored first, and the reference count of each restored JsFnHandle object is increased by 1.
[0083] It should be noted that the main process function, Map<ExecId,RcCount> and FinalizationRegistry <execid>The state changes are all monitored based on the monitor, and when the main process function is actually executed, its context environment will be restored.
[0084] In addition, the target component can hold the main thread function. When the main thread function is bound by the target component, the reference count increases (+1). When the main thread function is released, the reference count decreases by 1.
[0085] In order to support the numerous capabilities newly added by the present disclosure, the cross-communication framework of the present disclosure is required to provide corresponding atomic capabilities for support. Specifically, the present disclosure can perform a series of enhancement operations on the operating environment where the cross-communication framework is located.
[0086] Figure 6 A schematic diagram of the system for environmental enhancement according to an embodiment of the present disclosure is shown. Figure 6 Provide explanation.
[0087] In block 601, a Domain-Specific Language (DSL) layer is used to run a code file.
[0088] In box 602, the electronic device can perform a series of enhancements to the element application programming interface (Application Programming Interface, API), which mainly include event processing, property update, response animation and other capabilities, where the element API is the method and property used to operate and access the Document Object Model (Document Object Model, DOM) elements in the web page. Specifically, the electronic device can provide the ability to operate the element, such as the ability to update styles (updateStyles), the ability to call methods (invoke), etc. The electronic device can also add animation capabilities, such as supporting animations defined using Cascading Style Sheets (CSS) and supporting transition effects, etc.
[0089] In block 603 , in the runtime environment of the main thread function, key global APIs may be injected, and the main thread APIs may also be standardized to provide synchronization event capabilities that are missing in the code file.
[0090] Specifically, the global API mainly includes cross-thread communication API (or runtime monitor), timer API, callback API, animation frame request API, etc. The runtime monitor is used to provide cross-thread communication capabilities. Providing the synchronization event capabilities missing in the code file can include the ability to flexibly change the event bubbling logic and obtain the event initiation node in the event callback.
[0091] In block 604, the glue layer is used to provide the capabilities enhanced in block 603 to the DSL layer.
[0092] Specifically, the glue layer can bind the domain-specific language layer with the software development kit capabilities and pass the software development kit capabilities to the DSL layer.
[0093] Based on this approach, the embodiments of the present disclosure can run the first part of the front-end code file in the main thread, which can reduce the number of cross-thread communications between the background thread and the main thread, and effectively improve the efficiency of information processing.
[0094] Example devices and equipment
[0095] The embodiments of the present disclosure also provide corresponding devices for implementing the above methods or processes. Figure 7 : A schematic structural block diagram of an apparatus 700 for information processing according to some embodiments of the present disclosure is shown. The apparatus 700 may be implemented as or included in the electronic device 110 discussed above. Each module / component in the apparatus 700 may be implemented by hardware, software, firmware, or any combination thereof.
[0096] like Figure 7 As shown, the device 700 includes a first acquisition module 710, which is configured to acquire a compiled file corresponding to the front-end code file of the application, the compiled file includes a first part and a second part, the first part is generated based on the implementation code associated with the target function in the front-end code file, and the second part is generated based on the declaration information associated with the target function; a registration module 720, which is configured to register the main thread function corresponding to the first part of the compiled file in the main thread of the application; a second acquisition module 730, which is configured to acquire function dependency information associated with the target function from the background thread of the application by the main thread, the function dependency information is generated by the background thread based on the second part; and a running module 740, which is configured to run the main thread function corresponding to the target function in the main thread based on the function dependency information.
[0097] In some embodiments, the device 700 further includes an update module configured to update the view of the application in response to the main thread function being executed.
[0098] In some embodiments, the front-end code file includes a preset indicator associated with the target function.
[0099] In some embodiments, the first portion and the second portion are associated with the same identifier, and the main thread function is registered based on the identifier.
[0100] In some embodiments, the background thread is configured to send the function dependency information and the identifier to the main thread, and the main thread is configured to bind the function dependency information to the main thread function based on the identifier.
[0101] In some embodiments, the device 700 also includes a sending module, which is configured to: in response to a change in the function dependency information, send an identifier and the changed function dependency information to the main thread by the background thread; and a binding module, which is configured to, by the main thread, bind the changed function dependency information to the main thread function based on the identifier.
[0102] In some embodiments, the declaration information indicates contextual information upon which the execution of the implementation code depends.
[0103] In some embodiments, the first portion also includes runtime information associated with the target function.
[0104] In some embodiments, the first part includes a registration function, the registration function includes a registration code and an implementation code, and the registration module 720 is further configured to run the registration function in the main thread to register the main thread function in the main thread based on the registration code.
[0105] In some embodiments, the implementation code further includes a reference to an additional function, the additional function is configured to run in a background thread, and the function dependency information further includes reference information associated with a result of running the additional function in the background thread.
[0106] In some embodiments, the device 700 also includes a recording module configured to record reference information of the main thread function to the additional function; and a removal module configured to remove the recorded reference information in response to the object referencing the additional function in the main thread function being released.
[0107] The units included in the device 700 can be implemented in various ways, including software, hardware, firmware, or any combination thereof. In some embodiments, one or more units can be implemented using software and / or firmware, such as machine executable instructions stored on a storage medium. In addition to or as an alternative to machine executable instructions, some or all of the units in the device 700 can be implemented at least in part by one or more hardware logic components. As an example and not limitation, exemplary types of hardware logic components that can be used include field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0108] Figure 8 8 is a block diagram of an electronic device 800 in which one or more embodiments of the present disclosure may be implemented. It should be understood that Figure 8 The electronic device 800 shown is merely exemplary and should not constitute any limitation on the functionality and scope of the embodiments described herein. Figure 8 The electronic device 800 shown can be used to implement Figure 1 An electronic device 110 is shown.
[0109] like Figure 8 As shown, the electronic device 800 is in the form of a general electronic device. The components of the electronic device 800 may include, but are not limited to, one or more processors or processing units 810, a memory 820, a storage device 830, one or more communication units 840, one or more input devices 850, and one or more output devices 860. The processing unit 810 may be an actual or virtual processor and is capable of performing various processes according to a program stored in the memory 820. In a multi-processor system, multiple processing units execute computer executable instructions in parallel to improve the parallel processing capability of the electronic device 800.
[0110] The electronic device 800 typically includes a plurality of computer storage media. Such media may be any accessible media that is accessible to the electronic device 800, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 820 may be a volatile memory (e.g., a register, a cache, a random access memory (RAM)), a non-volatile memory (e.g., a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 830 may be a removable or non-removable medium, and may include a machine-readable medium, such as a flash drive, a disk, or any other medium, which may be capable of being used to store information and / or data (e.g., training data for training) and may be accessed within the electronic device 800.
[0111] The electronic device 800 may further include additional removable / non-removable, volatile / non-volatile storage media. Figure 8 As shown in , a disk drive for reading or writing from a removable, non-volatile disk (e.g., a "floppy disk") and an optical drive for reading or writing from a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to the bus (not shown) by one or more data media interfaces. The memory 820 may include a computer program product 825 having one or more program modules that are configured to perform various methods or actions of various embodiments of the present disclosure.
[0112] The communication unit 840 implements communication with other electronic devices through a communication medium. Additionally, the functions of the components of the electronic device 800 can be implemented with a single computing cluster or multiple computing machines that can communicate through a communication connection. Therefore, the electronic device 800 can operate in a networked environment using a logical connection with one or more other servers, a network personal computer (PC), or another network node.
[0113] The input device 850 may be one or more input devices, such as a mouse, a keyboard, a tracking ball, etc. The output device 860 may be one or more output devices, such as a display, a speaker, a printer, etc. The electronic device 800 may also communicate with one or more external devices (not shown) through the communication unit 840 as needed, such as a storage device, a display device, etc., communicate with one or more devices that allow a user to interact with the electronic device 800, or communicate with any device that allows the electronic device 800 to communicate with one or more other electronic devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface (not shown).
[0114] According to an exemplary implementation of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, wherein the computer-executable instructions are executed by a processor to implement the method described above. According to an exemplary implementation of the present disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.
[0115] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices, equipment, and computer program products implemented according to the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0116] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0117] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, so that the instructions executed on the computer, other programmable data processing apparatus, or other device implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0118] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple implementations of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of a module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some implementations as replacements, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.
[0119] The above descriptions of various implementations of the present disclosure are exemplary, non-exhaustive, and not limited to the disclosed implementations. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described implementations. The selection of terms used herein is intended to best explain the principles of the implementations, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the various implementations disclosed herein.< / execid> < / execid>
Claims
1. A method of information processing, comprising: Obtaining a compiled file corresponding to a front-end code file of an application, the compiled file comprising a first part and a second part, the first part being generated based on an implementation code associated with a target function in the front-end code file, and the second part being generated based on declaration information associated with the target function; Registering a main thread function corresponding to the first part of the compiled file in the main thread of the application; The main thread obtains function dependency information associated with the target function from a background thread of the application, where the function dependency information is generated by the background thread based on the second part; as well as In the main thread, a main thread function corresponding to the target function is executed based on the function dependency information.
2. The method according to claim 1, further comprising: In response to the main thread function being executed, the view of the application is updated.
3. The method of claim 1, wherein the front-end code file includes a preset indicator associated with the target function. 4 . The method of claim 1 , wherein the first portion and the second portion are associated with a same identifier, and the main thread function is registered based on the identifier.
5. The method according to claim 4, wherein the background thread is configured to send the function dependency information and the identifier to the main thread, and the main thread is configured to bind the function dependency information to the main thread function based on the identifier.
6. The method according to claim 5, further comprising: In response to a change in the function dependency information, the background thread sends the identifier and the changed function dependency information to the main thread; as well as The main thread binds the changed function dependency information to the main thread function based on the identifier. The method according to claim 1 , wherein the declaration information indicates context information on which execution of the implementation code depends.
8. The method of claim 1, wherein the first portion further comprises runtime information associated with the target function.
9. The method according to claim 1, wherein the first part includes a registration function, the registration function includes a registration code and the implementation code, and registering the main thread function corresponding to the first part of the compiled file in the main thread of the application comprises: The registration function is run in the main thread to register the main thread function in the main thread based on the registration code.
10. The method of claim 1, wherein the implementation code further includes a reference to an additional function, the additional function being configured to run in the background thread, and the function dependency information further includes reference information associated with a result of running the additional function in the background thread.
11. The method according to claim 10, further comprising: Recording the reference information of the main thread function to the additional function; as well as In response to the object in the main thread function that references the additional function being released, the recorded reference information is removed.
12. An apparatus for information processing, comprising: A first acquisition module is configured to acquire a compiled file corresponding to a front-end code file of an application, wherein the compiled file includes a first part and a second part, wherein the first part is generated based on an implementation code associated with a target function in the front-end code file, and the second part is generated based on declaration information associated with the target function; a registration module, configured to register a main thread function corresponding to the first part of the compiled file in the main thread of the application; A second acquisition module is configured to acquire, by the main thread, function dependency information associated with the target function from a background thread of the application, wherein the function dependency information is generated by the background thread based on the second part; as well as The running module is configured to run a main thread function corresponding to the target function in the main thread based on the function dependency information.
13. An electronic device comprising: at least one processing unit; as well as At least one memory, the at least one memory being coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions causing the electronic device to perform the method according to any one of claims 1 to 11 when executed by the at least one processing unit.
14. A computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the method according to any one of claims 1 to 11 when executed by a processor.
15. A computer program product comprising computer executable instructions, wherein the computer executable instructions, when executed by a processor, implement the method according to any one of claims 1 to 11.