-
Notifications
You must be signed in to change notification settings - Fork 900
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
Get rid of the chrome dependency inside the ipfs component #25333
Conversation
components/ipfs/BUILD.gn
Outdated
"ipfs_component_cleaner.cc", | ||
"ipfs_component_cleaner.h", | ||
] | ||
sources += [ "ipfs_component_cleaner_delegate.h" ] | ||
deps += [ "//chrome/common:constants" ] |
There was a problem hiding this comment.
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
file << contents; | ||
file.close(); |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
base::GetDeletePathRecursivelyCallback
components/ipfs/DEPS
Outdated
@@ -1,4 +1,3 @@ | |||
include_rules = [ | |||
"+chrome/common", | |||
"+content/prefs", |
There was a problem hiding this comment.
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?
test/BUILD.gn
Outdated
if (!is_android && !is_ios) { | ||
sources += [ "//brave/browser/ipfs/ipfs_component_cleaner_unittest.cc" ] | ||
} | ||
|
There was a problem hiding this comment.
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
#include "net/base/url_util.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
There was a problem hiding this comment.
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
components/ipfs/ipfs_prefs.cc
Outdated
@@ -9,10 +9,6 @@ | |||
#include "build/build_config.h" |
There was a problem hiding this comment.
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"
#include <memory> | ||
#include <utility> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need this
browser/brave_browser_main_parts.cc
Outdated
#if !BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_ANDROID) | ||
ipfs::CleanupIpfsComponent(); | ||
#endif | ||
} |
There was a problem hiding this comment.
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
browser/ipfs/sources.gni
Outdated
brave_browser_ipfs_sources = [] | ||
brave_browser_ipfs_deps = [] | ||
|
||
if (!is_android && !is_ios) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&& !is_ios
browser/ipfs/sources.gni
Outdated
import("//build/config/features.gni") | ||
|
||
brave_browser_ipfs_sources = [] | ||
brave_browser_ipfs_deps = [] |
There was a problem hiding this comment.
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 #include
s from ipfs_component_cleaner.cc/h
There was a problem hiding this 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
349a267
to
6705afd
Compare
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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
browser/brave_browser_main_parts.cc
Outdated
@@ -161,6 +162,10 @@ void BraveBrowserMainParts::PostBrowserStart() { | |||
} | |||
} | |||
#endif // !BUILDFLAG(IS_ANDROID) | |||
|
|||
#if !BUILDFLAG(IS_ANDROID) | |||
ipfs::CleanupIpfsComponent(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this 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
b9343c1
to
12defaa
Compare
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>
f0edb95
to
61ed0ff
Compare
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", | |||
] | |||
|
There was a problem hiding this comment.
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>
@@ -11,6 +11,13 @@ source_set("brave_ipfs_unit_tests") { | |||
|
|||
sources = [ "//brave/components/ipfs/ipfs_utils_unittest.cc" ] | |||
|
|||
if (!is_android && !is_ios) { | |||
sources += [ | |||
"//brave/components/ipfs/ipfs_component_cleaner.cc", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are you adding a source here instead of a dep on the target for that source? This should also have a new buildflag for enable_ipfs_component
or similar. os buildflags should only be used for os-specific code, not for things that just aren't enabled on all platforms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created follow up issue for that: brave/brave-browser#41626
@@ -67,6 +67,12 @@ | |||
#include "extensions/browser/extension_system.h" | |||
#endif | |||
|
|||
#if !BUILDFLAG(IS_ANDROID) | |||
#include "base/path_service.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buildflag guard in gn should match buildflag guards in cpp. It doesn't matter that this is only used inside !IS_ANDROID
, the headers themselves are not guarded by !is_android
in gn. Also there is already an existing !IS_ANDROID
guard in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created follow up issue for that: brave/brave-browser#41626
Resolves brave/brave-browser#39624
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: