CN111008050A - Page task execution method, device, terminal and storage medium - Google Patents

Page task execution method, device, terminal and storage medium Download PDF

Info

Publication number
CN111008050A
CN111008050A CN201911243791.XA CN201911243791A CN111008050A CN 111008050 A CN111008050 A CN 111008050A CN 201911243791 A CN201911243791 A CN 201911243791A CN 111008050 A CN111008050 A CN 111008050A
Authority
CN
China
Prior art keywords
page
task
thread
function
starting
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.)
Granted
Application number
CN201911243791.XA
Other languages
Chinese (zh)
Other versions
CN111008050B (en
Inventor
董永清
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN201911243791.XA priority Critical patent/CN111008050B/en
Publication of CN111008050A publication Critical patent/CN111008050A/en
Application granted granted Critical
Publication of CN111008050B publication Critical patent/CN111008050B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44568Immediately runnable code
    • G06F9/44578Preparing or optimising for loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

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 disclosure provides a page task execution method, a page task execution device, a page task execution terminal and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: creating a page task through a page thread; when the page task is a preset calculation task, starting a working thread corresponding to the page task; and executing the page task through the working thread in the running process of the page thread. By setting the preset calculation task, when the created page task is the preset calculation task, the page task can be handed to a working thread different from the page thread to be executed, and the page thread cannot be influenced in the process of executing the page task by the working thread, so that influence on normal execution of other page tasks when the page task consumes a long time is prevented, and page blockage is avoided.

Description

Page task execution method, device, terminal and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a terminal, and a storage medium for executing a page task.
Background
With the development of computer technology, various types of applications, such as video playing applications, instant messaging applications, and the like, have come to be used. The application can comprise various pages, and various page tasks such as page rendering, digital computation, image processing and the like need to be executed in the page running process.
In the related art, each page has a page thread through which a page task is executed. When the page tasks in the page comprise a plurality of tasks, each page task is executed in turn through the page thread. However, when a certain page task takes a long time, normal execution of other page tasks may be affected, and the page may be stuck.
Disclosure of Invention
The present disclosure provides a page task execution method, device, terminal and storage medium, which can overcome the page jamming problem in the related art, and the technical scheme is as follows:
according to a first aspect provided by an embodiment of the present disclosure, a method for executing a page task is provided, where the method includes:
creating a page task through a page thread;
when the page task is a preset calculation task, starting a working thread corresponding to the page task;
and executing the page task through the working thread in the running process of the page thread.
In one possible implementation, the creating a page task by a page thread includes:
displaying a page corresponding to the page thread;
and when the operation triggered on the page is detected through the page thread, creating a page task corresponding to the operation.
In one possible implementation, the method further includes:
calling configuration information, wherein the configuration information comprises types of a plurality of preset computing tasks;
and if the type of the page task is the same as that of any preset computing task in the configuration information, determining that the page task is a preset computing task.
In a possible implementation manner, the page data of the page includes path information of at least one script file, and when the page task is a preset computation task, starting a work thread corresponding to the page task includes:
determining the path information of a target script file corresponding to the page task according to the path information of the at least one script file;
and calling the target script file according to the path information of the target script file, and starting the working thread.
In one possible implementation manner, the executing the page task by the worker thread during the running of the page thread includes:
calling a first function through the page thread, and transferring input data of the page task to the first function;
and calling a second function through the working thread, receiving the input data transmitted by the page thread, and executing the page task based on the input data, wherein the second function is used for monitoring the first function.
In one possible implementation, the method further includes:
acquiring an execution result of the page task through the working thread;
calling a first function through the working thread, and transmitting the execution result to the first function;
and calling a second function through the page thread, and receiving the execution result transmitted by the working thread, wherein the second function is used for monitoring the first function.
In one possible implementation, the method further includes:
and when the page task is not a preset calculation task, executing the page task through the page thread.
In one possible implementation, the method further includes:
and when the operation of starting any page in the fast application is detected, starting a page thread corresponding to the page in the fast application.
According to a second aspect provided by an embodiment of the present disclosure, there is provided a page task execution device, including:
the page task creating module is used for creating page tasks through page threads;
the working thread starting module is used for starting a working thread corresponding to the page task when the page task is a preset computing task;
and the first page task execution module is used for executing the page task through the working thread in the running process of the page thread.
In one possible implementation, the page task creating module includes:
the display unit is used for displaying the page corresponding to the page thread;
and the creating unit is used for creating a page task corresponding to the operation when the operation triggered on the page is detected through the page thread.
In one possible implementation, the apparatus further includes:
the configuration information calling module is used for calling configuration information, and the configuration information comprises various types of preset calculation tasks;
and the determining module is used for determining that the page task is a preset computing task if the type of the page task is the same as that of any preset computing task in the configuration information.
In a possible implementation manner, the page data of the page includes path information of at least one script file, and the worker thread starting module includes:
a path information determining unit, configured to determine, according to the path information of the at least one script file, path information of a target script file corresponding to the page task;
and the working thread starting unit is used for calling the target script file according to the path information of the target script file and starting the working thread.
In one possible implementation, the first page task execution module includes:
the data transfer unit is used for calling a first function through the page thread and transferring the input data of the page task to the first function;
and the task execution unit is used for calling a second function through the working thread, receiving the input data transmitted by the page thread, and executing the page task based on the input data, wherein the second function is used for monitoring the first function.
In one possible implementation, the apparatus further includes:
the execution result acquisition module is used for acquiring the execution result of the page task through the working thread;
the execution result transfer module is used for calling a first function through the working thread and transferring the execution result to the first function;
and the execution result receiving module is used for calling a second function through the page thread and receiving the execution result transmitted by the working thread, wherein the second function is used for monitoring the first function.
In one possible implementation, the apparatus further includes:
and the second page task execution module is used for executing the page task through the page thread when the page task is not a preset calculation task.
In one possible implementation, the apparatus further includes:
and the page thread starting module is used for starting a page thread corresponding to the page in the fast application when the operation of starting any page in the fast application is detected.
According to a third aspect provided by an embodiment of the present disclosure, a terminal is provided, where the terminal includes:
one or more processors;
volatile or non-volatile memory for storing the one or more processor-executable instructions;
wherein the one or more processors are configured to:
when a target page display instruction is received, template style data is obtained, wherein the template style data comprises style data items of at least one dimension;
acquiring a specified style data item of a target page;
fusing the specified style data item with the template style data to obtain fused style data;
and displaying the target page according to the fusion style data.
According to a fourth aspect provided by the embodiments of the present disclosure, a computer-readable storage medium is provided, in which at least one instruction is stored, and the instruction is loaded and executed by a processor to implement the operations performed in the page task execution method according to the first aspect.
The beneficial effects brought by the technical scheme provided by the embodiment of the disclosure at least comprise:
according to the method, the device, the terminal and the storage medium provided by the embodiment of the disclosure, the page task is created through the page thread, when the page task is a preset calculation task, the working thread corresponding to the page task is started, and the page task is executed through the working thread in the running process of the page thread. By setting the preset calculation task, when the created page task is the preset calculation task, the page task can be handed to a working thread different from the page thread to be executed, and the page thread cannot be influenced in the process of executing the page task by the working thread, so that the influence of a certain page task consuming longer time on the normal operation of other page tasks can be prevented, and the page can be prevented from being stuck.
In addition, by displaying the page corresponding to the page thread, when the operation triggered on the page is detected through the page thread, the page task corresponding to the operation is created, so that the page task can be timely and quickly executed, the page can be prevented from being stuck, and the page response speed is improved.
In addition, the configuration information is called, the configuration information comprises various types of preset calculation tasks, if the type of the page task is the same as that of any preset calculation task in the configuration information, the page task is determined to be the preset calculation task, a mode for determining the preset calculation task is provided, and the preset calculation task and the non-preset calculation task are clearly divided, so that after the page task is created through the page thread, the type of the page task can be directly matched with the type of the preset calculation task in the configuration information, whether the page task is the preset calculation task can be determined, and the accuracy is improved.
In addition, the path information of at least one script file is set in the page data of the page, the path information of a target script file corresponding to the page task is determined according to the path information of the at least one script file, the target script file is called according to the path information of the target script file, the working thread is started, the target script file can be called accurately and quickly to start the working thread, and the efficiency and the accuracy of executing the page task are improved.
In addition, by calling the first function and the second function, data can be transmitted to the working thread through the page thread, the preset calculation task is processed by the working thread, meanwhile, the page thread is not affected, and page blocking caused by the fact that different page tasks are processed at the page thread at the same time is avoided. Or the execution result can be transmitted to the page thread through the working thread, so that the two-way communication between the page thread and the working thread is realized.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a flowchart illustrating a method of page task execution in accordance with an exemplary embodiment;
FIG. 2 is a flow diagram illustrating another method of page task execution in accordance with an illustrative embodiment;
FIG. 3 is a diagram illustrating an application package, according to an exemplary embodiment;
FIG. 4 is a block diagram illustrating a fast application framework in accordance with an exemplary embodiment;
FIG. 5 is a flowchart illustrating the launching of a fast application, according to an exemplary embodiment;
FIG. 6 is a block diagram illustrating a page task execution device in accordance with an exemplary embodiment;
FIG. 7 is a block diagram illustrating another page task performing device in accordance with an illustrative embodiment;
fig. 8 is a block diagram illustrating a terminal according to an example embodiment.
Detailed Description
To make the objects, technical solutions and advantages of the present disclosure more apparent, embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.
Fig. 1 is a flowchart illustrating a page task execution method according to an exemplary embodiment, as shown in fig. 1, the method including:
in step 101, a page task is created by a page thread.
In step 102, when the page task is a preset computing task, a work thread corresponding to the page task is started.
In step 103, during the running of the page thread, the page task is executed by the worker thread.
According to the method provided by the embodiment of the disclosure, the page task is created through the page thread, when the page task is the preset calculation task, the working thread corresponding to the page task is started, and the page task is executed through the working thread in the running process of the page thread. By setting the preset calculation task, when the created page task is the preset calculation task, the page task can be handed to a working thread different from the page thread to be executed, and the page thread cannot be influenced in the process of executing the page task by the working thread, so that influence on normal execution of other page tasks when the page task consumes a long time is prevented, and page blockage is avoided.
In one possible implementation, creating the page task by a page thread includes:
displaying a page corresponding to the page thread;
and when the operation triggered on the page is detected through the page thread, creating a page task corresponding to the operation.
In one possible implementation, the method further comprises:
calling configuration information, wherein the configuration information comprises types of a plurality of preset computing tasks;
and if the type of the page task is the same as that of any preset computing task in the configuration information, determining that the page task is the preset computing task.
In a possible implementation manner, the page data of the page includes path information of at least one script file, and when the page task is a preset computation task, the starting of a work thread corresponding to the page task includes:
determining the path information of a target script file corresponding to the page task according to the path information of at least one script file;
and calling the target script file according to the path information of the target script file, and starting a working thread.
In one possible implementation, during the running of the page thread, the page task is executed by the worker thread, including:
calling a first function through a page thread, and transferring input data of a page task to the first function;
and calling a second function through the working thread, receiving input data transmitted by the page thread, and executing the page task based on the input data, wherein the second function is used for monitoring the first function.
In one possible implementation, the method further comprises:
acquiring an execution result of a page task through a working thread;
calling a first function through a working thread, and transmitting an execution result to the first function;
and calling a second function through the page thread, and receiving an execution result transmitted by the working thread, wherein the second function is used for monitoring the first function.
In one possible implementation, the method further comprises:
and when the page task is not the preset computing task, executing the page task through the page thread.
In one possible implementation, the method further comprises:
and when the operation of starting any page in the fast application is detected, starting a page thread corresponding to the page in the fast application.
Fig. 2 is a flowchart illustrating another page task execution method according to an exemplary embodiment, where the method is applied to a terminal, and the terminal may be a mobile phone, a computer, a tablet computer, or any other type of device, as shown in fig. 2. The method comprises the following steps:
in step 201, the terminal displays a page corresponding to the page thread.
In terms of format, a page may be a web page or an application page in a certain application, or may also be another page. From the page type, the page may be a video playing page or a news page, or may be other pages.
In a possible implementation manner, when the terminal detects an operation of starting any page, the operation carries a page identifier, the terminal starts a page thread corresponding to the page identifier, starts the page thread, performs page rendering through the working thread, and displays a rendered page, that is, a page corresponding to the page thread.
The operation of starting any page may be an operation of clicking any application icon, or an operation of clicking a certain web page link in a web page, or may also be other operations. The page identifier is used to indicate a uniquely corresponding page, and may be a link address of the page, a number of the page, or other identifier.
In addition, the thread is the minimum unit for performing operation scheduling in the terminal, each page has a corresponding page thread, and the terminal runs the page thread and executes the page task through the page thread.
The page task may be a display task, a play task, a timing task, a download task, etc., and may be determined according to a function included in the page. The display task is used for indicating a page corresponding to the display page thread, and comprises the color, the position and the like of each display element in the display page.
In step 202, when the terminal detects an operation triggered on a page through a page thread, a page task corresponding to the operation is created.
In the process that the terminal displays the page through the page thread, the user can view the page and can trigger one or more operations on the page. When the terminal detects the operation through the page thread, the page task corresponding to the operation can be created.
The operation that can be triggered on the page has various types, and each type of operation can set a corresponding page task, for example, a skip web page task corresponding to a skip web page operation, and a video playing task corresponding to a video playing operation.
For example, when the terminal displays a login page, a user inputs an account and a password on the page and clicks a confirmation button, and when the terminal detects the operation of the user through a page thread, a login task corresponding to the login operation is created, wherein the login task comprises the account and the password input by the user.
It should be noted that the step 201-. For example, when the terminal receives a page display request, a page thread corresponding to the page display request is started, a page rendering task is created through the page thread, the page rendering task is used for rendering a page corresponding to the page thread, and at this time, the terminal temporarily does not display the page because the page is not rendered yet.
In step 203, the terminal determines whether the page task is a preset calculation task. If so, step 204 is performed, and if not, step 206 is performed.
In the embodiment of the present disclosure, it is considered that the page task may include a computation task and a non-computation task, where the computation task refers to a task that needs to perform data operation during execution, such as a style computation task, a data statistics task, and the like. The non-calculation task refers to a task which does not need to perform data operation during execution, such as a display task, a picture acquisition task, a video playing task and the like. Because data operation is needed when the calculation task is executed, the consumed time is long, so in order to avoid the influence of the calculation task, the terminal hands the calculation task to the working thread for execution, and does not need to be executed by the page thread any more.
For this reason, the terminal sets a preset calculation task, and after the terminal creates the page task through the page thread, the terminal can judge whether the page task is the preset calculation task, so that whether the page task is executed by the page thread or the working thread is determined according to the judgment result.
In a possible implementation manner, considering that the page task includes multiple types, the type of the page task may indicate whether the page task is a computing task, so that the terminal stores configuration information, where the configuration information includes multiple types of preset computing tasks. And calling the configuration information when the page task is created through the page thread, and judging whether the type of the page task is the same as the type of a preset calculation task in the configuration information. And if the type of the page task is the same as that of any preset computing task in the configuration information, determining that the page task is the preset computing task. And if the type of the page task is different from the type of each preset calculation task in the configuration information, determining that the page task is not the preset calculation task.
In step 204, when the page task is a preset computing task, the terminal starts a work thread corresponding to the page task.
After the terminal determines that the page task is a preset calculation task, a working thread (Worker thread) corresponding to the page task is started, and the page task is executed through the working thread.
In a possible implementation manner, the page data of the page includes path information of at least one script file, the path information of a target script file corresponding to the page task is determined according to the path information of the at least one script file, the target script file is called according to the path information of the target script file, and the working thread is started.
The script files are used for starting the working threads, and the working threads started by the different script files can be of the same type or different types. The Script file may be in a JS (Java Script) format or may be in another format.
The at least one script file is stored on the terminal, and each script file has path information, which is used to indicate a storage location of the corresponding script file, and may be a storage path, a storage address, or other information of the script file. The path information of the at least one script file can be added to the page data in advance, so that any script file can be called according to requirements in the following.
In addition, according to the function that the page can realize, a corresponding script file can be added to the page data, for example, if the page has a style calculation function, the script file for starting the style calculation thread is added to the page data, and if the page does not have an image synthesis function, the script file for starting the image synthesis thread does not need to be added to the page data.
When the terminal determines that the page task is a preset calculation task, the type of the page task can be determined, a script file corresponding to the type of the page task is searched from the at least one script file to be used as a target script file, the path information of the target script file is determined, the target script file can be called according to the determined path information, and a working thread corresponding to the target script file is started.
As shown in fig. 3, the page script files page1.js and page2.js and the Worker directory including the Worker thread script files main1.js and main2.js are stored in the application package. The structure of each file in the file package is a tree structure as shown in fig. 3. Further, page1.js stores path information of main1.js and main2.js, and page2.js stores path information of main1.js and main2. js. When page1.js runs, starting a page thread of a first page, creating a page task (preset calculation task) corresponding to Main1.js through the page thread, calling Main1.js according to the path information of Main1.js, starting a working thread corresponding to Main1.js, and executing the page task through the working thread.
In step 205, during the running process of the page thread, the terminal executes the page task through the work thread.
In the process that the terminal executes the page task through the working thread, the page thread does not need to wait for the working thread to return an execution result, can continue to run, continue to create other page tasks, can execute the page task, or is handed to other working threads to execute, so that the parallel running of the page thread and the working thread is realized, the efficiency of executing the page task is improved, and page blocking caused by the fact that a certain page task consuming longer time influences the normal execution of other page tasks is prevented.
When a work thread executes a page task, input data required for executing the corresponding page task needs to be acquired, the input data is acquired through the page thread and is sent to the work thread, and the work thread receives the input data and executes the page task based on the input data.
In one possible implementation, a first function and a second function may be created, and the page thread and the worker thread communicate by calling the first function and the second function. The terminal calls the first function through the page thread, transfers the input data of the page task to the first function, calls the second function through the work thread, receives the input data transferred by the page thread, and executes the page task based on the input data.
The second function is used for listening to the first function, such as a callback function which can be the first function. When the first function is called, the second function may intercept the notification calling the first function and acquire the input data. For example, the first function may be a post message function and the second function may be an on message function.
In addition, after the work thread executes the page task, the execution result of the page task can be obtained, and at this time, the execution result needs to be sent to the page thread, and the page thread receives the execution result.
In a possible implementation manner, the terminal obtains an execution result of the page task through the work thread, calls the first function through the work thread, transfers the execution result to the first function, calls the second function through the page thread, and receives the execution result transferred by the work thread.
And after the terminal receives the execution result of the page task of the working thread through the page thread, the terminal can perform subsequent operation based on the execution result. For example, the page task is a style calculation task and is used for calculating the style of each node in the page, and the terminal can render the page according to the style of each node after receiving the calculated style of each node through the page thread.
In step 206, when the page task is not the preset computing task, the terminal executes the page task through the page thread.
When the terminal detects that the page task type is different from the preset calculation task type in the configuration information through the page thread, the terminal determines that the page task is not the preset calculation task, and the terminal executes the page task through the page thread.
It should be noted that, the embodiment of the present disclosure only takes the terminal as an execution subject, in another embodiment, the terminal may further run at least one application, and the method may be executed by any application. For example, the application may be a video playing application, an instant messaging application, or the like, and the application may be a third party application installed in the terminal, or may also be a fast application, or the like.
In a possible implementation manner, taking a fast application as an example, when the terminal detects an operation of starting any page in the fast application, a page thread corresponding to the page is started in the fast application.
When the fast application is started, the terminal loads a file package of the fast application, the file package of the fast application comprises at least one script file of a page and at least one script file of a working thread, and the page task execution method provided by the embodiment of the disclosure can be executed based on the script files in the file package.
A second point to be described is that the above embodiment is only an example of one page task, and in fact, one page thread may create multiple page tasks, where the multiple page tasks may include a preset computing task or a non-computing task, and for the preset computing task, a corresponding work thread may be started through the page thread, and the preset computing task is executed through the work thread. For non-computational tasks, the non-computational task may be executed by a page thread.
According to the method provided by the embodiment of the disclosure, the page task is created through the page thread, when the page task is the preset calculation task, the working thread corresponding to the page task is started, and the page task is executed through the working thread in the running process of the page thread. By setting the preset calculation task, when the created page task is the preset calculation task, the page task can be handed to a working thread different from the page thread to be executed, and the page thread cannot be influenced in the process of executing the page task by the working thread, so that the influence of a certain page task consuming longer time on the normal operation of other page tasks can be prevented, and the page can be prevented from being stuck.
In addition, by displaying the page corresponding to the page thread, when the operation triggered on the page is detected through the page thread, the page task corresponding to the operation is created, so that the page task can be timely and quickly executed, the page can be prevented from being stuck, and the page response speed is improved.
In addition, the configuration information is called, the configuration information comprises various types of preset calculation tasks, if the type of the page task is the same as that of any preset calculation task in the configuration information, the page task is determined to be the preset calculation task, a mode for determining the preset calculation task is provided, and the preset calculation task and the non-preset calculation task are clearly divided, so that after the page task is created through the page thread, the type of the page task can be directly matched with the type of the preset calculation task in the configuration information, whether the page task is the preset calculation task can be determined, and the accuracy is improved.
In addition, the path information of at least one script file is set in the page data of the page, the path information of a target script file corresponding to the page task is determined according to the path information of the at least one script file, the target script file is called according to the path information of the target script file, the working thread is started, the target script file can be called accurately and quickly to start the working thread, and the efficiency and the accuracy of executing the page task are improved.
In addition, by calling the first function and the second function, data can be transmitted to the working thread through the page thread, the preset calculation task is processed by the working thread, meanwhile, the page thread is not affected, and page blocking caused by the fact that different page tasks are processed at the page thread at the same time is avoided. Or the execution result can be transmitted to the page thread through the working thread, so that the two-way communication between the page thread and the working thread is realized.
The fast Application related in the embodiments of the present disclosure is a novel Application form based on a hardware platform of an electronic device, and can run based on a native API (Application Programming Interface) provided by an operating system.
The fast application is developed by adopting a unified standard, and is rendered as native without installation, namely, the fast application is used as point, and has native application experience (performance, system integration, interaction and the like). The framework of the fast application can be deeply integrated in an operating system, can operate at the level of the operating system, and realizes seamless connection with other application services. Developers can operate on different types of electronic equipment through one-time development. The method is applied to the electronic equipment manufacturers at the beginning of birth, realizes standardization unification among the electronic equipment manufacturers on the aspects of development specifications, capability access, developer service and the like, and greatly reduces the adaptation cost of developers.
Compared with the traditional application, the quick application has the following characteristics:
instant: the user can use the method point by point, and the user does not need to wait;
everywhere (Everywhere visible): deeply integrated with the use scene of the electronic equipment, and everywhere has an entrance, such as a search engine, an intelligent assistant, intelligent recommendation, an application market, a browser and the like;
efficiency: the quasi-front-end development mode is high in efficiency.
FIG. 4 illustrates a block diagram of a fast application framework 400 shown in one exemplary embodiment of the present disclosure, including: scenario portal 420, fast application engine 440, and Operating System (OS) infrastructure and hardware 460.
The scene portal 420 includes at least one of a negative one-screen, a global search, a lock screen, a desktop, an application marketplace, a browser, and a two-dimensional code. The appearance of the scene portal 420 may be in the form of a page and a card.
The fast application engine 440 includes a front end framework 441, a generic scenario 442, a lightweight scenario 443, an embedded SDK (Software Development Kit) 444, and business access 445.
The front-end framework 441 includes an MVVM (Model-View-Model ), a V-DOM (Virtual-Document Object Model), a route, an Application Programming Interface (API), a service API, a User Interface (UI) component, a route, and the like;
the general scene 442 and the lightweight scene 443 include a JavaScript (a programming language) engine, a standard rendering engine, an extreme speed rendering engine, end-cloud-core acceleration, a security mechanism, emerging scenes such as AI (Artificial Intelligence), AR (Augmented Reality), and the like, system integration (application management, rights management, and the like);
service access 445 includes push, account/payment, etc.
OS infrastructure and hardware 460 includes: a graphics library, a native control, a system service, and a GPU (graphics Processing Unit)/NPU (embedded Neural network processor), etc.
From the execution path level, there are a standard HTML (Hyper Text Markup Language) 5 mode to support a general Web scene, and a JS (JavaScript, a programming Language) and Native (Native) mode to support a lighter and faster experience.
The architecture of the fast application engine will be briefly described in 3 aspects below.
1) Application development:
the design of the front end of the fast application refers to and integrates the design thought of the mainstream front end framework: the application is built in a componentized mode, an MVVM design mode taking data binding as a core is adopted, the performance is improved in a V-DOM mode, and meanwhile, a simple and clear template of a class Vue (a virtual machine shelling engine) is selected. Meanwhile, the layout aspect is correspondingly simplified. From the perspective of new application form, native UI mapping and capability opening, a set of components and API specifications need to be defined, and the rapid development application is convenient to develop.
2) System integration:
fast applications, as a complete application modality, can be deeply integrated with the system, run as native applications, and interact with the system. There are currently two forms of rapid application: a full screen mode independent application mode and an embedded mode card mode. Under the independent application form, the experience of the user is similar to a native application program, and the method has complete life cycle management, page management, routing and the like. The fast application can be hosted in the Activity of android, the page is hosted in Fragment, and the instance is managed and controlled through independent background Service. The card form is another form, and dynamic content is displayed in a light weight manner by embedding the embedded SDK (Software Development Kit) as an independent local control into each corner of the system. In the aspect of security isolation, better security guarantee can be achieved through a sandbox mechanism, process isolation and authority control in combination with the support of an operating system layer.
3) Performance experience and emerging scenes, such as JavaScript engines, rendering engines, end-cloud-core acceleration, emerging scenes, and the like:
in the aspects of interactive experience, resource overhead, stability and the like, the fast application realizes effective combination of a front-end development mode, native rendering and platform capability by introducing a native rendering path.
Different from cross-platform frameworks of other application layers, the application is planted in an operating system of the electronic equipment, and deep integration of a slave chip, the operating system and the cloud can be realized. By taking the acceleration of the starting performance as an example by combining the end and the cloud, the optimization of the network link layer can greatly accelerate the starting speed of the application through the cooperative rendering of the cloud and the end. Meanwhile, the special capability of the hardware platform can be integrated, and the experience is further improved. For example, the computing power of an NPU (Neural-network processing Unit, network processor) may be integrated into a fast application engine in combination with an AI chip of an electronic device, so that an AI scene (face recognition, image super-resolution, and the like) may be executed at a low latency and high performance on an end side, and meanwhile, the privacy of a user is effectively protected, and a bandwidth is saved.
Fig. 5 shows a flowchart illustrating the start-up of a fast application according to an exemplary embodiment of the present disclosure, including:
1) when the system is started for the first time, a user clicks a program package for triggering downloading of the fast application, and meanwhile, initialization related work of the fast application engine is carried out. After the whole fast application program package is downloaded and verified, the JavaScript file of the first page to be displayed is loaded and rendered.
2) The page rendering comprises JavaScript loading, execution of page and JavaScript frame logic, layout operation and drawing of the native UI control. When the logic in the page is executed, one or more network requests are generated, and the data returned by the network requests drive the page to be rendered again until the content of the page on the first screen is completely displayed.
The network request, JavaScript execution, typesetting and drawing are not in simple serial relation, but are parallelly interwoven, thereby affecting the rendering performance of the whole page and being strongly related to the logic and network conditions of page design and the running state of equipment.
Due to the specificity of fast applications, fast applications are expected to perform more tasks and perform more functions. At present, while the operation of the fast application is being gradually improved, the embodiment of the present disclosure provides a new method for the fast application to execute a page task, which provides a multithreading capability for the fast application, solves the problem of page stutter, and improves the operation capability and the practicability of the fast application.
Fig. 6 is a block diagram illustrating a page task performing apparatus according to an exemplary embodiment, as shown in fig. 6, the apparatus including:
a page task creating module 601, configured to create a page task through a page thread;
a working thread starting module 602, configured to start a working thread corresponding to a page task when the page task is a preset computing task;
the first page task executing module 603 is configured to execute a page task through a work thread in the running process of the page thread.
In one possible implementation, referring to fig. 7, the page task creation module 601 includes:
a display unit 6011, configured to display a page corresponding to the page thread;
a creating unit 6012, configured to, when an operation triggered on a page is detected by a page thread, create a page task corresponding to the operation.
In one possible implementation, referring to fig. 7, the apparatus further comprises:
a configuration information calling module 604, configured to call configuration information, where the configuration information includes types of multiple preset computing tasks;
a determining module 605, configured to determine that the page task is a preset computing task if the type of the page task is the same as that of any preset computing task in the configuration information.
In a possible implementation manner, referring to fig. 7, the page data of the page includes path information of at least one script file, and the worker thread starting module 602 includes:
a path information determining unit 6021, configured to determine path information of a target script file corresponding to the page task according to the path information of the at least one script file;
and the working thread starting unit 6022 is configured to call the target script file according to the path information of the target script file, and start the working thread.
In one possible implementation, referring to fig. 7, the first page task execution module 603 includes:
a data transfer unit 6031 configured to call a first function through a page thread, and transfer input data of a page task to the first function;
a task execution unit 6032, configured to invoke a second function through the work thread, receive input data passed by the page thread, and execute the page task based on the input data, where the second function is configured to listen to the first function.
In one possible implementation, referring to fig. 7, the apparatus further comprises:
an execution result obtaining module 606, configured to obtain an execution result of the page task through the work thread;
an execution result transfer module 607, configured to call the first function through the worker thread, and transfer the execution result to the first function;
and an execution result receiving module 608, configured to call a second function through the page thread, and receive an execution result delivered by the work thread, where the second function is used to monitor the first function.
In one possible implementation, referring to fig. 7, the apparatus further comprises:
and a second page task executing module 609, configured to execute the page task through the page thread when the page task is not the preset computing task.
In one possible implementation, referring to fig. 7, the apparatus further comprises:
the page thread starting module 610 is configured to start a page thread corresponding to a page in the fast application when detecting an operation of starting any page in the fast application.
Fig. 8 is a block diagram of a terminal according to an embodiment of the disclosure. For example, the terminal 800 may be configured to perform the steps performed by the terminal in the page task execution method provided in the foregoing embodiments. Referring to fig. 8, terminal 800 may include one or more of the following components: processing component 802, memory 804, power component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814, and communication component 816.
The processing component 802 generally controls overall operation of the terminal 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operation at the terminal 800. Examples of such data include instructions for any application or method operating on terminal 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power components 806 provide power to the various components of terminal 800. Power components 806 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for terminal 800.
The multimedia component 808 includes a screen that provides an output interface between the terminal 800 and the user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the terminal 800 is in an operation mode, such as a photographing mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the terminal 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
Sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for terminal 800. For example, sensor assembly 814 can detect an open/closed state of terminal 800, the relative positioning of components, such as a display and keypad of terminal 800, sensor assembly 814 can also detect a change in position of terminal 800 or a component of terminal 800, the presence or absence of user contact with terminal 800, orientation or acceleration/deceleration of terminal 800, and a change in temperature of terminal 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
Communication component 816 is configured to facilitate communications between terminal 800 and other devices in a wired or wireless manner. The terminal 800 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, communications component 816 further includes a Near Field Communications (NFC) module to facilitate short-range communications.
In an exemplary embodiment, the terminal 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 804 comprising instructions, executable by the processor 820 of the terminal 800 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
The embodiment of the present disclosure also provides a computer-readable storage medium, where at least one instruction is stored in the computer-readable storage medium, and the instruction is loaded and executed by a processor to implement the operations performed in the page task execution method of the foregoing embodiment.
The embodiment of the present disclosure further provides a computer program, where at least one instruction is stored in the computer program, and the instruction is loaded and executed by a processor to implement the operations performed in the page task execution method of the foregoing embodiment.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (16)

1. A page task execution method, characterized in that the method comprises:
creating a page task through a page thread;
when the page task is a preset calculation task, starting a working thread corresponding to the page task;
and executing the page task through the working thread in the running process of the page thread.
2. The method of claim 1, wherein creating page tasks by a page thread comprises:
displaying a page corresponding to the page thread;
and when the operation triggered on the page is detected through the page thread, creating a page task corresponding to the operation.
3. The method of claim 1, further comprising:
calling configuration information, wherein the configuration information comprises types of a plurality of preset computing tasks;
and if the type of the page task is the same as that of any preset computing task in the configuration information, determining that the page task is a preset computing task.
4. The method according to claim 1, wherein the page data of the page includes path information of at least one script file, and when the page task is a preset computation task, starting a work thread corresponding to the page task includes:
determining the path information of a target script file corresponding to the page task according to the path information of the at least one script file;
and calling the target script file according to the path information of the target script file, and starting the working thread.
5. The method according to claim 1, wherein executing the page task by the worker thread during the running of the page thread comprises:
calling a first function through the page thread, and transferring input data of the page task to the first function;
and calling a second function through the working thread, receiving the input data transmitted by the page thread, and executing the page task based on the input data, wherein the second function is used for monitoring the first function.
6. The method of claim 1, further comprising:
acquiring an execution result of the page task through the working thread;
calling a first function through the working thread, and transmitting the execution result to the first function;
and calling a second function through the page thread, and receiving the execution result transmitted by the working thread, wherein the second function is used for monitoring the first function.
7. The method according to any one of claims 1-6, further comprising:
and when the operation of starting any page in the fast application is detected, starting a page thread corresponding to the page in the fast application.
8. A page task execution apparatus, comprising:
the page task creating module is used for creating page tasks through page threads;
the working thread starting module is used for starting a working thread corresponding to the page task when the page task is a preset computing task;
and the first page task execution module is used for executing the page task through the working thread in the running process of the page thread.
9. The apparatus of claim 8, wherein the page task creation module comprises:
the display unit is used for displaying the page corresponding to the page thread;
and the creating unit is used for creating a page task corresponding to the operation when the operation triggered on the page is detected through the page thread.
10. The apparatus of claim 8, further comprising:
the configuration information calling module is used for calling configuration information, and the configuration information comprises various types of preset calculation tasks;
and the determining module is used for determining that the page task is a preset computing task if the type of the page task is the same as that of any preset computing task in the configuration information.
11. The apparatus according to claim 8, wherein the page data of the page includes path information of at least one script file, and the thread starting module includes:
a path information determining unit, configured to determine, according to the path information of the at least one script file, path information of a target script file corresponding to the page task;
and the working thread starting unit is used for calling the target script file according to the path information of the target script file and starting the working thread.
12. The apparatus of claim 8, wherein the first page task execution module comprises:
the data transfer unit is used for calling a first function through the page thread and transferring the input data of the page task to the first function;
and the task execution unit is used for calling a second function through the working thread, receiving the input data transmitted by the page thread, and executing the page task based on the input data, wherein the second function is used for monitoring the first function.
13. The apparatus of claim 8, further comprising:
the execution result acquisition module is used for acquiring the execution result of the page task through the working thread;
the execution result transfer module is used for calling a first function through the working thread and transferring the execution result to the first function;
and the execution result receiving module is used for calling a second function through the page thread and receiving the execution result transmitted by the working thread, wherein the second function is used for monitoring the first function.
14. The apparatus of any one of claims 8-13, further comprising:
and the page thread starting module is used for starting a page thread corresponding to the page in the fast application when the operation of starting any page in the fast application is detected.
15. A terminal, characterized in that the terminal comprises:
one or more processors;
volatile or non-volatile memory for storing the one or more processor-executable instructions;
wherein the one or more processors are configured to:
creating a page task through a page thread;
when the page task is a preset calculation task, starting a working thread corresponding to the page task;
and executing the page task through the working thread in the running process of the page thread.
16. A computer-readable storage medium having stored therein at least one instruction, which is loaded and executed by a processor to perform operations performed in a page task execution method according to any one of claims 1 to 7.
CN201911243791.XA 2019-12-06 2019-12-06 Page task execution method, device, terminal and storage medium Active CN111008050B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911243791.XA CN111008050B (en) 2019-12-06 2019-12-06 Page task execution method, device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911243791.XA CN111008050B (en) 2019-12-06 2019-12-06 Page task execution method, device, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN111008050A true CN111008050A (en) 2020-04-14
CN111008050B CN111008050B (en) 2023-11-28

Family

ID=70115494

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911243791.XA Active CN111008050B (en) 2019-12-06 2019-12-06 Page task execution method, device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN111008050B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114064376A (en) * 2020-07-29 2022-02-18 北京字节跳动网络技术有限公司 Page monitoring method and device, electronic equipment and medium
CN114077529A (en) * 2022-01-19 2022-02-22 荣耀终端有限公司 Log uploading method and device, electronic equipment and computer readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170131911A1 (en) * 2015-04-08 2017-05-11 Huawei Technologies Co., Ltd. Redo-logging for partitioned in-memory datasets
CN109359256A (en) * 2018-09-29 2019-02-19 北京城市网邻信息技术有限公司 Page loading method, device, equipment and storage medium
CN109446455A (en) * 2018-09-14 2019-03-08 广东神马搜索科技有限公司 Page processing method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170131911A1 (en) * 2015-04-08 2017-05-11 Huawei Technologies Co., Ltd. Redo-logging for partitioned in-memory datasets
CN109446455A (en) * 2018-09-14 2019-03-08 广东神马搜索科技有限公司 Page processing method and device
CN109359256A (en) * 2018-09-29 2019-02-19 北京城市网邻信息技术有限公司 Page loading method, device, equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114064376A (en) * 2020-07-29 2022-02-18 北京字节跳动网络技术有限公司 Page monitoring method and device, electronic equipment and medium
CN114077529A (en) * 2022-01-19 2022-02-22 荣耀终端有限公司 Log uploading method and device, electronic equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN111008050B (en) 2023-11-28

Similar Documents

Publication Publication Date Title
CN111026396B (en) Page rendering method and device, electronic equipment and storage medium
CN107329743B (en) Application page display method and device and storage medium
CN110990105B (en) Interface display method and device, electronic equipment and storage medium
CN111026490B (en) Page rendering method and device, electronic equipment and storage medium
CN110990075B (en) Method, device, equipment and storage medium for starting fast application
US11210119B2 (en) Method and device for displaying interface, electronic equipment, server, and storage medium
CN110874217B (en) Interface display method and device for quick application and storage medium
US10817282B2 (en) Application configuration file generation method and apparatus, application page display method and apparatus and storage medium
CN110851108A (en) Electronic equipment operation method and device, electronic equipment and storage medium
CN111078325B (en) Application program running method and device, electronic equipment and storage medium
CN110971974B (en) Configuration parameter creating method, device, terminal and storage medium
US20230004620A1 (en) Page display method
CN110928543A (en) Page processing method and device and storage medium
CN110865863B (en) Interface display method and device for fast application and storage medium
CN110851240B (en) Function calling method, device and storage medium
CN111008057A (en) Page display method and device and storage medium
CN111008050B (en) Page task execution method, device, terminal and storage medium
CN111046265B (en) Card data display method, device, equipment and storage medium
CN110865864B (en) Interface display method, device and equipment for quick application and storage medium
CN110908629A (en) Electronic equipment operation method and device, electronic equipment and storage medium
WO2023124657A1 (en) Micro-application running method and apparatus, device, storage medium, and program product
CN111104183B (en) Application program running method and device, electronic equipment and storage medium
CN110891194B (en) Comment information display method and device, terminal and storage medium
CN110865760A (en) Electronic equipment operation method and device, electronic equipment and storage medium
CN111338961A (en) Application debugging method and 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
GR01 Patent grant
GR01 Patent grant