[ads][CodeHealth] Explicitly delete copy constructor and assignment operator (#35811)
Add deleted copy constructor and copy assignment operator to classes that own resources or are not meant to be copied: HashedNGramsTransformation, ObliviousHttpKeyConfig, and the three scoped test setters for pacing, timer jitter, and confirmation queue delay. No behavioral changes.
This commit is contained in:
@@ -42,6 +42,9 @@ class ObliviousHttpKeyConfig final {
|
||||
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||
GURL key_config_url);
|
||||
|
||||
ObliviousHttpKeyConfig(const ObliviousHttpKeyConfig&) = delete;
|
||||
ObliviousHttpKeyConfig& operator=(const ObliviousHttpKeyConfig&) = delete;
|
||||
|
||||
~ObliviousHttpKeyConfig();
|
||||
|
||||
// Fetches and caches the key config if it is missing or expired.
|
||||
|
||||
+7
@@ -23,6 +23,13 @@ class ScopedDelayBeforeProcessingConfirmationQueueItemForTesting final {
|
||||
explicit ScopedDelayBeforeProcessingConfirmationQueueItemForTesting(
|
||||
base::TimeDelta delay);
|
||||
|
||||
ScopedDelayBeforeProcessingConfirmationQueueItemForTesting(
|
||||
const ScopedDelayBeforeProcessingConfirmationQueueItemForTesting&) =
|
||||
delete;
|
||||
ScopedDelayBeforeProcessingConfirmationQueueItemForTesting& operator=(
|
||||
const ScopedDelayBeforeProcessingConfirmationQueueItemForTesting&) =
|
||||
delete;
|
||||
|
||||
~ScopedDelayBeforeProcessingConfirmationQueueItemForTesting();
|
||||
};
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@ class PlatformHelper {
|
||||
|
||||
static void SetForTesting(const PlatformHelper* platform_helper);
|
||||
|
||||
PlatformHelper(const PlatformHelper&) = delete;
|
||||
PlatformHelper& operator=(const PlatformHelper&) = delete;
|
||||
|
||||
virtual bool IsMobile() const;
|
||||
virtual std::string GetName() const;
|
||||
virtual PlatformType GetType() const;
|
||||
|
||||
@@ -22,6 +22,11 @@ class ScopedRandTimeDeltaWithJitterSetterForTesting final {
|
||||
explicit ScopedRandTimeDeltaWithJitterSetterForTesting(
|
||||
base::TimeDelta time_delta);
|
||||
|
||||
ScopedRandTimeDeltaWithJitterSetterForTesting(
|
||||
const ScopedRandTimeDeltaWithJitterSetterForTesting&) = delete;
|
||||
ScopedRandTimeDeltaWithJitterSetterForTesting& operator=(
|
||||
const ScopedRandTimeDeltaWithJitterSetterForTesting&) = delete;
|
||||
|
||||
~ScopedRandTimeDeltaWithJitterSetterForTesting();
|
||||
};
|
||||
|
||||
|
||||
@@ -28,9 +28,6 @@ HashedNGramsTransformation::HashedNGramsTransformation(
|
||||
std::make_unique<HashVectorizer>(bucket_count, std::move(subgrams));
|
||||
}
|
||||
|
||||
HashedNGramsTransformation::HashedNGramsTransformation(
|
||||
HashedNGramsTransformation&& hashed_ngrams) noexcept = default;
|
||||
|
||||
HashedNGramsTransformation::~HashedNGramsTransformation() = default;
|
||||
|
||||
std::unique_ptr<Data> HashedNGramsTransformation::Apply(
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
#ifndef BRAVE_COMPONENTS_BRAVE_ADS_CORE_INTERNAL_ML_TRANSFORMATION_HASHED_NGRAMS_TRANSFORMATION_H_
|
||||
#define BRAVE_COMPONENTS_BRAVE_ADS_CORE_INTERNAL_ML_TRANSFORMATION_HASHED_NGRAMS_TRANSFORMATION_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -23,10 +22,9 @@ class HashedNGramsTransformation final : public Transformation {
|
||||
HashedNGramsTransformation();
|
||||
HashedNGramsTransformation(int bucket_count, std::vector<uint32_t> subgrams);
|
||||
|
||||
HashedNGramsTransformation(
|
||||
HashedNGramsTransformation&& hashed_ngrams) noexcept;
|
||||
HashedNGramsTransformation& operator=(
|
||||
HashedNGramsTransformation&& hashed_ngrams) = delete;
|
||||
HashedNGramsTransformation(const HashedNGramsTransformation&) = delete;
|
||||
HashedNGramsTransformation& operator=(const HashedNGramsTransformation&) =
|
||||
delete;
|
||||
|
||||
~HashedNGramsTransformation() override;
|
||||
|
||||
|
||||
@@ -14,6 +14,11 @@ class ScopedPacingRandomNumberSetterForTesting final {
|
||||
public:
|
||||
explicit ScopedPacingRandomNumberSetterForTesting(double number);
|
||||
|
||||
ScopedPacingRandomNumberSetterForTesting(
|
||||
const ScopedPacingRandomNumberSetterForTesting&) = delete;
|
||||
ScopedPacingRandomNumberSetterForTesting& operator=(
|
||||
const ScopedPacingRandomNumberSetterForTesting&) = delete;
|
||||
|
||||
~ScopedPacingRandomNumberSetterForTesting();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user