CN107766101A - App starts processing method, device and the equipment of event - Google Patents

App starts processing method, device and the equipment of event Download PDF

Info

Publication number
CN107766101A
CN107766101A CN201710938915.0A CN201710938915A CN107766101A CN 107766101 A CN107766101 A CN 107766101A CN 201710938915 A CN201710938915 A CN 201710938915A CN 107766101 A CN107766101 A CN 107766101A
Authority
CN
China
Prior art keywords
event
startup event
file
startup
thread
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
CN201710938915.0A
Other languages
Chinese (zh)
Other versions
CN107766101B (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.)
Wuba Co Ltd
Original Assignee
Wuba 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 Wuba Co Ltd filed Critical Wuba Co Ltd
Priority to CN201710938915.0A priority Critical patent/CN107766101B/en
Publication of CN107766101A publication Critical patent/CN107766101A/en
Application granted granted Critical
Publication of CN107766101B publication Critical patent/CN107766101B/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/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class 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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues

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 present invention provides processing method, device and the equipment that a kind of App starts event, and this method includes:Load the description file of startup event, the description file is the file got when application program App starts from server, the description file is used for the execution sequence for identifying each startup event, according to the execution sequence indicated by the description file, call each startup event, can occur problem on serious line with hedge effectiveness App, moreover, it is more efficient to perform the more conventional method of speed.

Description

App starts processing method, device and the equipment of event
Technical field
The present embodiments relate to the communication technology, more particularly to a kind of App starts the processing method of event, device and set It is standby.
Background technology
With the extensive use of mobile phone, apparatus such as computer, occur various functions application program (Application, App).Each App is required for performing multiple startup events when starting, such as:App may need the startup event performed when starting Including but not limited to following task:(1) advertisement is opened or shields, (2) start location information, (3) initialization App user interfaces (User Interface, UI) framework, (4) initialization data storehouse, (5) APP guide pages, (6) loading third-party software exploitation work Tool bag (Software Development Kit, SDK), the preloading data of certain module in (7) App, (8) push and outer Portion's function is aroused to enter a certain fixed page, and (9) enter homepage ... ..., App can perform it is therein partly or completely Startup event.
At present, all startup events, which are placed in main thread, performs, moreover, writing the execution for starting event in the dust at App ends Sequentially.In App start-up courses, startup event needs in part are offline, for example, App guide pages ability only when App has New function Occurring, and can only be shown at a fixed time in section, the startup event needs offline after having spent the period, or, newly The third party SDK of access is possible to need promptly to remove when gross mistake (bug) or collapse occur for App running environment, Such as unlatching or shielding advertisement also is not whenever all to show, it is necessary to just reach the standard grade under certain conditions.
Performed because all startup events are placed in main thread, execution efficiency is very low, is additionally, since and is write extremely at App ends The execution sequence of the event of startup, in problem on running into some serious lines, easily causes heavy losses.
The content of the invention
The embodiment of the present invention provides processing method, device and the equipment that a kind of App starts event, can effectively refuge open Dynamic event is placed on the execution sequence problem for performing in main thread and being write at App ends and start event in the dust.
In a first aspect, the embodiment of the present invention provides the processing method that a kind of App starts event, including:
The description file of startup event is loaded, the description file is that application program App is got when starting from server File, the description file is used to identify the execution sequence of each startup event;
According to the execution sequence indicated by the description file, each startup event is called.
In an embodiment of the present invention, the mark of the description file including each startup event and corresponding described open The attribute information of dynamic event, the attribute information comprises at least priority and task relies on;
The then execution sequence according to indicated by the description file, calls each startup event, including:
Relied on by the priority and the task, determine the execution sequence of each startup event;
According to the mark of the startup event and the mapping relations of thread task class name, determine that each startup event is corresponding Thread task;
The thread task according to corresponding to the execution sequence of the startup event calls each startup event.
In an embodiment of the present invention, the attribute information also includes thread configured information, and the thread configured information is used In indicating whether the startup event performs in main thread;
The then thread task according to corresponding to the execution sequence of the startup event calls each startup event, bag Include:
Judge whether the first startup event performs in main thread according to the thread configured information;
If so, the first startup event pair is then called in the main thread according to the execution sequence of the startup event The thread task answered;
If it is not, then according to corresponding to the execution sequence of the startup event calls the first startup event in sub-line journey Thread task.
In an embodiment of the present invention, the mark according to the startup event and the mapping of thread task class name are closed System, determines thread task corresponding to each startup event, including:
According to the mark of the startup event and the mapping relations of thread task class name, determine that each startup event is corresponding Thread task class name;
According to the thread task class name from system operation when the example of class that creates of application programming interface API in really Thread task corresponding to fixed each startup event.
In an embodiment of the present invention, the description file of the loading startup event, including:
The description file is parsed, establishes data structure corresponding to the description file;
Wherein, the data structure is array, and the array includes multiple elements, each corresponding startup of the element Event, the element include the mark of the startup event and the attribute information.
In an embodiment of the present invention, before the description file of the loading startup event, methods described also includes:
When the App starts, request message is sent to server, the request message includes first and describes file Version number and the version number of the App, the described first description file for describing file to store in the App;
The response message that the server is sent according to the request message is received, the response message includes the second description File and the described second version number for describing file, described second describes file describes file for the server to described first The description file generated after renewal.
In an embodiment of the present invention, the description file of the loading startup event, including:
Load described first and describe file;
After loading described first describes file success, describe file with described second and replace the first description text Part, so that loading described second during App startups next time describes file.
Second aspect, the embodiment of the present invention provide the processing unit that a kind of App starts event, including:
Load-on module, for loading the description file of startup event, the description file be when application program App starts from The file that server is got, the description file are used for the execution sequence for identifying each startup event;
Calling module, for the execution sequence according to indicated by the description file, call each startup event.
In an embodiment of the present invention, the mark of the description file including each startup event and corresponding described open The attribute information of dynamic event, the attribute information comprises at least priority and task relies on;
Then the calling module is specifically used for relying on by the priority and the task, determines each startup event Execution sequence;According to the mark of the startup event and the mapping relations of thread task class name, each startup event is determined Corresponding thread task;The thread task according to corresponding to the execution sequence of the startup event calls each startup event.
In an embodiment of the present invention, the attribute information also includes thread configured information, and the thread configured information is used In indicating whether the startup event performs in main thread;
Then calling module thread according to corresponding to the execution sequence of the startup event calls each startup event Task, including:
The calling module judges whether the first startup event performs in main thread according to the thread configured information;If It is that then thread is appointed according to corresponding to the execution sequence of the startup event calls the first startup event in the main thread Business;If it is not, the then thread according to corresponding to the execution sequence of the startup event calls the first startup event in sub-line journey Task.
In an embodiment of the present invention, the calling module is according to the mark of the startup event and thread task class name Mapping relations, thread task corresponding to each startup event is determined, including:
The calling module determines each startup according to the mark of the event of startup and the mapping relations of thread task class name Thread task class name corresponding to event;According to the thread task class name from system operation when application programming interface API wound Thread task corresponding to each startup event is determined in the example for the class built.
In an embodiment of the present invention, the loading load-on module is specifically used for parsing the description file, described in foundation Data structure corresponding to file is described;
Wherein, the data structure is array, and the array includes multiple elements, each corresponding startup of the element Event, the element include the mark of the startup event and the attribute information.
In an embodiment of the present invention, described device also includes:
Sending module, for when the App starts, sending request message to server, the request message includes First describes the version number of file and the App version number, the described first description text for describing file to store in the App Part;
Receiving module, the response message sent for receiving the server according to the request message, the response disappear Breath includes second and describes file and described second describing the version number of file, and described second to describe file be the server to institute State the first description file for describing to generate after file renewal.
In an embodiment of the present invention, the load-on module describes file specifically for loading described first;In loading institute State first file success is described after, describe file with described second and replace described first to describe file, so that the App is next Described second is loaded during startup and describes file.
The third aspect, the embodiment of the present invention provide a kind of computer-readable recording medium, the computer-readable storage medium Matter is stored with one or more program, and one or more of programs can be by one or more computing device, with reality App described in existing first aspect any embodiment starts the step in the processing method of event.
Fourth aspect, the embodiment of the present invention provide a kind of terminal device, including:Memory, processor and computer journey Sequence, the processor run method of the computer program execution as described in first aspect any embodiment.
The App that the present embodiment provides starts processing method, device and the equipment of event, and when App starts, terminal loads open The description file of dynamic event, according to the execution sequence indicated by description file, each startup event is called, because App starts every time All load and once describe file, in problem on running into line, description file can be updated by dynamic to change startup event Execution sequence, some losses are avoided, moreover, this in description file can describe the executive process of startup event, can be by part Startup event, which is placed in main thread, to be performed, and part startup event is placed in subprocess and performed, and improves execution efficiency.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are this hairs Some bright embodiments, for those of ordinary skill in the art, without having to pay creative labor, can be with Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 is the application scenarios schematic diagram for the processing method that App provided in an embodiment of the present invention starts event;
Fig. 2 is the flow chart for the processing method that a kind of App that one embodiment of the invention provides starts event;
Fig. 3 is the flow chart for the processing method that a kind of App that another embodiment of the present invention provides starts event;
Fig. 4 is the flow chart for the processing method that a kind of App that another embodiment of the present invention provides starts event;
Fig. 5 is the flow chart for the processing method that a kind of App that another embodiment of the present invention provides starts event;
Fig. 6 is the flow chart for the processing method that a kind of App that another embodiment of the present invention provides starts event;
Fig. 7 is the block diagram for the processing unit that a kind of App that one embodiment of the invention provides starts event;
Fig. 8 is the block diagram for the processing unit that a kind of App that another embodiment of the present invention provides starts event;
Fig. 9 is a kind of block diagram for terminal device that one embodiment of the invention provides.
Embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is Part of the embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art The every other embodiment obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.
First to the present embodiments relate to some nouns explain:
Startup event:Event to be processed is needed when starting App by various interfaces, such as, advertisement is opened or shielded, is started Location information, initialization data storehouse, App UI frameworks are initialized, push (push) and outside is aroused, guiding evaluation etc.. In the present invention, startup event is one-to-one with the thread task hereinafter spoken of.
NSOpreration:Be Apple Inc. provide a set of multithreading solution, can be provided for subclass it is useful and Thread-safe establishes the operations such as state, priority, task dependence and cancellation.NSOperation is an abstract base class, table Show an independent computing unit.In the present invention, the independent task started by NSOperation subclass to App is carried out Encapsulation.
Task relies on:Refer in multithreading operation, execution the holding dependent on other thread tasks of a thread task Row result.In the present invention, the program processing that task relies on can be by the addDependency that is encapsulated in NSOperation Method is realized.Such as [operationA addDependency:OperationB] represent that operationA is depended on operationB.Wherein operationA and operationB is NSOperation instance objects.
Priority:Priority (priority) be computer time sharing system when handling multiple operation procedures, determine Each operation procedure receives the parameter of the priority level of system resource.In the present invention, priority refers to that thread performs preferential Grade.The difference that priority relies on task is that priority is not required to rely on, and the thread task of high priority can be low Performed after the thread task of priority, and mistake will not be produced.And it is a kind of necessary relation that task, which relies on, if the thread is appointed Business performs before the thread tasks carrying relied on, will produce mistake.
NSOperationQueue:It is the API for the simplification threading operation that Apple Inc. provides.Can be NSOperationQueue regards a thread pool as, can be toward addition operation (NSOperation) in thread pool into queue.Thread Thread in pond can regard consumer as, take operation away from queue, and perform it.NSOperationQueue points are concurrent queue And tandem queue.
Fig. 1 is the application scenarios schematic diagram for the processing method that App provided in an embodiment of the present invention starts event, such as Fig. 1 institutes To show, the scene includes terminal device, server 1 and server 2, wherein, terminal device includes App1 and App2, App1 by servicing Device 1 provides information on services, and App2 provides information on services by server 2.Need to call multiple startup events when App starts, when When App starts every time, terminal device all can be that the App obtains newest description file from server, so as to dynamic configuration App starts the execution sequence of event.It should be noted that terminal device can also include more difference in functionalitys in the scene The corresponding server of App, each App, different App can correspond to different servers, it is also possible to which different App is corresponding Identical server, it is not any limitation as in of the invention.
Fig. 2 is the flow chart for the processing method that a kind of App that one embodiment of the invention provides starts event.This method is held Row main body is terminal device, and the terminal device can be mobile phone, computer, ipad, intelligent TV set, game machine etc..Such as Fig. 2 institutes Show, this method may comprise steps of:
Step 101, the description file for loading startup event, description file are the text got when App starts from server Part, description file are used for the execution sequence for identifying each startup event.
In the present embodiment, server can be in advance each one description file of App dynamic configurations, and this describes file and existed It is a built in meeting when App packs, and, this describes file can enter Mobile state renewal by access server interface, and App is each During startup, terminal can first load description file corresponding to the App, when this describes file can be that App is last starts terminal from Terminal is real from server when what server was got is stored in description file or the App this time startups in local cache When the description file that gets.
Wherein, describe that the attribute informations of multiple startup events corresponding to App can be included in file, the attribute information can be with To start the priority of event, task relies on, whether needs the information such as the instruction, the execution sequence that are performed in main thread.
Step 102, the execution sequence according to indicated by description file, call each startup event.
In the present embodiment, terminal loads this file is described after, each event of starting is determined according to description file Execution sequence, and according to the execution sequence successively or parallel calling start event.
Such as:The startup event that App may need to perform when starting includes but is not limited to following task:(1) open or shield Advertisement is covered, (2) start location information, (3) initialization App user interfaces (User Interface, UI) framework, (4) initialization Database, (5) APP guide pages, (6) loading third-party software development kit (Software Development Kit, SDK), in (7) App certain module preloading data, (8) push and external function arouse with enter a certain fixed page, (9) homepage is entered.It can know according in description file, in the above-mentioned startup event enumerated, some startup events need Main thread performs, such as:Startup event (1), (3), (5), (8), (9) need to perform in main thread, then terminal is in main thread Call startup event (1), (3), (5), (8), (9);What is had need not perform in main thread, can be performed in sub-line journey, such as, Startup event (2), (4), (6), (7) can perform in sub-line journey, then terminal calls startup event in corresponding sub-line journey (2)、(4)、(6)、(7).In the startup event that main thread performs, phase can also be set to each event that starts according to business scenario The priority orders answered, such as, open or shielding advertisement must perform before App UI frameworks are initialized, then start event (1) priority is higher than the priority of startup event (3).In addition, sub-line journey can also be relied on by starting the execution of event in main thread The implementing result of middle startup event, such as:Startup event (9) is necessarily dependent upon the implementing results of startup event (4) and (7) to hold OK, these execution sequences can be known from description file.
The App that the present embodiment provides starts the processing method of event, and when App starts, terminal loads start retouching for event File is stated, according to the execution sequence indicated by description file, each startup event is called, is all loaded once because App starts every time File is described, in problem on running into line, description file can be updated to change the execution sequence of startup event by dynamic, kept away Exempt from some losses, moreover, this in description file can describe the executive process of startup event, part startup event can be placed on Performed in main thread, part startup event is placed in subprocess and performed, improve execution efficiency.
Fig. 3 is the flow chart for the processing method that a kind of App that another embodiment of the present invention provides starts event, in Fig. 2 institutes On the basis of showing embodiment, as shown in figure 3, step 102 " according to the execution sequence indicated by description file, calls each startup thing The implementation method of part " may comprise steps of:
Step 201, relied on by priority and task, determine the execution sequence of each startup event.
Wherein, describing file includes the mark of each startup event and the attribute information of corresponding startup event, attribute information Relied on including at least priority and task.
In the present embodiment, each start event is identified as unique mark, and each attribute information for starting event is at least Relied on including priority and task.
Wherein, can be according to the protocol version before iOS8.0 systems and the association after iOS8.0 systems during setting priority View version situation is handled, for example, the protocol version after the protocol version and iOS8.0 systems before iOS8.0 systems Partial Variable sets as follows:
Protocol version before the systems of iOS 8.0:
NSOperationQueuePriorityVeryLow=-8L,
NSOperationQueuePriorityLow=-4L,
NSOperationQueuePriorityNormal=0,
NSOperationQueuePriorityHigh=4,
NSOperationQueuePriorityVeryHigh=8
The systems of iOS 8.0 and later protocol version, by setting service quality to substitute, including:
NSQualityOfServiceUserInteractive=0x21,
NSQualityOfServiceUserInitiated=0x19,
NSQualityOfServiceUtility=0x11,
NSQualityOfServiceBackground=0x09,
NSQualityOfServiceDefault=-1
Wherein, wherein, setting task need to be in the AllocatedTaskDict corresponding to the thread task created when relying on In searched, if find first thread task dependence thread task, by addDependency be first thread appoint Setting task of being engaged in relies on.For example, in the sample of description file,<string></string>Represent that the startup event is not appointed Business relies on,<string>task1</string>Represent the startup event dependent in thread task task1.
For example, description file can be described in the form of code, it is specific as follows:
Code is the description file sample for the attribute information for including startup event above, is with existing for document form. When App starts, application program can first load this and describe file, and data structure corresponding to establishing in internal memory is for follow-up journey Sequence is called.
Need to stress, to mitigate the complexity that terminal device handles event, server end is in generation description text Before the startup event that no task relies on can be placed on when part, the startup event for having task to rely on is put behind, That is, the startup event that no task relies on can be arranged into relatively low priority, the startup event for having task to rely on is set Higher priority is set to, sets task to rely on the complexity that can effectively reduce processing so when terminal device travels through.
Step 202, mark and the mapping relations of thread task class name according to the event of startup, determine that each startup event is corresponding Thread task.
In the present embodiment, a concurrent tasks queue can be established according to the execution sequence of the event of startup, according to startup The mark of event determines the thread task of startup event with the mapping relations of thread task class name, and thread task is added and concurrently appointed It is engaged in queue.For example, in iOS operating systems, this concurrent tasks queue is a NSOperationQueue object.Newly-built one Individual dictionary AllocatedTaskDict, stores the thread task created in the form of key-value, and key is startup event Mark, value is thread task, i.e. NSOperation examples.
In another example in iOS operating systems, each starts the subclass that event corresponds to a NSOperation.Terminal Equipment can utilize a dictionary data structure (TaskMappingDict) to store mark and the corresponding line that each starts event The mapping relations of journey task class name.The App of terminal device operationally (runtime), the description that can be issued according to server The mark for starting event in file finds corresponding thread task class name, and pair of corresponding class is instantiated according to thread task class name As.
Step 203, the thread task according to corresponding to the execution sequence of the event of startup calls each startup event.
In the present embodiment, due to each thread task in concurrent tasks queue set can priority, task rely on Attribute, terminal device can be according to the attribute of each startup event come the automatic thread task that call in concurrent tasks queue.
For example, in iOS operating systems, can be incited somebody to action by the addOperation methods for performing NSOperationQueue Thread task is added in concurrent tasks queue.NSOperation is once added into NSOperationQueue, corresponding Thread task will be performed automatically and immediately.
The App that the present embodiment provides starts the processing method of event, by describing the preferential of each startup event in file Level and task rely on, and determine the execution sequence of each startup event, according to the mark of the event of startup and the mapping of thread task class name Relation, thread task corresponding to each startup event is determined, according to corresponding to the execution sequence of the event of startup calls each startup event Thread task.The priority for describing to describe each startup event in file and task rely on, terminal can according to priority and Task relies on the execution sequence for determining each startup event, calls startup event so as to more rational in order, improves Consumer's Experience.
Fig. 4 is the flow chart for the processing method that a kind of App that another embodiment of the present invention provides starts event.In Fig. 3 institutes On the basis of showing embodiment, as shown in figure 4, step 203 is " according to corresponding to the execution sequence of the event of startup calls each startup event The implementation of thread task " may comprise steps of:
Step 301, according to thread configured information judge whether the first startup event performs in main thread, if so, then holding Row step 302;If it is not, then perform step 303.
In the present embodiment, attribute information also includes thread configured information, and thread configured information is used to indicate startup event Whether performed in main thread.
In the present embodiment, determined according to the instruction for whether needing to perform in main thread again described in description file every Whether the thread task of individual startup event is performed by main thread, for example, in the sample of foregoing description file,<true/>// True represents that the startup event needs to perform in main thread, then when performing the startup event, by corresponding thread task point Dispensing main thread performs;<false/>//false represents to perform in main thread, then is performing the startup event When, corresponding thread task is distributed into sub-line journey to perform.
Step 302, thread is appointed according to corresponding to the execution sequence of the event of startup calls the first startup event in main thread Business.
In the present embodiment, if determining that the first startup event performs in main thread according to description file, according to startup The execution sequence of event calls thread task corresponding to the first startup event in main thread.
Step 303, thread is appointed according to corresponding to the execution sequence of the event of startup calls the first startup event in sub-line journey Business.
In the present embodiment, if determining that the first startup event is performed in main thread according to description file, basis The execution sequence of startup event calls thread task corresponding to the first startup event in corresponding sub-line journey.
The App that the present embodiment provides starts the processing method of event, judges the first startup event according to thread configured information Whether performed in main thread, if so, then calling the first startup event pair in main thread according to the execution sequence of the event of startup The thread task answered;If it is not, then according to start event execution sequence the first startup event is called in sub-line journey corresponding to line Journey task so that multiple startup events can perform parallel in main thread and sub-line journey, improve execution efficiency.
Fig. 5 is the flow chart for the processing method that a kind of App that another embodiment of the present invention provides starts event.In Fig. 3 or On the basis of embodiment illustrated in fig. 4, as shown in figure 5, step 202 is " according to the startup mark of event and reflecting for thread task class name Penetrate relation, determine thread task corresponding to each startup event " implementation may comprise steps of:
Step 401, mark and the mapping relations of thread task class name according to the event of startup, determine that each startup event is corresponding Thread task class name.
In the present embodiment, the mark of startup event and the mapping relations of thread task class name can be pre-created, for example, will The mapping relations are stored as TaskMappingDict form, can be according to the mark of the event of startup in TaskMappingDict In find corresponding to thread task class name.
Step 402, according to thread task class name from system operation when application programming interface (Application Programming Interface, API) create class example in determine thread task corresponding to each startup event.
In the present embodiment, the thread task according to corresponding to the mark of the event of startup is found in TaskMappingDict Class name, and calling system provide operation when API create corresponding to class example, the example is thread corresponding to startup event Task, App all startup events are traveled through, determine a thread task for each startup event, and add In AllocatedTaskArray arrays.
The App that the present embodiment provides starts the processing method of event, according to the mark of the event of startup and thread task class name Mapping relations, determine thread task class name corresponding to each startup event, according to thread task class name from system operation when AP create Thread task corresponding to each startup event is determined in the example for the class built, can quickly and easily determine each startup event Thread task, App is accelerated to start.
Alternatively, on the basis of any of the above-described embodiment, step 101 " the description file of loading startup event " includes: Parsing description file, establishes data structure corresponding to description file;Wherein, data structure is array, and array includes multiple elements, Each corresponding startup event of element, element include the mark and attribute information of startup event.
In the present embodiment, App loads the description document analysis of the event of startup into after internal memory, can be with corresponding in internal memory Data structure storage.The outermost layer of data structure is an array (TaskArray), and each element in array is a word Allusion quotation (TaskInfoDict), each element are Map types, that is, element corresponds with starting event;Element pair in dictionary Answering each to start, whether attribute information of event includes priority, task relies on and need to perform in main thread.The data Structure is advantageous to convenient management description file, contribute to rapidly and efficiently establish concurrent tasks queue.
Fig. 6 is the flow chart for the processing method that a kind of App that another embodiment of the present invention provides starts event.In above-mentioned reality On the basis of applying example, as shown in fig. 6, before step 101 " the description file of loading startup event ", this method can also include following Step:
Step 501, when App starts, send request message to server, request message includes first and describe file Version number and App version number, the first description file for describing file to store in App.
In the present embodiment, when App starts, terminal device asks the description file of App startup events to server. Terminal device send request message in need carry parameter be:First describes the version number of file, App version number.First Description file is the description file preserved in local cache corresponding to App, and App version number refers to the APP using shop Version number, App version number may correspond to the version numbers of multiple description files, that is, App version does not update When, description file can update.
The response message that step 502, the reception server are sent according to request message, response message describe file including second The description text that file describes to generate after file renewal for server to first is described with the second version number for describing file, second Part.
In the present embodiment, when server receives request message, the version number that describes file by request message first Contrasted with the second version number for describing file in being cached in server, if the second version number for describing file is more than first The version number of file is described, then explanation description file has updated, and server describes file and right by generated after renewal second The version number answered feeds back to terminal device.
Wherein, it is related to the data of description file that the version number of file is described, if the data content renewal in description file, Then corresponding version number must also update.
The App that the present embodiment provides starts the processing method of event, and when App starts, request message is sent to server, The response message for including the description file after renewal that the reception server is sent according to request message, can dynamically update description text Part so that App starts reaching the standard grade for event and do not controlled with offline by released version, and App can be avoided to occur asking on serious line Topic, it ensure that the safety and reliability that App starts.
Alternatively, in the present embodiment, as shown in fig. 6, the realization side of step 101 " the description file of loading startup event " Formula may comprise steps of:
Step 503, loading first describe file.
Step 504, after loading first describes file success, describe file with second and replace first to describe file, with Loading second during App startups next time is set to describe file.
In the present embodiment, App can preferentially load the first of startup event built-in in local cache and describe file, newly more Second describe file and first can be stored in App, and the first description that file replaces early version is described using the second of renewal File, next App startups reload second and describe file, it is possible to prevente effectively from obstruction App startup, improves App and start speed Degree.
Fig. 7 is the block diagram for the processing unit that a kind of App that one embodiment of the invention provides starts event, as shown in figure 5, should Device includes:
Load-on module 11 is used for the description file for loading startup event, and description file is from clothes when application program App starts The file that business device is got, description file are used for the execution sequence for identifying each startup event;
Calling module 12 is used for the execution sequence according to indicated by description file, calls each startup event.
The device of the present embodiment, it can be used for the technical scheme for performing embodiment of the method shown in Fig. 2, its realization principle and skill Art effect is similar, and here is omitted.
Alternatively, on the basis of embodiment illustrated in fig. 7, the mark of description file including each startup event and corresponding open The attribute information of dynamic event, attribute information comprises at least priority and task relies on;Calling module 12 is specifically used for by preferential Level and task rely on, and determine the execution sequence of each startup event;According to the mark of the event of startup and the mapping of thread task class name Relation, determine thread task corresponding to each startup event;According to corresponding to the execution sequence of the event of startup calls each startup event Thread task.
The device of the present embodiment, it can be used for the technical scheme for performing embodiment of the method shown in Fig. 3, its realization principle and skill Art effect is similar, and here is omitted.
Alternatively, attribute information also includes thread configured information, thread configured information be used to indicating startup event whether Performed in main thread;The then thread task according to corresponding to the execution sequence of the event of startup calls each startup event of calling module 12, Including:
Calling module 12 judges whether the first startup event performs in main thread according to thread configured information;If so, then The thread task according to corresponding to the execution sequence of the event of startup calls the first startup event in main thread;If it is not, then basis opens The execution sequence of dynamic event calls thread task corresponding to the first startup event in sub-line journey.
The device of the present embodiment, it can be used for the technical scheme for performing embodiment of the method shown in Fig. 4, its realization principle and skill Art effect is similar, and here is omitted.
Alternatively, calling module 12 is according to the mark of the event of startup and the mapping relations of thread task class name, it is determined that respectively opening Thread task corresponding to dynamic event, including:
Calling module 12 determines each startup event pair according to the mark of the event of startup and the mapping relations of thread task class name The thread task class name answered;According to thread task class name from system operation when the examples of class that create of API in determine each start Thread task corresponding to event.
The device of the present embodiment, it can be used for the technical scheme for performing embodiment of the method shown in Fig. 5, its realization principle and skill Art effect is similar, and here is omitted.
Alternatively, load-on module 11 is specifically used for parsing description file, establishes data structure corresponding to description file;Its In, data structure is array, and array includes multiple elements, the corresponding startup event of each element, and element includes startup event Mark and attribute information.
Fig. 8 is the block diagram for the processing unit that a kind of App that another embodiment of the present invention provides starts event, as shown in figure 8, The device also includes:
Sending module 13 is used for when App starts, and sends request message to server, request message includes the first description The version number of file and App version number, the first description file for describing file to store in App;
Receiving module 14 is used for the response message that the reception server is sent according to request message, and response message is retouched including second State file and second and describe the version number of file, second describes file retouches for what server described to generate after file updates to first State file.
Alternatively, load-on module 11 describes file specifically for loading first;And file success is described in loading first Afterwards, describe file replacement first with second and describe file, so that loading second describes file during App startups next time.
The device of the present embodiment, it can be used for the technical scheme for performing embodiment of the method shown in Fig. 6, its realization principle and skill Art effect is similar, and here is omitted.
The embodiment of the present invention also provides a kind of computer-readable recording medium, and the computer-readable recording medium storage has One or more program, one or more of programs can be by one or more computing devices, to realize Fig. 2-Fig. 6 App described in any embodiment starts the step in the processing method of event.
Fig. 9 is a kind of block diagram for terminal device that one embodiment of the invention provides, as shown in figure 9, the terminal device includes Memory 21, processor 22 and computer program 23, it is any that the processor operation computer program performs Fig. 2-Fig. 6 Step in the acquisition methods of data message described in embodiment.
In terminal in the specific implementation, it should be understood that processor can be CPU (Central Processing Unit, CPU), can also be other general processors, digital signal processor (Digital Signal Processor, DSP), application specific integrated circuit (Application Specific Integrated Circuit, ASIC) etc..General processor Can be microprocessor or the processor can also be any conventional processor etc..With reference to the method disclosed in the present Step can be embodied directly in hardware processor and perform completion, or performed with the hardware in processor and software module combination Into.
One of ordinary skill in the art will appreciate that:Realizing all or part of step of above-mentioned each method embodiment can lead to The related hardware of programmed instruction is crossed to complete.Foregoing program can be stored in a computer read/write memory medium.The journey Sequence upon execution, execution the step of including above-mentioned each method embodiment;And foregoing storage medium includes:Read-only storage (Read-Only Memory, abbreviation ROM), random access memory (random access memory, abbreviation RAM), magnetic disc Or CD etc. is various can be with the medium of store program codes.
Finally it should be noted that:Various embodiments above is merely illustrative of the technical solution of the present invention, rather than its limitations;To the greatest extent The present invention is described in detail with reference to foregoing embodiments for pipe, it will be understood by those within the art that:Its according to The technical scheme described in foregoing embodiments can so be modified, either which part or all technical characteristic are entered Row equivalent substitution;And these modifications or replacement, the essence of appropriate technical solution is departed from various embodiments of the present invention technology The scope of scheme.

Claims (10)

1. a kind of App starts the processing method of event, it is characterised in that including:
The description file of startup event is loaded, the description file is the text got when application program App starts from server Part, the description file are used for the execution sequence for identifying each startup event;
According to the execution sequence indicated by the description file, each startup event is called.
2. according to the method described in the claim 1, it is characterised in that the description file includes each startup event The attribute information of mark and the corresponding startup event, the attribute information comprises at least priority and task relies on;
The then execution sequence according to indicated by the description file, calls each startup event, including:
Relied on by the priority and the task, determine the execution sequence of each startup event;
According to the mark of the startup event and the mapping relations of thread task class name, line corresponding to each startup event is determined Journey task;
The thread task according to corresponding to the execution sequence of the startup event calls each startup event.
3. according to the method for claim 2, it is characterised in that the attribute information also includes thread configured information, described Thread configured information is used to indicate whether the startup event performs in main thread;
The then thread task according to corresponding to the execution sequence of the startup event calls each startup event, including:
Judge whether the first startup event performs in main thread according to the thread configured information;
If so, then according to corresponding to the execution sequence of the startup event calls the first startup event in the main thread Thread task;
If it is not, the then thread according to corresponding to the execution sequence of the startup event calls the first startup event in sub-line journey Task.
4. according to the method in claim 2 or 3, it is characterised in that the mark and thread according to the startup event The mapping relations of task class name, thread task corresponding to each startup event is determined, including:
According to the mark of the startup event and the mapping relations of thread task class name, line corresponding to each startup event is determined Journey task class name;
According to the thread task class name from system operation when the example of class that creates of application programming interface API in determine it is every Thread task corresponding to the individual startup event.
5. according to the method described in claim any one of 1-3, it is characterised in that the description file of the loading startup event, Including:
The description file is parsed, establishes data structure corresponding to the description file;
Wherein, the data structure is array, and the array includes multiple elements, each corresponding startup thing of the element Part, the element include the mark of the startup event and the attribute information.
6. according to the method described in claim any one of 1-3, it is characterised in that it is described loading startup event description file it Before, methods described also includes:
When the App starts, request message is sent to server, the request message includes the first version for describing file Number and the App version number, the described first description file for describing file to store in the App;
The response message that the server is sent according to the request message is received, the response message describes file including second With the described second version number for describing file, described second describes file describes file renewal to described first for the server The description file generated afterwards.
7. according to the method for claim 6, it is characterised in that the description file of the loading startup event, including:
Load described first and describe file;
After loading described first describes file success, describe file replacement described first with described second and describe file, with Described second, which is loaded, when starting the App next times describes file.
8. a kind of App starts the processing unit of event, it is characterised in that including:
Load-on module, for loading the description file of startup event, the description file is from service when application program App starts The file that device is got, the description file are used for the execution sequence for identifying each startup event;
Calling module, for the execution sequence according to indicated by the description file, call each startup event.
A kind of 9. computer-readable recording medium, it is characterised in that the computer-readable recording medium storage have one or Multiple programs, one or more of programs can be by one or more computing devices, to realize in claim 1~7 App described in any one starts the step in the processing method of event.
A kind of 10. terminal device, it is characterised in that including:Memory, processor and computer program, the processor fortune The row computer program performs the method as described in claim any one of 1-7.
CN201710938915.0A 2017-09-30 2017-09-30 Method, device and equipment for processing App starting event Active CN107766101B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710938915.0A CN107766101B (en) 2017-09-30 2017-09-30 Method, device and equipment for processing App starting event

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710938915.0A CN107766101B (en) 2017-09-30 2017-09-30 Method, device and equipment for processing App starting event

Publications (2)

Publication Number Publication Date
CN107766101A true CN107766101A (en) 2018-03-06
CN107766101B CN107766101B (en) 2021-02-19

Family

ID=61268016

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710938915.0A Active CN107766101B (en) 2017-09-30 2017-09-30 Method, device and equipment for processing App starting event

Country Status (1)

Country Link
CN (1) CN107766101B (en)

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109522128A (en) * 2018-11-21 2019-03-26 北京像素软件科技股份有限公司 Segmented multithreading task executing method and device
CN109783158A (en) * 2019-01-14 2019-05-21 深圳市脸萌科技有限公司 Using starting task processing method and device
CN110262847A (en) * 2019-05-14 2019-09-20 百度(中国)有限公司 Application program launching accelerated method, device and machine readable storage medium
CN110377408A (en) * 2019-07-02 2019-10-25 上海上湖信息技术有限公司 A kind of starting method, apparatus, terminal and the medium of application program
CN110531985A (en) * 2019-08-09 2019-12-03 浙江大搜车软件技术有限公司 SDK initial method and system, electronic equipment, storage medium
CN111190654A (en) * 2019-12-30 2020-05-22 网易(杭州)网络有限公司 Loading method and device of functional module, storage medium and electronic device
CN111198725A (en) * 2019-12-30 2020-05-26 掌阅科技股份有限公司 Application starting processing method, computing equipment and computer storage medium
CN111857865A (en) * 2020-06-28 2020-10-30 珠海豹趣科技有限公司 Event type task processing method and device, electronic equipment and storage medium
CN112748961A (en) * 2019-10-30 2021-05-04 腾讯科技(深圳)有限公司 Method and device for executing starting task
CN112988281A (en) * 2021-04-25 2021-06-18 浙江口碑网络技术有限公司 Application starting method and device
CN113326082A (en) * 2021-07-30 2021-08-31 北京达佳互联信息技术有限公司 Application program starting method, electronic equipment and storage medium
CN114327685A (en) * 2022-01-04 2022-04-12 北京百度网讯科技有限公司 Method and device for optimizing running speed of small program
CN114745272A (en) * 2020-12-23 2022-07-12 武汉斗鱼网络科技有限公司 Method, server, medium, and apparatus for increasing application start speed
CN115080151A (en) * 2022-07-22 2022-09-20 平安银行股份有限公司 APP starting process control method, computer readable storage medium and terminal
CN115658185A (en) * 2022-12-29 2023-01-31 北京海誉动想科技股份有限公司 Method and device for quickly starting cloud application, storage medium and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101296199A (en) * 2008-06-27 2008-10-29 腾讯科技(深圳)有限公司 Method for instant communication tool scheduling task, and instant communication tool
CN105701113A (en) * 2014-11-27 2016-06-22 国际商业机器公司 Method and device for optimizing webpage pre-loading
CN105912455A (en) * 2016-04-27 2016-08-31 努比亚技术有限公司 Business execution method and server
CN106339312A (en) * 2015-07-17 2017-01-18 腾讯科技(深圳)有限公司 API (application programming interface) testing method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101296199A (en) * 2008-06-27 2008-10-29 腾讯科技(深圳)有限公司 Method for instant communication tool scheduling task, and instant communication tool
CN105701113A (en) * 2014-11-27 2016-06-22 国际商业机器公司 Method and device for optimizing webpage pre-loading
CN106339312A (en) * 2015-07-17 2017-01-18 腾讯科技(深圳)有限公司 API (application programming interface) testing method and system
CN105912455A (en) * 2016-04-27 2016-08-31 努比亚技术有限公司 Business execution method and server

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109522128B (en) * 2018-11-21 2020-11-13 北京像素软件科技股份有限公司 Segmented multithreading task execution method and device
CN109522128A (en) * 2018-11-21 2019-03-26 北京像素软件科技股份有限公司 Segmented multithreading task executing method and device
CN109783158A (en) * 2019-01-14 2019-05-21 深圳市脸萌科技有限公司 Using starting task processing method and device
CN110262847A (en) * 2019-05-14 2019-09-20 百度(中国)有限公司 Application program launching accelerated method, device and machine readable storage medium
CN110377408A (en) * 2019-07-02 2019-10-25 上海上湖信息技术有限公司 A kind of starting method, apparatus, terminal and the medium of application program
CN110377408B (en) * 2019-07-02 2022-04-12 上海上湖信息技术有限公司 Application program starting method, device, terminal and medium
CN110531985A (en) * 2019-08-09 2019-12-03 浙江大搜车软件技术有限公司 SDK initial method and system, electronic equipment, storage medium
CN112748961A (en) * 2019-10-30 2021-05-04 腾讯科技(深圳)有限公司 Method and device for executing starting task
CN111198725A (en) * 2019-12-30 2020-05-26 掌阅科技股份有限公司 Application starting processing method, computing equipment and computer storage medium
CN111198725B (en) * 2019-12-30 2023-02-28 掌阅科技股份有限公司 Application starting processing method, computing equipment and computer storage medium
CN111190654A (en) * 2019-12-30 2020-05-22 网易(杭州)网络有限公司 Loading method and device of functional module, storage medium and electronic device
CN111857865A (en) * 2020-06-28 2020-10-30 珠海豹趣科技有限公司 Event type task processing method and device, electronic equipment and storage medium
CN114745272A (en) * 2020-12-23 2022-07-12 武汉斗鱼网络科技有限公司 Method, server, medium, and apparatus for increasing application start speed
CN114745272B (en) * 2020-12-23 2023-09-15 武汉斗鱼网络科技有限公司 Method, server, medium and device for improving starting speed of application program
CN112988281A (en) * 2021-04-25 2021-06-18 浙江口碑网络技术有限公司 Application starting method and device
CN113326082A (en) * 2021-07-30 2021-08-31 北京达佳互联信息技术有限公司 Application program starting method, electronic equipment and storage medium
CN114327685A (en) * 2022-01-04 2022-04-12 北京百度网讯科技有限公司 Method and device for optimizing running speed of small program
CN114327685B (en) * 2022-01-04 2023-08-11 北京百度网讯科技有限公司 Method and device for optimizing running speed of applet
CN115080151A (en) * 2022-07-22 2022-09-20 平安银行股份有限公司 APP starting process control method, computer readable storage medium and terminal
CN115658185A (en) * 2022-12-29 2023-01-31 北京海誉动想科技股份有限公司 Method and device for quickly starting cloud application, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN107766101B (en) 2021-02-19

Similar Documents

Publication Publication Date Title
CN107766101A (en) App starts processing method, device and the equipment of event
US8122292B2 (en) Debugging of business flows deployed in production servers
US8065659B1 (en) Method and apparatus for executing scripts within a web browser
US20020144003A1 (en) Inter-thread communications between different components using double buffer
CN109951547B (en) Transaction request parallel processing method, device, equipment and medium
CN111221521B (en) Method, device, computer system and readable storage medium for generating log code
KR20110063313A (en) Automated merger of logically associated messages in a message queue
CN109558323A (en) For debugging system, the method and apparatus of the page
CN114553960A (en) Data caching method, device, equipment and storage medium
CN110457132B (en) Method and device for creating functional object and terminal equipment
CN109343862A (en) The dispatching method and device of the resource data of application
CN110704131B (en) Method and device for calling native application by HTML5 application
CN105847319A (en) Mobile terminal network request method and system
CN113448570A (en) Data processing method and device, electronic equipment and storage medium
CN110858238B (en) Data processing method and device
CN107092556A (en) Method of testing, device and equipment
CN113127335A (en) System testing method and device
US10171623B1 (en) Identifying application preemptive requests
CN111338775B (en) Method and equipment for executing timing task
CN111488286B (en) Method and device for independently developing Android modules
JP2021163475A (en) Log-based mashup code generation
US8321844B2 (en) Providing registration of a communication
CN109933459A (en) A kind of execution method and apparatus of multitask
US10303531B2 (en) Console application through web service
CN113238915B (en) Processing method, device, equipment, storage medium and program for calling information

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