Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Perf] Make Brave Extension disabled by default to optimize memory usage #39610

Open
atuchin-m opened this issue Jul 8, 2024 · 5 comments
Open

Comments

@atuchin-m
Copy link
Contributor

atuchin-m commented Jul 8, 2024

Description

Currently, we load Brave Extension on startup and it's background page stays persistent. It consumes about 40MB of memory (mac-arm64) and has some CPU overhead.

Features depending on Brave Extension:

  1. content picker: Don't inject content picker on pages by default #37841
  2. Greaselion (despite it creates a number of supplementary extensions, an investigation is needed)
  3. WDP (when enabled)

The goal is to not load Brave Extension when WDP is disabled. 1 & 2 should be reworked.
Or even rename it to WDP extension.

Related issues:
#21366
#35645

@atuchin-m
Copy link
Contributor Author

The plan for content picker feature:

  1. Stop injecting content_picker by default in every frame: Don't inject content picker on pages by default #37841
  2. Make a native menu instead an extension-based;
  3. Stop using iframe for content picker;
  4. Replace extension-based inject to C++ inject.

@atuchin-m
Copy link
Contributor Author

for Greaselion: here is PoC to remove chrome.tabs and chrome.webRequest API: brave/brave-site-specific-scripts#119. This approach allows to refactor Greaselion to not use a persistent background page

@atuchin-m
Copy link
Contributor Author

The current status of content picker changes:

  1. [done] remove inject by default: Inject content_picker dynamically brave-core#25330
  2. [done] content Picker refactoring into a single script, stop using the backround page: Content Picker refactoring into a single script brave-core#25358
  3. [in-progress] native menu + native inject via CosmeticFiltersJSHandler: Content picker native inject brave-core#25411

@atuchin-m
Copy link
Contributor Author

@atuchin-m
Copy link
Contributor Author

atuchin-m commented Sep 16, 2024

Test plan (for both this issue and #40872)

Case 1: Rewards and WDP are disabled:

  1. Restart browser
  2. Open a new tab and navigate to a page that uses Greaselion (e.g. https://x.com/bravelaurenwags on staging)
  3. Verify that the creator checkmark does not appear on the Rewards icon
  4. Verify there is no Brave Extension process in menu => More tools => Task manager
  5. Verify there is no extension with name greaselion- on brave://extensions-internals/

Case 2: Rewards ON:

  1. Open the browser with a clean profile
  2. Enable rewards
  3. Open a new tab and navigate to a page that uses Greaselion (e.g. https://x.com/bravelaurenwags on staging)
  4. Verify that the creator checkmark appears on the Rewards icon
  5. Verify there is Brave Extension process in menu => More tools => Task manager

Case 3: WDP ON:

  1. Open the browser with a clean profile
  2. Enable WDP
  3. Verify there is Brave Extension process in menu => More tools => Task manager
  4. check WDP basic functionality (ask @remusao if you need instructions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To do
Development

No branches or pull requests

1 participant