0

Fix clang plugin style errors for MiraclePtr Big Rewrite

raw_ptr<T> has a non trivial destructor so using it will cause "Complex class/struct needs an explicit out-of-line constructor/destructor" errors.
This CL adds destructors to fix them.
For classes that have inlined constructors, this CL avoids the errors by excluding the fields.

Bug: 1272324
Change-Id: I4f2c5c84be7fa1975c2d57e944a7ef20aa8aaa25
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3294657
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Thomas Lukaszewicz <tluk@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: Weilun Shi <sweilun@chromium.org>
Reviewed-by: Carlos Caballero <carlscab@google.com>
Reviewed-by: Bartek Nowierski <bartekn@chromium.org>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#944565}
This commit is contained in:
Keishi Hattori
2021-11-23 17:38:14 +00:00
committed by Chromium LUCI CQ
parent 48e2f0ddc0
commit cbd9cfaf33
17 changed files with 35 additions and 0 deletions

@ -166,6 +166,8 @@ PersistentMemoryAllocator::Iterator::Iterator(
Reset(starting_after);
}
PersistentMemoryAllocator::Iterator::~Iterator() = default;
void PersistentMemoryAllocator::Iterator::Reset() {
last_record_.store(kReferenceQueue, std::memory_order_relaxed);
record_count_.store(0, std::memory_order_relaxed);

@ -151,6 +151,8 @@ class BASE_EXPORT PersistentMemoryAllocator {
Iterator(const Iterator&) = delete;
Iterator& operator=(const Iterator&) = delete;
~Iterator();
// Resets the iterator back to the beginning.
void Reset();

@ -19,6 +19,8 @@ SequenceManager::Settings::Settings() = default;
SequenceManager::Settings::Settings(Settings&& move_from) noexcept = default;
SequenceManager::Settings::~Settings() = default;
SequenceManager::Settings::Builder::Builder() = default;
SequenceManager::Settings::Builder::~Builder() = default;

@ -88,6 +88,8 @@ class BASE_EXPORT SequenceManager {
// so we are making Settings move-only in preparation.
Settings(Settings&& move_from) noexcept;
~Settings();
MessagePumpType message_loop_type = MessagePumpType::DEFAULT;
bool randomised_sampling_enabled = false;
const TickClock* clock = DefaultTickClock::GetInstance();

@ -86,6 +86,8 @@ MediaEngagementContentsObserver::PlaybackTimer::PlaybackTimer(
base::Clock* clock)
: clock_(clock) {}
MediaEngagementContentsObserver::PlaybackTimer::~PlaybackTimer() = default;
void MediaEngagementContentsObserver::PlaybackTimer::Start() {
start_time_ = clock_->Now();
}

@ -150,6 +150,8 @@ class MediaEngagementContentsObserver : public content::WebContentsObserver {
PlaybackTimer(const PlaybackTimer&) = delete;
PlaybackTimer& operator=(const PlaybackTimer&) = delete;
~PlaybackTimer();
void Start();
void Stop();
bool IsRunning() const;

@ -60,6 +60,8 @@ SessionRestoreDelegate::RestoredTab::RestoredTab(const RestoredTab&) = default;
SessionRestoreDelegate::RestoredTab&
SessionRestoreDelegate::RestoredTab::operator=(const RestoredTab&) = default;
SessionRestoreDelegate::RestoredTab::~RestoredTab() = default;
bool SessionRestoreDelegate::RestoredTab::operator<(
const RestoredTab& right) const {
// Tab with internal web UI like NTP or Settings are good choices to

@ -31,6 +31,8 @@ class SessionRestoreDelegate {
RestoredTab(const RestoredTab&);
RestoredTab& operator=(const RestoredTab&);
~RestoredTab();
bool operator<(const RestoredTab& right) const;
content::WebContents* contents() const { return contents_; }

@ -199,6 +199,8 @@ QueryFields::~QueryFields() {}
VectorIterator::VectorIterator(std::vector<const BookmarkNode*>* nodes)
: nodes_(nodes), current_(nodes->begin()) {}
VectorIterator::~VectorIterator() = default;
bool VectorIterator::has_next() {
return (current_ != nodes_->end());
}

@ -45,6 +45,7 @@ class VectorIterator {
explicit VectorIterator(std::vector<const BookmarkNode*>* nodes);
VectorIterator(const VectorIterator& other) = delete;
VectorIterator& operator=(const VectorIterator& other) = delete;
~VectorIterator();
bool has_next();
const BookmarkNode* Next();

@ -86,6 +86,8 @@ FeatureSwitch::FeatureSwitch(const base::CommandLine* command_line,
default_value_(default_value == DEFAULT_ENABLED),
override_value_(OVERRIDE_NONE) {}
FeatureSwitch::~FeatureSwitch() = default;
bool FeatureSwitch::IsEnabled() const {
if (override_value_ != OVERRIDE_NONE)
return override_value_ == OVERRIDE_ENABLED;

@ -68,6 +68,8 @@ class FeatureSwitch {
FeatureSwitch(const FeatureSwitch&) = delete;
FeatureSwitch& operator=(const FeatureSwitch&) = delete;
~FeatureSwitch();
// Consider using ScopedOverride instead.
void SetOverrideValue(OverrideValue value);
OverrideValue GetOverrideValue() const;

@ -11,4 +11,6 @@ DataObjectBuilder::DataObjectBuilder(v8::Isolate* isolate)
context_(isolate->GetCurrentContext()),
object_(v8::Object::New(isolate)) {}
DataObjectBuilder::~DataObjectBuilder() = default;
} // namespace gin

@ -41,6 +41,8 @@ class GIN_EXPORT DataObjectBuilder {
DataObjectBuilder(const DataObjectBuilder&) = delete;
DataObjectBuilder& operator=(const DataObjectBuilder&) = delete;
~DataObjectBuilder();
template <typename T>
DataObjectBuilder& Set(base::StringPiece key, T&& value) {
DCHECK(!object_.IsEmpty());

@ -243,6 +243,10 @@ gpu::gles2::PassthroughProgramCache::ProgramCacheValue::program_cache_
# Performance-related exclusions
#######
# Populated manually - to avoid out-of-line destructor
base::LockFreeAddressHashSet::Node::next
gles2::TextureManager::DoTexSubImageArguments::pixels
# Populated manually - on-stack pointer + a large number of non-PA pointees
base::AutoReset::scoped_variable_

@ -45,6 +45,8 @@ ThemedVectorIcon::ThemedVectorIcon(ThemedVectorIcon&&) = default;
ThemedVectorIcon& ThemedVectorIcon::operator=(ThemedVectorIcon&&) = default;
ThemedVectorIcon::~ThemedVectorIcon() = default;
gfx::ImageSkia ThemedVectorIcon::GetImageSkia(
const ColorProvider* color_provider) const {
DCHECK(!empty());

@ -41,6 +41,8 @@ class NATIVE_THEME_EXPORT ThemedVectorIcon {
ThemedVectorIcon(ThemedVectorIcon&&);
ThemedVectorIcon& operator=(ThemedVectorIcon&&);
~ThemedVectorIcon();
void clear() { icon_ = nullptr; }
bool empty() const { return !icon_; }
gfx::ImageSkia GetImageSkia(const ColorProvider* color_provider) const;