CN111008050B - 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
CN111008050B
CN111008050B CN201911243791.XA CN201911243791A CN111008050B CN 111008050 B CN111008050 B CN 111008050B CN 201911243791 A CN201911243791 A CN 201911243791A CN 111008050 B CN111008050 B CN 111008050B
Authority
CN
China
Prior art keywords
page
task
thread
function
script file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911243791.XA
Other languages
Chinese (zh)
Other versions
CN111008050A (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

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

Abstract

The disclosure provides a method, a device, a terminal and a storage medium for executing a page task, 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 executed by a working thread different from the page thread, and the page thread is not influenced in the process of executing the page task by the working thread, so that the normal execution of other page tasks is prevented from being influenced when the time consumption of the page task is long, and page clamping is avoided.

Description

Page task execution method, device, terminal and storage medium
Technical Field
The disclosure relates to the technical field of computers, and in particular relates to a method, a device, 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 playback applications, instant messaging applications, and the like, have grown. The application can comprise various pages, and various page tasks such as page rendering, digital calculation, image processing and the like need to be executed in the page running process.
In the related art, each page has one page thread, by which a page task is performed. When the page tasks in the page comprise a plurality of page tasks, each page task is sequentially executed through the page thread. However, when a certain page task takes a long time, normal execution of other page tasks may be affected, resulting in page jam.
Disclosure of Invention
The disclosure provides a method, a device, a terminal and a storage medium for executing a page task, which can overcome the problem of page blocking in the related art, and the technical scheme is as follows:
according to a first aspect provided by an embodiment of the present disclosure, there is provided a method for performing a page task, including:
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 the page task by the page thread includes:
displaying a page corresponding to the page thread;
and when detecting the operation triggered on the page 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 various types of preset computing tasks;
and if the type of the page task is the same as the type of any preset computing task in the configuration information, determining that the page task is the preset computing task.
In one 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 computing task, starting a working thread corresponding to the page task, including:
determining the path information of the 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, by the working thread, the page task during the running of the page thread includes:
calling a first function through the page thread, and transmitting input data of the page task to the first function;
and calling a second function through the working thread, receiving the input data transferred by the page thread, executing the page task based on the input data, and monitoring the first function by the second function.
In one possible implementation, the method further includes:
acquiring an execution result of the page task through the working thread;
invoking a first function through the working thread, and transferring the execution result to the first function;
and calling a second function through the page thread, receiving the execution result transferred by the working thread, wherein the second function is used for monitoring the first function.
In one possible implementation, the method further includes:
and executing the page task through the page thread when the page task is not the preset calculation task.
In one possible implementation, the method further includes:
and when detecting the operation of starting any page in the fast application, 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 performing apparatus, including:
the page task creation module is used for creating a page task through a page thread;
the work thread starting module is used for starting a work thread corresponding to the page task when the page task is a preset calculation task;
And the first page task executing module is used for executing the page task through the working thread in the running process of the page thread.
In one possible implementation manner, the page task creation 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 types of a plurality of preset computing 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 the type of any preset computing task in the configuration information.
In one possible implementation manner, the page data of the page includes path information of at least one script file, and the work thread starting module includes:
the path information determining unit is used for determining the path information of the 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 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 manner, the first page task execution module includes:
the data transfer unit is used for calling a first function through the page thread and transferring 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, executing the page task based on the input data, and monitoring the first function through the second 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 transferring the execution result to the first function by calling the first function through the working thread;
and the execution result receiving module is used for calling a second function through the page thread, receiving the execution result transmitted by the working thread, and the second function is used for monitoring the first function.
In one possible implementation, the apparatus further includes:
and the second page task executing 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 the page thread corresponding to the page in the fast application when detecting the operation of starting any page in the fast application.
According to a third aspect provided by embodiments of the present disclosure, there is provided a terminal including:
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 are obtained, wherein the template style data comprise style data items of at least one dimension;
acquiring a designated style data item of a target page;
fusing the appointed style data item and 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 embodiments of the present disclosure, there is provided a computer-readable storage medium having stored therein at least one instruction that is loaded and executed by a processor to implement the operations performed in the page task performing method according to the first aspect.
The technical scheme provided by the embodiment of the disclosure has the beneficial effects that at least:
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 in the running process of the page thread, the page task is executed through the working thread. By setting the preset computing task, when the created page task is the preset computing task, the page task can be executed by a working thread different from the page thread, and the page thread is not influenced in the process of executing the page task by the working thread, so that the influence of a certain time-consuming longer page task on the normal operation of other page tasks can be prevented, and page clamping is prevented.
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 rapidly executed, page blocking can be prevented, and the page response speed is improved.
In addition, by calling configuration information, the configuration information comprises multiple types of preset computing tasks, if the type of the page task is the same as the type of any preset computing task in the configuration information, the page task is determined to be the preset computing task, a mode for determining the preset computing task is provided, the preset computing task and the non-preset computing task are definitely divided, and 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 computing task in the configuration information, so that whether the page task is the preset computing task can be determined, and accuracy is improved.
In addition, path information of at least one script file is set in page data of the page, 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 a working thread is started, so that the target script file can be accurately and quickly called to start the working thread, and efficiency and accuracy in executing the page task are improved.
In addition, through calling the first function and the second function, data can be transferred to the working thread through the page thread, a preset calculation task is processed by the working thread, meanwhile, the page thread cannot be affected, and page clamping caused by processing different page tasks on the page thread is avoided. Or the execution result can be transferred to the page thread through the working thread, so that the bidirectional 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 disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a flowchart illustrating a method of performing a page task according to an exemplary embodiment;
FIG. 2 is a flowchart illustrating another method of performing a page task according to an exemplary embodiment;
FIG. 3 is a schematic diagram of an application package, shown in accordance with an exemplary embodiment;
FIG. 4 is a block diagram of a quick application framework, shown in accordance with an exemplary embodiment;
FIG. 5 is a flowchart illustrating the start-up of a fast application according to an exemplary embodiment;
FIG. 6 is a block diagram of a page task performing device, according to an example embodiment;
FIG. 7 is a block diagram of another page task performing device, shown in accordance with an exemplary embodiment;
fig. 8 is a block diagram of a terminal according to an exemplary embodiment.
Detailed Description
For the purposes of clarity, technical solutions and advantages of the present disclosure, the following further details the embodiments of the present disclosure with reference to the accompanying drawings.
FIG. 1 is a flowchart illustrating a method of performing a page task, as shown in FIG. 1, according to an exemplary embodiment, the method comprising:
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 in the running process of the page thread, the page task is executed through the working thread. By setting the preset calculation task, when the created page task is the preset calculation task, the page task can be executed by a working thread different from the page thread, and the page thread is not influenced in the process of executing the page task by the working thread, so that the normal execution of other page tasks is prevented from being influenced when the time consumption of the page task is long, and page clamping is avoided.
In one possible implementation, creating a page task by a page thread includes:
displaying a page corresponding to the page thread;
when an operation triggered on a page is detected through a page thread, a page task corresponding to the operation is created.
In one possible implementation, the method further includes:
calling configuration information, wherein the configuration information comprises various types of preset computing tasks;
and if the type of the page task is the same as the type of any preset computing task in the configuration information, determining that the page task is the preset computing task.
In one 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 computing task, a working thread corresponding to the page task is started, including:
determining 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 the working thread.
In one possible implementation, during execution of the page thread, performing, by the worker thread, the page task includes:
transferring input data of a page task to a first function by calling the first function through a page thread;
and calling a second function through the working thread, receiving the input data transferred by the page thread, executing the page task based on the input data, and monitoring the first function by the second function.
In one possible implementation, the method further includes:
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, receiving an execution result transferred by the working thread, wherein the second function is used for monitoring the first function.
In one possible implementation, the method further includes:
and executing the page task through the page thread when the page task is not the preset calculation task.
In one possible implementation, the method further includes:
and when detecting the operation of starting any page in the fast application, starting a page thread corresponding to the page in the fast application.
Fig. 2 is a flowchart illustrating another method for performing a page task according to an exemplary embodiment, and as shown in fig. 2, the method is applied to a terminal, which may be a mobile phone, a computer, a tablet computer, or other various types of devices. The method comprises the following steps:
in step 201, the terminal displays a page corresponding to the page thread.
The page may be a web page, an application page in an application, or other pages in a format. The page may be a video playing page or a news page, or may be other pages as well, in terms of page type.
In one 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 the rendered page, namely, the page corresponding to the page thread.
The operation of launching any page may be an operation of clicking any application icon, or an operation of clicking a web page link in a web page, or may also be other operations. The page identifier is used for indicating 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 operation scheduling in the terminal, each page is provided with a corresponding page thread, the terminal runs the page thread, and the page task is executed through the page thread.
The page task may be a display task, a play task, a time counting task, a download task, etc., and may be determined according to functions 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 one or more operations can be triggered on the page. When the terminal detects the operation through the page thread, a page task corresponding to the operation can be created.
The operations that can be triggered on the page are of various types, and each type of operation can set a corresponding page task, for example, the skip web page operation corresponds to the skip web page task, and the video playing operation corresponds to the video playing task.
For example, when the terminal displays a login page, a user inputs an account number and a password on the page, clicks a confirmation button, and when the terminal detects an operation of the user through a page thread, creates a login task corresponding to the login operation, wherein the login task comprises the account number and the password input by the user.
It should be noted that, steps 201 to 202 are optional steps, and steps 201 to 202 may be used to create a page task, but may be created in other cases. For example, when the terminal receives the page display request, a page thread corresponding to the page display request is started, a page rendering task is created through the page thread, and the page rendering task is used for rendering a page corresponding to the page thread, at this time, the terminal does not display the page temporarily because the page is not rendered.
In step 203, the terminal determines whether the page task is a preset computing task. If yes, step 204 is performed, and if not, step 206 is performed.
In the embodiment of the disclosure, the page task may include a computing task and a non-computing task, where the computing task refers to a task that needs to perform data operation when executing, such as a style computing task, a data statistics task, and the like. The non-computing task refers to a task that does not need to perform data operation when executing, such as a display task, a picture acquisition task, a video playing task, and the like. Because the data operation is required to be performed when the computing task is executed, the time is long, so that the terminal can communicate the computing task to the working thread to be executed, and the page thread is not executed any more in order to avoid the influence of the computing task.
Therefore, the terminal sets the 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 work thread is determined according to a judging result.
In one 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 configuration information is stored in the terminal, where the configuration information includes multiple types of preset computing tasks. And when the page task is created through the page thread, calling configuration information, 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 the type 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 computing task in the configuration information, determining that the page task is not the preset computing task.
In step 204, when the page task is a preset computing task, the terminal starts a working thread corresponding to the page task.
After the terminal determines that the page task is a preset calculation task, starting a working thread (workbench thread) corresponding to the page task, and executing the page task through the working thread.
In one possible implementation manner, the page data of the page contains 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 at least one script file is used for starting the working threads, and the working threads started by different script files can be of the same type or different types. The Script file may be in JS (Java Script, a scripting language) format or may be in other formats as well.
The at least one script file is stored on the terminal, and each script file has path information, where the path information 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 the requirement.
In addition, according to the page-available functions, a corresponding script file may be added to the page data, for example, if the page has a style calculation function, a script file for starting a style calculation thread is added to the page data, and if the page does not have an image synthesis function, a script file for starting an image synthesis thread is not required 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 and 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, page script files page1.js and page2.js, and a Worker directory including Worker thread script files main1.js and main2.js are stored in a package of the application. The structure of each file in the file package is a tree structure shown in fig. 3. The page1.Js stores therein the path information of main1.Js and main2.Js, and the page2.Js stores therein the 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 the Main1.Js through the page thread, calling Main1.Js according to path information of the Main1.Js, starting a working thread corresponding to the Main1.Js, and executing the page task through the working thread.
In step 205, during the running 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, the page thread can continue to run, other page tasks can be continuously created, the page task can be executed, or the page task is submitted to other working threads for execution, parallel running of the page thread and the working thread is realized, the efficiency of executing the page task is improved, and meanwhile, page clamping caused by the fact that a certain page task with longer time consumption influences normal execution of other page tasks is prevented.
When the working thread executes the page task, the input data required by executing the corresponding page task is required to be acquired, the input data is acquired through the page thread, the input data is sent to the working thread, the working thread receives the input data, and the page task is executed 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 work thread communicate by calling the first function and the second function. The terminal calls a first function through a page thread, transfers input data of a page task to the first function, calls a second function through a working 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 monitoring 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 a notification that the first function is called, obtaining 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 the moment, the execution result needs to be sent to the page thread, and the page thread receives the execution result.
In one possible implementation manner, the terminal obtains an execution result of a page task through a working thread, calls a first function through the working thread, transfers the execution result to the first function, calls a second function through the page thread, and receives the execution result transferred by the working thread.
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 after the terminal receives the calculated style of each node through the page thread, the page can be rendered according to the style of each node.
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, in the embodiment of the present disclosure, the terminal is merely taken as an execution body, and in another embodiment, the terminal may also 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, etc., and the application may be a third party application installed on the terminal, a quick application, etc.
In one 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 quick application is started, the terminal loads a file package of the quick application, the file package of the quick application comprises at least one script file of a page and at least one script file of a working thread, and then 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 noted is that, in the above embodiment, only one page task is taken as an example, in fact, one page thread may create multiple page tasks, where the multiple page tasks may include a preset computing task or may include a non-computing task, and for the preset computing task, a corresponding working thread may be started by the page thread, and the preset computing task is executed by the working thread. For a non-computing task, the non-computing task may be executed by the 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 in the running process of the page thread, the page task is executed through the working thread. By setting the preset computing task, when the created page task is the preset computing task, the page task can be executed by a working thread different from the page thread, and the page thread is not influenced in the process of executing the page task by the working thread, so that the influence of a certain time-consuming longer page task on the normal operation of other page tasks can be prevented, and page clamping is prevented.
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 rapidly executed, page blocking can be prevented, and the page response speed is improved.
In addition, by calling configuration information, the configuration information comprises multiple types of preset computing tasks, if the type of the page task is the same as the type of any preset computing task in the configuration information, the page task is determined to be the preset computing task, a mode for determining the preset computing task is provided, the preset computing task and the non-preset computing task are definitely divided, and 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 computing task in the configuration information, so that whether the page task is the preset computing task can be determined, and accuracy is improved.
In addition, path information of at least one script file is set in page data of the page, 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 a working thread is started, so that the target script file can be accurately and quickly called to start the working thread, and efficiency and accuracy in executing the page task are improved.
In addition, through calling the first function and the second function, data can be transferred to the working thread through the page thread, a preset calculation task is processed by the working thread, meanwhile, the page thread cannot be affected, and page clamping caused by processing different page tasks on the page thread is avoided. Or the execution result can be transferred to the page thread through the working thread, so that the bidirectional communication between the page thread and the working thread is realized.
The fast application referred in the embodiments of the present disclosure is a new application form of a hardware platform based on an electronic device, and can be run based on a native API (Application Programming Interface ) provided by an operating system.
The quick application is developed by adopting a unified standard, and the quick application is used without installation, and has the advantages of both original application experience (performance, system integration, interaction and the like) and point use. The framework of the fast application can be deeply integrated in an operating system, can operate at the operating system level, and realizes seamless connection with other application services. The developer can perform one-time development and can operate on different types of electronic equipment. The quick application realizes standardization and unification among electronic equipment manufacturers at the development standard, capability access, developer service and other levels at the beginning of birth, and greatly reduces the adaptation cost of the developer.
Compared with the traditional application, the quick application has the following characteristics:
instant: the point is used immediately, and the user does not need to wait;
everywhere (Everywhere): the method is integrated with the depth of field of the use of the electronic equipment, and the portal is ubiquitous, such as search engines, intelligent assistants, intelligent recommendation, application markets, browsers and the like;
effect (high efficiency): the development mode of the quasi-front end is high in efficiency.
FIG. 4 illustrates a block diagram of a quick application framework 400 shown in an exemplary embodiment of the present disclosure, the quick application framework comprising: scene 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 external presentation form of the scene portal 420 may be a page form and a card form.
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 a business access 445.
Front end framework 441 includes, among other things, MVVM (Model-View-View-Model), V-DOM (Virtual-Document Object Model, virtual document object Model), routing, basic APIs (Application Programming Interface, application programming interfaces), business APIs, UI (User Interface) components, routing, and the like;
The general scene 442 and the lightweight scene 443 include JavaScript (a programming language) engine, standard rendering engine, very fast rendering engine, end-cloud-core acceleration, security mechanism, emerging scenes such as AI (Artificial Intelligence ), AR (Augmented Reality, augmented reality), etc., system integration (application management, rights management, etc.);
service access 445 includes push, account/payment, and the like.
The OS infrastructure and hardware 460 include: graphics libraries, native controls, system services and GPUs (Graphics Processing Unit, graphics processor)/NPUs (Neural-network Processing Unit, embedded Neural network processors), and the like.
From the execution path level, there is a standard HTML (Hyper Text Markup Language ) 5 way to support a general-purpose Web (World Wide Web) scene, and a JS (JavaScript, a programming language) combined with Native, to support a lighter, faster experience.
The architecture of the fast application engine will be briefly described in 3 aspects.
1) Application development:
the front end design of the fast application references and integrates the design thought of the main stream front end frame: the application is constructed in a componentization mode, the MVVM design mode taking data binding as a core is used for improving the performance in a V-DOM mode, and meanwhile, a simple and clear template of a class Vue (virtual machine unshelling engine) is selected. Meanwhile, the layout aspect is simplified correspondingly. From the aspects of new application form, mapping native UI and capability opening, a set of components and API specifications need to be defined, so that the rapid development application can be conveniently developed.
2) And (3) system integration:
the fast application, as a complete application modality, can be integrated deep with the system, run as a native application, and interact with the system. Fast applications currently have two forms: the independent application form of the full screen mode and the card form of the embedded mode. Under the independent application form, the experience of the user is just like a native application program, and the method has complete life cycle management, page management, routing and the like. The fast application can be parasitic to 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 is embedded into each corner of the system as an independent local control through an embedded SDK (Software Development Kit ), so that dynamic content is displayed in a lightweight mode. In the aspect of safety isolation, the method can realize better safety guarantee through a sandbox mechanism, process isolation and authority control and combining with the support of an operating system layer.
3) Performance experience and emerging scenes such as JavaScript engine, rendering engine, end-cloud-core acceleration, emerging scenes, etc.:
in the aspects of interactive experience, resource overhead, stability and the like, the fast application realizes the effective combination of a front-end development mode, native rendering and platform capability by introducing a native rendering path.
Different from the cross-platform framework of other application layers, the method can quickly apply the operating system rooted in the electronic equipment, and can realize the deep integration of the slave chip, the operating system and the cloud. By using the combination of the end and the cloud as an example of starting performance acceleration, the network link layer can be optimized to greatly accelerate the fast application starting speed through the cooperative rendering of the cloud and the end. And meanwhile, the special capability of the hardware platform can be integrated, and the experience is further improved. For example, the computing power of the NPU (Neural-network Processing Unit, network processor) can be integrated into a fast application engine by combining with an AI chip of the electronic device, so that the AI scene (face recognition, image super-resolution, etc.) can be executed with low delay and high performance at the end side, and meanwhile, the privacy of the user is effectively protected, and the bandwidth is saved.
FIG. 5 illustrates a flowchart of the launching of a quick application as illustrated by one exemplary embodiment of the present disclosure, including:
1) When the quick application engine is started for the first time, a user clicks a program package for triggering the downloading of the quick application, and meanwhile, related work of initialization of the quick application engine is conducted. After the downloading and verification of the program package of the whole fast application are completed, the JavaScript file of the first page to be displayed is loaded and rendering is started.
2) The page rendering comprises JavaScript loading, execution of page and JavaScript frame logic, and operation of layout, and finally drawing of the native UI control. When the logic in the page is executed, one or more network requests are generated, and the network requests return data to drive the re-rendering of the page until the content of the first screen page is completely displayed.
The network request, javaScript execution, typesetting and drawing are not in simple serial relation, but are interwoven together in parallel, so that the rendering performance of the whole page is affected, and the network request, the JavaScript execution, the typesetting and the drawing are strongly related to the logic of the page design, the network condition and the running state of equipment.
Because of the specificity of the fast application, the fast application is expected to complete more tasks and realize more functions. At present, in the gradual perfection of the operation of the fast application, the embodiment of the disclosure provides a new method for executing the page task of the fast application, provides multithreading capability for the fast application, solves the problem of page blocking, and improves the operation capability and practicability of the fast application.
FIG. 6 is a block diagram of a page task performing device, as shown in FIG. 6, according to an exemplary embodiment, the device comprising:
a page task creation module 601, configured to create a page task through a page thread;
The work thread starting module 602 is configured to start a work thread corresponding to a page task when the page task is a preset calculation task;
the first page task execution module 603 is configured to execute a page task through a work thread during a 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;
the creating unit 6012 is configured to create a page task corresponding to an operation when the operation triggered on the page is detected by the page thread.
In one possible implementation, referring to fig. 7, the apparatus further includes:
the configuration information calling module 604 is configured to call configuration information, where the configuration information includes types of multiple preset computing tasks;
the determining module 605 is configured to determine that the page task is a preset computing task if the type of the page task is the same as the type of any preset computing task in the configuration information.
In one possible implementation, 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 for determining path information of a target script file corresponding to the page task according to the path information of at least one script file;
And a worker thread starting unit 6022 for calling the target script file according to the path information of the target script file and starting the worker thread.
In one possible implementation, referring to fig. 7, the first page task execution module 603 includes:
a data transfer unit 6031 for transferring the input data of the page task to the first function by calling the first function by the page thread;
the task execution unit 6032 is configured to call a second function through the working thread, receive input data transferred by the page thread, execute a page task based on the input data, and monitor the first function.
In one possible implementation, referring to fig. 7, the apparatus further includes:
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 transfer an execution result to the first function by calling the first function by the worker thread;
the execution result receiving module 608 is configured to call a second function through the page thread, receive an execution result transferred by the work thread, and monitor the first function.
In one possible implementation, referring to fig. 7, the apparatus further includes:
the second page task execution module 609 is configured to execute the page task through the page thread when the page task is not a preset computing task.
In one possible implementation, referring to fig. 7, the apparatus further includes:
the page thread starting module 610 is configured to, when detecting an operation of starting any page in the fast application, start a page thread corresponding to the page in the fast application.
Fig. 8 is a block diagram of a terminal provided in an embodiment of the present disclosure. For example, the terminal 800 may be used to perform the steps performed by the terminal in the page task performing method provided in the above embodiments. Referring to fig. 8, a terminal 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and a 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 component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interactions 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 operations at the terminal 800. Examples of such data include instructions for any application or method operating on the terminal 800, contact data, phonebook data, messages, pictures, videos, and the like. The memory 804 may be implemented by any type or combination of volatile or nonvolatile 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 disk.
The power supply component 806 provides power to the various components of the terminal 800. The 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 the terminal 800.
The multimedia component 808 includes a screen between the terminal 800 and the user that provides an output interface. 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 input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or sliding action, but also the duration and pressure associated with the touch or sliding operation. In some embodiments, the multimedia component 808 includes a front camera and/or a rear 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 focal length and optical zoom capabilities.
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 operation mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 further 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 a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 814 includes one or more sensors for providing status assessment of various aspects of the terminal 800. For example, the sensor assembly 814 may detect an on/off state of the terminal 800, a relative positioning of the assemblies, such as a display and keypad of the terminal 800, the sensor assembly 814 may also detect a change in position of the terminal 800 or one of the assemblies of the terminal 800, the presence or absence of user contact with the terminal 800, an orientation or acceleration/deceleration of the terminal 800, and a change in temperature of the terminal 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects 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 gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate communication between the terminal 800 and other devices, either wired or wireless. The terminal 800 may access a wireless network based on a communication standard, such as WiFi,2G or 3G, or a combination thereof. In one exemplary embodiment, the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short range communications.
In an exemplary embodiment, the terminal 800 can 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, microcontrollers, microprocessors, or other electronic elements for executing the methods described above.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 804 including instructions executable by processor 820 of terminal 800 to perform the above-described method. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
The present disclosure also provides a computer-readable storage medium having at least one instruction stored therein, the instruction being loaded and executed by a processor to implement the operations performed in the page task performing method of the above embodiments.
The disclosed embodiments also provide a computer program having at least one instruction stored therein, the instruction being loaded and executed by a processor to implement the operations performed in the page task performing method of the above embodiments.
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 adaptations, uses, or adaptations of the disclosure following the general 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 is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (12)

1. A method for performing a page task, the method comprising:
when detecting the operation of starting any page in a fast application, starting a page thread corresponding to the page in the fast application, wherein a framework of the fast application is deeply integrated in an operating system, and the framework operates at the operating system level to realize seamless connection with other application services;
creating a page task through the page thread;
the page data of the page comprises script files corresponding to the page-realizable functions and path information of at least one script file, when the page task is a preset calculation task, the script file corresponding to the type of the page task is searched from the at least one script file and used as a target script file, and the path information of the target script file corresponding to the page task is determined;
according to the path information of the target script file, calling the target script file, and 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 the page task by the page thread comprises:
Displaying a page corresponding to the page thread;
and when detecting the operation triggered on the page through the page thread, creating a page task corresponding to the operation.
3. The method according to claim 1, wherein the method further comprises:
calling configuration information, wherein the configuration information comprises various types of preset computing tasks;
and if the type of the page task is the same as the type of any preset computing task in the configuration information, determining that the page task is the preset computing task.
4. The method of claim 1, wherein the 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 transmitting input data of the page task to the first function;
and calling a second function through the working thread, receiving the input data transferred by the page thread, executing the page task based on the input data, and monitoring the first function by the second function.
5. The method according to claim 1, wherein the method further comprises:
Acquiring an execution result of the page task through the working thread;
invoking a first function through the working thread, and transferring the execution result to the first function;
and calling a second function through the page thread, receiving the execution result transferred by the working thread, wherein the second function is used for monitoring the first function.
6. A page task performing device, the device comprising:
the system comprises a page thread starting module, a frame depth integrating module and a page thread processing module, wherein the page thread starting module is used for starting a page thread corresponding to a page in a fast application when detecting the operation of starting any page in the fast application, and the frame depth integrating module is used for performing operation on an operating system layer to realize seamless connection with other application services;
the page task creation module is used for creating a page task through the page thread;
the work thread starting module is used for starting a work thread corresponding to the page task when the page task is a preset calculation task;
the method comprises the steps that page data of a page comprise script files corresponding to functions which can be realized by the page and path information of at least one script file, and a path information determining unit is used for searching script files corresponding to the type of the page task from the at least one script file when the page task is a preset calculation task and determining the path information of the target script file corresponding to the page task as a target script file;
A working thread starting unit, configured to call the target script file according to the path information of the target script file, and start a working thread corresponding to the page task;
and the first page task executing module is used for executing the page task through the working thread in the running process of the page thread.
7. The apparatus of claim 6, 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.
8. The apparatus of claim 6, wherein the apparatus further comprises:
the configuration information calling module is used for calling configuration information, and the configuration information comprises types of a plurality of preset computing 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 the type of any preset computing task in the configuration information.
9. The apparatus of claim 6, 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 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, executing the page task based on the input data, and monitoring the first function through the second function.
10. The apparatus of claim 6, wherein the apparatus further comprises:
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 transferring the execution result to the first function by calling the first function through the working thread;
and the execution result receiving module is used for calling a second function through the page thread, receiving the execution result transmitted by the working thread, and the second function is used for monitoring the first function.
11. A terminal, the terminal comprising:
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 detecting the operation of starting any page in a fast application, starting a page thread corresponding to the page in the fast application;
creating a page task through the page thread;
the page data of the page comprises script files corresponding to the page-realizable functions and path information of at least one script file, when the page task is a preset calculation task, the script file corresponding to the type of the page task is searched from the at least one script file and used as a target script file, and the path information of the target script file corresponding to the page task is determined;
according to the path information of the target script file, calling the target script file, and 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.
12. A computer readable storage medium having stored therein at least one instruction that is loaded and executed by a processor to implement the operations performed in the page task performing method of any of claims 1 to 5.
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 CN111008050A (en) 2020-04-14
CN111008050B true 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)

Families Citing this family (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
CN114077529B (en) * 2022-01-19 2022-06-21 荣耀终端有限公司 Log uploading method and device, electronic equipment and computer readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3079065B1 (en) * 2015-04-08 2019-06-12 Huawei Technologies Co., Ltd. Redo-logging for partitioned in-memory datasets

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Also Published As

Publication number Publication date
CN111008050A (en) 2020-04-14

Similar Documents

Publication Publication Date Title
US11119812B2 (en) Method and device for processing application program page according to a common interface container
CN111026396B (en) Page rendering method and device, electronic equipment and storage medium
US10705780B2 (en) Method, device, and storage medium for displaying application page
CN111026490B (en) Page rendering method and device, electronic equipment and storage medium
CN110990105B (en) Interface display method and device, electronic equipment and storage medium
CN110874217B (en) Interface display method and device for quick application and storage medium
US11706331B2 (en) Information processing method and apparatus, storage medium, and electronic device
CN110990075B (en) Method, device, equipment and storage medium for starting fast application
CN111026491B (en) Interface display method, device, electronic equipment, server and storage medium
US10909203B2 (en) Method and device for improving page display effect via execution, conversion and native layers
US20230004620A1 (en) Page display method
CN111078325B (en) Application program running method and device, electronic equipment and storage medium
CN110851108A (en) Electronic equipment operation method and device, electronic equipment 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
CN111008050B (en) Page task execution method, device, terminal and storage medium
CN111008057A (en) Page display method and device and storage medium
US11210449B2 (en) Page display method and device and storage medium
CN111046265B (en) Card data display method, device, equipment and storage medium
CN110971974B (en) Configuration parameter creating method, device, terminal and storage medium
CN110865864B (en) Interface display method, device and equipment for quick application and storage medium
CN111104183B (en) Application program running method and device, electronic equipment and storage medium
CN110865760A (en) Electronic equipment operation method and device, electronic equipment and storage medium
CN110908629A (en) Electronic equipment operation method and device, electronic equipment and storage medium
CN113486281A (en) Page display 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