CN104715056B - A kind of method and apparatus using Lifetime of Web Pages optimization application - Google Patents

A kind of method and apparatus using Lifetime of Web Pages optimization application Download PDF

Info

Publication number
CN104715056B
CN104715056B CN201510146183.2A CN201510146183A CN104715056B CN 104715056 B CN104715056 B CN 104715056B CN 201510146183 A CN201510146183 A CN 201510146183A CN 104715056 B CN104715056 B CN 104715056B
Authority
CN
China
Prior art keywords
state machine
frame
mapping table
life cycle
cycle information
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
CN201510146183.2A
Other languages
Chinese (zh)
Other versions
CN104715056A (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 Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing 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 Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201510146183.2A priority Critical patent/CN104715056B/en
Priority claimed from CN201210093711.9A external-priority patent/CN102662668B/en
Publication of CN104715056A publication Critical patent/CN104715056A/en
Application granted granted Critical
Publication of CN104715056B publication Critical patent/CN104715056B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/986Document structures and storage, e.g. HTML extensions

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

This application provides a kind of method and apparatus using Lifetime of Web Pages optimization application, to solve the problems, such as in the prior art because development cost caused by identification needs to handle for numerous event codes when controlling Lifetime of Web Pages is high.The described method includes: obtaining the frame object of current web page according to the current event of browser control part object;Obtain the state machine object of the frame object;Based on the state machine object, the life cycle information of current web page is recorded;Each application obtains the life cycle information of corresponding web page according to self-demand;And based on acquired life cycle information, corresponding optimization operation is executed.The application is by for each frame object creation state machine in browser window and recording the state change in Lifetime of Web Pages, thus record and obtain the life cycle information of webpage with can be convenient, and improve performance optimization for the web-based life cycle information of application program and provide guarantee, effectively reduce development cost.

Description

A kind of method and apparatus using Lifetime of Web Pages optimization application
Technical field
This application involves web data processing technology fields, utilize Lifetime of Web Pages optimization application more particularly to a kind of Method and apparatus.
Background technique
Component technology is one of most important software development technique of current computer industry.Traditionally, an application program It is made of single binary file, but such application program is not convenient to use very much, because if to change application Certain partial function of program, which just needs to recompilate entire application program the new version of generation, to be used.Then, exploit person Member starts for single application program to be separated into independent multiple independent sectors, and each independent sector is relatively small executable journey Sequence that is to say component.Component can also provide clothes other than itself is executable for application program, operating system or other programs Business.
The Component Object Model (Component Oject Model, COM) is a kind of developer component that Microsoft proposes Method.Under com component framework, com component is usually issued in a manner of dynamic link library (DLL) or executable file (EXE) For executable code, people can develop various function-specific components, and then by them, group is closed as required Come, constitutes complicated application system.
Browser control part (WebBrowser) is a kind of control based on COM.It can be using WebBrowser control Webpage is carried in Windows window application and supports other documents of browser, and provides web browsing for application program Function.
WebBrowser control includes that a variety of can be used to realize control in browser (Internet Explorer) Attribute, method and event.WebBrowser is interacted by event and external application.Event is touched by WebBrowser Hair, external application execute different logical process according to different events.
WebBrowser often has with event following:
BeforeNavigate2: event before navigating, the event occur before navigation, and the event is not in refresh page Shi Fasheng.
NavigateComplete2: navigation completion event, when entire navigation is completed.
DownloadBegin: downloading beginning event, when a download items start, this event is also when refreshing Occur.
DownloadComplete: downloading completion event, when entire download items are completed, which is also occurred in When completing refresh page.
Although WebBrowser provides event abundant, but there are still defects for the encapsulation of these events.For example, working as user BeforeNavigate event can be triggered when browser address bar input URL enters website browsing webpage, when leaving current net (user has input new URL at this time) can also trigger BeforeNavigate event when page, and user inputs new URL while also anticipating Taste before Lifetime of Web Pages terminate.It, may packet in a main page (prime frame) due to the diversity of the webpage form of expression Containing multiple sub-pages (subframe), wherein the webpage of each frame corresponds to different url.As shown in Figure 1, Fig. 1 shows a prime frame Form web page comprising 2 two subframe 1, subframe subframes.In this case, prime frame and subframe can all trigger currently The same event of WebBrowser control, such as can be triggered repeatedly when prime frame and subframe enter or leave corresponding URL BeforeNavigate event.
For prime frame or the subframe respectively life cycle of webpage, since prime frame and subframe are when navigating to new URL BeforeNavigate event will be all triggered, and developer is in order to identify whether the life cycle of webpage in current frame object is tied Beam, it is necessary to compare and record the front and back variation of webpage in each frame one by one using a large amount of coding mode in the application, This flexibility by the way of hard coded is very poor, and resource and cost is caused to be difficult to decrease.Same problem is in webpage Life Cycle Interim other similar event not can avoid equally when triggering, such as DocumentComplete event.Therefore, not only institute is busy Part requires a large amount of coded treatments, must all cover the processing to all events to any modification of code, and apply journey Sequence must also revise accordingly.In particular, with the increase of sub-frame number in prime frame, bring complexity and workload therewith Also it sharply increases, development cost can not be effectively reduced.
In short, a technical problem that is urgently needed by the technical personnel in the field at present is that: how to reduce above-mentioned feelings Job costs under shape reduce resource consumption.
Summary of the invention
The technical problem to be solved by the application is to provide a kind of methods and dress using Lifetime of Web Pages optimization application Set, so as to reduce because identification control Lifetime of Web Pages when need for numerous event codes processing caused by exploitation at The big problem of this height, resource consumption.
To solve the above-mentioned problems, this application discloses a kind of methods using Lifetime of Web Pages optimization application, comprising:
The frame object of current web page is obtained according to the current event of browser control part object;
Obtain the state machine object of the frame object;
Based on the state machine object, the life cycle information of current web page is recorded;
Each application obtains the life cycle information of corresponding web page according to self-demand;And based on acquired life cycle Information executes corresponding optimization operation.
Preferably, described based on acquired life cycle information, executing corresponding optimization operation includes:
Life cycle information based on acquired webpage judges whether the life cycle of current web page terminates, if terminating, releases Put system resource corresponding with the webpage.
Preferably, the state machine object for obtaining the frame object includes:
According to preset state machine mapping table, judge that the state machine object of the frame object whether there is;
If it does not exist, the state machine object for creating the frame object stores the frame pair in the state machine mapping table As the mapping relations with corresponding states machine object.
Preferably, the state machine object for obtaining the frame object further include:
If the state machine object of the frame object exists in the state machine mapping table, mapped according to the state machine The state machine object of the frame object is searched and obtained to table.
Preferably, further includes:
If current event is that the life cycle information before navigating in event and state machine object is active state, destroy The state machine object;And
The mapping relations of the frame object and corresponding state machine object are deleted from the state machine mapping table;
Create new state machine object for the frame object, and reflecting the frame object and newly created state machine object Relationship storage is penetrated into the state machine mapping table.
It is preferably, described to destroy the state machine object further include:
If the frame object is prime frame, the state machine object of the prime frame is destroyed;
The state machine object of the corresponding whole subframes of the prime frame is obtained and destroyed according to the state machine mapping table.
It is preferably, described to destroy the state machine object further include:
If the frame object is subframe, the state machine object of the subframe is destroyed.
Preferably, the method also includes:
Preset condition machine control object, the state machine mapping table are placed in the state machine control object.
Preferably, the mapping pass that the frame object and corresponding states machine object are stored in the state machine mapping table System, comprising:
The frame object and corresponding state machine object are stored in the state machine mapping table by binary tree structure.
To solve the above problems, present invention also provides a kind of devices using Lifetime of Web Pages optimization application, comprising:
Frame object obtains module, and the frame object of current web page is obtained for the current event according to browser control part object;
State machine obtains module, for obtaining the state machine object of frame object;
Life cycle information logging modle records the life cycle information of webpage for being based on state machine object;
Life cycle information sending module, for sending the life cycle information of webpage to application according to application request.
Preferably, further includes:
State machine mapping table, for storing the mapping relations of frame object and corresponding states machine object;
The state machine obtains module further include:
State creating unit, for judging that the state machine object of frame object whether there is according to state machine mapping table;If no In the presence of creating the state machine object of frame object, store the frame object and corresponding states machine pair in the state machine mapping table The mapping relations of elephant.
Preferably, the state machine obtains module further include:
State machine searching unit, if the state machine object of frame object exists in state machine mapping table, search and obtain The state machine object of the frame object.
Preferably, further includes:
State machine destroys module, for destroying state machine object;
Removing module is mapped, for deleting the mapping relations of frame object and state machine object in state machine mapping table;
Authentication module is destroyed, for judge if current event is the life cycle in the preceding event of navigation and state machine object Information is active state, then notifies state machine to destroy module and destroy state machine object, notice mapping removing module deletes frame object With the mapping relations of state machine object.
Preferably, the state machine destroys module further include:
Prime frame state machine destroys unit, for destroying the state machine object of prime frame;It is obtained simultaneously according to state machine mapping table is stated Destroy the state machine object of the corresponding whole subframes of the prime frame.
Preferably, the state machine destroys module further include:
Subframe state machine destroys unit, for destroying the state machine object of subframe.
Preferably, further includes:
State machine control module, the state machine mapping table are located in the state machine control module.
Preferably, the mapping relations in the state machine mapping table between frame object and corresponding state machine object are with y-bend Storage of data structure.
Compared with prior art, the application has the following advantages:
For the life cycle state for if desired understanding a webpage in the prior art, need in related browser control It goes to record by way of encoding each prime frame subframe one by one in each event of part, it is contemplated that existing processing mode can be led High development and maintenance cost is caused, we have proposed be that each frame object creates corresponding state machine pair in the inlet of event As, and influence of the current event to webpage life state is recorded, and applications need to only pass through the life cycle of state machine object Information understands the life cycle state of webpage and makes a response, without being concerned about numerous events to the shadow of Lifetime of Web Pages state It rings, therefore greatly reduces development amount and maintenance cost.
Detailed description of the invention
Fig. 1 is a kind of schematic diagram comprising multiple subframe web interfaces;
Fig. 2 is a kind of flow chart of Lifetime of Web Pages control method embodiment one of the application;
Fig. 3 is a kind of flow chart of Lifetime of Web Pages control method embodiment two of the application;
Fig. 4 is a kind of structural block diagram of Lifetime of Web Pages control device embodiment of the application.
Specific embodiment
In order to make the above objects, features, and advantages of the present application more apparent, with reference to the accompanying drawing and it is specific real Applying mode, the present application will be further described in detail.
Referring to Fig. 2, a kind of stream of an embodiment of the method using Lifetime of Web Pages optimization application of the application is shown Journey schematic diagram.The described method includes:
Step 201, the frame object of current web page is obtained according to the current event of browser control part object.
When browser control part window includes the main page sub-pages nested with one or more, the main page is known as leading Frame, the sub-pages are known as subframe.Wherein, prime frame, subframe respectively correspond different WebBrowser objects.Those skilled in the art Member is readily appreciated that browser control part WebBrowser is interacted by event and outside, for example, when user is in browser address When inputting URL carriage return progress browse operation in column, WebBrowser control will trigger BeforeNavigate event.From event The WebBrowser object for triggering the event, i.e. frame object can be obtained in the parameter transmitted.
When in browsing device net page including prime frame and one or more subframes, BeforeNavigate event is triggered It can be prime frame, it is also possible to be wherein any one subframe, therefore may be main based on frame object acquired in event argument The frame object of the frame object of frame or any one subframe.
Step 202, the state machine object of the frame object is obtained.
Specifically: before the state machine object of creation frame object, according to preset state machine mapping table, described in judgement The state machine object of frame object whether there is;If it does not exist, then the state machine object of current frame object is created, and is reflected in state machine The mapping relations of current frame object and corresponding states machine object are stored in firing table;If it exists, it according to the state machine mapping table, obtains Take the state machine object of the frame object.
For the life cycle of a webpage, after user inputs URL and presses enter key, navigation can be triggered first Preceding event BeforeNavigate event, therefore the starting/entry events of the event i.e. Lifetime of Web Pages.Later, with The operation of user will continue to trigger other events, the NavigateComplete2 event triggered when such as navigation is completed, under Carry the DownloadBegin event etc. triggered when starting.
Method provided herein can both use in the entry events BeforeNavigate of Lifetime of Web Pages, Also response processing is done to other events in combination with specific implementation situation, we are not particularly limited to this, can be by art technology Personnel are voluntarily handled according to practical situations when implementing the application.
Step 203, it is based on the state machine object, records the life cycle information of current web page.
The life cycle mark of webpage is illustrated below for recording state change of the webpage in whole life cycle It is bright:
Unkown: original state
Newborn: raw when both BeforeNavigate event is triggered for the first time when the life cycle of webpage just starts Life period indication is set to newborn.
Adult: when webpage, which loads, to be completed, i.e., life cycle mark is set after NavigateComplete2 event is triggered For adult.
Dead: Lifetime of Web Pages terminates, i.e., when BeforeNavigate event is again triggered, life cycle is identified It is set to dead, has new URL to be input by a user at this time, Lifetime of Web Pages terminates before, while the life cycle of new web page Start.
The above life cycle mark example is merely for convenience of understanding present context, and those skilled in the art are easy reason Solution, when implementing the application, can according to the needs of practical application, be arranged the pilot process status indicator of Lifetime of Web Pages, and And the life cycle mark can be changed in different event inlet.Moreover, other than above-mentioned life cycle mark, Other status indicator can also be added in state machine object, to realize different application operatings, such as: remember for download event The download state of each download thread is recorded, and more newly downloaded in DownloadBegin and DownloadComplete event The status indicator of thread.
Step 204, each application obtains the life cycle information of corresponding web page according to self-demand;And based on acquired Life cycle information executes corresponding optimization operation.
Life cycle information in state machine of the applications by obtaining frame object is it can be learnt that the current net of the frame object The situation of change of page life cycle, and make a response processing.For example, the life cycle information that applications pass through state machine object Have learned that corresponding Lifetime of Web Pages has terminated, then resource related with the webpage in applications can be discharged, Such as in the application to handle the related dedicated program of display effect of network page, memory space etc., if learning the Lifetime of Web Pages Terminate, so that it may discharge the occupied system resource of these programs, memory space etc. in time.
Referring to embodiment one and Fig. 3, Fig. 3 shows a kind of embodiment two of Lifetime of Web Pages control method of the application Flow diagram.Opposite embodiment one, embodiment two have still further comprised the description to state machine is destroyed, the webpage life Cycle control methods specifically include:
Step 301, the frame object of current web page is obtained according to the current event of browser control part object.
Step 302, according to preset state machine mapping table, judge that the state machine object of the frame object whether there is;If It is not present, creates the state machine object of the frame object, the frame object and corresponding shape are stored in the state machine mapping table The mapping relations of state machine object;If it exists, step 303 is executed.
The mapping relations being stored in preset state machine mapping table between frame object and corresponding states machine object, to remember Whether record is that the frame object creates state machine object.The following are the examples of a state machine mapping table, wherein deposits in mapping table The value for storing up frame object pointer key and state machine object constitutes a key-value pair:
In the application, the state machine mapping table can be come from outside application program, such as database, external file; In addition, the state machine mapping table can also be placed in inside program, in the same DLL, application program.
Preferably, preset condition machine control object, the state machine mapping table are placed in the state machine control object.Institute State state control pair as be located at global space in, i.e., in entire application program or DLL any method or event can all lead to It crosses the state machine control object and searches the state machine mapping table.
Preferably, frame object and corresponding state machine object are stored in the state machine mapping table by binary tree structure In.The mapping relations of frame object and state machine object can be stored according to plurality of data structures such as arrays.But we are with two Fork storage of data structure frame object and state machine object are remarkably improved search efficiency when searching according to binary tree structure, reduce Search spent time and system resource.
Step 303, according to the state machine mapping table, the state machine object of the frame object is obtained.
Step 304, it is based on the state machine object, records the life cycle information of current web page.
Step 305, if current event is the Life Cycle in the preceding event BeforeNagvate of navigation and state machine object Phase information is active state, then destroys the current state machine object of frame object, then creates new state machine object, and by frame pair As the mapping relations storage with newly created state machine object or update into state machine mapping table.
For the state machine object of the same frame object, the triggering when the web page windows in frame object are navigated for the first time When BeforeNavigate event, the life cycle information in corresponding state machine object is marked as active state, at this The state is newborn in example, and later as other events are triggered, the life cycle state mark may be marked as it His active state, such as adult.Therefore, if current BeforeNavigate event is again triggered, while life cycle state mark Knowing is not unkown, but the life state of a centre, then illustrates that current frame object is to trigger for the second time BeforeNavigate event has new URL to be navigated at this time, also implies that the Lifetime of Web Pages knot before the frame object Beam.
It is found from preset state machine mapping table according to current frame object first and destroys the current state machine of frame object Object;Then new state machine object is created for frame object, and by the storage of the mapping relations of frame object and state machine object or more Newly into state machine mapping table.It stores, is also possible to according to frame pair again after original mapping relations can be deleted when update As finding and updating original mapping relations.
Step 306, further, by judging that current frame object is prime frame or subframe, to execute corresponding destruction respectively State machine object operation.
In this application, prime frame object and current can be all passed to when the method that we call state machine object implements operation Frame object: if present frame pointer to object is identical as prime frame pointer to object, current frame object is main frame;If it is different, then present frame Object is subframe.
If current frame object is main frame, the state machine object of the prime frame is destroyed;Ergodic state machine mapping table is obtained and is destroyed The state machine object of the corresponding whole subframes of the prime frame;Then, prime frame and corresponding all is deleted from state machine mapping table The mapping relations of subframe and respective state machine object.When prime frame is destroyed, the release of current global space can be triggered, it also can trigger bit The destructed method Free up Memory of state machine management class in global space, by method triggering release institute destructed in state machine management class There is subframe state machine object.
If current frame object is subframe, corresponding state machine object is found according to the subframe and state machine mapping table and is then sold It ruins, while deleting corresponding mapping relations in state machine mapping table.It, can triggering state machine object when subframe state machine object is destroyed Destructed method, discharge corresponding memory source.
The step is optional step.Before the life cycle of webpage is not finished, applications can pass through corresponding state machine Life cycle information in object obtains the life cycle of current web page.
Preferably, the processing related with Lifetime of Web Pages that the application is done applications writes on state machine object In interface, in this way, the applications can know immediately corresponding state machine object by interface when state machine object is destroyed It is whether destroyed, illustrate that the Lifetime of Web Pages of the state machine object has terminated if destroying.
It is retouched above by a kind of method using Lifetime of Web Pages optimization application of several embodiments to the application It states.Present context in order to better understand makees herein described method below with reference to a specific instance section pseudo-code It further describes:
S1, firstly, definition status machine management class CFrameStateMachineManager and machine class CFrameStateMachine
S2 creates state machine management object of overall importance in program initialization CFrameStateMachineManager。
State machine mapping table is preset in state machine management object CFrameStateMachineManager, the state machine Mapping table initial value is sky.
S3 triggers BeforeNavigate thing after user inputs URL carriage return browsing webpage in browser address bar Part.
S4 obtains the frame object for triggering the event from the parameter of BeforeNavigate event.Call state machine management FindByBrowser () method in object CFrameStateMachineManager judges the frame object in state machine management It whether there is in state machine mapping table in object CFrameStateMachineManager.
S5 according to the frame object of current triggering BeforeNavigate event, calls state machine to manage object if it does not exist AppendBrowser () method is one state machine pair of present frame Object Creation in CFrameStateMachineManager As, and increase a mapping relations record into state machine mapping table.
S6, if it exists and current event is BeforeNavigate event, it is meant that had been triggered before current frame object BeforeNavigate event, is triggered, again for subframe, it is meant that subframe being navigated to new URL, currently Lifetime of Web Pages corresponding to URL terminates;And trigger BeforeNavigate event again if it is prime frame, then it not only means Lifetime of Web Pages corresponding to the current URL of prime frame terminate, and webpage corresponding to all current URL of subframe in the prime frame Life cycle will be moved to end.
Specifically, IsTop () method in state machine object CFrameStateMachine is called to judge current frame object It whether is prime frame.In IsTop () method, by comparing the pointer address of current frame object and the prime frame original pointer of record Whether address is consistent, if unanimously, otherwise it is subframe that current frame object, which is main frame,.
If prime frame, from the state machine mapping table in state machine management object CFrameStateMachineManager The state machine object of current prime frame and the state machine object of all subframes of the prime frame are searched, then, to prime frame and the prime frame institute There is subframe that the ClearByBrowser () method in state machine management object is called to remove state machine object, is mapped from state machine The mapping relations of prime frame and all subframes of the prime frame in state machine mapping table are deleted in table, while discharging the prime frame, son Frame and all occupied memory sources of corresponding states machine object.
If subframe, the ClearByBrowser () method in state machine management object is called to remove state machine the subframe Object, from deleting mapping relations of the subframe in state machine mapping table in state machine mapping table, while discharge the subframe and All occupied memory sources of corresponding states machine object.
S61 calls state machine to manage object according to the frame object of current triggering BeforeNavigate event AppendBrowser () method is one state machine pair of present frame Object Creation in CFrameStateMachineManager As, and increase a mapping relations record into state machine mapping table.
The modification to Lifetime of Web Pages information in state machine is generally only related in the entrance of other events, it is no longer superfluous here It states.
State machine management class CFrameStateMachineManager and state used in examples detailed above is given below Part attribute, method in machine class CFrameStateMachine, so that those skilled in the art are best understood from the application:
State machine manages class CFrameStateMachineManager
(1) state machine mapping table map
The key-value pair for the key- > value form stored in map.It uses the pointer of frame object as key, uses state machine CFrameStateMachine object is as value.
(2) AppendBrowser (IWebBrowser2*pBrowser) method
Class CFrameStateMachineManager provides AppendBrowser method, and this method can add one CFrameStateMachine object.Realize it is first to reflect according to incoming frame object pointer pBrowser from state machine inside method Key is searched in firing table map whether there is, if there is no then one new CFrameStateMachine object of creation and in shape Frame object pointer pBrowser and corresponding CFrameStateMachine object are recorded in state machine mapping table map, if there is Then directly return to this existing CFrameStateMachine object.
(3) ClearByBrowser (IWebBrowser2*pBrowser) method
Class CFrameStateMachineManager provides ClearByBrowser method, and this method can remove one A internal control CFrameStateMachine object.Realize it is first according to the pointer pBrowser of frame object from shape inside method Key is searched in state machine mapping table map whether there is, if there is just removing this key and value from state machine mapping table, If there is no then ignoring.
(4) FindByBrowser (IWebBrowser2*pBrowser) method
Class CFrameStateMachineManager provides FindByBrowser method, and this method can search one Internal control CFrameStateMachine object.Realize it is first to search according to the pointer pBrowser of frame object inside method Key whether there is, and if so, return to this existing CFrameStateMachine object, if there is no then returning NULL。
Machine class CFrameStateMachine
Machine class CFrameStateMachine is responsible for the life cycle of webpage corresponding to current URL in a frame object Management:
(1) DWORD m_dwWebBrowser attribute
M_dwWebBrowser attribute is defined in class CFrameStateMachine, has recorded the finger of current frame object Needle.
(2) DWORD m_dwTopWebBrowser attribute
M_dwTopWebBrowser attribute is defined in class CFrameStateMachine, has recorded prime frame The pointer of WebBrowser.
(3) BOOL IsTop () method
IsTop method is defined in class CFrameStateMachine, shows that state machine is corresponding if returning to TRUE Frame is prime frame, is otherwise subframe.
(4)Init(IWebBrowser2Ptr spWebBrowser,IWebBrowser2PtrspTopWebBrowser) Method
Init method is defined in class CFrameStateMachine, this method is the BeforeNavigate thing of frame object It is called when part, for initialization frame state machine object.This method has been passed to the pointer of present frame and prime frame, root inside method Corresponding operation is carried out according to the state of present frame state machine.It is arranged if frame state machine is the Init triggered for the first time current The attribute of frame and prime frame changes simultaneously life cycle in frame state machine object and is identified as newborn;It is triggered if not first time , then the current state of state machine object is obtained, according to current state executing application corresponding operation.
A kind of method using Lifetime of Web Pages optimization application provided by the present application, can be easily to including multiple subframes The life cycle of webpage be managed, the life cycle information of each webpage is supplied to application, using according to itself demand The life cycle information of webpage is obtained, and executes corresponding optimization operation.
A kind of done using Lifetime of Web Pages optimization application disclosed in the present application is retouched in detail above by embodiment It states, referring to the content of above-described embodiment, to a kind of device using Lifetime of Web Pages optimization application involved by the application It is described, comprising:
Frame object obtains module 410, and the frame pair of current web page is obtained for the current event according to browser control part object As;
State machine obtains module 420, for obtaining the state machine object of frame object;
Life cycle information logging modle 430 records the life cycle information of webpage for being based on state machine object;
Life cycle information sending module 440, for sending the life cycle information of webpage to application according to application request.
Preferably, further includes:
State machine mapping table 450, for storing the mapping relations of frame object and corresponding states machine object;
The state machine obtains module 420 further include:
State machine creating unit 421, for judging whether the state machine object of frame object is deposited according to state machine mapping table ?;If it does not exist, the state machine object for creating frame object stores the frame object and corresponding shape in the state machine mapping table The mapping relations of state machine object.
Preferably, the state machine obtains module 420 further include:
State machine searching unit 422, if the state machine object of frame object exists in state machine mapping table, search simultaneously Obtain the state machine object of the frame object.
Preferably, further includes:
State machine destroys module 460, for destroying state machine object;
Removing module 470 is mapped, for deleting the mapping relations of frame object and state machine object in state machine mapping table;
Authentication module 480 is destroyed, for judge if current event is the life in the preceding event of navigation and state machine object Cycle information is active state, then notifies state machine to destroy module and destroy state machine object, notice mapping removing module deletes frame The mapping relations of object and state machine object.
Preferably, the state machine destroys module 460 further include:
Prime frame state machine destroys unit 461, for destroying the state machine object of prime frame;It is obtained according to state machine mapping table is stated And destroy the state machine object of the corresponding whole subframes of the prime frame.
Preferably, the state machine destroys module 460 further include:
Subframe state machine destroys unit 462, for destroying the state machine object of subframe.
Preferably, further includes:
State machine control module 490, the state machine mapping table are located in the state machine control module.
Preferably, the mapping relations in the state machine mapping table 450 between frame object and corresponding state machine object with Binary tree structure storage.
All the embodiments in this specification are described in a progressive manner, the highlights of each of the examples are with The difference of other embodiments, the same or similar parts between the embodiments can be referred to each other.For Installation practice For, since it is basically similar to the method embodiment, so being described relatively simple, referring to the portion of embodiment of the method in place of correlation It defends oneself bright.
Above to a kind of method and apparatus using Lifetime of Web Pages optimization application provided herein, carry out in detail Thin to introduce, specific examples are used herein to illustrate the principle and implementation manner of the present application, and above embodiments are said It is bright to be merely used to help understand the present processes and its core concept;At the same time, for those skilled in the art, foundation The thought of the application, there will be changes in the specific implementation manner and application range, in conclusion the content of the present specification is not It is interpreted as the limitation to the application.
The invention discloses A1, a kind of method using Lifetime of Web Pages optimization application, comprising:
The frame object of current web page is obtained according to the current event of browser control part object;
Obtain the state machine object of the frame object;
Based on the state machine object, the life cycle information of current web page is recorded;
Each application obtains the life cycle information of corresponding web page according to self-demand;And based on acquired life cycle Information executes corresponding optimization operation.
A2, method as described in a1, described based on acquired life cycle information, executing corresponding optimization operation includes:
Life cycle information based on acquired webpage judges whether the life cycle of current web page terminates, if terminating, releases Put system resource corresponding with the webpage.
A3, method as described in a1, the state machine object for obtaining the frame object include:
According to preset state machine mapping table, judge that the state machine object of the frame object whether there is;
If it does not exist, the state machine object for creating the frame object stores the frame pair in the state machine mapping table As the mapping relations with corresponding states machine object.
A4, the method as described in A3, the state machine object for obtaining the frame object further include:
If the state machine object of the frame object exists in the state machine mapping table, mapped according to the state machine The state machine object of the frame object is searched and obtained to table.
A5, the method as described in A4, further includes:
If current event is that the life cycle information before navigating in event and state machine object is active state, destroy The state machine object;And
The mapping relations of the frame object and corresponding state machine object are deleted from the state machine mapping table;
Create new state machine object for the frame object, and reflecting the frame object and newly created state machine object Relationship storage is penetrated into the state machine mapping table.
A6, method as described in a5, it is described to destroy the state machine object further include:
If the frame object is prime frame, the state machine object of the prime frame is destroyed;
The state machine object of the corresponding whole subframes of the prime frame is obtained and destroyed according to the state machine mapping table.
A7, the method as described in A6, it is described to destroy the state machine object further include:
If the frame object is subframe, the state machine object of the subframe is destroyed.
A8, the method as described in A4, the method also includes:
Preset condition machine control object, the state machine mapping table are placed in the state machine control object.
A9, the method as described in A4 or A8, it is described that the frame object and corresponding shape are stored in the state machine mapping table The mapping relations of state machine object, comprising:
The frame object and corresponding state machine object are stored in the state machine mapping table by binary tree structure.
The invention also discloses B10, a kind of device using Lifetime of Web Pages optimization application, comprising:
Frame object obtains module, and the frame object of current web page is obtained for the current event according to browser control part object;
State machine obtains module, for obtaining the state machine object of frame object;
Life cycle information logging modle records the life cycle information of webpage for being based on state machine object;
Life cycle information sending module, for sending the life cycle information of webpage to application according to application request.
B11, the device as described in B10, which is characterized in that further include:
State machine mapping table, for storing the mapping relations of frame object and corresponding states machine object;
The state machine obtains module further include:
State creating unit, for judging that the state machine object of frame object whether there is according to state machine mapping table;If no In the presence of creating the state machine object of frame object, store the frame object and corresponding states machine pair in the state machine mapping table The mapping relations of elephant.
B12, the device as described in B10, the state machine obtain module further include:
State machine searching unit, if the state machine object of frame object exists in state machine mapping table, search and obtain The state machine object of the frame object.
B13, the device as described in B10, further includes:
State machine destroys module, for destroying state machine object;
Removing module is mapped, for deleting the mapping relations of frame object and state machine object in state machine mapping table;
Authentication module is destroyed, for judge if current event is the life cycle in the preceding event of navigation and state machine object Information is active state, then notifies state machine to destroy module and destroy state machine object, notice mapping removing module deletes frame object With the mapping relations of state machine object.
B14, the device as described in B13, the state machine destroy module further include:
Prime frame state machine destroys unit, for destroying the state machine object of prime frame;It is obtained simultaneously according to state machine mapping table is stated Destroy the state machine object of the corresponding whole subframes of the prime frame.
B15, the device as described in B13, the state machine destroy module further include:
Subframe state machine destroys unit, for destroying the state machine object of subframe.
B16, the device as described in B10, further includes:
State machine control module, the state machine mapping table are located in the state machine control module.
B17, the device as described in B16, in the state machine mapping table between frame object and corresponding state machine object Mapping relations are stored with binary tree structure.

Claims (17)

1. a kind of method using Lifetime of Web Pages optimization application characterized by comprising
The frame object of current web page is obtained according to the current event of browser control part object;
Obtain the state machine object of the frame object;
Based on the state machine object, the life cycle information of current web page is recorded;
Each application obtains the life cycle information of corresponding web page according to self-demand;And based on acquired life cycle information, Execute corresponding optimization operation.
2. the method as described in claim 1, which is characterized in that it is described based on acquired life cycle information, it executes corresponding Optimization operates
Life cycle information based on acquired webpage judges whether the life cycle of current web page terminates, if terminate, release with The corresponding system resource of the webpage.
3. the method as described in claim 1, which is characterized in that the state machine object for obtaining the frame object includes:
According to preset state machine mapping table, judge that the state machine object of the frame object whether there is;
If it does not exist, the state machine object for creating the frame object, stored in the state machine mapping table frame object and The mapping relations of corresponding states machine object.
4. method as claimed in claim 3, which is characterized in that the state machine object for obtaining the frame object further include:
If the state machine object of the frame object exists in the state machine mapping table, according to the state machine mapping table, look into Look for and obtain the state machine object of the frame object.
5. method as claimed in claim 4, which is characterized in that further include:
If current event is that the life cycle information before navigating in event and state machine object is active state, destroy described in State machine object;And
The mapping relations of the frame object and corresponding state machine object are deleted from the state machine mapping table;
New state machine object is created for the frame object, and the mapping of the frame object and newly created state machine object is closed System's storage is into the state machine mapping table.
6. method as claimed in claim 5, which is characterized in that described to destroy the state machine object further include:
If the frame object is prime frame, the state machine object of the prime frame is destroyed;
The state machine object of the corresponding whole subframes of the prime frame is obtained and destroyed according to the state machine mapping table.
7. method as claimed in claim 6, which is characterized in that described to destroy the state machine object further include:
If the frame object is subframe, the state machine object of the subframe is destroyed.
8. method as claimed in claim 4, which is characterized in that the method also includes:
Preset condition machine control object, the state machine mapping table are placed in the state machine control object.
9. the method as described in claim 4 or 8, which is characterized in that described to store the frame in the state machine mapping table The mapping relations of object and corresponding states machine object, comprising:
The frame object and corresponding state machine object are stored in the state machine mapping table by binary tree structure.
10. a kind of device using Lifetime of Web Pages optimization application characterized by comprising
Frame object obtains module, and the frame object of current web page is obtained for the current event according to browser control part object;
State machine obtains module, for obtaining the state machine object of frame object;
Life cycle information logging modle records the life cycle information of webpage for being based on state machine object;
Life cycle information sending module, for sending the life cycle information of webpage to application according to application request.
11. device as claimed in claim 10, which is characterized in that further include:
State machine mapping table, for storing the mapping relations of frame object and corresponding states machine object;
The state machine obtains module further include:
State creating unit, for judging that the state machine object of frame object whether there is according to state machine mapping table;If not depositing The state machine object of frame object is being created, the frame object and corresponding states machine object are stored in the state machine mapping table Mapping relations.
12. device as claimed in claim 10, which is characterized in that the state machine obtains module further include:
State machine searching unit is searched and is obtained described if the state machine object of frame object exists in state machine mapping table The state machine object of frame object.
13. device as claimed in claim 10, which is characterized in that further include:
State machine destroys module, for destroying state machine object;
Removing module is mapped, for deleting the mapping relations of frame object and state machine object in state machine mapping table;
Authentication module is destroyed, for judge if current event is the life cycle information in the preceding event of navigation and state machine object For active state, then state machine is notified to destroy module and destroy state machine object, notice mapping removing module deletes frame object and shape The mapping relations of state machine object.
14. device as claimed in claim 13, which is characterized in that the state machine destroys module further include:
Prime frame state machine destroys unit, for destroying the state machine object of prime frame;It obtains and sells according to the state machine mapping table Ruin the state machine object of the corresponding whole subframes of the prime frame.
15. device as claimed in claim 13, which is characterized in that the state machine destroys module further include:
Subframe state machine destroys unit, for destroying the state machine object of subframe.
16. device as claimed in claim 13, which is characterized in that further include:
State machine control module, the state machine mapping table are located in the state machine control module.
17. device as claimed in claim 16, which is characterized in that frame object and corresponding state in the state machine mapping table Mapping relations between machine object are stored with binary tree structure.
CN201510146183.2A 2012-03-31 2012-03-31 A kind of method and apparatus using Lifetime of Web Pages optimization application Active CN104715056B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510146183.2A CN104715056B (en) 2012-03-31 2012-03-31 A kind of method and apparatus using Lifetime of Web Pages optimization application

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201210093711.9A CN102662668B (en) 2012-03-31 2012-03-31 Method and device for optimizing application by utilizing webpage life cycle
CN201510146183.2A CN104715056B (en) 2012-03-31 2012-03-31 A kind of method and apparatus using Lifetime of Web Pages optimization application

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN201210093711.9A Division CN102662668B (en) 2012-03-31 2012-03-31 Method and device for optimizing application by utilizing webpage life cycle

Publications (2)

Publication Number Publication Date
CN104715056A CN104715056A (en) 2015-06-17
CN104715056B true CN104715056B (en) 2018-12-04

Family

ID=53414382

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510146183.2A Active CN104715056B (en) 2012-03-31 2012-03-31 A kind of method and apparatus using Lifetime of Web Pages optimization application

Country Status (1)

Country Link
CN (1) CN104715056B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105930205A (en) * 2016-04-14 2016-09-07 北京思特奇信息技术股份有限公司 Method and device for processing service states based on state machine mode

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1744512A (en) * 2004-08-30 2006-03-08 华为技术有限公司 Network resource management method
CN102103497A (en) * 2009-12-18 2011-06-22 阿尔卡特朗讯 Finite state machine actuating device and method, and method for establishing and using finite state machine
CN102375758A (en) * 2010-08-20 2012-03-14 联芯科技有限公司 Method and device for preventing apparent death of browser of mobile communication equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100180330A1 (en) * 2009-01-09 2010-07-15 Microsoft Corporation Securing Communications for Web Mashups

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1744512A (en) * 2004-08-30 2006-03-08 华为技术有限公司 Network resource management method
CN102103497A (en) * 2009-12-18 2011-06-22 阿尔卡特朗讯 Finite state machine actuating device and method, and method for establishing and using finite state machine
CN102375758A (en) * 2010-08-20 2012-03-14 联芯科技有限公司 Method and device for preventing apparent death of browser of mobile communication equipment

Also Published As

Publication number Publication date
CN104715056A (en) 2015-06-17

Similar Documents

Publication Publication Date Title
CN107533453B (en) System and method for generating data visualization applications
Adam et al. A new PHP web application development framework based on MVC architectural pattern and ajax technology
US20150220333A1 (en) Generation of api call graphs from static disassembly
CN109189374B (en) Object structure code generation method and system based on object reference chain
CN103744680B (en) Method and device for business process processing
US10248581B2 (en) Guarded memory access in a multi-thread safe system level modeling simulation
WO2015019074A1 (en) Automated application test system
US9075666B2 (en) Deferred execution in a multi-thread safe system level modeling simulation
US11397608B2 (en) Multi-dimensional spreadsheet system enabling stack based programming using a virtual machine
US9201708B2 (en) Direct memory interface access in a multi-thread safe system level modeling simulation
JP4695903B2 (en) Web application system and program thereof
CN104715056B (en) A kind of method and apparatus using Lifetime of Web Pages optimization application
JP4754021B1 (en) Database conversion system
CN104267954A (en) Generation method and device for units included in user interface
CN114218278A (en) Data table field query method and system of http interface
Lazovik et al. Runtime modifications of spark data processing pipelines
CN102662668B (en) Method and device for optimizing application by utilizing webpage life cycle
US11521089B2 (en) In-database predictive pipeline incremental engine
Hallé et al. Exhaustive exploration of ajax web applications with selective jumping
Xu The universal design solution for Ajax-based three-tier architecture
Hai et al. Multi-threaded on-the-fly model generation of malware with hash compaction
CN109062954A (en) A kind of efficient data exchange and data source shielding system
CN108959489A (en) A kind of efficient data exchange and data source partition method
Catrina A Comparative Analysis of Spring MVC and Spring WebFlux in Modern Web Development
Franchi An agent-based modeling framework for social network simulation

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20220727

Address after: Room 801, 8th floor, No. 104, floors 1-19, building 2, yard 6, Jiuxianqiao Road, Chaoyang District, Beijing 100015

Patentee after: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park)

Patentee before: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Patentee before: Qizhi software (Beijing) Co.,Ltd.

TR01 Transfer of patent right