Skip to content

Commit

Permalink
[BRP] Remove #constexpr-* exclusions (and modernize comments)
Browse files Browse the repository at this point in the history
No rewrites were necessary. In vast majority of cases there was another exclusion reason barring from making a rewrite. In the 2 cases where no other reason was listed, turns out the embedding struct is STACK_ALLOCATED, so we don't rewrite such pointers.

Bug: 346694917
Change-Id: I6b8002e424dc4d6b3952567382eb81b926e55244
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5632968
Reviewed-by: Keishi Hattori <[email protected]>
Commit-Queue: Keishi Hattori <[email protected]>
Auto-Submit: Bartek Nowierski <[email protected]>
Owners-Override: Keishi Hattori <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1318385}
  • Loading branch information
bartekn-chromium authored and Chromium LUCI CQ committed Jun 23, 2024
1 parent c630a79 commit 26a2cce
Show file tree
Hide file tree
Showing 18 changed files with 33 additions and 60 deletions.
21 changes: 7 additions & 14 deletions base/metrics/field_trial_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ struct FeatureParam<std::string> {
// GetFieldTrialParamValueByFeature() for more details.
BASE_EXPORT std::string Get() const;

// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #global-scope, #constexpr-ctor-field-initializer
// RAW_PTR_EXCLUSION: #global-scope,
RAW_PTR_EXCLUSION const Feature* const feature;
const char* const name;
const char* const default_value;
Expand All @@ -189,8 +188,7 @@ struct FeatureParam<double> {
// GetFieldTrialParamValueByFeature() for more details.
BASE_EXPORT double Get() const;

// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #global-scope, #constexpr-ctor-field-initializer
// RAW_PTR_EXCLUSION: #global-scope
RAW_PTR_EXCLUSION const Feature* const feature;
const char* const name;
const double default_value;
Expand All @@ -214,8 +212,7 @@ struct FeatureParam<int> {
// GetFieldTrialParamValueByFeature() for more details.
BASE_EXPORT int Get() const;

// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #global-scope, #constexpr-ctor-field-initializer
// RAW_PTR_EXCLUSION: #global-scope
RAW_PTR_EXCLUSION const Feature* const feature;
const char* const name;
const int default_value;
Expand All @@ -239,8 +236,7 @@ struct FeatureParam<bool> {
// GetFieldTrialParamValueByFeature() for more details.
BASE_EXPORT bool Get() const;

// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #global-scope, #constexpr-ctor-field-initializer
// RAW_PTR_EXCLUSION: #global-scope
RAW_PTR_EXCLUSION const Feature* const feature;
const char* const name;
const bool default_value;
Expand All @@ -265,8 +261,7 @@ struct FeatureParam<base::TimeDelta> {
// GetFieldTrialParamValueByFeature() for more details.
BASE_EXPORT base::TimeDelta Get() const;

// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #global-scope, #constexpr-ctor-field-initializer
// RAW_PTR_EXCLUSION: #global-scope
RAW_PTR_EXCLUSION const Feature* const feature;
const char* const name;
const base::TimeDelta default_value;
Expand Down Expand Up @@ -336,13 +331,11 @@ struct FeatureParam<Enum, true> {
return "";
}

// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #global-scope, #constexpr-ctor-field-initializer
// RAW_PTR_EXCLUSION: #global-scope
RAW_PTR_EXCLUSION const base::Feature* const feature;
const char* const name;
const Enum default_value;
// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #global-scope, #constexpr-ctor-field-initializer
// RAW_PTR_EXCLUSION: #global-scope
RAW_PTR_EXCLUSION const Option* const options;
const size_t option_count;
};
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/ui/ash/clipboard_history_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ class ClipboardDataWaiter : public ui::ClipboardObserver {
return clipboard_data == nullptr || *clipboard_data == *clipboard_data_;
}

// This field is not a raw_ptr<> because it was filtered by the rewriter
// for: #addr-of, #constexpr-ctor-field-initializer
// RAW_PTR_EXCLUSION: #addr-of
RAW_PTR_EXCLUSION const ui::ClipboardData* clipboard_data_ = nullptr;
std::unique_ptr<base::RunLoop> run_loop_;
};
Expand Down
3 changes: 1 addition & 2 deletions chromeos/components/onc/onc_utils_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,7 @@ TEST(ONCUtils, ParseAndValidateOncForImport_WithAdvancedOpenVPNSettings) {
}

struct MaskCredentialsTestCase {
// This field is not a raw_ptr<> because it was filtered by the rewriter
// for: #constexpr-var-initializer, #global-scope
// RAW_PTR_EXCLUSION: #global-scope
RAW_PTR_EXCLUSION const OncValueSignature* onc_signature;
const char* onc;
const char* expected_after_masking;
Expand Down
3 changes: 1 addition & 2 deletions components/flags_ui/feature_entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ struct FeatureEntry {
// get translated. The other parts here use ids for historical reasons and
// can realistically also be moved to direct description_texts.
const char* description_text;
// This field is not a raw_ptr<> because it was filtered by the rewriter
// for: #global-scope, #constexpr-var-initializer
// RAW_PTR_EXCLUSION: #global-scope
RAW_PTR_EXCLUSION const FeatureParam* params;
int num_params;
// A variation id number in the format of
Expand Down
3 changes: 1 addition & 2 deletions components/safe_browsing/core/common/features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,7 @@ namespace {
// be set to true if the experiment state should be listed on
// chrome://safe-browsing. Features should be listed in alphabetical order.
constexpr struct {
// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #global-scope, #constexpr-var-initializer
// RAW_PTR_EXCLUSION: #global-scope
RAW_PTR_EXCLUSION const base::Feature* feature;
// True if the feature's state should be listed on chrome://safe-browsing.
bool show_state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <optional>

#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/memory/stack_allocated.h"
#include "components/segmentation_platform/internal/database/ukm_types.h"
#include "components/segmentation_platform/public/proto/model_metadata.pb.h"

Expand All @@ -27,19 +27,18 @@ class MetadataWriter {

// Defines a feature based on UMA metric.
struct UMAFeature {
STACK_ALLOCATED();

public:
const proto::SignalType signal_type{proto::SignalType::UNKNOWN_SIGNAL_TYPE};
const char* name{nullptr};
const uint64_t bucket_count{0};
const uint64_t tensor_length{0};
const proto::Aggregation aggregation{proto::Aggregation::UNKNOWN};
const size_t enum_ids_size{0};
// This field is not a raw_ptr<> because it was filtered by the rewriter
// for: #constexpr-var-initializer
RAW_PTR_EXCLUSION const int32_t* const accepted_enum_ids = nullptr;
const int32_t* const accepted_enum_ids = nullptr;
const size_t default_values_size{0};
// This field is not a raw_ptr<> because it was filtered by the rewriter
// for: #constexpr-var-initializer
RAW_PTR_EXCLUSION const float* const default_values = nullptr;
const float* const default_values = nullptr;

static constexpr UMAFeature FromUserAction(const char* name,
uint64_t bucket_count) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ INSTANTIATE_TEST_SUITE_P(GetBlockMessageIDParameterized,

struct BuildHtmlTestParameter {
bool allow_access_requests;
// These fields are not a raw_ref<> because they were filtered by the rewriter
// for: #constexpr-ctor-field-initializer, global-scope
// RAW_PTR_EXCLUSION: #global-scope
RAW_PTR_EXCLUSION const std::string& profile_image_url;
RAW_PTR_EXCLUSION const std::string& profile_image_url2;
RAW_PTR_EXCLUSION const std::string& custodian;
Expand Down
3 changes: 1 addition & 2 deletions content/browser/media/session/media_session_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,7 @@ class MediaSessionImpl : public MediaSession,
bool operator==(const PlayerIdentifier& other) const;
bool operator!=(const PlayerIdentifier& other) const;
bool operator<(const PlayerIdentifier& other) const;
// This field is not a raw_ptr<> because it was filtered by the rewriter
// for: #constexpr-ctor-field-initializer, #union
// RAW_PTR_EXCLUSION: #union
RAW_PTR_EXCLUSION MediaSessionPlayerObserver* observer;
int player_id;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ const char kShapeDetectionTestHtml[] = "/media/shape_detection_test.html";
struct TestParameters {
const std::string detector_name;
const std::string image_path;
// This field is not a raw_ref<> because it was filtered by the rewriter for:
// #constexpr-ctor-field-initializer, global-scope
// RAW_PTR_EXCLUSION: global-scope
RAW_PTR_EXCLUSION const std::vector<std::vector<float>>&
expected_bounding_boxes;
} const kTestParameters[] = {
Expand Down
6 changes: 2 additions & 4 deletions ipc/ipc_channel_proxy_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ class QuitListener : public IPC::Listener {

bool bad_message_received_ = false;
bool quit_message_received_ = false;
// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #constexpr-ctor-field-initializer, #addr-of
// RAW_PTR_EXCLUSION: #addr-of
RAW_PTR_EXCLUSION base::RunLoop* run_loop_ = nullptr;
};

Expand Down Expand Up @@ -130,8 +129,7 @@ class ChannelReflectorListener : public IPC::Listener {
run_loop_->QuitWhenIdle();
}

// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #constexpr-ctor-field-initializer, #addr-of
// RAW_PTR_EXCLUSION: #addr-of
RAW_PTR_EXCLUSION base::RunLoop* run_loop_ = nullptr;

private:
Expand Down
3 changes: 1 addition & 2 deletions net/disk_cache/disk_cache_fuzzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ class DiskCacheLPMFuzzer {
EntryInfo(const EntryInfo&) = delete;
EntryInfo& operator=(const EntryInfo&) = delete;

// This field is not a raw_ptr<> because it was filtered by the rewriter
// for: #addr-of, #constexpr-ctor-field-initializer
// RAW_PTR_EXCLUSION: #addr-of
RAW_PTR_EXCLUSION disk_cache::Entry* entry_ptr = nullptr;
std::unique_ptr<TestEntryResultCompletionCallback> tcb;
};
Expand Down
3 changes: 1 addition & 2 deletions services/network/trust_tokens/scoped_boringssl_bytes.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ class ScopedBoringsslBytes {

private:
size_t len_ = 0;
// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #constexpr-ctor-field-initializer, #addr-of
// RAW_PTR_EXCLUSION: #addr-of
RAW_PTR_EXCLUSION uint8_t* ptr_ = nullptr;
};

Expand Down
6 changes: 2 additions & 4 deletions services/tracing/perfetto/privacy_filtered_fields-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ namespace tracing {
struct MessageInfo {
// List of accepted field ids in the output for this message. The end of list
// is marked by a -1.
// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #global-scope, #constexpr-var-initializer
// RAW_PTR_EXCLUSION: #global-scope
RAW_PTR_EXCLUSION const int* accepted_field_ids;

// List of sub messages that correspond to the accepted field ids list. There
// is no end of list marker and the length is this list is equal to length of
// |accepted_field_ids| - 1.
// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #global-scope, #constexpr-var-initializer
// RAW_PTR_EXCLUSION: #global-scope
RAW_PTR_EXCLUSION const MessageInfo* const* const sub_messages;
};

Expand Down
3 changes: 1 addition & 2 deletions ui/base/interaction/element_identifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ class COMPONENT_EXPORT(UI_BASE) ElementIdentifier final {
// The value of the identifier. Because all non-null values point to static
// ElementIdentifierImpl objects this can be treated as a value from a set of
// unique, opaque handles.
// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #union, #global-scope, #constexpr-ctor-field-initializer
// RAW_PTR_EXCLUSION: #union, #global-scope
RAW_PTR_EXCLUSION const internal::ElementIdentifierImpl* handle_ = nullptr;
};

Expand Down
3 changes: 1 addition & 2 deletions ui/gfx/animation/keyframe/animation_curve.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ class GFX_KEYFRAME_ANIMATION_EXPORT AnimationCurve {
virtual base::TimeDelta TickInterval() const;
};

// |target_| field is not a raw_ptr<> because it was filtered by the rewriter
// for: #constexpr-ctor-field-initializer, #macro
// RAW_PTR_EXCLUSION: #macro
#define DECLARE_ANIMATION_CURVE_BODY(T, Name) \
public: \
static const Name##AnimationCurve* To##Name##AnimationCurve( \
Expand Down
5 changes: 2 additions & 3 deletions ui/gfx/native_widget_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,8 @@ class GFX_EXPORT NativeWindow {
#if defined(__has_feature) && __has_feature(objc_arc)
__unsafe_unretained NSWindow* ns_window_ = nullptr;
#else
// This field is not a raw_ptr<> because it was filtered by the rewriter
// for: #constexpr-ctor-field-initializer, #global-scope, #union
// This field also points to Objective-C object.
// RAW_PTR_EXCLUSION: #global-scope, #union; Also, points to Objective-C
// object which isn't supported.
RAW_PTR_EXCLUSION NSWindow* ns_window_ = nullptr;
#endif
};
Expand Down
6 changes: 2 additions & 4 deletions ui/gfx/vector_icon_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ struct VectorIconRep {
VectorIconRep(const VectorIconRep&) = delete;
VectorIconRep& operator=(const VectorIconRep&) = delete;

// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #global-scope, #constexpr-ctor-field-initializer
// RAW_PTR_EXCLUSION: #global-scope
RAW_PTR_EXCLUSION const PathElement* path = nullptr;

// The length of |path|.
Expand All @@ -118,8 +117,7 @@ struct VectorIcon {

bool is_empty() const { return !reps; }

// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #global-scope, #constexpr-ctor-field-initializer
// RAW_PTR_EXCLUSION: #global-scope
RAW_PTR_EXCLUSION const VectorIconRep* const reps = nullptr;
size_t reps_size = 0u;

Expand Down
3 changes: 1 addition & 2 deletions ui/gl/android/scoped_a_native_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ class GL_EXPORT ScopedANativeWindow {

void DestroyIfNeeded();

// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #constexpr-ctor-field-initializer, #global-scope
// RAW_PTR_EXCLUSION: #global-scope
RAW_PTR_EXCLUSION ANativeWindow* a_native_window_ = nullptr;
};

Expand Down

0 comments on commit 26a2cce

Please sign in to comment.