CN104268229A - Resource obtaining method and device based on multi-process browser - Google Patents

Resource obtaining method and device based on multi-process browser Download PDF

Info

Publication number
CN104268229A
CN104268229A CN201410504006.2A CN201410504006A CN104268229A CN 104268229 A CN104268229 A CN 104268229A CN 201410504006 A CN201410504006 A CN 201410504006A CN 104268229 A CN104268229 A CN 104268229A
Authority
CN
China
Prior art keywords
resource
resource data
data
shared
type
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
CN201410504006.2A
Other languages
Chinese (zh)
Other versions
CN104268229B (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.)
Zhuhai Baoqu Technology Co Ltd
Original Assignee
Beijing Kingsoft Internet Security Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Internet Security Software Co Ltd filed Critical Beijing Kingsoft Internet Security Software Co Ltd
Priority to CN201410504006.2A priority Critical patent/CN104268229B/en
Publication of CN104268229A publication Critical patent/CN104268229A/en
Application granted granted Critical
Publication of CN104268229B publication Critical patent/CN104268229B/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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5018Thread allocation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention discloses a resource obtaining method and a resource obtaining device based on a multi-process browser, and relates to the technical field of computers, wherein the method comprises the following steps: the browser subprocess determines the identifier of the resource to be loaded; judging whether resource data corresponding to the identifier exists in an inter-process shared memory according to the determined identifier of the resource to be loaded, wherein the resource data in the inter-process shared memory is pre-stored by a browser main process; and if so, acquiring resource data corresponding to the identifier of the determined resource to be loaded. When the resource obtaining scheme provided by the embodiment of the invention is applied to obtain the resource data, the memory resource can be saved.

Description

A kind of resource preparation method based on multi-process browser and device
Technical field
The present invention relates to field of computer technology, particularly a kind of resource preparation method based on browser and device.
Background technology
Along with the development of hardware technology, the computing power of various terminal is more and more stronger, can support that user browses webpage by the browser of multi-process pattern, wherein, during the browser execution of multi-process pattern, call a host process, and at least one subprocess can be called by this host process, such as: subprocess can be play up process, tool processes etc.Generally, above-mentioned subprocess runs in constrained environment, and they do not have authority directly obtain user data or directly obtain web data etc. from network side, and only has host process to have the authority obtaining these data.
In view of the foregoing, in prior art, when browsing webpage by browser, general implementation is: host process is loaded on resource data (such as: picture, text, script, configuration information etc.) in internal memory, and subprocess accesses by the mode communicated with host process the resource data that host process loads.
To play up the communication between process and host process, when the process of playing up plays up webpage, usually obtain resource data by following steps:
The resource data of host process loaded targets resource is in internal memory, and serializing process is carried out to loaded resource data, data after serializing process are stored to corresponding region of memory, then by the data Replica after above-mentioned serializing process to the region of memory sending data when being used for interprocess communication;
The data sent in the region of memory of data when being used for interprocess communication, according to inter-process communication mechanisms, are sent to for receiving in the region of memory of data during interprocess communication by host process;
Process of playing up carries out unserializing process to for the data received in the region of memory of data during interprocess communication, and the data after unserializing process are stored to corresponding region of memory, finally by the data Replica after above-mentioned unserializing process to playing up in process the region of memory being used for webpage and playing up, so far, the resource data that process obtains target resource is played up.
From above step, when subprocess obtains resource data by inter-process communication mechanisms, need repeatedly internal memory operation, memory requirements is larger.
Summary of the invention
The embodiment of the invention discloses a kind of resource preparation method based on multi-process browser and device, to save memory source.
For achieving the above object, the embodiment of the invention discloses a kind of resource preparation method based on multi-process browser, described method comprises:
Browser subprocess determines the mark of resource to be loaded;
According to the mark of determined resource to be loaded, judge the resource data that whether there is this mark correspondence between process in shared drive, wherein, the resource data between described process in shared drive, is prestored by browser host process;
If exist, obtain the resource data of the mark correspondence of determined resource to be loaded.
Optionally, between browser host process is by the resource data store of shared resource to described process after shared drive, also comprise:
Obtain the relative memory address of resource data between described process in shared drive of described shared resource, wherein, the relative memory address obtained is: relative to the memory address of the initial physical storage address of shared drive between described process;
According to mark and the obtained relative memory address of described shared resource, upgrade the Key-Value mapping table preset in shared drive between described process, wherein, Key represents the mark of described shared resource, Value value comprises: the relative memory address obtained, Key-Value mapping table, for storing the mapping relations between Key and Value.
Optionally, between browser host process is by the resource data store of shared resource to described process before shared drive, also comprise:
Browser host process judges whether shared resource meets the shared resource decision rule preset;
If meet, then perform browser host process by the step of shared drive between the resource data store of shared resource to described process.
Optionally, the resource data of the mark correspondence of the determined resource to be loaded of described acquisition, comprising:
According to the Key value of determined resource to be loaded, from described Key-Value mapping table, obtain the relative memory address of determined resource to be loaded;
To obtain between described process shared drive for the mapping address of described browser subprocess;
According to obtained data index value and mapping address, determine the physical storage address of the resource data that the Key value of determined resource to be loaded is corresponding;
According to determined physical storage address, obtain the resource data that the Key value of determined resource to be loaded is corresponding.
Optionally, browser host process to the type of resource data store in shared drive between described process, comprise following several at least one:
JSON type, Image type, Binary type, JavaScript type, RegExp type and Text type.
Optionally, when the type of the resource data that browser host process stores in shared drive between described process is JSON type,
Browser host process, by the method for shared drive between the resource data store of shared resource to described process, comprising:
Browser host process, according to resolution rules corresponding to the data of JSON type, is resolved the resource data of shared resource;
Serializing process is carried out to the resource data after resolving;
Data after serializing process to be stored between described process in shared drive.
Optionally, when the type of the resource data that browser host process stores in shared drive between described process is Image type,
Browser host process, by the method for shared drive between the resource data store of shared resource to described process, comprising:
Browser host process is regular according to the image decoding that the data of Image type are corresponding, carries out decoding process to the resource data of shared resource;
Data after decoding process to be stored between described process in shared drive.
Optionally, when the type of the resource data that browser host process stores in shared drive between described process is Binary type, JavaScript type, RegExp type or Text type,
Browser host process, by the method for shared drive between the resource data store of shared resource to described process, comprising:
The raw data of the resource data of shared resource to be stored between described process in shared drive by browser host process.
For achieving the above object, the embodiment of the invention discloses a kind of resource obtaining means based on multi-process browser, described device comprises:
Browser host process module and browser subprocess module;
Wherein, described browser host process module, comprising: resource data store submodule;
Described browser subprocess module, comprising: resource identification determination submodule, resource data judge that submodule and resource data obtain submodule;
Described resource identification determination submodule, for determining the mark of resource to be loaded;
Described resource data judges submodule, for the mark according to determined resource to be loaded, judges the resource data that whether there is this mark correspondence between process in shared drive, if exist, triggers described resource data and obtains submodule acquisition resource data;
Described resource data obtains submodule, for obtaining the resource data of the mark correspondence of determined resource to be loaded;
Described resource data store submodule, for prestoring resource data in shared drive between described process.
Optionally, described browser host process module also comprises:
Relative memory address obtains submodule, for after the resource data of described resource data store submodule Storage sharing resource, obtain the described relative memory address of resource data between described process in shared drive sharing resource to be loaded, wherein, the relative memory address obtained is: relative to the memory address of the initial physical storage address of shared drive between described process;
Mapping table upgrades submodule, for sharing the mark of resource to be loaded and obtained relative memory address according to described, upgrade the Key-Value mapping table preset in shared drive between described process, wherein, Key represents the mark of described shared resource, Value value comprises: the relative memory address obtained, Key-Value mapping table, for storing the mapping relations between Key and Value.
Optionally, described browser host process module also comprises:
Resource judgment submodule to be loaded, for judging whether shared resource meets the shared resource decision rule preset, if meet, triggers the resource data that described resource data store submodule stores described shared resource.
Optionally, described resource data obtains submodule, comprising:
Data index value obtains unit, for the Key value according to determined resource to be loaded, from described Key-Value mapping table, obtains the relative memory address of determined resource to be loaded;
Mapping address obtains unit, for obtaining between described process shared drive for the mapping address of described browser subprocess;
Physical storage address computing unit, for according to obtained data index value and mapping address, determines the physical storage address of the resource data that the Key value of determined resource to be loaded is corresponding;
Resource data obtains unit, for according to determined physical storage address, obtains the resource data that the Key value of determined resource to be loaded is corresponding.
Optionally, browser host process to the type of resource data store in shared drive between described process, comprise following several at least one:
JSON type, Image type, Binary type, JavaScript type, RegExp type and Text type.
Optionally, when the type of the resource data that browser host process stores in shared drive between described process is JSON type,
Described resource data store submodule, comprising:
Resource data resolution unit, for according to resolution rules corresponding to the data of JSON type, resolves the resource data of shared resource;
Serializing processing unit, for carrying out serializing process to the resource data after parsing;
First data storage cell, for being stored between described process in shared drive by the data after serializing process.
Optionally, when the type of the resource data that browser host process stores in shared drive between described process is Image type,
Described resource data store submodule, comprising:
Codec processing unit, regular for the image decoding corresponding according to the data of Image type, decoding process is carried out to the resource data of shared resource;
Second data storage cell, for being stored between described process in shared drive by the data after decoding process.
Optionally, when the type of the resource data that browser host process stores in shared drive between described process is Binary type, JavaScript type, RegExp type or Text type,
Described resource data store submodule, the raw data specifically for the resource data by shared resource to be stored between described process in shared drive.
Due to upper visible, in the scheme that the embodiment of the present invention provides, by browser host process in advance by shared drive between resource data store to process, when browser subprocess need obtain the resource data of resource to be loaded, from shared drive between above-mentioned process, directly obtain relevant resource data.Compared with prior art, when the scheme that the application embodiment of the present invention provides obtains resource data, only need once from shared drive between process to the internal memory operation in the correspondence memory region of browser subprocess, and without the need to carrying out repeatedly internal memory operation, therefore, it is possible to saving memory source.
Accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, be briefly described to the accompanying drawing used required in embodiment or description of the prior art below, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
The schematic flow sheet of a kind of resource preparation method based on multi-process browser that Fig. 1 provides for the embodiment of the present invention;
The another kind that Fig. 2 provides for the embodiment of the present invention is based on the schematic flow sheet of the resource preparation method of multi-process browser;
The structural representation of a kind of resource obtaining means based on multi-process browser that Fig. 3 provides for inventive embodiments;
The another kind that Fig. 4 provides for inventive embodiments is based on the structural representation of the resource obtaining means of multi-process browser;
Fig. 5 is RBTree schematic diagram;
Fig. 6 is the data structure schematic diagram of a node in Fig. 5 RBTree.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
The schematic flow sheet of a kind of resource preparation method based on multi-process browser that Fig. 1 provides for the embodiment of the present invention, the method comprises:
S101: browser subprocess determines the mark of resource to be loaded.
In practical application, after starting multi-process browser, first call a browser host process, then call one or more browser subprocess by this host process.Because browser subprocess generally runs in constrained environment, directly can not obtain user data or obtain the data of webpage from network side, so, browser subprocess first can only determine the mark of resource to be loaded according to web page source code, then obtains the resource data of resource to be loaded by the mode of shared drive between the mode that communicates with host process or access process.
S102: according to the mark of determined resource to be loaded, judges the resource data that whether there is this mark correspondence between process in shared drive, if exist, performs S103, otherwise, perform S104.
Wherein, the resource data between process in shared drive, is prestored by browser host process.In practical application, for ease of searching corresponding resource in shared drive between process, after this region of memory resource data store, information corresponding for this resource data can be recorded in default mapping table.
Concrete, browser host process is by after shared drive between the resource data store of shared resource to process, first can obtain the relative memory address of resource data between this process in shared drive of shared resource, again according to mark and the obtained relative memory address of this shared resource, the Key-Value mapping table preset in shared drive between renewal process, wherein, Key represents the mark of shared resource, Value value comprises: the relative memory address obtained, Key-Value mapping table, for storing the mapping relations between Key and Value.
Further, above-mentioned Value value can also comprise: the information such as type, size of resource data.
In addition, above-mentioned obtained relative memory address is: relative to the memory address of the initial physical storage address of shared drive between process.
Browser host process is by shared drive between the resource data store of shared resource to process, can be after launching the browser, carry out before starting to play up webpage, can carry out in the process playing up webpage, the application does not limit the execution time of above-mentioned steps yet.
Those skilled in the art are understandable that, above-mentioned Key-Value mapping table can generate based on RBTree algorithm, and RBTree algorithm belongs to prior art, no longer repeats here.
In addition, consider that between process, shared drive is limited, in a preferred embodiment of the present invention, between browser host process is by the resource data store of shared resource to process before shared drive, browser host process first can also judge whether shared resource meets the shared resource decision rule preset, meeting the situation of this decision rule, then by browser host process by shared drive between the resource data store of shared resource to process.
Wherein, the shared resource decision rule preset, can be whether the access frequency of resource is greater than a certain threshold value, whether the type of resource is default type etc.The application does not limit the particular content of shared resource decision rule.
Browser host process to the type of resource data store in shared drive between process, can comprise following several at least one:
JSON type, Image type, Binary type, JavaScript type, RegExp type and Text type.
Certainly, the application is just described for above-mentioned, and in practical application, the type of resource data is not limited in above-mentioned several.
Such as, the data of JSON type can be: renderer resource allocation, and this resource is used to indicate the process of playing up and how plays up webpage;
The data of Image type can be: image, as: background image etc.;
The data of JavaScript type can be: script resource, as: User Defined script or expansion script etc.;
The data of RegExp type can be: advertisement filter rule, and this resource is used for the advertisement in filtering web page;
The data of Text type can be: multi-language resource, and this resource is used for showing different language according to different running environment;
The data of Binary type are binary data, for preserving the data of any type.
S103: the resource data obtaining the mark correspondence of determined resource to be loaded.
S104: process ends.
In a kind of specific implementation of the present invention, when there is not the resource data of determined mark correspondence between process in shared drive, browser subprocess can send resource request to browser host process, after browser host process receives this request, corresponding resource data is obtained from network side, and pass through the mode of shared drive between interprocess communication or access process, send corresponding resource data to browser subprocess.
From aforementioned description, browser host process can have polytype to resource data store in shared drive between process, and a point situation is described in detail below.
One, when the type of the resource data that browser host process stores in shared drive between process is JSON type,
Browser host process is by between the resource data store of shared resource to process during shared drive, browser host process can first according to the resolution rules that the data of JSON type are corresponding, the resource data of shared resource is resolved, again serializing process is carried out to the resource data after resolving, again the data after serializing process to be stored between process in shared drive afterwards.
Corresponding to resource data store in shared drive between process with above-mentioned browser host process, when browser subprocess acquisition type is the resource data of JSON type, the resource data obtaining the mark correspondence of determined resource to be loaded can comprise the following steps:
Browser subprocess obtains the data of the mark correspondence of determined resource to be loaded from shared drive between process;
Unserializing process is carried out to obtained data, namely obtains the resource data of the mark correspondence of determined resource to be loaded.
As seen from the above, when the type of resource data is JSON type, if when multiple browser subprocess all needs a certain storage resources between access process in shared drive, browser host process only need carry out a series processing, and the data after process are existed in this shared drive, and do not need the requirements for access for each browser subprocess to carry out repeatedly serializing process, after each browser subprocess obtains data from shared drive between process, carry out corresponding unserializing process, namely obtain corresponding resource data.
Two, when the type of the resource data that browser host process stores in shared drive between described process is Image type,
Browser host process is by between the resource data store of shared resource to process during shared drive, browser host process can first according to the image decoding rule that the data of Image type are corresponding, decoding process is carried out to the resource data of shared resource, obtain the data such as pixel value of the size of this view data, color format, each pixel, then the data after these decoding process to be stored between process in shared drive.
Corresponding to resource data store in shared drive between process with above-mentioned browser host process, browser subprocess obtains type when being the resource data of Image type, and the data that browser subprocess obtains from shared drive between process are the resource data of the mark correspondence of determined resource to be loaded.
As seen from the above, when the type of resource data is Image type, if when multiple browser subprocess all needs a certain storage resources between access process in shared drive, browser host process only need carry out an image decoding process, the requirements for access for each browser subprocess is not needed repeatedly to decode process, and browser subprocess only need obtain corresponding data from shared drive between process, and without the need to other internal memory operations.
Three, when the type of the resource data that browser host process stores in shared drive between described process is Binary type, JavaScript type, RegExp type or Text type,
Browser host process is by between the resource data store of shared resource to process during shared drive, and the raw data of the resource data of shared resource to be stored between process in shared drive by browser host process.
Corresponding to resource data store in shared drive between process with above-mentioned browser host process, when browser subprocess acquisition type is the resource data of JavaScript type or RegExp type, after browser subprocess is resolved the corresponding data that shared drive between process obtains, namely obtain the resource data of the mark correspondence of determined resource to be loaded.
More than comprehensive, when resource data is JavaScript type, RegExp type or Text type, if when multiple browser subprocess all needs a certain storage resources between access process in shared drive, the raw data of resource data only need be stored into shared drive between process by browser host process, does not want other any internal memory operation.
Due to upper visible, in the scheme that the embodiment of the present invention provides, by browser host process in advance by shared drive between resource data store to process, when browser subprocess need obtain the resource data of resource to be loaded, from shared drive between above-mentioned process, directly obtain relevant resource data.Compared with prior art, when the scheme that the application embodiment of the present invention provides obtains resource data, only need once from shared drive between process to the internal memory operation in the correspondence memory region of browser subprocess, and without the need to carrying out repeatedly internal memory operation, therefore, it is possible to saving memory source.
In one particular embodiment of the present invention, see Fig. 2, provide the another kind of schematic flow sheet based on the resource preparation method of multi-process browser, compared with previous embodiment, in the present embodiment,
According to the mark of determined resource to be loaded, judge the resource data (S102) that whether there is this mark correspondence between process in shared drive, concrete can be:
S102A: according to the Key value of determined resource to be loaded, in the Key-Value mapping table preset, judges the resource data that whether there is this mark correspondence between process in shared drive.
Obtain the resource data (S103) of the mark correspondence of determined resource to be loaded, comprising:
S103A: according to the Key value of determined resource to be loaded, from Key-Value mapping table, obtains the relative memory address of determined resource to be loaded.
S103B: between acquisition process, shared drive is for the mapping address of above-mentioned browser subprocess.
In practical application, one piece of shared drive region is generally only had in one station terminal, and the physical storage address of this shared drive is unique, but, browser subprocess is between access process during shared drive, directly cannot obtain the physical storage address of shared drive between this process, shared drive can only to be obtained between this process for the mapping address of this browser subprocess, and shared drive may be different for the mapping address in different browsers subprocess between this process, such as, between process, shared drive is 100 for the mapping address in a browser subprocess, may be then 1000 for the mapping address in another one browser subprocess.
Wherein, between process the physical storage address of shared drive and its for each browser subprocess mapping address between corresponding relation arranged and record by operating system.Operating system arranges above-mentioned corresponding relation and belongs to prior art, no longer describes in detail here.
S103C: according to obtained relative memory address and mapping address, determines the physical storage address of the resource data that the Key value of determined resource to be loaded is corresponding.
From aforementioned description, corresponding relation between process between the physical storage address of shared drive and mapping address is arranged and record by operating system, so, after obtaining mapping address, the physical storage address of shared drive between process can be obtained according to the mapping relations of operating system record, again due to memory address that obtained relative memory address is the start physical address relative to shared drive between process, so, the physical storage address of the resource data that the Key value of determined resource to be loaded is corresponding can be determined according to the physical storage address of shared drive between process and obtained relative memory address.
Suppose, the relative memory address obtained is D1, the mapping address obtained is D2, according to the mapping relations that it records, operating system determines that the physical storage address that D2 is corresponding is D3, then the physical storage address of the resource data that the Key value of determined resource to be loaded is corresponding is: D1+D3.
S103D: according to determined physical storage address, obtains the resource data that the Key value of determined resource to be loaded is corresponding.
As seen from the above, in the scheme that the present embodiment provides, by the physical storage address of the mapping address determination resource data of shared drive in browser subprocess between the relative memory address of resource data between process in shared drive and process, and obtain resource data according to this address, solve due to cannot pointer be shared between process in prior art, and the problem of the memory address of resource data cannot be obtained.
Below for RBTree, the resource data how obtaining a resource to be loaded is described.
Fig. 5 is RBTree schematic diagram, and Fig. 6 is the data structure schematic diagram of a node in Fig. 5 RBTree.
S101: suppose, browser subprocess determines that the Key value of resource to be loaded is 15.
Whether S102A: according to the Key value 15 of determined resource to be loaded, in the Key-Value mapping table preset, exist the resource data corresponding with this Key value according between following steps determination process in shared drive between process in shared drive:
In Fig. 5 RBTree, the left child nodes of start node 13 is 8, and right child nodes is 17, and due to 13 < 15, then the right child nodes 17 along start node 13 continues to judge;
The left child nodes of node 17 is 15, and right child nodes is 25, visible, and the left child nodes of node 17 is equal with the Key value 15 of the determined resource to be loaded of S101, therefore, there is the resource data of this resource to be loaded between process in shared drive.
S103A: the relative memory address D1 that can obtain the resource data of above-mentioned resource to be loaded according to node data structures.
S103B: the mapping address D2 of shared drive in current browser subprocess between acquisition process.
S103C: the mapping relations obtaining mapping address D2, operating system record according to S103B, and the relative memory address D1 that S103A obtains, determine the physical storage address of the resource data that the Key value of determined resource to be loaded is corresponding.
S103D: according to the physical storage address calculated, obtains the resource data that the Key value of determined resource to be loaded is corresponding.
Corresponding with the above-mentioned resource preparation method based on multi-process browser, the embodiment of the present invention additionally provides a kind of resource obtaining means based on multi-process browser.
The structural representation of a kind of resource obtaining means based on multi-process browser that Fig. 3 provides for the embodiment of the present invention, this device comprises: browser host process module 301 and browser subprocess module 302.
Wherein, browser host process module 301, comprising: resource data store submodule 3011;
Browser subprocess module 302, comprising: resource identification determination submodule 3021, resource data judge that submodule 3022 and resource data obtain submodule 3023.
Concrete, resource identification determination submodule 3021, for determining the mark of resource to be loaded;
Resource data judges submodule 3022, for the mark according to determined resource to be loaded, judges the resource data that whether there is this mark correspondence between process in shared drive, if exist, triggers described resource data acquisition submodule 3022 and obtains resource data;
Resource data obtains submodule 3023, for obtaining the resource data of the mark correspondence of determined resource to be loaded;
Resource data store submodule 3011, for prestoring resource data in shared drive between described process.
In a preferred embodiment of the invention, browser host process module 301 also comprises: memory address obtains submodule and mapping table renewal submodule (not shown) relatively.
Wherein, relative memory address obtains submodule, for after the resource data of described resource data store submodule Storage sharing resource, obtain the relative memory address of resource data between described process in shared drive of described shared resource, wherein, the relative memory address obtained is: relative to the memory address of the initial physical storage address of shared drive between described process;
Mapping table upgrades submodule, for according to the mark of described shared resource and obtained relative memory address, upgrade the Key-Value mapping table preset in shared drive between described process, wherein, Key represents the mark of described shared resource, Value value comprises: the relative memory address obtained, Key-Value mapping table, for storing the mapping relations between Key and Value.
In a preferred embodiment of the invention, browser host process module 301 also comprises: resource judgment submodule (not shown) to be loaded.
Wherein, resource judgment submodule to be loaded, for judging whether shared resource meets the shared resource decision rule preset, if meet, triggers the resource data that described resource data store submodule 3011 stores described shared resource.
Concrete, browser host process to the type of resource data store in shared drive between described process, comprise following several at least one:
JSON type, Image type, Binary type, JavaScript type, RegExp type and Text type.
Concrete, when the type of the resource data that browser host process stores in shared drive between described process is JSON type,
Resource data store submodule 3011, comprising: resource data resolution unit, serializing processing unit and the first data storage cell (not shown).
Wherein, resource data resolution unit, for according to resolution rules corresponding to the data of JSON type, resolves the resource data of shared resource;
Serializing processing unit, for carrying out serializing process to the resource data after parsing;
First data storage cell, for being stored between described process in shared drive by the data after serializing process.
Concrete, when the type of the resource data that browser host process stores in shared drive between described process is Image type,
Resource data store submodule 3011, comprising: codec processing unit and the second data storage cell (not shown).
Wherein, codec processing unit, regular for the image decoding corresponding according to the data of Image type, decoding process is carried out to the resource data of shared resource;
Second data storage cell, for being stored between described process in shared drive by the data after decoding process.
Concrete, when the type of the resource data that browser host process stores in shared drive between described process is Binary type, JavaScript type, RegExp type or Text type,
Resource data store submodule 3011, the raw data specifically for the resource data by shared resource to be stored between described process in shared drive.
Due to upper visible, in the scheme that the embodiment of the present invention provides, by browser host process in advance by shared drive between resource data store to process, when browser subprocess need obtain the resource data of resource to be loaded, from shared drive between above-mentioned process, directly obtain relevant resource data.Compared with prior art, when the scheme that the application embodiment of the present invention provides obtains resource data, only need once from shared drive between process to the internal memory operation in the correspondence memory region of browser subprocess, and without the need to carrying out repeatedly internal memory operation, therefore, it is possible to saving memory source.
In one particular embodiment of the present invention, see Fig. 4, provide the another kind of structural representation based on the resource obtaining means of multi-process browser, compared with previous embodiment, in the present embodiment, resource data obtains submodule 3023, comprising: data index value obtains unit 30231, mapping address obtains unit 30232, physical storage address determining unit 30233 and resource data and obtains unit 30234.
Wherein, data index value obtains unit 30231, for the Key value according to determined resource to be loaded, from described Key-Value mapping table, obtains the relative memory address of determined resource to be loaded;
Mapping address obtains unit 30232, for obtaining between described process shared drive for the mapping address of described browser subprocess;
Physical storage address determining unit 30233, for according to obtained data index value and mapping address, determines the physical storage address of the resource data that the Key value of determined resource to be loaded is corresponding;
Resource data obtains unit 30234, for according to determined physical storage address, obtains the resource data that the Key value of determined resource to be loaded is corresponding.
As seen from the above, in the scheme that the present embodiment provides, by the physical storage address of the mapping address determination resource data of shared drive in browser subprocess between the relative memory address of resource data between process in shared drive and process, and obtain resource data according to this address, solve due to cannot pointer be shared between process in prior art, and the problem of the memory address of resource data cannot be obtained.
For device embodiment, because it is substantially similar to embodiment of the method, so description is fairly simple, relevant part illustrates see the part of embodiment of the method.
It should be noted that, in this article, the such as relational terms of first and second grades and so on is only used for an entity or operation to separate with another entity or operational zone, and not necessarily requires or imply the relation that there is any this reality between these entities or operation or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or equipment.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment comprising described key element and also there is other identical element.
One of ordinary skill in the art will appreciate that all or part of step realized in said method embodiment is that the hardware that can carry out instruction relevant by program has come, described program can be stored in computer read/write memory medium, here the alleged storage medium obtained, as: ROM/RAM, magnetic disc, CD etc.
The foregoing is only preferred embodiment of the present invention, be not intended to limit protection scope of the present invention.All any amendments done within the spirit and principles in the present invention, equivalent replacement, improvement etc., be all included in protection scope of the present invention.

Claims (16)

1. based on a resource preparation method for multi-process browser, it is characterized in that, described method comprises:
Browser subprocess determines the mark of resource to be loaded;
According to the mark of determined resource to be loaded, judge the resource data that whether there is this mark correspondence between process in shared drive, wherein, the resource data between described process in shared drive, is prestored by browser host process;
If exist, obtain the resource data of the mark correspondence of determined resource to be loaded.
2. method according to claim 1, is characterized in that, between browser host process is by the resource data store of shared resource to described process after shared drive, also comprises:
Obtain the relative memory address of resource data between described process in shared drive of described shared resource, wherein, the relative memory address obtained is: relative to the memory address of the initial physical storage address of shared drive between described process;
According to mark and the obtained relative memory address of described shared resource, upgrade the Key-Value mapping table preset in shared drive between described process, wherein, Key represents the mark of described shared resource, Value value comprises: the relative memory address obtained, Key-Value mapping table, for storing the mapping relations between Key and Value.
3. method according to claim 2, is characterized in that, between browser host process is by the resource data store of shared resource to described process before shared drive, also comprises:
Browser host process judges whether shared resource meets the shared resource decision rule preset;
If meet, then perform browser host process by the step of shared drive between the resource data store of shared resource to described process.
4. according to the method in claim 2 or 3, it is characterized in that, the resource data of the mark correspondence of the determined resource to be loaded of described acquisition, comprising:
According to the Key value of determined resource to be loaded, from described Key-Value mapping table, obtain the relative memory address of determined resource to be loaded;
To obtain between described process shared drive for the mapping address of described browser subprocess;
According to obtained relative memory address and mapping address, determine the physical storage address of the resource data that the Key value of determined resource to be loaded is corresponding;
According to determined physical storage address, obtain the resource data that the Key value of determined resource to be loaded is corresponding.
5. method according to claim 1, is characterized in that, browser host process to the type of resource data store in shared drive between described process, comprise following several at least one:
JSON type, Image type, Binary type, JavaScript type, RegExp type and Text type.
6. method according to claim 5, is characterized in that, when the type of the resource data that browser host process stores in shared drive between described process is JSON type,
Browser host process, by the method for shared drive between the resource data store of shared resource to described process, comprising:
Browser host process, according to resolution rules corresponding to the data of JSON type, is resolved the resource data of shared resource;
Serializing process is carried out to the resource data after resolving;
Data after serializing process to be stored between described process in shared drive.
7. method according to claim 5, is characterized in that, when the type of the resource data that browser host process stores in shared drive between described process is Image type,
Browser host process, by the method for shared drive between the resource data store of shared resource to described process, comprising:
Browser host process is regular according to the image decoding that the data of Image type are corresponding, carries out decoding process to the resource data of shared resource;
Data after decoding process to be stored between described process in shared drive.
8. method according to claim 5, is characterized in that, when the type of the resource data that browser host process stores in shared drive between described process is Binary type, JavaScript type, RegExp type or Text type,
Browser host process, by the method for shared drive between the resource data store of shared resource to described process, comprising:
The raw data of the resource data of shared resource to be stored between described process in shared drive by browser host process.
9. based on a resource obtaining means for multi-process browser, it is characterized in that, described device comprises:
Browser host process module and browser subprocess module;
Wherein, described browser host process module, comprising: resource data store submodule;
Described browser subprocess module, comprising: resource identification determination submodule, resource data judge that submodule and resource data obtain submodule;
Described resource identification determination submodule, for determining the mark of resource to be loaded;
Described resource data judges submodule, for the mark according to determined resource to be loaded, judges the resource data that whether there is this mark correspondence between process in shared drive, if exist, triggers described resource data and obtains submodule acquisition resource data;
Described resource data obtains submodule, for obtaining the resource data of the mark correspondence of determined resource to be loaded;
Described resource data store submodule, for prestoring resource data in shared drive between described process.
10. device according to claim 9, is characterized in that, described browser host process module also comprises:
Relative memory address obtains submodule, for after the resource data of described resource data store submodule Storage sharing resource, obtain the relative memory address of resource data between described process in shared drive of described shared resource, wherein, the relative memory address obtained is: relative to the memory address of the initial physical storage address of shared drive between described process;
Mapping table upgrades submodule, for according to the mark of described shared resource and obtained relative memory address, upgrade the Key-Value mapping table preset in shared drive between described process, wherein, Key represents the mark of described shared resource, Value value comprises: the relative memory address obtained, Key-Value mapping table, for storing the mapping relations between Key and Value.
11. devices according to claim 10, is characterized in that, described browser host process module also comprises:
Resource judgment submodule to be loaded, for judging whether shared resource meets the shared resource decision rule preset, if meet, triggers the resource data that described resource data store submodule stores described shared resource.
12. devices according to claim 10 or 11, is characterized in that, described resource data obtains submodule, comprising:
Data index value obtains unit, for the Key value according to determined resource to be loaded, from described Key-Value mapping table, obtains the relative memory address of determined resource to be loaded;
Mapping address obtains unit, for obtaining between described process shared drive for the mapping address of described browser subprocess;
Physical storage address determining unit, for according to obtained data index value and mapping address, determines the physical storage address of the resource data that the Key value of determined resource to be loaded is corresponding;
Resource data obtains unit, for according to determined physical storage address, obtains the resource data that the Key value of determined resource to be loaded is corresponding.
13. devices according to claim 9, is characterized in that, browser host process to the type of resource data store in shared drive between described process, comprise following several at least one:
JSON type, Image type, Binary type, JavaScript type, RegExp type and Text type.
14. devices according to claim 13, is characterized in that, when the type of the resource data that browser host process stores in shared drive between described process is JSON type,
Described resource data store submodule, comprising:
Resource data resolution unit, for according to resolution rules corresponding to the data of JSON type, resolves the resource data of shared resource;
Serializing processing unit, for carrying out serializing process to the resource data after parsing;
First data storage cell, for being stored between described process in shared drive by the data after serializing process.
15. devices according to claim 13, is characterized in that, when the type of the resource data that browser host process stores in shared drive between described process is Image type,
Described resource data store submodule, comprising:
Codec processing unit, regular for the image decoding corresponding according to the data of Image type, decoding process is carried out to the resource data of shared resource;
Second data storage cell, for being stored between described process in shared drive by the data after decoding process.
16. devices according to claim 13, is characterized in that, when the type of the resource data that browser host process stores in shared drive between described process is Binary type, JavaScript type, RegExp type or Text type,
Described resource data store submodule, the raw data specifically for the resource data by shared resource to be stored between described process in shared drive.
CN201410504006.2A 2014-09-26 2014-09-26 Resource obtaining method and device based on multi-process browser Active CN104268229B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410504006.2A CN104268229B (en) 2014-09-26 2014-09-26 Resource obtaining method and device based on multi-process browser

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410504006.2A CN104268229B (en) 2014-09-26 2014-09-26 Resource obtaining method and device based on multi-process browser

Publications (2)

Publication Number Publication Date
CN104268229A true CN104268229A (en) 2015-01-07
CN104268229B CN104268229B (en) 2018-01-19

Family

ID=52159751

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410504006.2A Active CN104268229B (en) 2014-09-26 2014-09-26 Resource obtaining method and device based on multi-process browser

Country Status (1)

Country Link
CN (1) CN104268229B (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105955971A (en) * 2015-11-30 2016-09-21 中国银联股份有限公司 Key value buffer memory implementation method and device
CN106056530A (en) * 2016-06-01 2016-10-26 腾讯科技(深圳)有限公司 Method and device for displaying picture content in application
CN109543437A (en) * 2018-11-30 2019-03-29 人教数字出版有限公司 A kind of load resource allocation method and device
CN109582458A (en) * 2017-09-28 2019-04-05 北京国双科技有限公司 Resource information loading method, device, storage medium and processor
CN109729362A (en) * 2019-01-10 2019-05-07 高新兴科技集团股份有限公司 Video decodes playback method, device, computer storage medium and electronic equipment
CN111124685A (en) * 2019-12-26 2020-05-08 神州数码医疗科技股份有限公司 Big data processing method and device, electronic equipment and storage medium
CN111182060A (en) * 2019-12-30 2020-05-19 北京健康之家科技有限公司 Message detection method and device
CN111382200A (en) * 2018-12-29 2020-07-07 北京中交兴路信息科技有限公司 Information loading method and device, server and storage medium
CN111760293A (en) * 2020-07-07 2020-10-13 网易(杭州)网络有限公司 Dynamic resource loading method and device for time axis tool and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103530329A (en) * 2013-09-27 2014-01-22 北京奇虎科技有限公司 Method and device for performing webpage loading and browsers
US8683099B1 (en) * 2012-06-14 2014-03-25 Emc Corporation Load balancing of read/write accesses on a single host device
CN103699535A (en) * 2012-09-27 2014-04-02 联想(北京)有限公司 Webpage loading method and terminal equipment
CN103701911A (en) * 2013-12-30 2014-04-02 百度在线网络技术(北京)有限公司 Method and device for downloading through browser
CN103838839A (en) * 2011-09-26 2014-06-04 北京奇虎科技有限公司 Page download control method and system of IE kernel browser
CN103902675A (en) * 2011-02-18 2014-07-02 北京奇虎科技有限公司 Method and device for browser process allocation

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103902675A (en) * 2011-02-18 2014-07-02 北京奇虎科技有限公司 Method and device for browser process allocation
CN103838839A (en) * 2011-09-26 2014-06-04 北京奇虎科技有限公司 Page download control method and system of IE kernel browser
US8683099B1 (en) * 2012-06-14 2014-03-25 Emc Corporation Load balancing of read/write accesses on a single host device
CN103699535A (en) * 2012-09-27 2014-04-02 联想(北京)有限公司 Webpage loading method and terminal equipment
CN103530329A (en) * 2013-09-27 2014-01-22 北京奇虎科技有限公司 Method and device for performing webpage loading and browsers
CN103701911A (en) * 2013-12-30 2014-04-02 百度在线网络技术(北京)有限公司 Method and device for downloading through browser

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105955971A (en) * 2015-11-30 2016-09-21 中国银联股份有限公司 Key value buffer memory implementation method and device
CN105955971B (en) * 2015-11-30 2019-09-17 中国银联股份有限公司 A kind of implementation method and device of key assignments caching
CN106056530B (en) * 2016-06-01 2019-12-06 腾讯科技(深圳)有限公司 Method and device for displaying picture content in application
CN106056530A (en) * 2016-06-01 2016-10-26 腾讯科技(深圳)有限公司 Method and device for displaying picture content in application
US10825130B2 (en) 2016-06-01 2020-11-03 Tencent Technology (Shenzhen) Company Limited Method and apparatus for displaying picture content in application, and storage medium
US10636113B2 (en) 2016-06-01 2020-04-28 Tencent Technology (Shenzhen) Company Limited Method and apparatus for displaying picture content in application, and storage medium
CN109582458A (en) * 2017-09-28 2019-04-05 北京国双科技有限公司 Resource information loading method, device, storage medium and processor
CN109543437A (en) * 2018-11-30 2019-03-29 人教数字出版有限公司 A kind of load resource allocation method and device
CN111382200A (en) * 2018-12-29 2020-07-07 北京中交兴路信息科技有限公司 Information loading method and device, server and storage medium
CN109729362A (en) * 2019-01-10 2019-05-07 高新兴科技集团股份有限公司 Video decodes playback method, device, computer storage medium and electronic equipment
CN111124685A (en) * 2019-12-26 2020-05-08 神州数码医疗科技股份有限公司 Big data processing method and device, electronic equipment and storage medium
CN111182060A (en) * 2019-12-30 2020-05-19 北京健康之家科技有限公司 Message detection method and device
CN111760293A (en) * 2020-07-07 2020-10-13 网易(杭州)网络有限公司 Dynamic resource loading method and device for time axis tool and electronic equipment
CN111760293B (en) * 2020-07-07 2024-02-09 网易(杭州)网络有限公司 Dynamic loading method and device for resources of time axis tool and electronic equipment

Also Published As

Publication number Publication date
CN104268229B (en) 2018-01-19

Similar Documents

Publication Publication Date Title
CN104268229A (en) Resource obtaining method and device based on multi-process browser
US11003625B2 (en) Method and apparatus for operating on file
US9536261B2 (en) Resolving conflicts within saved state data
US9558016B2 (en) Platform system, method for changing support hardware configuration of universal extensible firmware interface basic input output system and computer program product
KR20200043467A (en) Method and terminal device for extracting web page content
CN104866383A (en) Interface calling method and device and terminal
US11086638B2 (en) Method and apparatus for loading application
CN113158110B (en) Data processing method and device
CN102567485B (en) The special parsing of provider for content retrieval
US10649905B2 (en) Method and apparatus for storing data
CN108268609B (en) File path establishing and accessing method and device
CN109388766A (en) The method and apparatus of page load
US9785720B2 (en) Script optimized browser rendering process
CN103530160A (en) Page loading method and device
CN111274512A (en) Page loading method, device and medium
US20190294450A1 (en) Method for Interface Refresh Synchronization,Terminal Device, and Non-Transitory Computer-Readable Storage Medium
CN108255434B (en) Label management method, management device and computer readable storage medium
CN111079048A (en) Page loading method and device
CN113127430B (en) Mirror image information processing method, mirror image information processing device, computer readable medium and electronic equipment
CN106502707B (en) Code generation method and device
CN113297267A (en) Data caching and task processing method, device, equipment and storage medium
CN117435569A (en) Dynamic capacity expansion method, device, equipment, medium and program product for cache system
CN105144073A (en) Removable storage device identity and configuration information
CN113486025B (en) Data storage method, data query method and device
JP5975003B2 (en) Virtualization control device, virtualization system, virtualization method, and virtualization control program.

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: 20181212

Address after: Room 105-53811, No. 6 Baohua Road, Hengqin New District, Zhuhai City, Guangdong Province

Patentee after: Zhuhai Leopard Technology Co.,Ltd.

Address before: 100085 East District, Second Floor, 33 Xiaoying West Road, Haidian District, Beijing

Patentee before: BEIJING KINGSOFT INTERNET SECURITY SOFTWARE Co.,Ltd.

TR01 Transfer of patent right