CN105843691B - Method and device for interprocess communication in browser - Google Patents

Method and device for interprocess communication in browser Download PDF

Info

Publication number
CN105843691B
CN105843691B CN201610159007.7A CN201610159007A CN105843691B CN 105843691 B CN105843691 B CN 105843691B CN 201610159007 A CN201610159007 A CN 201610159007A CN 105843691 B CN105843691 B CN 105843691B
Authority
CN
China
Prior art keywords
bho
memory space
data
target memory
frame
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.)
Expired - Fee Related
Application number
CN201610159007.7A
Other languages
Chinese (zh)
Other versions
CN105843691A (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
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 filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201610159007.7A priority Critical patent/CN105843691B/en
Publication of CN105843691A publication Critical patent/CN105843691A/en
Application granted granted Critical
Publication of CN105843691B publication Critical patent/CN105843691B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes

Abstract

The invention provides a method and a device for interprocess communication in a browser, wherein the method comprises the following steps: a FRAME process of the browser serializes the data to be transmitted; the FRAME process allocates a first target memory space in the virtual address space of the FRAME process, and copies and acquires serialized data to the first target memory space; the FRAME process asynchronously sends first notification information to a browser auxiliary object (BHO) process, wherein the notification information carries address information of a first target memory space and a process identifier of the FRAME process; receiving second notification information returned by the BHO process, and notifying that the processing of the transmission data in the BHO process is finished; and releasing the allocated first target memory space. Because different data are respectively stored in different corresponding memory space sections, the BHO process cannot read the data incorrectly, and the efficiency of interprocess communication in the browser is improved.

Description

Method and device for interprocess communication in browser
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for interprocess communication in a browser.
Background
A process is a running activity of a program with independent functionality with respect to a certain data set. It can apply for and own system resources, and is a dynamic concept, an active entity. Each process has a private address space, which typically includes a code segment, a data segment, and a stack segment. The code segment stores code executed by the processor; a data segment storage variable and a dynamically allocated memory used during process execution; the stack segment stores the instructions and local variables of the active procedure call.
With the development of technology, single-process programs have been unable to meet the needs of people in many situations. How to write multi-process programs has become the focus of modern programming technology. In a multiprocess program, interaction and sharing of data is inevitable. For example, some browsers support a multi-process mode, and page a and page B do not run in the same process, but need to share data between them frequently.
The Microsoft Win32 API provides a variety of ways for processes to communicate, such as shared memory, clipboard, and the like. Referring to fig. 1, a schematic flow chart of a process communication method in a shared memory manner in a browser in the prior art is shown, where a process a and a process B use the same shared memory area, the process a sends data 1 to the shared memory area and notifies the process B to receive the data, and at this time, the process B may be busy with other transactions and does not operate on the data in the shared memory area in time; at this time, if the process a sends the data 2 to the shared memory, the process B now starts to process the message, and operates the data in the shared memory area, which may cause a problem of read-write confusion, affecting the execution accuracy of the process.
In order to avoid the problem of disordered reading and writing, a process communication method of the existing shared memory mode adopts a certain remedy mechanism, namely, process a sends data to a shared memory area, process B receives a message and operates, and after the execution is finished, process a is informed, and at this time, process a can read and write the shared memory area again. However, if the above-mentioned remediation mechanism is adopted, the process a cannot write data at any time when the data needs to be written, but the next operation can be performed only after the process B is executed, which seriously affects the execution efficiency of the process a and the communication efficiency of the process, for example, the efficiency of loading the browser page, etc.
In summary, one of the technical problems that needs to be urgently solved by those skilled in the art is: how to ensure that the execution efficiency of process communication is improved under the condition that the read-write disorder does not occur in the communication among a plurality of processes in the browser.
Disclosure of Invention
The technical problem to be solved by the present invention is to provide a method and a device for inter-process communication in a browser, so as to improve the execution efficiency of inter-process communication under the condition of ensuring that the inter-process communication is not disordered.
In order to solve the above problem, the present invention discloses a method for inter-process communication in a browser, comprising:
a FRAME process of the browser serializes the data to be transmitted;
the FRAME process allocates a first target memory space in the virtual address space of the FRAME process, and copies and acquires serialized data to the first target memory space;
the FRAME process asynchronously sends first notification information to a browser auxiliary object (BHO) process, wherein the notification information carries address information of a first target memory space and a process identifier of the FRAME process;
receiving second notification information returned by the BHO process, and notifying that the processing of the transmission data in the BHO process is finished;
and releasing the allocated first target memory space.
Preferably, the step of allocating a first target memory space in the virtual address space of the FRAME process, and copying and acquiring the serialized data into the first target memory space includes:
acquiring the first address and data length information of the serialized data;
according to the data length information, allocating a first target memory space in the virtual address space of the FRAME process;
and copying the serialized data to a distributed first target memory space according to the first address of the serialized data.
Preferably, the step of the FRAME process performing the serialization operation on the transmission data further includes:
and carrying out serialization operation on the to-be-transmitted data by adopting reload operators, wherein the to-be-transmitted data of different data types correspond to different reload operators.
Preferably, the second notification information further includes:
address information of the allocated first target memory space and the FRAME process identifier;
the step of releasing the allocated first target memory space further comprises:
determining to process the FRAME process according to the FRAME process identification in the second notification information, and obtaining a process object handle of the FRAME process;
and releasing the first target memory space allocated by the FRAME process according to the process object handle of the FRAME process and the address information of the first target memory space in the second notification information. 5. The method of claim 1, further comprising:
receiving third notification information sent by a BHO process of the browser, wherein the third notification information carries address information of a second target memory space distributed in the BHO process and a process identifier of the BHO process;
acquiring a process object handle of the BHO process according to the process identifier of the BHO process;
acquiring data for processing according to the address information of the second target memory space by using the process object handle;
and after the processing is finished, sending fourth notification information to the BHO process, and notifying the FRAME process of the BHO process browser of finishing the processing of the data in the second target memory space.
Preferably, the fourth notification information further includes:
address information of the allocated second target memory space and a process identifier of the BHO process.
Preferably, the browser auxiliary object process BHO is a BHO subprocess of a control for login.
Preferably, the browser helper object process BHO is two or more BHO processes.
In order to solve the above problem, the present invention also discloses a method for inter-process communication in a browser, comprising:
an auxiliary object process BHO of the browser carries out serialization operation on the data to be transmitted;
the BHO process allocates a third target memory space in the virtual address space of the BHO process and copies serialized data to the third target memory space;
the BHO process synchronously sends fifth notification information to a FRAME FRAME process of the browser, wherein the notification information carries address information of a third target memory space and a process identifier of the BHO process;
receiving sixth notification information returned by the FRAME process of the browser, and notifying that the processing of the transmission data in the FRAME process is finished;
and releasing the allocated third target memory space.
Preferably, the step of the BHO process allocating a third target memory space in its virtual address space and copying the serialized data to the third target memory space includes:
acquiring the first address and data length information of the serialized data;
distributing a third target memory space in the virtual address space of the BHO process according to the data length information;
and copying the serialized data to a distributed third target memory space according to the first address of the serialized data.
Preferably, the sixth notification information further includes:
address information of the allocated third target memory space and a process identifier of the BHO process;
the step of releasing the allocated third target memory space includes:
determining to process the BHO process according to the process identifier of the BHO process in the sixth notification message, and obtaining a process object handle of the BHO process;
and releasing the third target memory space allocated by the frame BHO process according to the process object handle of the BHO process and the address information of the third target memory space in the sixth notification message.
Preferably, the method further comprises the following steps:
receiving seventh notification information sent by a FRAME process of a browser, wherein the seventh notification information carries address information of a fourth target memory space allocated in the FRAME process and a process identifier of the FRAME process;
acquiring a process object handle of the FRAME process according to the process identification of the FRAME process;
acquiring data for processing according to the address information of the fourth target memory space by using the process object handle;
and sending eighth notification information to the FRAME process after the processing is finished, and notifying the FRAME process that the BHO process finishes processing the data in the fourth target memory space.
Preferably, the eighth notification information further includes:
address information of the allocated fourth target memory space and a process identification of the FRAME process.
Preferably, the browser auxiliary object process is a BHO subprocess of a login control.
Preferably, the browser helper object process BHO is two or more BHO processes.
In order to solve the above problem, the present invention also discloses a device for interprocess communication in a browser, which comprises:
the first data serialization module is configured to perform serialization operation on the transmission data by a FRAME process FRAME of the browser;
a first memory space obtaining module configured to allocate a first target memory space in a virtual address space of the FRAME process, and copy and obtain serialized data into the first target memory space;
a first notification information sending module, configured to asynchronously send, by the FRAME process, first notification information to a browser auxiliary object process BHO, where the notification information carries address information of a first target memory space and a process identifier of the FRAME process;
the second notification information receiving module is configured to receive second notification information returned by the browser auxiliary object process BHO and notify that the processing of the transmission data in the BHO process is finished;
a first memory space releasing module configured to release the allocated first target memory space.
Preferably, the first memory space obtaining module includes:
a first data extraction unit configured to acquire a head address and data length information of the serialized data;
a first memory space allocation unit configured to allocate a first target memory space in a virtual address space of the FRAME process according to the data length information;
and the first data copying unit is configured to copy the serialized data to the allocated first target memory space according to the first address of the serialized data.
Preferably, the first data serialization module includes:
and the reloading unit is configured to carry out serialization operation on the to-be-transmitted data by adopting a reloading operator, wherein the to-be-transmitted data of different data types correspond to different reloading operators.
Preferably, the second notification information further includes:
address information of the allocated first target memory space and the FRAME process identifier;
the first memory space releasing module further includes:
a second memory release unit configured to:
determining to process the FRAME process according to the FRAME process identification in the second notification information, and obtaining a process object handle of the FRAME process;
and releasing the first target memory space allocated by the FRAME process according to the process object handle of the FRAME process and the address information of the first target memory space in the second notification information.
Preferably, the method further comprises the following steps:
a third notification information receiving module, configured to receive third notification information sent by a BHO process of the browser, where the third notification information carries address information of a second target memory space allocated in the BHO process and a process identifier of the BHO process;
a first process handle obtaining module configured to obtain a process object handle of the BHO process according to the process identifier of the BHO process;
the second data processing module is configured to use the process object handle to acquire data according to the address information of the second target memory space for processing;
and the fourth notification information sending module is configured to send fourth notification information to the BHO process after the processing is finished, and notify the FRAME process of the BHO process browser of finishing processing the data in the second target memory space.
Preferably, the fourth notification information further includes:
address information of the allocated second target memory space and a process identifier of the BHO process.
Preferably, the browser auxiliary object process BHO is a BHO subprocess of a control for login.
Preferably, the browser helper object process BHO is two or more BHO processes.
In order to solve the above problem, the present invention also discloses a device for interprocess communication in a browser, which comprises:
the second data serialization module is configured to perform serialization operation on the to-be-transmitted data by an auxiliary object process BHO of the browser;
a third memory space obtaining module configured to allocate a third target memory space in the virtual address space of the BHO process, and copy the serialized data to the third target memory space;
a fifth notification information sending module, configured to send fifth notification information to a FRAME process of a browser synchronously by the BHO process, where the notification information carries address information of a third target memory space and a process identifier of the BHO process;
a sixth notification information receiving module configured to receive sixth notification information returned by the FRAME process of the browser, and notify that the processing of the transmission data in the FRAME process is finished;
a third memory space releasing module configured to release the allocated third target memory space.
Preferably, the third memory space obtaining module includes:
a third data extraction unit configured to acquire a head address and data length information of the serialized data;
a third memory space allocation unit configured to allocate a third target memory space in the virtual address space of the BHO process according to the data length information;
and the third data copying unit is configured to copy the serialized data to a distributed third target memory space according to the first address of the serialized data.
Preferably, the sixth notification information further includes:
address information of the allocated third target memory space and a process identifier of the BHO process;
the third memory space releasing module further includes:
a third memory release unit configured to:
determining to process the BHO process according to the process identifier of the BHO process in the sixth notification message, and obtaining a process object handle of the BHO process;
and releasing the third target memory space allocated by the frame BHO process according to the process object handle of the BHO process and the address information of the third target memory space in the sixth notification message.
Preferably, the method further comprises the following steps:
a seventh notification information receiving module, configured to receive seventh notification information sent by a FRAME process of a browser, where the seventh notification information carries address information of a fourth target memory space allocated in the FRAME process and a process identifier of the FRAME process;
a second process handle acquiring module configured to acquire a process object handle of the FRAME process according to the process identification of the FRAME process;
a fourth data processing module configured to acquire data for processing according to the address information of the fourth target memory space using the process object handle;
an eighth notification message sending module, configured to send eighth notification messages to the FRAME process after the processing is finished, and notify the FRAME process that the BHO process finishes processing the data in the fourth target memory space.
Preferably, the eighth notification information further includes:
address information of the allocated fourth target memory space and a process identification of the FRAME process.
Preferably, the browser auxiliary object process is a BHO subprocess of a login control.
Preferably, the browser helper object process BHO is two or more BHO processes.
Compared with the prior art, the invention has the following advantages:
communication among a plurality of processes in the existing browser is to read and write data in a shared memory mode, but the processes often cannot acquire data from the shared memory in time, so that the problem of disordered data reading and writing is easily caused. The browser FRAME FRAME process or the browser auxiliary object process BHO carries out serialization operation on data before sending the data, then allocates a first target memory space in a virtual address space of the data, copies the serialized data to the first target memory space, and then sends notification information carrying address information of the first target memory space and a process identifier of a sender, and a process of a receiver can complete reading and writing of the data in the first target memory space based on the notification information. Because different data (such as data 1 and data 2) are respectively stored in different corresponding memory space segments (such as the memory space segment 1 and the memory space segment 2), even if the sending party process writes the data 2 into the memory space segment 2 before the receiving party process reads the data 1 and sends a message to inform the receiving party process to read the data 2, the receiving party process can not read wrong data, and the sending party process can send new data without waiting for the receiving party process to finish processing operations such as reading and the like.
In addition, the invention takes the data after the serialization operation as the storage object of the memory space, so the invention can support the storage of infinite depth data and is convenient for the interaction of a large number of complex data structures.
Drawings
Fig. 1 is a schematic flow chart illustrating a method for process communication in a shared memory manner in a browser in the prior art;
FIG. 2 is a flowchart illustrating an embodiment 1 of a method for inter-process communication in a browser according to the present invention;
FIG. 3 is a flow chart of embodiment 2 of the method for inter-process communication in a browser according to the present invention;
FIG. 4 is a flowchart illustrating an embodiment 3 of a method for inter-process communication in a browser according to the present invention;
FIG. 5 is a flow chart illustrating an application embodiment of a method for inter-process communication in a browser according to the present invention;
FIG. 6 is a schematic structural diagram illustrating an embodiment of an inter-process communication apparatus in a browser according to the present invention;
fig. 7 is a schematic structural diagram of another embodiment of an interprocess communication device in a browser according to the invention.
Detailed Description
In order to make the above objects, features and advantages of the present invention more comprehensible, the present invention will be described in further detail with reference to the accompanying drawings and the detailed description, taking a Browser FRAME process (FRAME) as a sender process and a BHO (Browser Helper Object) process as a receiver process as an example.
Referring to fig. 2, fig. 2 is a flow chart illustrating an embodiment of a method for inter-process communication in a browser according to the present invention, where the method includes:
in step 201, the FRAME process serializes the data to be transmitted.
Firstly, performing serialization operation on to-be-transmitted data, creating a serialization object, and recording information such as a first address, a current address and the total size of a memory of the serialization memory in the serialization object; and secondly, storing the data to be transmitted into the serialized memory. Specifically, the data after the serialization operation is completed may be sequentially stored in the corresponding serialization memory according to the total memory size recorded in the serialization object.
For example, the total size of the corresponding serialized memory is 4GB, the first address is 0x00000000, it is assumed that there are 5 pieces of data sent to the receiver process, and the sizes after the serialization operation are 0.1G, 0.2G, 0.5G, 0.6G, and 0.8G, and it is assumed that these 5 pieces of data are stored in the serialized memory in sequence, the current address changes continuously with each storage.
Different data types such as character strings, integers and the like, the structural bodies of the data types are partitioned and are discontinuous sections of spaces in the memory space, and the originally discontinuous sections of memory spaces of the data can be changed into a continuous section of memory addresses by performing serialization operation on the data, so that the memory space can be allocated for the data structure with any depth in the structural body, and the deep copying of the data is ensured.
In another preferred embodiment of the present invention, the step of the FRAME process performing the serialization operation on the transmission data further comprises: and carrying out serialization operation on the to-be-transmitted data by adopting reload operators, wherein the to-be-transmitted data of different data types correspond to different reload operators.
The preferred embodiment serializes the incoming data using the reload operator < < to do so. Assuming that the name of the serialized object is CSerializeObject & obj, obj < < m _ nId; and the obj < < m _ strGenName and the like carry the operator. The "<" operator can perform different memory allocations for different data types after being reloaded for multiple times. For example, for data of int type, the allocation manner may be: memcpy (pBuff, & nValue, sizeof (int)); for string type data, the allocation mode may be: tcscpy (pStr, strvalue. c _ str ()).
For the reloading operators used for other types of data, it is sufficient to refer to each other, and this is not listed here.
In step 202, the FRAME process allocates a target memory space in its virtual address space, and copies the obtained serialized data to the target memory space.
In another preferred embodiment of the present invention, step 202 further comprises:
acquiring the first address and data length information of the serialized data; according to the data length information, allocating a target memory space in a virtual address space of the FRAME process; and copying the serialized data to the allocated target memory space according to the first address of the serialized data.
Specifically, the method comprises the following steps:
firstly, calling obj.GetBuffer (& ltlpData, & dwLength) to obtain the memory initial address and length after data serialization;
next, a call to VirtualAllocEx (GetCurrentProcess (), NULL, sizeof (twhmessage), MEM _ COMMIT, PAGE _ READWRITE) gets a block of memory in the address space of the process. The process control method comprises the following steps that a first parameter GetCurrentProcess () can obtain a process handle, a second parameter is NULL and represents the position to which a function determines to allocate, a third parameter is the size of a memory, a fourth parameter represents the allocation of a memory space, and a fifth parameter represents the permission of read-write operation;
finally, memcpy is called to copy the previously serialized memory into the allocated target memory space.
Step 203, the FRAME process asynchronously sends notification information to the BHO process, where the notification information carries address information of the target memory space and the process identifier of the FRAME process.
The target memory space address information and the FRAME process identifier carried in the notification information sent to the BHO process are a pointer of the target memory space and a process ID of the FRAME process, respectively.
The browser helper object BHO is an industry standard for browser-to-third-party programmers to open an interactive interface, which is simply a code to enter the browser domain's "interactive interface" (INTERACTIVED Interface). Through the interface, a programmer can write codes to acquire the behaviors of the browser, such as 'back', 'forward', 'current page', and the like, and by utilizing the interactive characteristic of the BHO, the programmer can also control the browser behaviors by using the codes, such as modifying a tool bar of a replacement browser, adding own program buttons, and the like.
The BHO object is hosted on the browser main window. In practice, this means that once a browser window is generated, a new BHO object instance is generated. Any BHO object is consistent with the lifecycle of the browser instance
Preferably, the BHO process in the embodiment of the present invention is a BHO sub-process of a control for login, and the login control is added to the browser in the form of a button and is used for processing a login form in a web tag in a browser window; when a plurality of tab pages are opened in the browser window at the same time, the number of the corresponding BHO processes is also multiple, wherein each tab page is a BHO sub-process.
And step 204, the FRAME process receives the notification information returned by the BHO process and notifies that the processing of the transmission data in the BHO process is finished.
In step 205, the allocated first target memory space is released.
After the BHO process finishes processing the data in the target memory space, the FRAME process releases the target memory space to save system resources.
In another preferred embodiment of the present invention, the notification information returned by the BHO process in step 204 further includes: address information of the allocated target memory space and the FRAME process identification;
the step 204 of releasing the allocated first target memory space further includes:
firstly, according to the FRAME process identification in BHO return notification information, the FRAME process is determined to be processed, and a process object handle of the FRAME process is obtained. Specifically, an OpenProcess function is called (an important parameter is a sender process ID, that is, a FRAME process identifier in the FRAME return notification message), and a process object handle of the sender is obtained.
Secondly, according to the process object handle of the FRAME process and the address information of the target memory space in the BHO return notification information, releasing the target memory space allocated by the FRAME process. Specifically, a VirtualFreeEx function release (important parameters are the process handle obtained in the last step and the data pointer of the previously allocated memory) is called, and a CloseHandle function is called to close the thread handle.
In another preferred embodiment of the present invention, the method further comprises:
the FRAME process receives notification information sent by the BHO process, wherein the notification information carries address information of a target memory space distributed in the BHO process and a process identifier of the BHO process;
acquiring a process object handle of the BHO process according to the process identifier of the BHO process;
using the BHO process object handle to obtain data according to the address information of the target memory space allocated by the BHO process for processing;
and sending notification information to the BHO process after the processing is finished, and notifying the FRAME process of the BHO process browser of finishing processing the data in the target memory space.
As can be seen from the above description of the preferred embodiments, the FRAME process and the BHO process can communicate with each other between processes in the browser, i.e., the sender process and the receiver process.
The above is a content of the first embodiment of the present invention, and it should be understood by those skilled in the art that the functions and parameters presented in the above embodiments are only for better understanding of the content of the present invention, and when the present invention is applied to different operating systems or application environments, the functions and parameters required may be completely selected or named according to actual needs, and the present invention is not limited thereto.
Referring to fig. 3, fig. 3 is a flowchart illustrating a second embodiment of the inter-process communication method in a browser according to the present invention. In this embodiment, the BHO sends data to the Frame synchronously, the Frame reads the data, and finally the BHO releases the memory, where the method specifically includes: in step 301, the BHO process serializes the data to be transmitted.
Step 302, the BHO process allocates a target memory space in its virtual address space and copies serialized data to the target memory space.
The method specifically comprises the following steps: acquiring the first address and data length information of the serialized data; distributing a third target memory space in the virtual address space of the BHO process according to the data length information; and copying the serialized data to a distributed third target memory space according to the first address of the serialized data.
For example: LPVOID pString ═ strucctvirtualalloc ();
step 303, the BHO process synchronously sends notification information to the FRAME process of the browser, where the notification information carries the address information of the target memory space and the process identifier of the BHO process.
And step 304, the BHO process receives the notification information returned by the FRAME process of the browser, and notifies that the processing of the transmission data in the FRAME process is finished.
In step 305, the BHO process releases the allocated target memory space.
For example, calling the function structvirtualfree (pstring) frees the target memory space.
Preferably, the notification information returned by the FRAME process further includes: address information of the allocated target memory space and a process identifier of the BHO process;
the BHO process releasing the allocated target memory space further comprises:
determining to process the BHO process according to the process identifier of the BHO process in the notification information returned by the FRAME process, and obtaining a process object handle of the BHO process;
and releasing the target memory space allocated by the frame BHO process according to the process object handle of the BHO process and the address information of the target memory space in the notification information.
Referring to fig. 4, fig. 4 is a flowchart illustrating a third embodiment of an inter-process communication method in a browser according to the present invention. In this embodiment, a BHO process synchronously sends notification information to a Frame process, the Frame process fills data into a target memory space of the BHO, and finally the BHO process releases a memory after completing processing of the target memory space, where the method specifically includes:
at step 401, the BHO process allocates a target memory space in its virtual address space.
Step 402, the BHO process synchronously sends notification information to the FRAME process, wherein the notification information carries the address information of the target memory space and the process identifier of the BHO process.
In step 403, the FRAME process serializes the data to be transmitted.
Storing the data to be transferred to the serialized memory.
In step 404, when the FRAME process receives the notification message sent by the BHO process, the data to be transmitted is copied to the target memory space of the BHO process.
Acquiring a process object handle of the BHO process according to the BHO process identifier in the BHO process notification message;
and copying the data in the serialized memory to the target memory space according to the process object handle of the BHO process and the address information of the target memory space in the notification information.
Step 405, the BHO process receives the notification information returned by the FRAME process, and notifies that the processing of the transmission data in the FRAME process is finished.
Preferably, the notification information returned by the FRAME process further includes target memory address information of the BHO process and a BHO process identifier.
At step 406, the BHO process reads the data in the target memory space.
In step 407, the BHO process releases the target memory space.
In order to better understand the content of the embodiment of the present invention, a method for communication between browsers according to the present invention is further described with reference to fig. 5. In this embodiment, the communication between the main process FRAME and the BHO sub-process corresponding to the tag page A, B, C specifically includes:
referring to table 1, functional and parametric definitions of some of the functions used in this example are shown.
Figure BDA0000945070040000151
TABLE 1
The following is an example of a communication process between the FRAME main process and the BHO1 subprocess, and communication between other BHO subprocesses and the FRAME process is similar to that, which is not described herein again, and this example may specifically include the following steps:
step S1, the FRAME process allocates a target memory space on the virtual address space of the FRAME process, and stores the data after the serialization operation to the target memory space.
LPVOID lpData=StructVirtualAlloc();
The method specifically comprises the following steps:
a1: before sending data, carrying out serialization operation on the data to be sent, storing the data after the serialization operation is finished to a corresponding serialization memory, and creating a CSerializeObject & obj object, wherein information such as the first address, the current address, the total size of the memory and the like of the serialization memory is recorded in the object;
a2: after the serialization operation is finished, calling obj.GetBuffer (& ltlpData, & dwLength) to obtain the memory initial address and length after the data serialization;
a3: calling VirtualAllocEx (GetCurrentProcess (), NULL, sizeof (TWHMessage), MEM _ COMMIT, PAGE _ READWRITE) to obtain a target memory space on the virtual address space of the process, wherein the length of the target memory space is equal to that of the serialized memory, and the return value of the VirtualAllocEx function is the address information of the memory space section;
a4, call memcpy copies the previously serialized memory into the target memory space.
Step S2, the FRAME process asynchronously sends information to the BHO1 process to notify it of receiving data, where the information carries the address information of the target memory space segment and the process identifier of the FRAME process.
Browser_PostMessage();
And S3, reading data by the BHO1 process according to the address information of the target memory space carried in the notification information and the process identification of the FRAME process.
The method specifically comprises the following steps:
b1: the BHO1 process calls an OpenProcess function (important parameter is FRAME process ID) to obtain a process object handle of the FRAME process;
b2: the BHO1 process calls the readprocess memory function (the important parameters are the FRAME process object handle and address information of the previous step) to obtain data.
B3: calling a CloseHandle () function to close a process object handle of the FRAME process;
b4: the BHO1 process handles data.
Step S4, the BHO1 process sends notification information WM _ BHO _ fresh of data processing completion to the FRAME process, where the data processing completion message carries the address information of the target memory space and the process identifier of the FRAME process.
Step S5, the FRAME process releases the corresponding memory according to the data processing completion notification message.
C1: calling an OpenProcess function (important parameter is FRAME process ID) to obtain a process object handle of the FRAME process;
c2: calling VirtualFreeEx function release (important parameters are the FRAME process handle obtained in the last step and the address information of the target memory space);
c3: calling the CloseHandle () function closes the process object handle of the FRAME process.
The method for displaying the webpage label thumbnail provided by the invention is described above, and the device of the invention is described below with reference to the content of the above method embodiment:
referring to fig. 6, fig. 6 is a schematic structural diagram illustrating an embodiment of an apparatus for inter-process communication in a browser according to the present invention, where the apparatus includes:
a first data serialization module 610 configured to serialize data to be transmitted by a FRAME process FRAME of a browser;
a first memory space obtaining module 620, configured to allocate a first target memory space in the virtual address space of the FRAME process, and copy and obtain serialized data into the first target memory space;
a first notification information sending module 630, configured to asynchronously send, by the FRAME process, first notification information to a browser auxiliary object process BHO, where the notification information carries address information of a first target memory space and a process identifier of the FRAME process;
a second notification information receiving module 640, configured to receive second notification information returned by the browser auxiliary object process BHO, and notify that processing of the transmission data in the BHO process is finished;
a first memory space release module 650 configured to release the allocated first target memory space.
Preferably, the first memory space obtaining module 620 includes:
a first data extraction unit 621 configured to acquire a first address and data length information of the serialized data;
a first memory space allocation unit 622 configured to allocate a first target memory space in the virtual address space of the FRAME process according to the data length information;
a first data copying unit 623 configured to copy the serialized data into the allocated first target memory space according to the first address of the serialized data.
Preferably, the first data serialization module 610 includes:
an override unit 611 configured to perform a serialization operation on the to-be-transmitted data with an override operator, wherein different data types of the to-be-transmitted data correspond to different override operators.
Preferably, the second notification information further includes:
address information of the allocated first target memory space and the FRAME process identifier;
the first memory space releasing module 650 further comprises:
a second memory release unit 651 configured to:
determining to process the FRAME process according to the FRAME process identification in the second notification information, and obtaining a process object handle of the FRAME process;
and releasing the first target memory space allocated by the FRAME process according to the process object handle of the FRAME process and the address information of the first target memory space in the second notification information.
Preferably, the apparatus further comprises:
a third notification information receiving module 660, configured to receive third notification information sent by a BHO process of the browser, where the third notification information carries address information of a second target memory space allocated in the BHO process and a process identifier of the BHO process;
a first process handle obtaining module 670 configured to obtain a process object handle of the BHO process according to the process identifier of the BHO process;
a second data processing module 680, configured to obtain data according to the address information of the second target memory space by using the process object handle for processing;
a fourth notification information sending module 690, configured to send fourth notification information to the BHO process after the processing is finished, and notify the FRAME process of the BHO process browser that the processing of the data in the second target memory space is finished.
Preferably, the fourth notification information further includes:
address information of the allocated second target memory space and a process identifier of the BHO process.
Preferably, the browser auxiliary object process BHO is a BHO subprocess of a control for login.
Preferably, the browser helper object process BHO is two or more BHO processes.
Referring to fig. 7, fig. 7 is a schematic structural diagram illustrating an embodiment of an apparatus for inter-process communication in a browser according to the present invention, where the apparatus includes:
a second data serialization module 710 configured to perform serialization operation on the data to be transmitted by an auxiliary object process BHO of the browser;
a third memory space obtaining module 720, configured to allocate a third target memory space in the virtual address space of the BHO process, and copy the serialized data into the third target memory space;
a fifth notification information sending module 730, configured to synchronously send fifth notification information to a FRAME process of the browser by the BHO process, where the notification information carries address information of a third target memory space and a process identifier of the BHO process;
a sixth notification information receiving module 740 configured to receive sixth notification information returned by the FRAME process of the browser, and notify that the processing of the transmission data in the FRAME process is finished;
a third memory space release module 750 configured to release the allocated third target memory space.
Preferably, the third memory space obtaining module 750 includes:
a third data extraction unit 751 configured to acquire header address and data length information of the serialized data;
a third memory space allocation unit 752 configured to allocate a third target memory space in the virtual address space of the BHO process according to the data length information;
a third data copying unit 753 configured to copy the serialized data into the allocated third target memory space according to the first address of the serialized data.
Preferably, the sixth notification information further includes:
address information of the allocated third target memory space and a process identifier of the BHO process;
the third memory space releasing module 750 further includes:
a third memory release unit 754 configured to:
determining to process the BHO process according to the process identifier of the BHO process in the sixth notification message, and obtaining a process object handle of the BHO process;
and releasing the third target memory space allocated by the frame BHO process according to the process object handle of the BHO process and the address information of the third target memory space in the sixth notification message.
Preferably, the apparatus further comprises:
a seventh notification information receiving module 760, configured to receive seventh notification information sent by a FRAME process of a browser, where the seventh notification information carries address information of a fourth target memory space allocated in the FRAME process and a process identifier of the FRAME process;
a second process handle acquisition module 770 configured to acquire a process object handle of the FRAME process from the process identification of the FRAME process;
a fourth data processing module 780, configured to obtain data according to the address information of the fourth target memory space by using the process object handle for processing;
an eighth notification information sending module 790, configured to send eighth notification information to the FRAME process after the processing is finished, and notify the FRAME process that the BHO process finishes processing the data in the fourth target memory space.
Preferably, the eighth notification information further includes:
address information of the allocated fourth target memory space and a process identification of the FRAME process.
Preferably, the browser auxiliary object process is a BHO subprocess of a login control.
Preferably, the browser helper object process BHO is two or more BHO processes.
The methods and apparatus of the embodiments of the present invention described above are applicable in a variety of network or client environments, and may be implemented in, for example, a computer device such as a personal computer device, or other portable or non-portable electronic devices such as a mobile phone, a mobile communication device, a Personal Digital Assistant (PDA), etc. Therefore, it will be clear to those skilled in the art that the scope of the present invention is not limited to the inter-process communication method and apparatus in the browser running on the PC, but is described in the embodiment of the present invention by using the inter-process communication method and apparatus in the browser running on the PC for simplicity and convenience of description.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For system and/or apparatus embodiments, because they are substantially similar to method embodiments, the description is relatively simple, and reference may be made to some descriptions of method embodiments for related points.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
Further, the word "and/or" above means that the relation "and" or "is included herein, wherein: if the scheme A and the scheme B are in an 'and' relationship, the method indicates that the scheme A and the scheme B can be simultaneously included in a certain embodiment; if the scheme a and the scheme B are in an or relationship, this means that in some embodiment, the scheme a may be included separately, or the scheme B may be included separately.
The method and the device for inter-process communication in a browser provided by the invention are described in detail above, and a specific example is applied in the text to explain the principle and the implementation of the invention, and the description of the above embodiment is only used to help understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
The embodiment of the invention also discloses A1 and a method for inter-process communication in a browser, which is characterized by comprising the following steps:
a FRAME process of the browser serializes the data to be transmitted;
the FRAME process allocates a first target memory space in the virtual address space of the FRAME process, and copies and acquires serialized data to the first target memory space;
the FRAME process asynchronously sends first notification information to a browser auxiliary object (BHO) process, wherein the notification information carries address information of a first target memory space and a process identifier of the FRAME process;
receiving second notification information returned by the BHO process, and notifying that the processing of the transmission data in the BHO process is finished;
and releasing the allocated first target memory space.
A2, the method as claimed in a1, wherein the step of the FRAME process allocating a first target memory space in its virtual address space and copying the obtained serialized data into the first target memory space includes:
acquiring the first address and data length information of the serialized data;
according to the data length information, allocating a first target memory space in the virtual address space of the FRAME process;
and copying the serialized data to a distributed first target memory space according to the first address of the serialized data.
A3, the method as described in a1, wherein the step of the FRAME process serializing the data to be transmitted further comprises:
and carrying out serialization operation on the to-be-transmitted data by adopting reload operators, wherein the to-be-transmitted data of different data types correspond to different reload operators.
A4, the method of a1, wherein the second notification information further comprises:
address information of the allocated first target memory space and the FRAME process identifier;
the step of releasing the allocated first target memory space further comprises:
determining to process the FRAME process according to the FRAME process identification in the second notification information, and obtaining a process object handle of the FRAME process;
and releasing the first target memory space allocated by the FRAME process according to the process object handle of the FRAME process and the address information of the first target memory space in the second notification information.
A5, the method of A1, further comprising:
receiving third notification information sent by a BHO process of the browser, wherein the third notification information carries address information of a second target memory space distributed in the BHO process and a process identifier of the BHO process;
acquiring a process object handle of the BHO process according to the process identifier of the BHO process;
acquiring data for processing according to the address information of the second target memory space by using the process object handle;
and after the processing is finished, sending fourth notification information to the BHO process, and notifying the FRAME process of the BHO process browser of finishing the processing of the data in the second target memory space.
A6, the method of a5, wherein the fourth notification information further comprises:
address information of the allocated second target memory space and a process identifier of the BHO process.
A7, the method according to A1, wherein the browser helper object process BHO is a BHO sub-process of a control for login.
A8, the method of A1, wherein the browser assisted object process (BHO) is two or more BHO processes.
The embodiment of the invention also discloses B9 and a method for inter-process communication in a browser, which is characterized by comprising the following steps:
an auxiliary object process BHO of the browser carries out serialization operation on the data to be transmitted;
the BHO process allocates a third target memory space in the virtual address space of the BHO process and copies serialized data to the third target memory space;
the BHO process synchronously sends fifth notification information to a FRAME FRAME process of the browser, wherein the notification information carries address information of a third target memory space and a process identifier of the BHO process;
receiving sixth notification information returned by the FRAME process of the browser, and notifying that the processing of the transmission data in the FRAME process is finished;
and releasing the allocated third target memory space.
B10, the method of B9, wherein the step of the BHO process allocating a third target memory space in its virtual address space and copying the serialized data to the third target memory space comprises:
acquiring the first address and data length information of the serialized data;
distributing a third target memory space in the virtual address space of the BHO process according to the data length information;
and copying the serialized data to a distributed third target memory space according to the first address of the serialized data.
B11, the method of B9, wherein the sixth notification message further comprises:
address information of the allocated third target memory space and a process identifier of the BHO process;
the step of releasing the allocated third target memory space includes:
determining to process the BHO process according to the process identifier of the BHO process in the sixth notification message, and obtaining a process object handle of the BHO process;
and releasing the third target memory space allocated by the frame BHO process according to the process object handle of the BHO process and the address information of the third target memory space in the sixth notification message.
B12, the method according to B9, further comprising:
receiving seventh notification information sent by a FRAME process of a browser, wherein the seventh notification information carries address information of a fourth target memory space allocated in the FRAME process and a process identifier of the FRAME process;
acquiring a process object handle of the FRAME process according to the process identification of the FRAME process;
acquiring data for processing according to the address information of the fourth target memory space by using the process object handle;
and sending eighth notification information to the FRAME process after the processing is finished, and notifying the FRAME process that the BHO process finishes processing the data in the fourth target memory space.
B13, the method according to B12, wherein the eighth notification information further includes:
address information of the allocated fourth target memory space and a process identification of the FRAME process.
B14, the method according to B9, wherein the browser auxiliary object process is a BHO sub-process of a login control.
B15, the method according to B9, wherein the browser assisted object process BHO is two or more BHO processes.
The embodiment of the invention also discloses C16, a device for interprocess communication in a browser, which is characterized by comprising:
the first data serialization module is configured to perform serialization operation on the transmission data by a FRAME process FRAME of the browser;
a first memory space obtaining module configured to allocate a first target memory space in a virtual address space of the FRAME process, and copy and obtain serialized data into the first target memory space;
a first notification information sending module, configured to asynchronously send, by the FRAME process, first notification information to a browser auxiliary object process BHO, where the notification information carries address information of a first target memory space and a process identifier of the FRAME process;
the second notification information receiving module is configured to receive second notification information returned by the browser auxiliary object process BHO and notify that the processing of the transmission data in the BHO process is finished;
a first memory space releasing module configured to release the allocated first target memory space.
C17, the apparatus according to C16, wherein the first memory space obtaining module comprises:
a first data extraction unit configured to acquire a head address and data length information of the serialized data;
a first memory space allocation unit configured to allocate a first target memory space in a virtual address space of the FRAME process according to the data length information;
and the first data copying unit is configured to copy the serialized data to the allocated first target memory space according to the first address of the serialized data.
C18, the apparatus of C16, wherein the first data serialization module comprises:
and the reloading unit is configured to carry out serialization operation on the to-be-transmitted data by adopting a reloading operator, wherein the to-be-transmitted data of different data types correspond to different reloading operators.
C19, the apparatus according to C16, wherein the second notification information further comprises:
address information of the allocated first target memory space and the FRAME process identifier;
the first memory space releasing module further includes:
a second memory release unit configured to:
determining to process the FRAME process according to the FRAME process identification in the second notification information, and obtaining a process object handle of the FRAME process;
and releasing the first target memory space allocated by the FRAME process according to the process object handle of the FRAME process and the address information of the first target memory space in the second notification information.
C20, the apparatus of C16, further comprising:
a third notification information receiving module, configured to receive third notification information sent by a BHO process of the browser, where the third notification information carries address information of a second target memory space allocated in the BHO process and a process identifier of the BHO process;
a first process handle obtaining module configured to obtain a process object handle of the BHO process according to the process identifier of the BHO process;
the second data processing module is configured to use the process object handle to acquire data according to the address information of the second target memory space for processing;
and the fourth notification information sending module is configured to send fourth notification information to the BHO process after the processing is finished, and notify the FRAME process of the BHO process browser of finishing processing the data in the second target memory space.
C21, the apparatus according to C20, wherein the fourth notification information further comprises:
address information of the allocated second target memory space and a process identifier of the BHO process.
C22, the apparatus according to C16, wherein the browser helper object process BHO is a BHO child process of a control for login.
C23, the apparatus of C16, wherein the browser assisted object process, BHO, is two or more BHO processes.
The embodiment of the invention also discloses D24 and a device for interprocess communication in the browser, which is characterized by comprising the following steps:
the second data serialization module is configured to perform serialization operation on the to-be-transmitted data by an auxiliary object process BHO of the browser;
a third memory space obtaining module configured to allocate a third target memory space in the virtual address space of the BHO process, and copy the serialized data to the third target memory space;
a fifth notification information sending module, configured to send fifth notification information to a FRAME process of a browser synchronously by the BHO process, where the notification information carries address information of a third target memory space and a process identifier of the BHO process;
a sixth notification information receiving module configured to receive sixth notification information returned by the FRAME process of the browser, and notify that the processing of the transmission data in the FRAME process is finished;
a third memory space releasing module configured to release the allocated third target memory space.
D25, the apparatus according to D24, wherein the third memory space obtaining module comprises:
a third data extraction unit configured to acquire a head address and data length information of the serialized data;
a third memory space allocation unit configured to allocate a third target memory space in the virtual address space of the BHO process according to the data length information;
and the third data copying unit is configured to copy the serialized data to a distributed third target memory space according to the first address of the serialized data.
D26, the apparatus as claimed in D24, wherein the sixth notification information further comprises:
address information of the allocated third target memory space and a process identifier of the BHO process;
the third memory space releasing module further includes:
a third memory release unit configured to:
determining to process the BHO process according to the process identifier of the BHO process in the sixth notification message, and obtaining a process object handle of the BHO process;
and releasing the third target memory space allocated by the frame BHO process according to the process object handle of the BHO process and the address information of the third target memory space in the sixth notification message.
D27, the apparatus of D24, further comprising:
a seventh notification information receiving module, configured to receive seventh notification information sent by a FRAME process of a browser, where the seventh notification information carries address information of a fourth target memory space allocated in the FRAME process and a process identifier of the FRAME process;
a second process handle acquiring module configured to acquire a process object handle of the FRAME process according to the process identification of the FRAME process;
a fourth data processing module configured to acquire data for processing according to the address information of the fourth target memory space using the process object handle;
an eighth notification message sending module, configured to send eighth notification messages to the FRAME process after the processing is finished, and notify the FRAME process that the BHO process finishes processing the data in the fourth target memory space.
The apparatus of D28, as recited in D24, wherein the eighth notification information further comprises:
address information of the allocated fourth target memory space and a process identification of the FRAME process.
D29, the apparatus of D24, wherein the browser auxiliary object process is a BHO sub-process of a login control.
D30, the apparatus of D24, wherein the browser assisted object process, BHO, is two or more BHO processes.

Claims (22)

1. A method for interprocess communication in a browser is characterized by comprising the following steps:
a FRAME process of the browser serializes the data to be transmitted;
the FRAME process allocates a first target memory space in the virtual address space of the FRAME process, and copies and acquires serialized data to the first target memory space;
the FRAME process asynchronously sends first notification information to a browser auxiliary object (BHO) process, wherein the notification information carries address information of a first target memory space and a process identifier of the FRAME process;
receiving second notification information returned by the BHO process, and notifying that the processing of the transmission data in the BHO process is finished; the BHO process is a BHO sub-process of a login control, and the login control is added in the browser in a button mode and used for processing a login form in a webpage label in a browser window; when a plurality of tab pages are opened in a browser window at the same time, a plurality of corresponding BHO processes are also provided, and each tab page is a BHO subprocess;
releasing the allocated first target memory space;
the serializing operation of the data to be transmitted comprises changing originally discontinuous sections of memory space into continuous sections of memory addresses.
2. The method as claimed in claim 1, wherein the step of the FRAME process allocating a first target memory space in its virtual address space and copying the obtained serialized data into the first target memory space comprises:
acquiring the first address and data length information of the serialized data;
according to the data length information, allocating a first target memory space in the virtual address space of the FRAME process;
and copying the serialized data to a distributed first target memory space according to the first address of the serialized data.
3. The method of claim 1, wherein the step of the FRAME process serializing the transmission data further comprises:
and carrying out serialization operation on the to-be-transmitted data by adopting reload operators, wherein the to-be-transmitted data of different data types correspond to different reload operators.
4. The method of claim 1, wherein the second notification information further comprises:
address information of the allocated first target memory space and the FRAME process identifier;
the step of releasing the allocated first target memory space further comprises:
determining to process the FRAME process according to the FRAME process identification in the second notification information, and obtaining a process object handle of the FRAME process;
and releasing the first target memory space allocated by the FRAME process according to the process object handle of the FRAME process and the address information of the first target memory space in the second notification information.
5. The method of claim 1, further comprising:
receiving third notification information sent by a BHO process of the browser, wherein the third notification information carries address information of a second target memory space distributed in the BHO process and a process identifier of the BHO process;
acquiring a process object handle of the BHO process according to the process identifier of the BHO process;
acquiring data for processing according to the address information of the second target memory space by using the process object handle;
and after the processing is finished, sending fourth notification information to the BHO process, and notifying the FRAME process of the BHO process browser of finishing the processing of the data in the second target memory space.
6. The method of claim 5, wherein the fourth notification information further comprises:
address information of the allocated second target memory space and a process identifier of the BHO process.
7. A method for interprocess communication in a browser is characterized by comprising the following steps:
an auxiliary object process BHO of the browser carries out serialization operation on the data to be transmitted;
the BHO process allocates a third target memory space in the virtual address space of the BHO process and copies serialized data to the third target memory space;
the BHO process synchronously sends fifth notification information to a FRAME FRAME process of the browser, wherein the notification information carries address information of a third target memory space and a process identifier of the BHO process;
receiving sixth notification information returned by the FRAME process of the browser, and notifying that the processing of the transmission data in the FRAME process is finished; the BHO process is a BHO sub-process of a login control, and the login control is added in the browser in a button mode and used for processing a login form in a webpage label in a browser window; when a plurality of tab pages are opened in a browser window at the same time, a plurality of corresponding BHO processes are also provided, and each tab page is a BHO subprocess;
releasing the allocated third target memory space;
the serializing operation of the data to be transmitted comprises changing originally discontinuous sections of memory space into continuous sections of memory addresses.
8. The method of claim 7, wherein the BHO process allocates a third target memory space in its virtual address space, and copying the serialized data into the third target memory space comprises:
acquiring the first address and data length information of the serialized data;
distributing a third target memory space in the virtual address space of the BHO process according to the data length information;
and copying the serialized data to a distributed third target memory space according to the first address of the serialized data.
9. The method of claim 7, wherein the sixth notification information further comprises:
address information of the allocated third target memory space and a process identifier of the BHO process;
the step of releasing the allocated third target memory space includes:
determining to process the BHO process according to the process identifier of the BHO process in the sixth notification message, and obtaining a process object handle of the BHO process;
and releasing the third target memory space allocated by the BHO process according to the process object handle of the BHO process and the address information of the third target memory space in the sixth notification message.
10. The method of claim 7, further comprising:
receiving seventh notification information sent by a FRAME process of a browser, wherein the seventh notification information carries address information of a fourth target memory space allocated in the FRAME process and a process identifier of the FRAME process;
acquiring a process object handle of the FRAME process according to the process identification of the FRAME process;
acquiring data for processing according to the address information of the fourth target memory space by using the process object handle;
and sending eighth notification information to the FRAME process after the processing is finished, and notifying the FRAME process that the BHO process finishes processing the data in the fourth target memory space.
11. The method of claim 10, wherein the eighth notification information further comprises:
address information of the allocated fourth target memory space and a process identification of the FRAME process.
12. An apparatus for interprocess communication in a browser, comprising:
the first data serialization module is configured to perform serialization operation on the transmission data by a FRAME process FRAME of the browser;
a first memory space obtaining module configured to allocate a first target memory space in a virtual address space of the FRAME process, and copy and obtain serialized data into the first target memory space;
a first notification information sending module, configured to asynchronously send, by the FRAME process, first notification information to a browser auxiliary object process BHO, where the notification information carries address information of a first target memory space and a process identifier of the FRAME process;
the second notification information receiving module is configured to receive second notification information returned by the browser auxiliary object process BHO and notify that the processing of the transmission data in the BHO process is finished; the BHO process is a BHO sub-process of a login control, and the login control is added in the browser in a button mode and used for processing a login form in a webpage label in a browser window; when a plurality of tab pages are opened in a browser window at the same time, a plurality of corresponding BHO processes are also provided, and each tab page is a BHO subprocess;
a first memory space releasing module configured to release the allocated first target memory space;
the serializing operation of the data to be transmitted comprises changing originally discontinuous sections of memory space into continuous sections of memory addresses.
13. The apparatus of claim 12, wherein the first memory space acquisition module comprises:
a first data extraction unit configured to acquire a head address and data length information of the serialized data;
a first memory space allocation unit configured to allocate a first target memory space in a virtual address space of the FRAME process according to the data length information;
and the first data copying unit is configured to copy the serialized data to the allocated first target memory space according to the first address of the serialized data.
14. The apparatus of claim 12, wherein the first data serialization module comprises:
and the reloading unit is configured to carry out serialization operation on the to-be-transmitted data by adopting a reloading operator, wherein the to-be-transmitted data of different data types correspond to different reloading operators.
15. The apparatus of claim 12, wherein the second notification information further comprises:
address information of the allocated first target memory space and the FRAME process identifier;
the first memory space releasing module further includes:
a second memory release unit configured to:
determining to process the FRAME process according to the FRAME process identification in the second notification information, and obtaining a process object handle of the FRAME process;
and releasing the first target memory space allocated by the FRAME process according to the process object handle of the FRAME process and the address information of the first target memory space in the second notification information.
16. The apparatus of claim 12, further comprising:
a third notification information receiving module, configured to receive third notification information sent by a BHO process of the browser, where the third notification information carries address information of a second target memory space allocated in the BHO process and a process identifier of the BHO process;
a first process handle obtaining module configured to obtain a process object handle of the BHO process according to the process identifier of the BHO process;
the second data processing module is configured to use the process object handle to acquire data according to the address information of the second target memory space for processing;
and the fourth notification information sending module is configured to send fourth notification information to the BHO process after the processing is finished, and notify the FRAME process of the BHO process browser of finishing processing the data in the second target memory space.
17. The apparatus of claim 16, wherein the fourth notification information further comprises:
address information of the allocated second target memory space and a process identifier of the BHO process.
18. An apparatus for interprocess communication in a browser, comprising:
the second data serialization module is configured to perform serialization operation on the to-be-transmitted data by an auxiliary object process BHO of the browser;
a third memory space obtaining module configured to allocate a third target memory space in the virtual address space of the BHO process, and copy the serialized data to the third target memory space;
a fifth notification information sending module, configured to send fifth notification information to a FRAME process of a browser synchronously by the BHO process, where the notification information carries address information of a third target memory space and a process identifier of the BHO process;
a sixth notification information receiving module configured to receive sixth notification information returned by the FRAME process of the browser, and notify that the processing of the transmission data in the FRAME process is finished; the BHO process is a BHO sub-process of a login control, and the login control is added in the browser in a button mode and used for processing a login form in a webpage label in a browser window; when a plurality of tab pages are opened in a browser window at the same time, a plurality of corresponding BHO processes are also provided, and each tab page is a BHO subprocess;
a third memory space releasing module configured to release the allocated third target memory space;
the serializing operation of the data to be transmitted comprises changing originally discontinuous sections of memory space into continuous sections of memory addresses.
19. The apparatus of claim 18, wherein the third memory space acquisition module comprises:
a third data extraction unit configured to acquire a head address and data length information of the serialized data;
a third memory space allocation unit configured to allocate a third target memory space in the virtual address space of the BHO process according to the data length information;
and the third data copying unit is configured to copy the serialized data to a distributed third target memory space according to the first address of the serialized data.
20. The apparatus of claim 18, wherein the sixth notification information further comprises:
address information of the allocated third target memory space and a process identifier of the BHO process;
the third memory space releasing module further includes:
a third memory release unit configured to:
determining to process the BHO process according to the process identifier of the BHO process in the sixth notification message, and obtaining a process object handle of the BHO process;
and releasing the third target memory space allocated by the BHO process according to the process object handle of the BHO process and the address information of the third target memory space in the sixth notification message.
21. The apparatus of claim 18, further comprising:
a seventh notification information receiving module, configured to receive seventh notification information sent by a FRAME process of a browser, where the seventh notification information carries address information of a fourth target memory space allocated in the FRAME process and a process identifier of the FRAME process;
a second process handle acquiring module configured to acquire a process object handle of the FRAME process according to the process identification of the FRAME process;
a fourth data processing module configured to acquire data for processing according to the address information of the fourth target memory space using the process object handle;
an eighth notification message sending module, configured to send eighth notification messages to the FRAME process after the processing is finished, and notify the FRAME process that the BHO process finishes processing the data in the fourth target memory space.
22. The apparatus of claim 21, wherein the eighth notification information further comprises:
address information of the allocated fourth target memory space and a process identification of the FRAME process.
CN201610159007.7A 2012-06-29 2012-06-29 Method and device for interprocess communication in browser Expired - Fee Related CN105843691B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610159007.7A CN105843691B (en) 2012-06-29 2012-06-29 Method and device for interprocess communication in browser

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201210226976.1A CN102779076B (en) 2012-06-29 2012-06-29 The method and apparatus of interprocess communication in a kind of browser
CN201610159007.7A CN105843691B (en) 2012-06-29 2012-06-29 Method and device for interprocess communication in browser

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN201210226976.1A Division CN102779076B (en) 2012-06-29 2012-06-29 The method and apparatus of interprocess communication in a kind of browser

Publications (2)

Publication Number Publication Date
CN105843691A CN105843691A (en) 2016-08-10
CN105843691B true CN105843691B (en) 2020-04-10

Family

ID=47123995

Family Applications (2)

Application Number Title Priority Date Filing Date
CN201610159007.7A Expired - Fee Related CN105843691B (en) 2012-06-29 2012-06-29 Method and device for interprocess communication in browser
CN201210226976.1A Active - Reinstated CN102779076B (en) 2012-06-29 2012-06-29 The method and apparatus of interprocess communication in a kind of browser

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN201210226976.1A Active - Reinstated CN102779076B (en) 2012-06-29 2012-06-29 The method and apparatus of interprocess communication in a kind of browser

Country Status (1)

Country Link
CN (2) CN105843691B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102981876B (en) * 2012-11-28 2016-05-04 北京奇虎科技有限公司 Picture tool bar window loading method and device
CN104571953B (en) * 2014-12-25 2017-10-17 珠海金山网络游戏科技有限公司 A kind of method that memory address is controlled in extension process
CN107665173B (en) * 2016-07-29 2021-05-14 北京小米移动软件有限公司 Voice storage method, voice reading method and device
CN109614237A (en) * 2018-12-10 2019-04-12 浪潮(北京)电子信息产业有限公司 A kind of method for releasing resource, device, equipment and medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1811717A (en) * 2006-01-10 2006-08-02 杭州东信灵通电子实业公司 Universal interprocess communication achieving method
CN101075201A (en) * 2007-06-26 2007-11-21 北京邮电大学 Method for realizing unified universal message bus between different assembly process
CN101393591A (en) * 2008-10-27 2009-03-25 中国科学院计算技术研究所 Method and system for discovering unknown USB virus
CN101448018A (en) * 2008-12-26 2009-06-03 中兴通讯股份有限公司 Interprocess communication method and device thereof

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7231638B2 (en) * 2002-12-03 2007-06-12 International Business Machines Corporation Memory sharing in a distributed data processing system using modified address space to create extended address space for copying data

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1811717A (en) * 2006-01-10 2006-08-02 杭州东信灵通电子实业公司 Universal interprocess communication achieving method
CN101075201A (en) * 2007-06-26 2007-11-21 北京邮电大学 Method for realizing unified universal message bus between different assembly process
CN101393591A (en) * 2008-10-27 2009-03-25 中国科学院计算技术研究所 Method and system for discovering unknown USB virus
CN101448018A (en) * 2008-12-26 2009-06-03 中兴通讯股份有限公司 Interprocess communication method and device thereof

Also Published As

Publication number Publication date
CN102779076A (en) 2012-11-14
CN105843691A (en) 2016-08-10
CN102779076B (en) 2016-04-20

Similar Documents

Publication Publication Date Title
EP3129871B1 (en) Generating a screenshot
JP4420968B2 (en) Method and computer-readable medium for commanding
JP5551363B2 (en) Integrated charts in documents
WO2015131804A1 (en) Call stack relationship acquiring method and apparatus
CN105843691B (en) Method and device for interprocess communication in browser
CN114816401B (en) Interface element positioning method, electronic equipment and storage medium
WO2019047508A1 (en) Method for processing e-book comment information, electronic device and storage medium
CN110765288B (en) Image information synchronization method, device and system and storage medium
US20170004316A1 (en) Alternate clipboard for secure applications
WO2015069671A1 (en) Two step content selection with auto content categorization
CN107526623B (en) Data processing method and device
CN110990014A (en) Method and device for generating page code of skeleton screen, server and storage medium
CN105723314B (en) Two-step content selection
US20130152049A1 (en) Warning of register and storage area assignment errors
CN111324398A (en) Recent content processing method, device, terminal and storage medium
CN113835835B (en) Method, device and computer readable storage medium for creating consistency group
EP2849058A1 (en) Method and device for displaying a message associated with an application
CN113190158A (en) Repeated screenshot method and device
CN110795389B (en) Storage snapshot based copying method, user equipment, storage medium and device
CN114185845A (en) File management method and device, computer equipment and storage medium
JP2009524876A (en) External setting of processing contents for script
CN111026463A (en) Page loading method, device, equipment and storage medium
US20120185452A1 (en) System and method for file coordination
JP6151946B2 (en) Information processing system, information processing apparatus, and control method thereof
US20240160501A1 (en) Interoperability between actor frameworks and asynchronous frameworks

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20200410

Termination date: 20210629

CF01 Termination of patent right due to non-payment of annual fee