CN111124553A - Program execution method, device, terminal and storage medium - Google Patents

Program execution method, device, terminal and storage medium Download PDF

Info

Publication number
CN111124553A
CN111124553A CN201911243362.2A CN201911243362A CN111124553A CN 111124553 A CN111124553 A CN 111124553A CN 201911243362 A CN201911243362 A CN 201911243362A CN 111124553 A CN111124553 A CN 111124553A
Authority
CN
China
Prior art keywords
execution
code
execution environment
execution code
environment
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
CN201911243362.2A
Other languages
Chinese (zh)
Other versions
CN111124553B (en
Inventor
饶福贵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN201911243362.2A priority Critical patent/CN111124553B/en
Publication of CN111124553A publication Critical patent/CN111124553A/en
Application granted granted Critical
Publication of CN111124553B publication Critical patent/CN111124553B/en
Active 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/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • G06F9/4484Executing subprograms

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The present disclosure relates to a program execution method, apparatus, terminal, and storage medium, the method comprising: configuring a communication channel between a first execution environment and a second execution environment; first execution code in the first execution environment, and second execution code running in the second execution environment is called through the communication channel; and running the second execution code in the first execution environment to obtain a program execution result. Therefore, the same software product can be split to be developed or debugged, and when the software product is modified or debugged, the part needing to be modified or debugged can be independently processed, so that the workload of developers is reduced, the development efficiency is improved, and the development cost is reduced.

Description

Program execution method, device, terminal and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a program execution method, an apparatus, a terminal, and a storage medium.
Background
In the related art, for the same software product, for example, the software product for an application program, the entire software product needs to use the same development language and be executed in the same execution environment. That is, for the same software product, it is necessary for developers to use the same development language and execute in the same execution environment, and in the face of some fine adjustments, development or debugging of the whole project also needs to be started, which obviously increases the workload of developers, and results in slow development efficiency, high development cost, and the like.
Disclosure of Invention
According to a first aspect of embodiments of the present disclosure, there is provided a program execution method including:
configuring a communication channel between a first execution environment and a second execution environment;
first execution code in the first execution environment, and second execution code running in the second execution environment is called through the communication channel;
and running the second execution code in the first execution environment to obtain a program execution result.
Optionally, the invoking, by the first execution code in the first execution environment and through the communication channel, a second execution code running in the second execution environment includes:
detecting whether a calling requirement for calling the second execution code exists;
and when the calling requirement exists, the first execution code in the first execution environment calls the second execution code running in the second execution environment through the communication channel.
Optionally, the detecting whether there is a call requirement for calling the second execution code includes one of:
when a page which is native to the first execution code and embedded with the second execution code is started, determining that the calling requirement for calling the second execution code exists;
when the second execution code called in the first execution environment is executed, monitoring a preset user operation or a preset trigger event, and determining that the calling requirement for calling the second execution code exists.
Optionally, the invoking, by the first execution code in the first execution environment and through the communication channel, a second execution code running in the second execution environment includes:
transmitting the encapsulation packet of the second execution code to the first execution code through the communication channel, and configuring the encapsulation packet of the second execution code at a preset position of the first execution code;
the executing the second execution code in the first execution environment to obtain a program execution result comprises:
and running the first execution code containing the packaging packet in the first execution environment to obtain a program running result.
Optionally, the method further comprises:
determining the second execution code which needs to be called and corresponds to the first execution code based on a white list; wherein, the white list pre-records the second execution code that the first execution code needs to call.
Optionally, the first execution environment is an execution environment of an application program, the first execution code is native code of the application program, the second execution environment is an execution environment of a web page presented by the application program, and the second execution code is code of the web page;
alternatively, the first and second electrodes may be,
the first execution environment is an execution environment of a web page rendered by the application, the first execution code is code of the web page, the second execution environment is an execution environment of the application, and the second execution code is native code of the application.
According to a second aspect of the embodiments of the present disclosure, there is provided a program execution device including:
a configuration module configured to configure a communication channel between a first execution environment and a second execution environment;
a calling module configured to call a second execution code running in the second execution environment through the communication channel, the first execution code being in the first execution environment;
an execution module configured to execute the second execution code in the first execution environment to obtain a program execution result.
Optionally, the invoking module further includes:
the detection submodule is configured to detect whether a call requirement for calling the second execution code exists;
and the calling submodule is configured to call the first execution code in the first execution environment and the second execution code running in the second execution environment through the communication channel when the calling requirement exists.
Optionally, the detection submodule is configured to:
when a page which is native to the first execution code and embedded with the second execution code is started, determining that the calling requirement for calling the second execution code exists;
when the second execution code called in the first execution environment is executed, monitoring a preset user operation or a preset trigger event, and determining that the calling requirement for calling the second execution code exists.
Optionally, the invoking module is further configured to:
transmitting the encapsulation packet of the second execution code to the first execution code through the communication channel, and configuring the encapsulation packet of the second execution code at a preset position of the first execution code;
the execution module further configured to:
and running the first execution code containing the packaging packet in the first execution environment to obtain a program running result.
Optionally, the apparatus further comprises:
the determining module is configured to determine that the first execution code corresponds to the second execution code to be called based on a white list; wherein, the white list pre-records the second execution code that the first execution code needs to call.
Optionally, the first execution environment is an execution environment of an application program, the first execution code is native code of the application program, the second execution environment is an execution environment of a web page presented by the application program, and the second execution code is code of the web page;
alternatively, the first and second electrodes may be,
the first execution environment is an execution environment of a web page rendered by the application, the first execution code is code of the web page, the second execution environment is an execution environment of the application, and the second execution code is native code of the application.
According to a third aspect of the embodiments of the present disclosure, there is provided a terminal, including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
configuring a communication channel between a first execution environment and a second execution environment;
first execution code in the first execution environment, and second execution code running in the second execution environment is called through the communication channel;
and running the second execution code in the first execution environment to obtain a program execution result.
According to a fourth aspect of embodiments of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon a computer program for execution by a processor to perform the method steps of any of the above.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
in the embodiment of the disclosure, a communication channel is configured between a first execution environment and a second execution environment; first execution code in the first execution environment, and second execution code running in the second execution environment is called through the communication channel; and running the second execution code in the first execution environment to obtain a program execution result. That is, the embodiment of the present disclosure may invoke the second execution code running in the second execution environment through the communication channel configured between the first execution environment and the second execution environment, and then run the second execution code in the first execution environment to obtain the program running result. Therefore, the embodiment of the disclosure does not need to limit the same software product to the same execution code and execute in the same execution environment, but different execution codes can be used for different parts of the same software product and execute in different execution environments, and mutual calling between two execution codes is realized through a communication channel and runs to obtain a program execution result.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
FIG. 1 is a flow diagram illustrating a method of program execution in accordance with an exemplary embodiment;
FIG. 2 is another flow diagram illustrating a method of program execution in accordance with an exemplary embodiment;
FIG. 3 is yet another flow chart illustrating a method of program execution in accordance with an exemplary embodiment;
FIG. 4 is a block diagram illustrating a program execution device in accordance with an exemplary embodiment;
fig. 5 is a block diagram illustrating a terminal according to an example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
Fig. 1 is a flowchart illustrating a program execution method according to an exemplary embodiment, which is applied to a terminal, as shown in fig. 1, and includes the following steps:
step 101: a communication channel is configured between the first execution environment and the second execution environment.
Here, the terminal may specifically be a mobile terminal or a fixed terminal; the mobile terminal can be a mobile phone, a tablet computer, a notebook computer and the like; the fixed terminal may be a desktop computer. The method can be applied to any terminal capable of running a computer program.
Here, the execution environment refers to an execution environment in which program codes are executed, and programs written in different development languages need to be executed in the execution environment provided for the languages. For example, a program written by Java needs to run in a JRE (Java runtime Environment) Environment; a program written in JavaScript needs to be run in an environment provided by a browser, and for example, a program written in C # runs in microsoft.
It should be noted that JavaScript is a graphics layer language, and java or C # is a server-side code.
Here, the communication channel may be a communication protocol defined between the first execution environment and the second execution environment, or a communication rule for program interaction between the first execution environment and the second execution environment.
For example, the execution code that needs to interact between the first execution environment and the second execution environment may be encapsulated in a pre-configured encapsulation package, so that the execution code can be executed in another execution environment based on the encapsulation package.
For another example, the execution code that needs to interact between the first execution environment and the second execution environment may be converted in advance, and the converted execution code is transferred to another execution environment through the communication channel so as to be executable in another execution environment.
That is to say, the communication channel can complete the mutual interaction of the execution codes in the first execution environment and the second execution environment, thereby completing the smooth execution of the program in the software product based on the execution in different execution environments for the same event. The communication protocol defined by the communication channel is not limited in any way herein.
Step 102: and calling a second execution code running in the second execution environment through the communication channel by using the first execution code in the first execution environment.
Here, the first execution code and the second execution code are program code implementing the same software product. Here, the software product may be an application program, a website system, or the like. The first execution code executes in the first execution environment and the second execution code executes in a second execution environment.
Taking the software product as an application program as an example, the first execution code is a native code of the application program. It is understood that the native code of the application is usually used for implementing the background of the application, and is the code on the server side, such as data analysis or data processing for background implementation. The first execution code is a code of a webpage presented by an application program, for example, a webpage written in JavaScript, and is used for foreground display, for example, used for displaying a data analysis result or a data processing result in the background.
Step 103: and running the second execution code in the first execution environment to obtain a program execution result.
In this embodiment, the first execution code may invoke a second execution code running in the second execution environment through the communication channel, and run the second execution code in the first execution environment to obtain a program execution result, so that execution of the same event between the first execution code and the second execution code may be implemented. For example, for a login event in an application, the first execution code may be an execution code related to analysis of verification data logged in the background, and the second execution code may be an execution code related to presentation of a result based on a verification result performed in the foreground. For another example, for a download event in an application program, the first execution code may be a related execution code for performing download data processing in the background, and the second execution code may be a related execution code for performing result presentation based on a download result in the foreground.
Therefore, the terminal can call the second execution code which cannot be run in the first execution environment to run in the first execution environment through one communication channel, so that two different execution codes of the same program can be mutually called and executed to obtain an execution result. Therefore, by the method, the program can be split and compiled, the program development efficiency is improved, when some parts of the program need to be modified, the whole part does not need to be modified and compiled, and only the codes of the corresponding parts need to be modified and tested in the execution environment corresponding to the codes of the parts, so that the workload of developers is reduced, the development efficiency is improved, and the development cost is reduced.
Moreover, because the program can be split and written, when the software product is updated aiming at a part of execution codes, the use of the whole software product does not need to be stopped, and a new version is released after the part of the execution codes are updated, so that the phenomenon that the whole software product cannot be used when the version of the software product is iterated is reduced.
As an alternative embodiment, the step 102, that is, the first execution code in the first execution environment, calls the second execution code running in the second execution environment through the communication channel, and includes: detecting whether a calling requirement for calling the second execution code exists; and when the calling requirement exists, the first execution code in the first execution environment calls the second execution code in the second execution environment through the communication channel.
Here, the terminal automatically calls the second execution code running in the second execution environment through the communication channel by detecting whether there is a call demand for calling the second execution code.
It is understood that the call requirement for calling the second execution code may be pre-configured according to the requirement of the software product. Specifically, when an event that interaction is required between a first execution code and a second execution code in a software product occurs, that is, when the first execution code and the second execution code need to jointly complete the same event, it is determined that there is a call requirement for calling the second execution code. For example, a login event or a download event requiring interaction between a first executing code and a second executing code in a software product.
In practical applications, the detecting whether there is a call requirement for calling the second execution code may be that, according to a requirement of a software product, a predetermined instruction code is inserted in a predetermined execution position of the first execution code in advance, and by detecting the predetermined instruction code, there is a call requirement for calling the second execution code. For example, for a java code, a corresponding JavaScript code can be called by an instruction code such as webview.
As an optional embodiment, the detecting whether there is a call requirement for calling the second execution code includes:
when a page which is native to the first execution code and embedded with a second execution code is started, determining that the calling requirement for calling the second execution code exists;
here, when the page embedded with the first execution code and native to start the first execution code includes the second execution code, it is determined that there is the call demand for calling the second execution code, and it may be understood that the page embedded with the second execution code is embedded into the native code of the first execution code in advance, and when a predetermined event occurs in the page embedded with the second execution code in the first execution code, the page embedded with the second execution code and native to start the first execution code is started. At this time, the terminal determines that there is the call demand for calling the second execution code.
Specifically, the page containing the second execution code may be a page corresponding to a login control, for example, shown in a web page presented by an application program, or a page corresponding to a download control, that is, when a corresponding click operation is detected on the page corresponding to the login control or the page corresponding to the download control, the corresponding predetermined event is generated, and the page containing the second execution code is started to be embedded into the first execution code.
In other embodiments, when the page embedded with the second execution code, which starts the first execution code to be native, is determined to have the call requirement for calling the second execution code, it may be understood that the page embedded with the second execution code is embedded into the native code of the first execution code in advance, and when the first execution code runs into the program node embedded with the second execution code, it indicates that the page embedded with the second execution code, which starts the first execution code to be native, is embedded. At this time, the terminal determines that there is the call demand for calling the second execution code.
Specifically, the page containing the second execution code may be a page showing comments in web pages of a forum website, that is, when a comment event occurs in the background, the page containing the second execution code embedded in the first execution code is started.
As another optional embodiment, the detecting whether there is a call requirement for calling the second execution code includes:
when the second execution code called in the first execution environment is executed, monitoring a preset user operation or a preset trigger event, and determining that the calling requirement for calling the second execution code exists.
Here, the second execution code that has been called in the first execution environment is executed while monitoring a predetermined user operation or a predetermined trigger event, and it is determined that there is a call request for calling the second execution code, and it is understood that the first execution environment is a trigger event when a predetermined user operation or a predetermined trigger event is monitored while the second execution code has been called in the first execution environment, for example, a download event is being executed, for example, a stop operation of a user is monitored, or a problem occurs in a server download resource. At this time, the background is required to return an interactive page with failed download to the foreground, so that it can be determined that there is the call requirement for calling the second execution code.
As an optional embodiment, the first execution code in the first execution environment calling the second execution code running in the second execution environment through the communication channel includes:
transmitting the encapsulation packet of the second execution code to the first execution code through the communication channel, and configuring the encapsulation packet of the second execution code at a preset position of the first execution code;
the executing the second execution code in the first execution environment to obtain a program execution result comprises:
and running the first execution code containing the packaging packet in the first execution environment to obtain a program running result.
Here, the encapsulation packet of the second execution code may include: the interface which can be identified by the first execution environment and is packaged by the second execution code can be used for enabling the first execution code to call the second execution code through the interface so as to execute the second execution code.
In another embodiment, the encapsulating packet of the second execution code may further include: and the encapsulation package of the function library of the second execution code can enable the first execution code to call the function library of the second execution code through the function library to replace the second execution code for execution. For example, taking the first execution code as java code and the second execution code as JaveScript code as an example, if the java code needs to call the JaveScript code, a function library of the JaveScript code may be configured in a predetermined position, for example, in the head, of the java code in advance, so that the JaveScript code may be executed by calling the function library of the JaveScript code at the same time when the java code is executed.
It is added that, in some embodiments, when the call requirement is determined, a second execution code corresponding to the first execution code is called through a certain call instruction. For example, for the jave code, the JavaScript code that needs to be called can be determined through shouldoverlaveriderurrlloading ().
In this embodiment, by configuring the encapsulation package of the second execution code at the predetermined position of the first execution code, the problem that the second execution code cannot run in the first execution environment of the first execution code is solved, and the implementation is convenient and simple, and is implemented without complex programming modes such as corresponding replacement of the first execution code and the second execution code by developers.
As an optional embodiment, the method further comprises:
determining the second execution code which needs to be called and corresponds to the first execution code based on a white list; wherein, the white list pre-records the second execution code that the first execution code needs to call.
Since the whitelist is pre-recorded with the second execution code that the first execution code needs to call, in some embodiments, the method may further include: and determining whether the first execution code has a call requirement for calling the second execution code by using the white list.
Taking java codes as an example, the terminal can call a white list through a needlinjbjisbridge () instruction, judge java codes needing to be loaded before loading an application program, and judge whether the JavaScript codes need to be called through the white list.
In this embodiment, through the establishment of the white list, the second execution code that needs to be called by the first execution code may be placed in the white list, and the second execution code that does not need to be called is excluded in advance. Therefore, when the first execution code needs to be called, the second execution code which needs to be called by the first code can be quickly found through the white list, and the program execution efficiency is improved.
As an alternative embodiment, the first execution environment is an execution environment of an application program, the first execution code is native code of the application program, the second execution environment is an execution environment of a web page presented by the application program, and the second execution code is code of the web page;
alternatively, the first and second electrodes may be,
the first execution environment is an execution environment of a web page rendered by the application, the first execution code is code of the web page, the second execution environment is an execution environment of the application, and the second execution code is native code of the application.
Here, taking the application as the software product as an example, the software product of the application can be split into native codes of the application and codes of a web page of the application, and because the codes of the web page presented by the application, such as html and JavaScript, have the characteristics of short development period and online updating, etc., it is not necessary to start engineering development like the native codes of the application.
Further, the embodiment can call the code of the webpage presented by the application program through the communication channel, and operate in the execution environment of the application program; or calling the native code of the application program through the communication channel and running in the execution environment of the webpage presented by the application program to complete the interaction between the native code of the application program and the code of the webpage presented by the application program. In this way, even if the application program is developed by being split into the execution codes in the two execution environments, the execution of the application program is not affected. Therefore, in the embodiment, when modifying some codes of the webpage related to the application program, modification of native codes of the application program and the like do not need to be started, so that the workload of developers can be reduced, the development efficiency can be improved, and the development cost can be reduced.
Further, the present disclosure provides a specific embodiment to further understand the program execution method provided by the embodiment of the present disclosure.
The execution environment of the application program is taken as a first execution environment, and the native code of the application program is taken as a first execution code; and taking the execution environment of the webpage presented by the application program as a second execution environment, and taking the code of the webpage as a second execution code.
Here, the second execution code of the web page is js (javascript) code, and the native code of the application program is jave code.
FIG. 2 is another flow diagram illustrating a method of program execution, according to an exemplary embodiment, as shown in FIG. 2, the method comprising:
step 201: the Js is loaded.
It will be appreciated that loading Js is loading the web page of the application.
Step 202: and judging whether injection is needed, if so, executing step 203, and if not, executing step 204.
Here, it is determined whether injection is required, that is, whether there is a call demand for calling the second execution code is detected as described in the above embodiment.
Step 203: and (5) injecting.
Here, injecting the Js may be understood as referring to the first execution code in the first execution environment and calling the second execution code in the second execution environment through the communication channel, in the above embodiments.
In a specific application, the determination of whether injection is needed is usually determined by the current execution status of the application, for example, when the application currently starts the page embedded with the first execution code and native with the second execution code, it is determined that injection is needed.
Step 204: and (6) ending.
In this embodiment, by injecting Js into the native code of the application program, the interaction between the application program and the web page presented by the application program is realized in cooperation with the native code of the application program. Meanwhile, the execution code of the webpage based on the application program can be independent of the native code of the application program, and when the style and the like of the webpage of the application program are changed, the native code of the application program is not required to be modified completely, so that the efficiency of program development is improved. And based on the characteristic that the webpage development period is short, online updating can be realized, and in the process of cross-platform development of the application program, the webpage of the application program is developed aiming at different platforms, so that the development workload is reduced, and the development efficiency is improved.
Taking the execution environment of the application program as a second execution environment, and taking the native code of the application program as a second execution code; and taking the execution environment of the webpage presented by the application program as a first execution environment, and taking the code of the webpage as a second execution code.
Here, the second execution code of the web page is Js code, and the native code of the application is java code.
FIG. 3 is yet another flow diagram illustrating a method of program execution, as shown in FIG. 3, according to an exemplary embodiment, the method comprising:
step 301: a callback occurs.
It is understood that after Js is injected into the native code of an application, a program execution result is obtained. Whether a response will occur to the program execution result. For example, for the program execution result of the download event, the callback is a download success or a download failure; and calling back is successful login or failed login according to the program execution result of the login event.
Step 302: if not, step 303 is executed, and if yes, step 304 is executed.
Here, the page is a callback that is determined to be required to be processed, that is, a callback that is required to be returned to a web page presented by the application program, if the execution environment executed by the native code of the application program responds to the callback.
Step 303: and processing the call-back.
Here, the processing callback may be understood as that the first execution code in the first execution environment calls the second execution code running in the second execution environment through the communication channel when there is the call requirement in the above embodiment. I.e., code on the web page of the application, calls native code of the application running in the execution environment of the application through the communication channel.
Step 304: and (6) ending.
In this embodiment, the native code of the application program is called into the web page code of the application program through the communication channel to show a return result of the native code of the application program for the relevant event, so that interaction between the native code of the application program and the web page presented by the application program is realized. Similarly, the execution code of the webpage based on the application program can be independent of the native code of the application program, and when the style and the like of the webpage of the application program are changed, the native code of the application program does not need to be modified at all, so that the efficiency of program development is improved. And based on the characteristic that the webpage development period is short, online updating can be realized, and in the process of cross-platform development of the application program, the webpage of the application program is developed aiming at different platforms, so that the development workload is reduced, and the development efficiency is improved.
Fig. 4 is a block diagram illustrating a program execution device according to an example embodiment. Referring to fig. 4, the apparatus includes a configuration module 41, a calling module 42, and an execution module 43;
the configuration module 41 configured to configure a communication channel between the first execution environment and the second execution environment;
the calling module 42 is configured to execute a first execution code in the first execution environment and call a second execution code running in the second execution environment through the communication channel;
the execution module 43 is configured to execute the second execution code in the first execution environment to obtain a program execution result.
In an optional embodiment, the invoking module 42 further includes:
the detection submodule is configured to detect whether a call requirement for calling the second execution code exists;
and the calling submodule is configured to call the first execution code in the first execution environment and the second execution code running in the second execution environment through the communication channel when the calling requirement exists.
In an optional embodiment, the detection submodule is configured to one of:
when a page which is native to the first execution code and embedded with the second execution code is started, determining that the calling requirement for calling the second execution code exists;
when the second execution code called in the first execution environment is executed, monitoring a preset user operation or a preset trigger event, and determining that the calling requirement for calling the second execution code exists.
In an optional embodiment, the invoking module 42 is further configured to:
transmitting the encapsulation packet of the second execution code to the first execution code through the communication channel, and configuring the encapsulation packet of the second execution code at a preset position of the first execution code;
the execution module 43 is further configured to:
and running the first execution code containing the packaging packet in the first execution environment to obtain a program running result.
In an optional embodiment, the apparatus further comprises:
the determining module is configured to determine that the first execution code corresponds to the second execution code to be called based on a white list; wherein, the white list pre-records the second execution code that the first execution code needs to call.
In an alternative embodiment, the first execution environment is an execution environment of an application, the first execution code is native code of the application, the second execution environment is an execution environment of a web page rendered by the application, and the second execution code is code of the web page;
alternatively, the first and second electrodes may be,
the first execution environment is an execution environment of a web page rendered by the application, the first execution code is code of the web page, the second execution environment is an execution environment of the application, and the second execution code is native code of the application.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 5 is a block diagram illustrating a terminal 500 according to an example embodiment. For example, the terminal 500 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 5, terminal 500 may include one or more of the following components: a processing component 502, a memory 504, a power component 506, a multimedia component 508, an audio component 510, an input/output (I/O) interface 512, a sensor component 514, and a communication component 516.
The processing component 502 generally controls overall operation of the terminal 500, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 502 may include one or more processors 520 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 502 can include one or more modules that facilitate interaction between the processing component 502 and other components. For example, the processing component 502 can include a multimedia module to facilitate interaction between the multimedia component 508 and the processing component 502.
The memory 504 is configured to store various types of data to support operations at the terminal 500. Examples of such data include instructions for any application or method operating on terminal 500, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 504 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power component 506 provides power to the various components of terminal 500. Power components 506 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for terminal 500.
The multimedia component 508 includes a screen providing an output interface between the terminal 500 and the user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the terminal 500 is in an operation mode, such as a photographing mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 510 is configured to output and/or input audio signals. For example, the audio component 510 includes a Microphone (MIC) configured to receive external audio signals when the terminal 500 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in memory 804 or transmitted via communications component 516. In some embodiments, audio component 510 further includes a speaker for outputting audio signals.
The I/O interface 512 provides an interface between the processing component 502 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 514 includes one or more sensors for providing various aspects of status assessment for the terminal 500. For example, sensor component 514 can detect an open/closed state of terminal 500, relative positioning of components such as a display and keypad of terminal 500, change in position of one component of terminal 500 or terminal 5000, presence or absence of user contact with terminal 500, orientation or acceleration/deceleration of terminal 500, and temperature change of terminal 500. The sensor assembly 514 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 514 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 516 is configured to facilitate communications between the terminal 500 and other devices in a wired or wireless manner. The terminal 500 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 516 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the terminal 500 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer readable storage medium comprising instructions, such as the memory 504 comprising instructions, executable by the processor 520 of the terminal 500 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
A non-transitory computer-readable storage medium, wherein instructions of the storage medium, when executed by a processor of a terminal, enable the terminal to perform the program execution method according to the above embodiments.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.

Claims (14)

1. A program execution method, comprising:
configuring a communication channel between a first execution environment and a second execution environment;
first execution code in the first execution environment, and second execution code running in the second execution environment is called through the communication channel;
and running the second execution code in the first execution environment to obtain a program execution result.
2. The method of claim 1, wherein said first executing code in the first execution environment invoking a second executing code running in the second execution environment through the communication channel comprises:
detecting whether a calling requirement for calling the second execution code exists;
and when the calling requirement exists, the first execution code in the first execution environment calls the second execution code running in the second execution environment through the communication channel.
3. The method of claim 2, wherein detecting whether there is a call requirement to call the second executable code comprises one of:
when a page which is native to the first execution code and embedded with the second execution code is started, determining that the calling requirement for calling the second execution code exists;
when the second execution code called in the first execution environment is executed, monitoring a preset user operation or a preset trigger event, and determining that the calling requirement for calling the second execution code exists.
4. The method of claim 1, wherein said first executing code in the first execution environment invoking a second executing code running in the second execution environment through the communication channel comprises:
transmitting the encapsulation packet of the second execution code to the first execution code through the communication channel, and configuring the encapsulation packet of the second execution code at a preset position of the first execution code;
the executing the second execution code in the first execution environment to obtain a program execution result comprises:
and running the first execution code containing the packaging packet in the first execution environment to obtain a program running result.
5. The method of claim 1, further comprising:
determining the second execution code which needs to be called and corresponds to the first execution code based on a white list; wherein, the white list pre-records the second execution code that the first execution code needs to call.
6. The method of claim 1,
the first execution environment is an execution environment of an application program, the first execution code is native code of the application program, the second execution environment is an execution environment of a webpage presented by the application program, and the second execution code is code of the webpage;
alternatively, the first and second electrodes may be,
the first execution environment is an execution environment of a web page rendered by the application, the first execution code is code of the web page, the second execution environment is an execution environment of the application, and the second execution code is native code of the application.
7. A program execution device, comprising:
a configuration module configured to configure a communication channel between a first execution environment and a second execution environment;
a calling module configured to call a second execution code running in the second execution environment through the communication channel, the first execution code being in the first execution environment;
an execution module configured to execute the second execution code in the first execution environment to obtain a program execution result.
8. The apparatus of claim 7, wherein the invoking module further comprises:
the detection submodule is configured to detect whether a call requirement for calling the second execution code exists;
and the calling submodule is configured to call the first execution code in the first execution environment and the second execution code running in the second execution environment through the communication channel when the calling requirement exists.
9. The apparatus of claim 8, wherein the detection submodule is configured to one of:
when a page which is native to the first execution code and embedded with the second execution code is started, determining that the calling requirement for calling the second execution code exists;
when the second execution code called in the first execution environment is executed, monitoring a preset user operation or a preset trigger event, and determining that the calling requirement for calling the second execution code exists.
10. The apparatus of claim 7, wherein the invoking module is further configured to:
transmitting the encapsulation packet of the second execution code to the first execution code through the communication channel, and configuring the encapsulation packet of the second execution code at a preset position of the first execution code;
the execution module further configured to:
and running the first execution code containing the packaging packet in the first execution environment to obtain a program running result.
11. The apparatus of claim 7, further comprising:
the determining module is configured to determine that the first execution code corresponds to the second execution code to be called based on a white list; wherein, the white list pre-records the second execution code that the first execution code needs to call.
12. The apparatus of claim 7,
the first execution environment is an execution environment of an application program, the first execution code is native code of the application program, the second execution environment is an execution environment of a webpage presented by the application program, and the second execution code is code of the webpage;
alternatively, the first and second electrodes may be,
the first execution environment is an execution environment of a web page rendered by the application, the first execution code is code of the web page, the second execution environment is an execution environment of the application, and the second execution code is native code of the application.
13. A terminal, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
configuring a communication channel between a first execution environment and a second execution environment;
first execution code in the first execution environment, and second execution code running in the second execution environment is called through the communication channel;
and running the second execution code in the first execution environment to obtain a program execution result.
14. A non-transitory computer-readable storage medium, on which a computer program is stored, characterized in that the program is executed by a processor to implement the method steps of any of claims 1 to 6.
CN201911243362.2A 2019-12-06 2019-12-06 Program execution method, device, terminal and storage medium Active CN111124553B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911243362.2A CN111124553B (en) 2019-12-06 2019-12-06 Program execution method, device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911243362.2A CN111124553B (en) 2019-12-06 2019-12-06 Program execution method, device, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN111124553A true CN111124553A (en) 2020-05-08
CN111124553B CN111124553B (en) 2024-04-26

Family

ID=70497677

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911243362.2A Active CN111124553B (en) 2019-12-06 2019-12-06 Program execution method, device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN111124553B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2343266A (en) * 1998-10-29 2000-05-03 Ibm Event controller object
US20040268312A1 (en) * 2003-05-30 2004-12-30 International Business Machines Corporation Application development support, component invocation monitoring, and data processing
CN106445518A (en) * 2016-09-22 2017-02-22 中国传媒大学 Method and system for developing cross-platform mobile terminal application
CN106815055A (en) * 2017-02-15 2017-06-09 深圳创维-Rgb电子有限公司 The method and system of Mobile solution Dynamic Distribution
CN109032612A (en) * 2018-07-02 2018-12-18 平安科技(深圳)有限公司 Interface call method, device and the computer readable storage medium of mixed type application
CN109976831A (en) * 2019-03-28 2019-07-05 山东浪潮通软信息科技有限公司 Data interactive method between a kind of JavaScript and primary APP

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2343266A (en) * 1998-10-29 2000-05-03 Ibm Event controller object
US20040268312A1 (en) * 2003-05-30 2004-12-30 International Business Machines Corporation Application development support, component invocation monitoring, and data processing
CN106445518A (en) * 2016-09-22 2017-02-22 中国传媒大学 Method and system for developing cross-platform mobile terminal application
CN106815055A (en) * 2017-02-15 2017-06-09 深圳创维-Rgb电子有限公司 The method and system of Mobile solution Dynamic Distribution
CN109032612A (en) * 2018-07-02 2018-12-18 平安科技(深圳)有限公司 Interface call method, device and the computer readable storage medium of mixed type application
CN109976831A (en) * 2019-03-28 2019-07-05 山东浪潮通软信息科技有限公司 Data interactive method between a kind of JavaScript and primary APP

Also Published As

Publication number Publication date
CN111124553B (en) 2024-04-26

Similar Documents

Publication Publication Date Title
CN111026396B (en) Page rendering method and device, electronic equipment and storage medium
CN108182131B (en) Method and device for monitoring application running state, storage medium and electronic equipment
CN110990105B (en) Interface display method and device, electronic equipment and storage medium
US9870239B2 (en) Method and device for running application program
CN110781080B (en) Program debugging method and device and storage medium
CN111427622B (en) Execution method and device of script codes in application program
CN111736916A (en) Dynamic expansion method and device based on Java language, electronic equipment and storage medium
CN107911482B (en) Target application opening method and device
CN110795354A (en) Information processing method, device and storage medium
CN110851370B (en) Program testing method and device and storage medium
CN111008050B (en) Page task execution method, device, terminal and storage medium
CN111124553B (en) Program execution method, device, terminal and storage medium
CN111596980B (en) Information processing method and device
CN111338961B (en) Application debugging method and device, electronic equipment and storage medium
CN111104183B (en) Application program running method and device, electronic equipment and storage medium
CN112631695A (en) Data verification method and device, electronic equipment and storage medium
CN108563487B (en) User interface updating method and device
CN112860625A (en) Data acquisition method, data storage method, device, equipment and storage medium
CN111831292A (en) Method and device for generating installation package, storage medium and electronic equipment
CN110941459A (en) Method and device for calling Replugin
CN111290944A (en) Script generation method, device and storage medium
CN112083981A (en) Method and device for creating page view component
CN112306566A (en) Data processing method and device
CN113360341B (en) Front-end application maintenance and loading method and device
CN111596949B (en) Method and device for developing application program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant