Deprecate Brave Ads ProcessorInterface and ResourceInterface

This commit is contained in:
Terry Mancey
2022-06-07 13:35:39 -05:00
parent 5f36639298
commit ef3749dc77
11 changed files with 29 additions and 90 deletions
-2
View File
@@ -785,7 +785,6 @@ source_set("ads") {
"src/bat/ads/internal/processors/behavioral/purchase_intent/purchase_intent_signal_info.h",
"src/bat/ads/internal/processors/contextual/text_classification/text_classification_processor.cc",
"src/bat/ads/internal/processors/contextual/text_classification/text_classification_processor.h",
"src/bat/ads/internal/processors/processor_interface.h",
"src/bat/ads/internal/resources/behavioral/anti_targeting/anti_targeting_features.cc",
"src/bat/ads/internal/resources/behavioral/anti_targeting/anti_targeting_features.h",
"src/bat/ads/internal/resources/behavioral/anti_targeting/anti_targeting_info.cc",
@@ -816,7 +815,6 @@ source_set("ads") {
"src/bat/ads/internal/resources/country_components.h",
"src/bat/ads/internal/resources/language_components.h",
"src/bat/ads/internal/resources/parsing_result.h",
"src/bat/ads/internal/resources/resource_interface.h",
"src/bat/ads/internal/resources/resources_util.h",
"src/bat/ads/internal/resources/resources_util_impl.h",
"src/bat/ads/internal/segments/segments_aliases.h",
@@ -10,20 +10,18 @@
#include <string>
#include "bat/ads/internal/processors/behavioral/bandits/bandit_feedback_info.h"
#include "bat/ads/internal/processors/processor_interface.h"
namespace ads {
namespace processor {
class EpsilonGreedyBandit final
: public ProcessorInterface<BanditFeedbackInfo> {
class EpsilonGreedyBandit final {
public:
EpsilonGreedyBandit();
~EpsilonGreedyBandit() override;
~EpsilonGreedyBandit();
EpsilonGreedyBandit(const EpsilonGreedyBandit&) = delete;
EpsilonGreedyBandit& operator=(const EpsilonGreedyBandit&) = delete;
void Process(const BanditFeedbackInfo& feedback) override;
void Process(const BanditFeedbackInfo& feedback);
private:
void InitializeArms() const;
@@ -10,7 +10,6 @@
#include <string>
#include "base/memory/raw_ptr.h"
#include "bat/ads/internal/processors/processor_interface.h"
#include "bat/ads/internal/segments/segments_aliases.h"
#include "url/gurl.h"
@@ -27,14 +26,14 @@ struct PurchaseIntentSiteInfo;
namespace processor {
class PurchaseIntent final : public ProcessorInterface<GURL> {
class PurchaseIntent final {
public:
explicit PurchaseIntent(resource::PurchaseIntent* resource);
~PurchaseIntent() override;
~PurchaseIntent();
PurchaseIntent(const PurchaseIntent&) = delete;
PurchaseIntent& operator=(const PurchaseIntent&) = delete;
void Process(const GURL& url) override;
void Process(const GURL& url);
private:
targeting::PurchaseIntentSignalInfo ExtractSignal(const GURL& url) const;
@@ -9,7 +9,6 @@
#include <string>
#include "base/memory/raw_ptr.h"
#include "bat/ads/internal/processors/processor_interface.h"
namespace ads {
@@ -19,14 +18,14 @@ class TextClassification;
namespace processor {
class TextClassification final : public ProcessorInterface<std::string> {
class TextClassification final {
public:
explicit TextClassification(resource::TextClassification* resource);
~TextClassification() override;
~TextClassification();
TextClassification(const TextClassification&) = delete;
TextClassification& operator=(const TextClassification&) = delete;
void Process(const std::string& text) override;
void Process(const std::string& text);
private:
raw_ptr<resource::TextClassification> resource_ = nullptr;
@@ -1,23 +0,0 @@
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef BRAVE_VENDOR_BAT_NATIVE_ADS_SRC_BAT_ADS_INTERNAL_PROCESSORS_PROCESSOR_INTERFACE_H_
#define BRAVE_VENDOR_BAT_NATIVE_ADS_SRC_BAT_ADS_INTERNAL_PROCESSORS_PROCESSOR_INTERFACE_H_
namespace ads {
namespace processor {
template <typename T>
class ProcessorInterface {
public:
virtual ~ProcessorInterface() = default;
virtual void Process(const T&) = 0;
};
} // namespace processor
} // namespace ads
#endif // BRAVE_VENDOR_BAT_NATIVE_ADS_SRC_BAT_ADS_INTERNAL_PROCESSORS_PROCESSOR_INTERFACE_H_
@@ -11,24 +11,23 @@
#include "base/memory/weak_ptr.h"
#include "bat/ads/internal/resources/behavioral/anti_targeting/anti_targeting_info.h"
#include "bat/ads/internal/resources/parsing_result.h"
#include "bat/ads/internal/resources/resource_interface.h"
namespace ads {
namespace resource {
class AntiTargeting final : public ResourceInterface<AntiTargetingInfo> {
class AntiTargeting final {
public:
AntiTargeting();
~AntiTargeting() override;
~AntiTargeting();
AntiTargeting(const AntiTargeting&) = delete;
AntiTargeting& operator=(const AntiTargeting&) = delete;
bool IsInitialized() const override;
bool IsInitialized() const;
void Load();
AntiTargetingInfo get() const override;
AntiTargetingInfo get() const;
private:
void OnLoadAndParseResource(ParsingResultPtr<AntiTargetingInfo> result);
@@ -6,7 +6,6 @@
#ifndef BRAVE_VENDOR_BAT_NATIVE_ADS_SRC_BAT_ADS_INTERNAL_RESOURCES_BEHAVIORAL_BANDITS_EPSILON_GREEDY_BANDIT_RESOURCE_H_
#define BRAVE_VENDOR_BAT_NATIVE_ADS_SRC_BAT_ADS_INTERNAL_RESOURCES_BEHAVIORAL_BANDITS_EPSILON_GREEDY_BANDIT_RESOURCE_H_
#include "bat/ads/internal/resources/resource_interface.h"
#include "bat/ads/internal/segments/segments_aliases.h"
namespace ads {
@@ -15,18 +14,18 @@ struct CatalogInfo;
namespace resource {
class EpsilonGreedyBandit final : public ResourceInterface<SegmentList> {
class EpsilonGreedyBandit final {
public:
EpsilonGreedyBandit();
~EpsilonGreedyBandit() override;
~EpsilonGreedyBandit();
EpsilonGreedyBandit(const EpsilonGreedyBandit&) = delete;
EpsilonGreedyBandit& operator=(const EpsilonGreedyBandit&) = delete;
bool IsInitialized() const override;
bool IsInitialized() const;
void LoadFromCatalog(const CatalogInfo& catalog);
SegmentList get() const override;
SegmentList get() const;
private:
bool is_initialized_ = false;
@@ -12,24 +12,23 @@
#include "bat/ads/internal/resources/behavioral/conversions/conversion_id_pattern_info_aliases.h"
#include "bat/ads/internal/resources/behavioral/conversions/conversions_info.h"
#include "bat/ads/internal/resources/parsing_result.h"
#include "bat/ads/internal/resources/resource_interface.h"
namespace ads {
namespace resource {
class Conversions final : public ResourceInterface<const ConversionsInfo*> {
class Conversions final {
public:
Conversions();
~Conversions() override;
~Conversions();
Conversions(const Conversions&) = delete;
Conversions& operator=(const Conversions&) = delete;
bool IsInitialized() const override;
bool IsInitialized() const;
void Load();
const ConversionsInfo* get() const override;
const ConversionsInfo* get() const;
private:
void OnLoadAndParseResource(ParsingResultPtr<ConversionsInfo> result);
@@ -10,7 +10,6 @@
#include "base/memory/weak_ptr.h"
#include "bat/ads/internal/resources/parsing_result.h"
#include "bat/ads/internal/resources/resource_interface.h"
namespace ads {
@@ -20,20 +19,19 @@ struct PurchaseIntentInfo;
namespace resource {
class PurchaseIntent final
: public ResourceInterface<const targeting::PurchaseIntentInfo*> {
class PurchaseIntent final {
public:
PurchaseIntent();
~PurchaseIntent() override;
~PurchaseIntent();
PurchaseIntent(const PurchaseIntent&) = delete;
PurchaseIntent& operator=(const PurchaseIntent&) = delete;
bool IsInitialized() const override;
bool IsInitialized() const;
void Load();
const targeting::PurchaseIntentInfo* get() const override;
const targeting::PurchaseIntentInfo* get() const;
private:
void OnLoadAndParseResource(
@@ -10,7 +10,6 @@
#include "base/memory/weak_ptr.h"
#include "bat/ads/internal/resources/parsing_result.h"
#include "bat/ads/internal/resources/resource_interface.h"
namespace ads {
@@ -22,20 +21,19 @@ class TextProcessing;
namespace resource {
class TextClassification final
: public ResourceInterface<ml::pipeline::TextProcessing*> {
class TextClassification final {
public:
TextClassification();
~TextClassification() override;
~TextClassification();
TextClassification(const TextClassification&) = delete;
TextClassification& operator=(const TextClassification&) = delete;
bool IsInitialized() const override;
bool IsInitialized() const;
void Load();
ml::pipeline::TextProcessing* get() const override;
ml::pipeline::TextProcessing* get() const;
private:
void OnLoadAndParseResource(
@@ -1,25 +0,0 @@
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef BRAVE_VENDOR_BAT_NATIVE_ADS_SRC_BAT_ADS_INTERNAL_RESOURCES_RESOURCE_INTERFACE_H_
#define BRAVE_VENDOR_BAT_NATIVE_ADS_SRC_BAT_ADS_INTERNAL_RESOURCES_RESOURCE_INTERFACE_H_
namespace ads {
namespace resource {
template <typename T>
class ResourceInterface {
public:
virtual ~ResourceInterface() = default;
virtual bool IsInitialized() const = 0;
virtual T get() const = 0;
};
} // namespace resource
} // namespace ads
#endif // BRAVE_VENDOR_BAT_NATIVE_ADS_SRC_BAT_ADS_INTERNAL_RESOURCES_RESOURCE_INTERFACE_H_