Skip to content

Commit

Permalink
Merge pull request #26936 from brave/issues/42767
Browse files Browse the repository at this point in the history
[ads] Remove ShouldLaunchBraveAdsAsInProcessService feature
  • Loading branch information
aseren authored Dec 10, 2024
2 parents befb8d7 + eb97eef commit a08c449
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 54 deletions.
3 changes: 0 additions & 3 deletions app/brave_generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -640,9 +640,6 @@ Or change later at <ph name="SETTINGS_EXTENIONS_LINK">$2<ex>brave://settings/ext
</if>

<!-- Brave Ads -->
<message name="IDS_SERVICE_BAT_ADS" desc="The bat ads utility process">
Bat Ads Service
</message>
<message name="IDS_UTILITY_PROCESS_REWARDS_NAME" desc="The utility process running rewards">
Bat Rewards Service
</message>
Expand Down
9 changes: 0 additions & 9 deletions browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -761,15 +761,6 @@
FEATURE_VALUE_TYPE( \
brave_rewards::features::kPlatformCreatorDetectionFeature), \
}, \
{ \
"brave-ads-should-launch-brave-ads-as-an-in-process-service", \
"Launch Brave Ads as an in-process service", \
"Launch Brave Ads as an in-process service removing the utility " \
"process.", \
kOsAll, \
FEATURE_VALUE_TYPE( \
brave_ads::kShouldLaunchBraveAdsAsAnInProcessServiceFeature), \
}, \
{ \
"brave-ads-should-always-run-brave-ads-service", \
"Should always run Brave Ads service", \
Expand Down
14 changes: 1 addition & 13 deletions browser/brave_ads/services/bat_ads_service_factory_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
#include "base/task/single_thread_task_runner_thread_mode.h"
#include "base/task/thread_pool.h"
#include "brave/browser/brave_ads/services/service_sandbox_type.h"
#include "brave/components/brave_ads/core/public/ads_feature.h"
#include "brave/components/services/bat_ads/bat_ads_service_impl.h"
#include "brave/grit/brave_generated_resources.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/service_process_host.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"

Expand Down Expand Up @@ -46,14 +43,6 @@ mojo::Remote<bat_ads::mojom::BatAdsService> LaunchInProcessBatAdsService() {
return bat_ads_service_remote;
}

// Launches a new Bat Ads Service utility process.
mojo::Remote<bat_ads::mojom::BatAdsService> LaunchOutOfProcessBatAdsService() {
return content::ServiceProcessHost::Launch<bat_ads::mojom::BatAdsService>(
content::ServiceProcessHost::Options()
.WithDisplayName(IDS_SERVICE_BAT_ADS)
.Pass());
}

} // namespace

BatAdsServiceFactoryImpl::BatAdsServiceFactoryImpl() = default;
Expand All @@ -64,8 +53,7 @@ mojo::Remote<bat_ads::mojom::BatAdsService> BatAdsServiceFactoryImpl::Launch()
const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);

return ShouldLaunchAsInProcessService() ? LaunchInProcessBatAdsService()
: LaunchOutOfProcessBatAdsService();
return LaunchInProcessBatAdsService();
}

} // namespace brave_ads
9 changes: 0 additions & 9 deletions components/brave_ads/core/internal/ads_feature.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@

namespace brave_ads {

BASE_FEATURE(kShouldLaunchBraveAdsAsAnInProcessServiceFeature,
"ShouldLaunchBraveAdsAsInProcessService",
base::FEATURE_ENABLED_BY_DEFAULT);

bool ShouldLaunchAsInProcessService() {
return base::FeatureList::IsEnabled(
kShouldLaunchBraveAdsAsAnInProcessServiceFeature);
}

BASE_FEATURE(kShouldAlwaysRunBraveAdsServiceFeature,
"ShouldAlwaysRunBraveAdsService",
base::FEATURE_DISABLED_BY_DEFAULT);
Expand Down
15 changes: 0 additions & 15 deletions components/brave_ads/core/internal/ads_feature_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,6 @@

namespace brave_ads {

TEST(BraveAdsBraveAdsFeatureTest, ShouldLaunchAsInProcessService) {
// Act & Assert
EXPECT_TRUE(ShouldLaunchAsInProcessService());
}

TEST(BraveAdsBraveAdsFeatureTest, ShouldNotLaunchAsInProcessService) {
// Arrange
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(
kShouldLaunchBraveAdsAsAnInProcessServiceFeature);

// Act & Assert
EXPECT_FALSE(ShouldLaunchAsInProcessService());
}

TEST(BraveAdsBraveAdsFeatureTest, ShouldAlwaysRunService) {
// Arrange
const base::test::ScopedFeatureList scoped_feature_list(
Expand Down
5 changes: 0 additions & 5 deletions components/brave_ads/core/public/ads_feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

namespace brave_ads {

// Set to `true` to launch as an in process service.
BASE_DECLARE_FEATURE(kShouldLaunchBraveAdsAsAnInProcessServiceFeature);

bool ShouldLaunchAsInProcessService();

// Set to `true` to always run the ads service, even if Brave Private Ads are
// disabled.
BASE_DECLARE_FEATURE(kShouldAlwaysRunBraveAdsServiceFeature);
Expand Down

0 comments on commit a08c449

Please sign in to comment.