New issue
Advanced search Search tips

Issue 749873 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Jul 2017
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

Is it possible to compile Chromium with certain features removed?

Reported by trusktr@gmail.com, Jul 27 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36

Steps to reproduce the problem:
n/a

What is the expected behavior?

What went wrong?
n/a

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 59.0.3071.115  Channel: n/a
OS Version: OS X 10.12.5
Flash Version: 

For example, suppose I want to ship a custom application made with Chromium (something like Electron, but my own). Suppose my application does not use Canvas 2D context, only WebGL, and it does not use the `<video>` element.

Would it be possible to compile Chromium without `<video>` tag support, and without canvas 2D features?

In general, I'd like to write apps with HTML technology, but when I ship them as standalone apps I'd like for the build to be minimal, only including the features that I use. Is there some way to achieve this?
 

Comment 1 by trusktr@gmail.com, Jul 28 2017

Suppose my app only ever uses SVGElements, it'd be great to compile an app that only has those elements, and for example none of the HTMLElement classes that I never touch.

Or for example, suppose I have custom elements that extend from HTMLElement, and internally they only ever use other custom elements that extend from HTMLElement. And suppose I don't use CSS much (for example, no CSS animations, etc). And suppose my custom elements render everything into WebGL, so I also use a `<canvas>` element. I'd like to compile an app that only has HTMLElement, the Custom Elements API, HTMLCanvasElement with webgl context, and none of the CSS engine stuff around animation because I haven't used it. The result would be lean, for my specific use case.

I'd really like to do something like this.
Labels: Needs-Milestone

Comment 3 by trusktr@gmail.com, Jul 28 2017

It would be great for Electron apps: https://github.com/electron/electron/issues/4961
Labels: TE-NeedsTriageHelp

Comment 5 by rsesek@chromium.org, Jul 28 2017

Status: WontFix (was: Unconfirmed)
The bug tracker is not a place to post discussion questions like this, so I'm going to WontFix this. A better forum would be chromium-dev@chromium.org or chromium-discuss@chromium.org.

To answer the question, though, certain subsystems have GN feature flags to disable them. E.g., extensions here (codesearch for buildflag): https://cs.chromium.org/chromium/src/extensions/features/features.gni. However not all features do, and many web platform features do not. We probably would not accept changes to disable selective web platform features because it would add code complexity, and such things would most likely break rather quickly since nothing in our continuous integration system would test them.

Comment 6 by trusktr@gmail.com, Jul 31 2017

Rather than being able to manually disable certain features, perhaps an automatic way to do it would be less complex for the code base. 

For example, imagine a way to run a Chromium application while a Chromium build tool observes and records which code paths are ever hit (the developer has to automate and execute all designed use cases within reason), then based on that recording the compiler can figure out which code paths to omit when compiling, without the code base having to have feature-enabling/disabling code.

This may be done by compiling the code into a record state that can inject no-op function calls into every scope, where when code paths are executed the code path tree will be recorded (seems like DevTools already does something at least similar for JavaScript in the timeline viewer).

Based on this info, it should be possible to compile with unused code paths removed. a DevOps team and a QA team (for example) could be in charge of doing this after an application developer writes an app.

It might be powerful for embedded development, mobile apps, etc.

It's just an idea. If it can be imagined, then it can be done! 

Comment 7 by trusktr@gmail.com, Jul 31 2017

By 

> This may be done by compiling the code into a record state that can inject no-op function calls into every scope,

I meant

> This may be done by inject no-op function calls into every scope when compiling, so that the program has these extra no-op functions throughout every code path, ...

Comment 8 by trusktr@gmail.com, Jul 31 2017

Moving to the list as suggested.

Sign in to add a comment