CN113032037A - Method and device for dynamically configuring chromium functional module and electronic equipment - Google Patents

Method and device for dynamically configuring chromium functional module and electronic equipment Download PDF

Info

Publication number
CN113032037A
CN113032037A CN202110188616.6A CN202110188616A CN113032037A CN 113032037 A CN113032037 A CN 113032037A CN 202110188616 A CN202110188616 A CN 202110188616A CN 113032037 A CN113032037 A CN 113032037A
Authority
CN
China
Prior art keywords
function
switch
build
browser
module
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
CN202110188616.6A
Other languages
Chinese (zh)
Other versions
CN113032037B (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.)
Seerof Information Technology Shanghai Co ltd
Original Assignee
Seerof Information Technology Shanghai 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 Seerof Information Technology Shanghai Co ltd filed Critical Seerof Information Technology Shanghai Co ltd
Priority to CN202110188616.6A priority Critical patent/CN113032037B/en
Publication of CN113032037A publication Critical patent/CN113032037A/en
Application granted granted Critical
Publication of CN113032037B publication Critical patent/CN113032037B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Devices For Executing Special Programs (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a method and a device for dynamically configuring a chrome browser functional module and electronic equipment, wherein the method comprises the following steps: the method comprises the steps of carding a function module of the chromium browser, and identifying a function item of the chromium browser, which is not provided with a switch; adding a configuration switch aiming at the function item of the unconfigured switch; setting a function configuration list according to requirements and controlling the compiling of the function items; and operating the chromium browser, and controlling functional items to participate or not to participate in operation. According to the method, the device and the electronic equipment for dynamically configuring the chromium functional module, the functional modules are carded and modularized, the functional switches are added to the functions of the chromium, and the configuration of the functional switches is provided externally, so that the aims of quickly customizing and cutting the functions of the chromium, balancing the functions, the performance and the binary size are fulfilled, and the dynamic configuration of the chromium functional module is realized.

Description

Method and device for dynamically configuring chromium functional module and electronic equipment
Technical Field
The invention relates to the field of browsers, in particular to a method and a device for dynamically configuring a chromium functional module and electronic equipment.
Background
Chrome is an excellent and rich-function open source browser engine, and the embed view or Hybrid App of many platforms is constructed based on the chrome browser engine. The whole chromosome engine not only comprises a plurality of kernel platform level functions, such as finished W3C spec support, rich HTML tag and CSS3 style attributes, but also comprises a plurality of Application level functions, such as webpage translation, multi-user, night mode and the like, which are realized by the chromosome at the periphery.
Although the Chromium is a browser engine with rich functions, the Chromium advocates space time exchange, so that the Chromium compromises other points such as Memory and Binary Size while pursuing speed, and the Chromium looks bloated to some extent. Some functions of the Chromium are even redundant when applied on certain specific platforms. For example, a GPS module is not arranged on a TV system, a chroma LBS module is not required on the TV at all, and an HTML geocation API is not required to be supported; for another example, there is no Camera module on a TV, so the WebRTC module is also not needed for chromaum on a TV system.
Therefore, many times we do not need the large and full functions of the chroma when creating their own browser or browser SDK based on the chroma, and we need to adaptively tailor these multiple functions of the chroma according to different scenes or hardware platforms, especially embedded platforms, to realize a small and fine customized browser or browser SDK, so as to achieve the balance of functions, performance and size.
However, many functions in the chroma are not modularized, and even the configurable function modules are not realized, many modules are not exposed and provide an external flag switch, and many functions are crossed. This current state of the art for Chromium makes it cumbersome when some platforms require functional tailoring of Chromium. The correlation of various functions in the chromosome and the overall link trend of each function need to be cleaned up, and then the functions can be cut.
Disclosure of Invention
In view of the above-mentioned defects of the prior art, the technical problems to be solved by the present invention are that the functions in the chromosome are not modularized, the configurability of each functional module is not realized, and an external flag switch is not provided, so that it is very troublesome to perform function clipping on the chromosome. Therefore, the invention provides a method, a device and electronic equipment for dynamically configuring a chromium function module, wherein the method, the device and the electronic equipment are used for combing and modularizing each function module of the chromium, adding a function switch to each function of the chromium, and providing function switch configuration to the outside, so as to achieve the purposes of quickly customizing and cutting the chromium function, balancing the function, the performance and the binary size, and realize the dynamic configuration of the chromium function module.
In order to achieve the above object, the present invention provides a method for dynamically configuring a chrome browser function module, comprising the following steps:
the method comprises the steps of carding a function module of the chromium browser, and identifying a function item of the chromium browser, which is not provided with a switch;
adding a configuration switch aiming at the function item of the unconfigured switch;
setting a function configuration list according to requirements and controlling the compiling of the function items;
and operating the chromium browser, and controlling functional items to participate or not to participate in operation.
Further, the function module of the comb premium browser specifically comprises the following steps:
identifying the relationship and the dependence calling link of each functional module of the chromium browser through the functional design document of the chromium browser and the code corresponding to the function;
identifying the intersection points of the functional modules through the relationship of the functional modules and the dependence calling link;
judging the number of functional modules and the number of cross points in the chrome browser, and reconstructing the crossed functional modules and independently separating the crossed functional modules when the number of the functional modules and the number of the cross points in the chrome browser are smaller than threshold values;
and when the number of the functional modules in the chromium browser and the number of the intersection points are larger than the threshold value, combining the partially intersected functional modules to form a new larger functional module.
Furthermore, gn build flag option output generated according to gn args-list, FeatureList word in code, commandline flags word, build flag macro, custom macro are combined with the chrome directory structure to comb up each function module of chrome.
Further, identifying a function item of the chrome browser which is not configured with a switch specifically comprises the following steps:
and (3) combing the starting process of the chromium browser, and the build.gn file related to the code and gn compiling chain, and identifying a point in the code or the build.gn file where a function switch is not configured, so as to identify a function item of the chromium browser where the switch is not configured.
Further, identifying a function item of the chrome browser which is not configured with a switch specifically comprises the following steps:
and generating a gn build switch list by looking up gn args-list, and looking up all commandline to identify the function items of the configured switches, thereby deducing that the rest function items are unconfigured switches.
Further, adding a configuration switch for a function item of an unconfigured switch specifically includes the following steps:
determining the relationship between the function items through the design documents and the related codes of the function items;
determining the type and number of switches to be added for the function item;
a switch is then created.
Further, the switch types include a build switch and a runtime switch.
Further, when the type of the switch added for the function item is determined to be a build switch, a build flag is newly added in the build.gn file, and then the compiling of the related file is controlled through the build flag;
meanwhile, defining a buildflag macro or a custom macro in the build according to the buildflag;
the function code is then wrapped with these macros in the code.
Further, when the switch type added for the function item is determined to be a runtime switch, a single xxx _ features.h/xxx _ features.cc file is created under the function code directory for the feature list runtime switch, and the feature-runtime switch of the function module is stored in the file;
aiming at a commandline runtime switch, creating a single xxx _ switches.h/xxx _ switches.cc under a function code directory, and storing the commandline runtime switch with the function;
the function code is then wrapped in the code with these switches.
Further, setting a function configuration list according to requirements and controlling the compiling of the function items, comprising the following steps:
setting a structured function configuration list according to the software and hardware characteristics of the platform and the specific requirements of a user;
and analyzing the function configuration list to obtain a build switch, applying the build switch to the build.
Furthermore, a structured function configuration list is set according to the software and hardware characteristics of the platform and the specific requirements of the user, and the setting of the function configuration list is completed by combining program automatic configuration and manual personalized customization configuration.
Further, a platform interface is called, hardware information of the current equipment is obtained, a part of function configuration lists are automatically configured according to the hardware performance of the equipment, and switches of some function items are dynamically turned on or turned off according to the hardware performance.
Further, the method for controlling compiling of the function items includes parsing the function configuration list to obtain a build switch, and applying the build switch to the build.
And analyzing the function configuration list to obtain a build switch, setting the build switch into build.gn, finally generating a build.ninja compiling file, and finally generating a specific target product output component through ninja compiling.
Further, when the chrome browser is operated, the control function item participates or does not participate in the operation, and the method specifically comprises the following steps:
and analyzing the function configuration list to obtain a Runtime switch, and controlling the function item to participate or not to participate in the operation.
Further, analyzing the runtime switch from the function configuration list, setting the runtime switch into a commandline, reading the commandline value by the chromium browser during operation, and dynamically opening or closing the function item.
Another embodiment of the present invention provides a device for dynamically configuring a chrome browser function module, including the following modules:
the combing module is used for combing the functional module of the chromium browser and identifying the functional items of the chromium browser which are not configured with a switch;
the newly-added module is used for adding a configuration switch aiming at the function items which are not configured with the switch;
the compiling module is used for setting a function configuration list according to requirements and controlling the compiling of the function items;
and the operation module is used for operating the chromium browser and controlling the function item to participate or not to participate in the operation.
Further, the carding module comprises the following units:
the first identification unit is used for identifying the relationship and the dependence calling link of each functional module of the chromium browser through the functional design document of the chromium browser and the code corresponding to the function;
the second identification unit is used for identifying the cross points of the functional modules through the relationship and the dependence calling links of the functional modules;
the first processing unit is used for judging the number of the functional modules and the number of the cross points in the chromium browser, and when the number of the functional modules and the number of the cross points in the chromium browser are smaller than threshold values, reconstructing the crossed functional modules and separating the crossed functional modules;
and the second processing unit is used for combining the partially crossed functional modules to form a new larger functional module when the number of the functional modules and the number of the crossed points in the chromium browser are greater than threshold values.
Furthermore, the first identification unit integrates the gn build flag option output, FeatureList characters in the code, commandline flags characters, build flag macros and custom macros generated according to gn args-list, and combines the custom macros with the cache directory structure to comb the various function modules of the cache.
Furthermore, the combing module further comprises an identification configuration switch unit, which is used for identifying the function item of the non-configuration switch of the chromium browser, specifically used for combing the build.gn file related to the starting process, the related code and the gn compiling chain of the chromium browser, and identifying the point of the non-configuration switch in the code or the build.gn file, thereby identifying the function item of the non-configuration switch of the chromium browser.
Further, the identifying and configuring switch unit is further configured to look up gn args-list to generate a gn build switch list, look up all commandlines, identify the function items of the configured switches, and accordingly deduce that the remaining function items are the unconfigured switches.
Further, the newly added module specifically comprises the following units:
the relation determining unit is used for determining the relation between the inside and the outside of the function item through the design document and the related code of the function item;
a determination type unit for determining the type and number of switches to be added for the function item;
a creating unit for creating a switch.
Further, the switch types include a build switch and a runtime switch.
Further, when the type determining unit determines that the type of the added switch of the function item is a build switch, a build flag is newly added in the build.gn file, and then the compiling of the related file is controlled through the build flag;
meanwhile, defining a buildflag macro or a custom macro in the build according to the buildflag;
the function code is then wrapped with these macros in the code.
Further, when the type determining unit determines that the type of the added switch for the function item is a runtime switch, creating a separate xxx _ features.h/xxx _ features.cc file under the function code directory for the feature list runtime switch, and storing the feature-runtime switch of the function module;
aiming at a commandline runtime switch, creating a single xxx _ switches.h/xxx _ switches.cc under a function code directory, and storing the commandline runtime switch with the function;
the function code is then wrapped in the code with these switches.
Further, the compiling module includes the following units:
the configuration unit is used for setting a structured function configuration list according to the software and hardware characteristics of the platform and the specific requirements of a user;
and the compiling unit is used for analyzing the function configuration list to obtain a build switch, applying the build switch to the build.gn and controlling the compiling of the function items.
Furthermore, the configuration unit sets the function configuration list through the combination of program automatic configuration and manual personalized customization configuration.
Further, the configuration unit calls a platform interface, acquires the hardware information of the current device, automatically configures a part of function configuration lists according to the hardware performance of the device, and dynamically turns on or off switches of some function items according to the hardware performance.
Further, the compiling unit analyzes the function configuration list to obtain a build switch, then sets the build switch into build.gn, finally generates a build.ninja compiling file, and finally generates a specific target product output component through ninja compiling.
Furthermore, the running module analyzes the function configuration list to obtain a Runtime switch, and controls the function item to participate or not to participate in running.
Further, analyzing the runtime switch from the function configuration list, setting the runtime switch into a commandline, reading the commandline value by the chromium browser during operation, and dynamically opening or closing the function item.
A further preferred embodiment of the invention provides a computer apparatus comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor when executing the program implementing the method as claimed in any one of the preceding claims.
Another preferred embodiment of the present invention provides a computer readable storage medium storing a computer program, which when executed by a computer, implements a method of dynamically configuring a chromatic browser function module as described in any one of the above.
Technical effects
The invention carries out modular processing on the chromosome function, adds a function switch to each function module of the chromosome, provides a function switch configuration item externally, and can control the opening or closing of a certain function externally through the switch configuration item.
By the invention, the chroma functional module can be quickly customized and cut according to different hardware platforms and different requirements of scenes, and the invention has the following advantages:
1. sorting and classifying the Chromium functional modules;
2. the method can dynamically issue a function configuration list according to the characteristics of the current platform, and achieves the purpose of quickly customizing and cutting the Chromium function;
3. by cutting the Chromium function, the size of the whole Chromium binary size can be reduced, and memory occupation during the running of the Chromium is reduced.
The conception, the specific structure, and the technical effects produced by the present invention will be further described below to fully understand the objects, the features, and the effects of the present invention.
Detailed Description
In order to make the technical problems, technical solutions and advantageous effects to be solved by the present invention more apparent, the following and embodiments will explain the present invention in further detail. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular internal procedures, techniques, etc. in order to provide a thorough understanding of the embodiments of the invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
Example one
The embodiment of the invention provides a method for dynamically configuring a chrome browser functional module, which comprises the following steps:
step 100, combing a function module of the chromium browser, and identifying a function item of the chromium browser which is not configured with a switch;
step 200, adding a configuration switch aiming at a function item without the configuration switch;
step 300, setting a function configuration list according to requirements and controlling the compiling of function items;
and step 400, operating the chromium browser, and controlling functional items to participate or not participate in operation.
In step 100, the method specifically comprises the following steps:
step 101, identifying the relationship and the dependence calling link of each functional module of the chromium browser through a functional design document and a code corresponding to the function of the chromium browser;
102, identifying the cross points of the functional modules through the relationship of the functional modules and the dependence calling link;
103, judging the number of the functional modules and the number of the cross points in the chromium browser, and reconstructing the crossed functional modules and isolating the crossed functional modules when the number of the functional modules and the number of the cross points in the chromium browser are smaller than a threshold value;
and 104, combining the partially crossed functional modules to form a new larger functional module when the number of the functional modules and the number of the crossed points in the chromium browser are greater than threshold values.
And outputting gn build flag option generated according to gn args-list, and combing each functional module of the chromium by combining FeatureList characters, commandline flags characters, build flag macros and custom macros in codes with a chromium directory structure.
In step 100, two methods are mainly used for identifying the function item of the configurable switch of the chromium browser, namely, the method comprises the steps of combing the build.gn file related to the starting process, the related code and the gn compiling chain of the chromium browser, and identifying the point of the configurable switch in the code or the build.gn file, so as to identify the function item of the configurable switch of the chromium browser.
Another way is to look at gn args-list to generate gn build switch list, and look at all commandlines to identify the function items of configured switches, thereby deducing the rest function items as unconfigured switches. The method for identifying the existing function item switch is that a gn build switch list can be generated by checking gn args-list, all commandline can be checked, and after the function item without the switch is identified, marking is not needed, and the function items with the switch and the function items without the switch are not needed to be separated. When a switch is additionally added to a function item which is not provided with the switch (a built switch or a runtime switch), the adding mode is the same as the method and the approach of the native addition of the chromium. The processing mode is that in the switch naming, a xxx prefix or suffix is uniformly added to the additionally added switches during naming.
Step 200, adding a configuration switch for a function item without a configuration switch, specifically comprising the following steps:
step 201, determining the relationship between the function items through the design documents and the related codes of the function items; the relationship between the function items comprises an internal relationship and an external relationship, wherein the internal relationship is as follows: some functional items include many sub-functional items, such as the bookmark function of the browser, including the management of the bookmark (add, delete, check and change), the online synchronization of the bookmark; external relationships: for example, the bookmark is checked and checked by depending on the bottom database management module, and the online synchronization of the bookmark depends on the bottom network module.
Step 202, determining the types and the number of switches to be added for the function items; the switch types comprise a build switch and a runtime switch; the Build switch acts on the construction of software, and once the construction of the browser is completed, the state of the switch is fixed; the Runtime switch refers to a switch that can be dynamically turned on or off during the operation of the browser, and can be changed during the operation.
Step 203, then create a switch.
When the type of the switch added for the function item is determined to be a build switch in step 202, a build flag is newly added in a build.gn file, and then the compilation of the related file is controlled through the build flag;
meanwhile, defining a buildflag macro or a custom macro in the build according to the buildflag;
roughly as follows:
Figure BDA0002944227300000071
self-defining macro:
if(enable_xxx_flags){defines+=["SENABLE_XXX_FLAG=1"]}
4 then wrapping the function code with these macros in the code
#if BUILDFLAG(ENABLE_XXX_FLAG)
#endif
Or
#if defined(ENABLE_XXX_FLAG)
#endif
The function code is then wrapped with these macros in the code.
When the step 202 determines that the type of the switch added for the function item is a runtime switch, a separate xxx _ features.h/xxx _ features.cc file is created under the function code directory for the feature list runtime switch, and the feature-runtime switch of the function module is stored therein, which is approximately as follows:
const base::Feature kEnableXXXFeature{
"EnableXXXFeature",base::FEATURE_DISABLED_BY_DEFAULT}
aiming at the commandline runtime switch, a single xxx _ switches.h/xxx _ switches.cc is created under a function code directory, and the commandline runtime switch for the function is stored therein, which is roughly as follows:
const char kEnableXXX[]="enable-xxx";
the function code is then wrapped in the code with these switches, roughly as follows:
FeatureList:
if(base::FeatureList::IsEnabled(features::kEnableXXXFeature)){}
commandline:
if(command_line.HasSwitch(switches::kEnableXXX)){}
step 300, setting a function configuration list according to requirements and controlling the compiling of function items, comprising the following steps:
step 301, setting a structured function configuration list according to the software and hardware characteristics of the platform and the specific requirements of a user; setting a function configuration list is completed by combining program automatic configuration and manual personalized customization configuration; calling a platform interface, acquiring hardware information of the current equipment, automatically configuring a part of function configuration lists according to the hardware performance of the equipment, and dynamically turning on or off switches of some function items according to the hardware performance; the platform interface refers to a software and hardware platform specifically operated by a browser, and is divided into Android and Linux (embedded type) according to an operating system; according to the architecture, the system comprises ARM, ARM64, MIPS, X64 and the like.
Setting a function configuration list is completed by combining program automatic configuration and manual personalized customization configuration, because whether certain functions are needed or not is subjective and needs to be customized with a client or according to an actual user using scene; aiming at the function of objectivity, the configuration can be automatically completed through a program: for example, a platform interface may be called to obtain hardware information of the current device, such as cpu, gpu, memory, and the like, so that a part of the function configuration list is automatically configured according to the hardware performance of the device, some performance is dynamically turned on or off according to the hardware performance, for example, only software rendering is turned on a low-end device, and hardware accelerated rendering is turned on a high-end device.
Step 302, analyzing the function configuration list to obtain a build switch, applying the build switch to build.gn, and controlling the compiling of the function item, specifically including:
and analyzing the function configuration list to obtain a build switch, setting the build switch into build.gn, finally generating a build.ninja compiling file, and finally generating a specific target product output component through ninja compiling.
Since our list of functional configurations is chosen in json form, it can be resolved directly through json resolution libraries, such as google's jsonncpp library and gson library. Of course, structured lists in the form of xml or other forms can be selected, and these forms all have a three-party parsing library, and the three-party parsing library is directly relied on, and the API of the parsing library is called to parse the three-party parsing library.
Step 400, operating a chromium browser, controlling the function item to participate or not to participate in the operation, and specifically comprising:
and analyzing the function configuration list to obtain a Runtime switch, setting the Runtime switch into a commandline, reading the commandline value by the chromium browser during running, and dynamically opening or closing the function item so as to control the function item to participate or not participate in the running. The process of analyzing to obtain the Runtime switch and the process of analyzing to obtain the built switch are not described herein again.
Example two
The embodiment provides a device for dynamically configuring a chrome browser function module, which comprises the following modules:
the combing module is used for combing the functional module of the chromium browser and identifying the functional items of the chromium browser which are not configured with a switch;
the newly-added module is used for adding a configuration switch aiming at the function items which are not configured with the switch;
the compiling module is used for setting a function configuration list according to requirements and controlling the compiling of the function items;
and the operation module is used for operating the chromium browser and controlling the function item to participate or not to participate in the operation.
Further, the carding module comprises the following units:
the first identification unit is used for identifying the relationship and the dependence calling link of each functional module of the chromium browser through the functional design document of the chromium browser and the code corresponding to the function;
the second identification unit is used for identifying the cross points of the functional modules through the relationship and the dependence calling links of the functional modules;
the first processing unit is used for judging the number of the functional modules and the number of the cross points in the chromium browser, and when the number of the functional modules and the number of the cross points in the chromium browser are smaller than threshold values, reconstructing the crossed functional modules and separating the crossed functional modules;
and the second processing unit is used for combining the partially crossed functional modules to form a new larger functional module when the number of the functional modules and the number of the crossed points in the chromium browser are greater than threshold values.
Furthermore, the first identification unit integrates the gn build flag option output, FeatureList characters in the code, commandline flags characters, build flag macros and custom macros generated according to gn args-list, and combines the custom macros with the cache directory structure to comb the various function modules of the cache.
Furthermore, the combing module further comprises an identification configuration switch unit, which is used for identifying the function item of the non-configuration switch of the chromium browser, specifically used for combing the build.gn file related to the starting process, the related code and the gn compiling chain of the chromium browser, and identifying the point of the non-configuration switch in the code or the build.gn file, thereby identifying the function item of the non-configuration switch of the chromium browser.
Further, the identifying and configuring switch unit is further configured to look up gn args-list to generate a gn build switch list, look up all commandlines, identify the function items of the configured switches, and accordingly deduce that the remaining function items are the unconfigured switches.
Further, the newly added module specifically comprises the following units:
the relation determining unit is used for determining the relation between the inside and the outside of the function item through the design document and the related code of the function item;
a determination type unit for determining the type and number of switches to be added for the function item;
a creating unit for creating a switch.
Further, the switch types include a build switch and a runtime switch.
Further, when the type determining unit determines that the type of the added switch of the function item is a build switch, a build flag is newly added in the build.gn file, and then the compiling of the related file is controlled through the build flag;
meanwhile, defining a buildflag macro or a custom macro in the build according to the buildflag;
the function code is then wrapped with these macros in the code.
Further, when the type determining unit determines that the type of the added switch for the function item is a runtime switch, creating a separate xxx _ features.h/xxx _ features.cc file under the function code directory for the feature list runtime switch, and storing the feature-runtime switch of the function module;
aiming at a commandline runtime switch, creating a single xxx _ switches.h/xxx _ switches.cc under a function code directory, and storing the commandline runtime switch with the function;
the function code is then wrapped in the code with these switches.
Further, the compiling module includes the following units:
the configuration unit is used for setting a structured function configuration list according to the software and hardware characteristics of the platform and the specific requirements of a user;
and the compiling unit is used for analyzing the function configuration list to obtain a build switch, applying the build switch to the build.gn and controlling the compiling of the function items.
Furthermore, the configuration unit sets the function configuration list through the combination of program automatic configuration and manual personalized customization configuration.
Further, the configuration unit calls a platform interface, acquires the hardware information of the current device, automatically configures a part of function configuration lists according to the hardware performance of the device, and dynamically turns on or off switches of some function items according to the hardware performance.
Further, the compiling unit analyzes the function configuration list to obtain a build switch, then sets the build switch into build.gn, finally generates a build.ninja compiling file, and finally generates a specific target product output component through ninja compiling.
Furthermore, the running module analyzes the function configuration list to obtain a Runtime switch, and controls the function item to participate or not to participate in running.
Further, analyzing the runtime switch from the function configuration list, setting the runtime switch into a commandline, reading the commandline value by the chromium browser during operation, and dynamically opening or closing the function item.
The present embodiment is to implement the first embodiment, and the implementation method is the same as that of the first embodiment, which will not be described herein again.
EXAMPLE III
A further preferred embodiment of the invention provides a computer apparatus comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor when executing the program implementing the method as claimed in any one of the preceding claims.
The computer device of this embodiment includes: a processor, a memory, and a computer program stored in the memory and executable on the processor. The processor implements the steps in the above-described respective embodiments of the networking method when executing the computer program. Alternatively, the processor implements the functions of the modules/units in the above device embodiments when executing the computer program.
Illustratively, the computer program may be partitioned into one or more modules/units that are stored in the memory and executed by the processor to implement the invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program in the computer device.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer device may include, but is not limited to, a processor, a memory.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory may be an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. The memory may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, provided on the computer device. Further, the memory may also include both an internal storage unit and an external storage device of the computer device. The memory is used for storing the computer program and other programs and data required by the computer device. The memory may also be used to temporarily store data that has been output or is to be output.
Another preferred embodiment of the present invention provides a computer readable storage medium storing a computer program, which when executed by a computer, implements a method of dynamically configuring a chromatic browser function module as described in any one of the above.
The foregoing detailed description of the preferred embodiments of the invention has been presented. It should be understood that numerous modifications and variations could be devised by those skilled in the art in light of the present teachings without departing from the inventive concepts. Therefore, the technical solutions available to those skilled in the art through logic analysis, reasoning and limited experiments based on the prior art according to the concept of the present invention should be within the scope of protection defined by the claims.

Claims (32)

1. A method for dynamically configuring a chrome browser function module is characterized by comprising the following steps:
the method comprises the steps of carding a function module of the chromium browser, and identifying a function item of the chromium browser, which is not provided with a switch;
adding a configuration switch aiming at the function item of the unconfigured switch;
setting a function configuration list according to requirements and controlling the compiling of the function items;
and operating the chromium browser, and controlling functional items to participate or not to participate in operation.
2. The method of claim 1, wherein the step of combing the module of the chrome browser comprises the steps of:
identifying the relationship and the dependence calling link of each functional module of the chromium browser through the functional design document of the chromium browser and the code corresponding to the function;
identifying the intersection points of the functional modules through the relationship of the functional modules and the dependence calling link;
judging the number of functional modules and the number of cross points in the chrome browser, and reconstructing the crossed functional modules and independently separating the crossed functional modules when the number of the functional modules and the number of the cross points in the chrome browser are smaller than threshold values;
and when the number of the functional modules in the chromium browser and the number of the intersection points are larger than the threshold value, combining the partially intersected functional modules to form a new larger functional module.
3. The method of claim 2, wherein the output of gn build flag option generated from gn args-list, FeatureList words in code, commandline flags words, build flag macros, and custom macros are combined with the chrome directory structure to comb the chrome function modules.
4. The method as claimed in claim 2, wherein the step of identifying the function item of the configurable switch of the chrome browser comprises the following steps:
and (3) combing the starting process of the chromium browser, and the build.gn file related to the code and gn compiling chain, and identifying a point in the code or the build.gn file where a function switch is not configured, so as to identify a function item of the chromium browser where the switch is not configured.
5. The method as claimed in claim 2, wherein the step of identifying the function item of the configurable switch of the chrome browser comprises the following steps:
and generating a gn build switch list by looking up gn args-list, and looking up all commandline to identify the function items of the configured switches, thereby deducing that the rest function items are unconfigured switches.
6. The method of claim 1, wherein adding configuration switches for the function items of the unconfigured switches comprises the following steps:
determining the relationship between the function items through the design documents and the related codes of the function items;
determining the type and number of switches to be added for the function item;
a switch is then created.
7. The method of claim 6, wherein the switch types include a build switch and a runtime switch.
8. The method for dynamically configuring a module of a chrome browser function as claimed in claim 7, wherein when it is determined that the type of the switch added for the function item is a build switch, a build flag is newly added to the build.gn file, and then the compiling of the relevant file is controlled by the build flag;
meanwhile, defining a buildflag macro or a custom macro in the build according to the buildflag;
the function code is then wrapped with these macros in the code.
9. The method of claim 7, wherein when the type of the added switch for the function item is determined to be a runtime switch, creating a separate xxx _ features.h/xxx _ features.cc file under the function code directory for the feature list runtime switch, storing therein the feature-runtime switch of the function module;
aiming at a commandline runtime switch, creating a single xxx _ switches.h/xxx _ switches.cc under a function code directory, and storing the commandline runtime switch with the function;
the function code is then wrapped in the code with these switches.
10. The method of claim 7, wherein setting the function configuration list and controlling the compiling of the function items according to the requirement comprises the following steps:
setting a structured function configuration list according to the software and hardware characteristics of the platform and the specific requirements of a user;
and analyzing the function configuration list to obtain a build switch, applying the build switch to the build.
11. The method as claimed in claim 10, wherein a structured function configuration list is set according to the software and hardware characteristics of the platform and the specific requirements of the user, and the setting of the function configuration list is completed by combining program automatic configuration and manual personalized configuration.
12. The method of claim 11, wherein the platform interface is invoked to obtain hardware information of a current device, a part of the function configuration list is automatically configured according to hardware performance of the device, and switches of some function items are dynamically turned on or off according to the hardware performance.
13. The method as claimed in claim 10, wherein the step of parsing the function configuration list to obtain a build switch, and applying the build switch to the build.gn, controls compiling of function items, and specifically includes:
and analyzing the function configuration list to obtain a build switch, setting the build switch into build.gn, finally generating a build.ninja compiling file, and finally generating a specific target product output component through ninja compiling.
14. The method of claim 10, wherein the running of the chrome browser is performed with or without participation of the control function, and the method specifically comprises:
and analyzing the function configuration list to obtain a runtime switch, and controlling the function items to participate or not to participate in the operation.
15. The method as claimed in claim 12, wherein the runtime switch is parsed from the function configuration list and then set to the commandline, and the chromaum browser reads the commandline value during running to dynamically turn on or off the function item.
16. An apparatus for dynamically configuring a chrome browser function module, comprising the following modules:
the combing module is used for combing the functional module of the chromium browser and identifying the functional items of the chromium browser which are not configured with a switch;
the newly-added module is used for adding a configuration switch aiming at the function items which are not configured with the switch;
the compiling module is used for setting a function configuration list according to requirements and controlling the compiling of the function items;
and the operation module is used for operating the chromium browser and controlling the function item to participate or not to participate in the operation.
17. The apparatus for dynamically configuring a chrome browser feature module as recited in claim 16, wherein the comb module comprises the following elements:
the first identification unit is used for identifying the relationship and the dependence calling link of each functional module of the chromium browser through the functional design document of the chromium browser and the code corresponding to the function;
the second identification unit is used for identifying the cross points of the functional modules through the relationship and the dependence calling links of the functional modules;
the first processing unit is used for judging the number of the functional modules and the number of the cross points in the chromium browser, and when the number of the functional modules and the number of the cross points in the chromium browser are smaller than threshold values, reconstructing the crossed functional modules and separating the crossed functional modules;
and the second processing unit is used for combining the partially crossed functional modules to form a new larger functional module when the number of the functional modules and the number of the crossed points in the chromium browser are greater than threshold values.
18. The apparatus of claim 17, wherein the first identification unit is configured to comb the respective modules of the chrome according to the gn build flag option output generated by the gn args-list, FeatureList words in the code, commandline flags words, build flag macros, and custom macros combined with the chrome directory structure.
19. The apparatus of claim 17, wherein the grooming module further comprises a configuration switch recognition unit, configured to recognize a function item of the reconfigured switch of the chromium browser, specifically, a build.gn file related to a start procedure, a related code, and a gn compile chain of the chromium browser, and a point in the code or the build.gn file where the function switch is not configured, so as to recognize the function item of the reconfigured switch of the chromium browser.
20. The apparatus for dynamically configuring a chrome browser feature module as claimed in claim 17, wherein the identify configuration switch unit is further configured to look at gn args-list to generate gn build switch list, and look at all commandlines to identify the feature of the configured switch, thereby deducing the remaining feature as an unconfigured switch.
21. The apparatus of claim 16, wherein the newly added module comprises the following elements:
the relation determining unit is used for determining the relation between the function items through the design documents and the related codes of the function items;
a determination type unit for determining the type and number of switches to be added for the function item;
a creating unit for creating a switch.
22. The apparatus of claim 21, wherein the switch types include a build switch and a runtime switch.
23. The apparatus for dynamically configuring a module for a chrome browser function as claimed in claim 22, wherein when the type determining unit determines that the type of the switch added for the function item is a build switch, a build flag is newly added to the build.gn file, and then the compiling of the relevant file is controlled by the build flag;
meanwhile, defining a buildflag macro or a custom macro in the build according to the buildflag;
the function code is then wrapped with these macros in the code.
24. The apparatus of claim 22, wherein when the type determining unit determines that the added switch type for the function item is a runtime switch, a separate xxx _ features.h/xxx _ features.cc file is created under the function code directory for the feature list runtime switch, in which the feature-runtime switch of the function module is stored;
aiming at a commandline runtime switch, creating a single xxx _ switches.h/xxx _ switches.cc under a function code directory, and storing the commandline runtime switch with the function;
the function code is then wrapped in the code with these switches.
25. The apparatus for dynamically configuring a chrome browser feature module as recited in claim 22, wherein the compiling module includes the following elements:
the configuration unit is used for setting a structured function configuration list according to the software and hardware characteristics of the platform and the specific requirements of a user;
and the compiling unit is used for analyzing the function configuration list to obtain a build switch, applying the build switch to the build.gn and controlling the compiling of the function items.
26. The apparatus of claim 25, wherein the configuration unit sets the function configuration list by combining program automation configuration and manual personalized customization configuration.
27. The apparatus according to claim 26, wherein the configuration unit invokes a platform interface to obtain hardware information of a current device, automatically configures a part of function configuration list according to hardware performance of the device, and dynamically turns on or off a switch of some function items according to the hardware performance.
28. The apparatus as claimed in claim 25, wherein the compiling unit parses the build switch from the function configuration list, then sets the build switch to the build.gn, finally generates a build.ninja compilation file, and finally generates a specific target product output component through ninja compilation.
29. The apparatus of claim 25, wherein the run module parses a run runtime switch from the function configuration list to control whether the function item is running or not running.
30. The apparatus as claimed in claim 27, wherein the runtime switch is parsed from the function configuration list and then set to the commandline, and the chromaum browser reads the commandline value during running to dynamically turn on or off the function item.
31. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor, when executing the program, implements the method according to any of claims 1-15.
32. A computer-readable storage medium storing a computer program, the computer program causing a computer to implement a method of dynamically configuring a chromatic browser feature module as claimed in any one of claims 1 to 15 when executed.
CN202110188616.6A 2021-02-19 2021-02-19 Method and device for dynamically configuring chromium functional module and electronic equipment Active CN113032037B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110188616.6A CN113032037B (en) 2021-02-19 2021-02-19 Method and device for dynamically configuring chromium functional module and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110188616.6A CN113032037B (en) 2021-02-19 2021-02-19 Method and device for dynamically configuring chromium functional module and electronic equipment

Publications (2)

Publication Number Publication Date
CN113032037A true CN113032037A (en) 2021-06-25
CN113032037B CN113032037B (en) 2023-03-10

Family

ID=76461380

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110188616.6A Active CN113032037B (en) 2021-02-19 2021-02-19 Method and device for dynamically configuring chromium functional module and electronic equipment

Country Status (1)

Country Link
CN (1) CN113032037B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113379507A (en) * 2021-06-30 2021-09-10 特赞(上海)信息科技有限公司 Customization method and device suitable for enterprise-level multi-tenant product and electronic equipment
CN114153462A (en) * 2021-12-14 2022-03-08 北京字节跳动网络技术有限公司 Client source code processing method and device, storage medium and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105373390A (en) * 2015-12-03 2016-03-02 北京小鸟科技发展有限责任公司 OEM-oriented online software customization packaging release method and apparatus
CN107577478A (en) * 2017-09-08 2018-01-12 湖南快乐阳光互动娱乐传媒有限公司 Mobile phone software online method and system
CN108121563A (en) * 2017-11-10 2018-06-05 广州阿里巴巴文学信息技术有限公司 Application function method for customizing, device, computing device and storage medium
CN108509212A (en) * 2018-02-07 2018-09-07 平安科技(深圳)有限公司 Application program update test method, device, terminal device and storage medium
US20200201659A1 (en) * 2018-12-21 2020-06-25 Business Objects Software Ltd. Emulating Functions Provided In Application Resources
CN111679820A (en) * 2020-05-19 2020-09-18 浪潮金融信息技术有限公司 Android modular development and rapid module integration method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105373390A (en) * 2015-12-03 2016-03-02 北京小鸟科技发展有限责任公司 OEM-oriented online software customization packaging release method and apparatus
CN107577478A (en) * 2017-09-08 2018-01-12 湖南快乐阳光互动娱乐传媒有限公司 Mobile phone software online method and system
CN108121563A (en) * 2017-11-10 2018-06-05 广州阿里巴巴文学信息技术有限公司 Application function method for customizing, device, computing device and storage medium
CN108509212A (en) * 2018-02-07 2018-09-07 平安科技(深圳)有限公司 Application program update test method, device, terminal device and storage medium
US20200201659A1 (en) * 2018-12-21 2020-06-25 Business Objects Software Ltd. Emulating Functions Provided In Application Resources
CN111679820A (en) * 2020-05-19 2020-09-18 浪潮金融信息技术有限公司 Android modular development and rapid module integration method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113379507A (en) * 2021-06-30 2021-09-10 特赞(上海)信息科技有限公司 Customization method and device suitable for enterprise-level multi-tenant product and electronic equipment
CN114153462A (en) * 2021-12-14 2022-03-08 北京字节跳动网络技术有限公司 Client source code processing method and device, storage medium and electronic equipment
CN114153462B (en) * 2021-12-14 2024-08-02 北京字节跳动网络技术有限公司 Client source code processing method and device, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN113032037B (en) 2023-03-10

Similar Documents

Publication Publication Date Title
CN109976761B (en) Software development kit generation method and device and terminal equipment
CN113032037B (en) Method and device for dynamically configuring chromium functional module and electronic equipment
CN106155749B (en) Monitoring plug-in extension method and device
CN110941779B (en) Page loading method and device, storage medium and electronic equipment
CN107479868B (en) Interface loading method, device and equipment
CN112800858A (en) Model configuration and image recognition method and device
CN112597013A (en) Online development and debugging method and device
CN110007926B (en) Language conversion method and device
CN112486459A (en) Activity page generation method and device, computer equipment and readable storage medium
CN116643778A (en) Application program optimization method and electronic equipment
CN114706616A (en) Applet construction method and device
CN112988026B (en) Scroll bar display method and device and electronic equipment
CN114268538A (en) Configuration method and device of front-end route
CN107423093B (en) Control method and apparatus, computer apparatus, and computer-readable storage medium
CN111611505B (en) Method for accessing multimedia resources in electronic book, computing device and storage medium
EP1394677A2 (en) Generation of compiled code for speeding up a simulator
CN117539490A (en) Low-code engine page rendering method and system running at browser end
CN117270873A (en) Real-time compiling method, device, equipment and medium based on Android application
CN114911541B (en) Processing method and device of configuration information, electronic equipment and storage medium
CN114489619A (en) Interface view display method, terminal equipment and computer readable storage medium
CN106569799B (en) Program processing method and apparatus thereof
EP2336883A1 (en) Programming system in multi-core, and method and program of the same
CN108733401B (en) Method and device for realizing browser compatibility
CN109725799B (en) Advertisement display control method and device and intelligent terminal
CN112035178A (en) Application starting method and device and storage medium

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