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

Get rid of the chrome dependency inside the ipfs component #25333

Conversation

vadimstruts
Copy link
Collaborator

@vadimstruts vadimstruts commented Aug 26, 2024

Resolves brave/brave-browser#39624

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

"ipfs_component_cleaner.cc",
"ipfs_component_cleaner.h",
]
sources += [ "ipfs_component_cleaner_delegate.h" ]
deps += [ "//chrome/common:constants" ]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deps += [ "//chrome/common:constants" ]
Also chrome line from DEPS file in this folder

@vadimstruts vadimstruts marked this pull request as ready for review August 27, 2024 18:01
@vadimstruts vadimstruts requested review from a team as code owners August 27, 2024 18:01
Comment on lines 54 to 55
file << contents;
file.close();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

base::WriteFile

return;
}
namespace ipfs {
void CleanupIpfsComponent() {
// Remove IPFS component
base::ThreadPool::PostTask(
FROM_HERE, {base::TaskPriority::BEST_EFFORT, base::MayBlock()},
base::BindOnce(IgnoreResult(&base::DeletePathRecursively),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

base::GetDeletePathRecursivelyCallback

@@ -1,4 +1,3 @@
include_rules = [
"+chrome/common",
"+content/prefs",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need content/prefs here?

@vadimstruts vadimstruts requested a review from a team as a code owner August 29, 2024 09:54
test/BUILD.gn Outdated
Comment on lines 150 to 153
if (!is_android && !is_ios) {
sources += [ "//brave/browser/ipfs/ipfs_component_cleaner_unittest.cc" ]
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need !is_ios check. It's already asserted above

Comment on lines 24 to 15
#include "net/base/url_util.h"
#include "testing/gtest/include/gtest/gtest.h"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whole includes section needs some cleanup

@@ -9,10 +9,6 @@
#include "build/build_config.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#include "base/files/file_path.h"

Comment on lines 6 to 8
#include <memory>
#include <utility>

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need this

Comment on lines 169 to 173
#if !BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_ANDROID)
ipfs::CleanupIpfsComponent();
#endif
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need IOS checks in this file

brave_browser_ipfs_sources = []
brave_browser_ipfs_deps = []

if (!is_android && !is_ios) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&& !is_ios

import("//build/config/features.gni")

brave_browser_ipfs_sources = []
brave_browser_ipfs_deps = []
Copy link
Collaborator

@supermassive supermassive Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strictly speaking needs some deps based on #includes from ipfs_component_cleaner.cc/h

Copy link
Collaborator

@supermassive supermassive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with some suggestions

@vadimstruts vadimstruts force-pushed the 39624-get-rid-of-the-chrome-dependency-inside-the-ipfs-component branch from 349a267 to 6705afd Compare August 29, 2024 11:13
test/BUILD.gn Outdated
@@ -146,6 +146,11 @@ test("brave_unit_tests") {
"//components/sync/service/sync_auth_manager_unittest.cc",
"//components/sync_device_info/device_info_sync_bridge_unittest.cc",
]

if (!is_android) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls add a source set to browser/ipfs/BUILD.gn instead

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just removed that line

@@ -161,6 +162,10 @@ void BraveBrowserMainParts::PostBrowserStart() {
}
}
#endif // !BUILDFLAG(IS_ANDROID)

#if !BUILDFLAG(IS_ANDROID)
ipfs::CleanupIpfsComponent();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIU moving the code from components to chrome was done only becase of chrome::USER_DATA. If that's correct, I'd suggest to move only this call (and pass the FilePath with user data dir into it) and keep the component cleaner in components, it just looks more logical to me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

@iefremov iefremov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm once the unit test target is put into separate BUILD.gn
pls consider keeping the cleaner in components instead of moving it b/browser/ipfs entirely

@vadimstruts vadimstruts force-pushed the 39624-get-rid-of-the-chrome-dependency-inside-the-ipfs-component branch 2 times, most recently from b9343c1 to 12defaa Compare September 3, 2024 21:00
Signed-off-by: Vadym Struts <vstruts@brave.com>
Signed-off-by: Vadym Struts <vstruts@brave.com>
Signed-off-by: Vadym Struts <vstruts@brave.com>
Signed-off-by: Vadym Struts <vstruts@brave.com>
Signed-off-by: Vadym Struts <vstruts@brave.com>
Signed-off-by: Vadym Struts <vstruts@brave.com>
Signed-off-by: Vadym Struts <vstruts@brave.com>
Signed-off-by: Vadym Struts <vstruts@brave.com>
Signed-off-by: Vadym Struts <vstruts@brave.com>
@vadimstruts vadimstruts force-pushed the 39624-get-rid-of-the-chrome-dependency-inside-the-ipfs-component branch from f0edb95 to 61ed0ff Compare September 5, 2024 10:10
test/BUILD.gn Outdated
@@ -146,6 +146,7 @@ test("brave_unit_tests") {
"//components/sync/service/sync_auth_manager_unittest.cc",
"//components/sync_device_info/device_info_sync_bridge_unittest.cc",
]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: unnecessary change

Signed-off-by: Vadym Struts <vstruts@brave.com>
Signed-off-by: Vadym Struts <vstruts@brave.com>
Signed-off-by: Vadym Struts <vstruts@brave.com>
Signed-off-by: Vadym Struts <vstruts@brave.com>
@vadimstruts vadimstruts merged commit 1148af4 into master Sep 5, 2024
17 checks passed
@vadimstruts vadimstruts deleted the 39624-get-rid-of-the-chrome-dependency-inside-the-ipfs-component branch September 5, 2024 15:26
@github-actions github-actions bot added this to the 1.71.x - Nightly milestone Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get rid of the chrome dependency inside the ipfs component
3 participants