DanglingPointer: annotate for unittests base+linux [2/N]
Those are the leaked raw_ptr's. We detected those raw_ptr's as being never released, and thus as being potential candidates to increase pressure on the BRP memory quarantine. Bug: 1400059 Change-Id: Id1f4799c1b3b4a3709b1ce19165c2fbb97313d67 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4570897 Owners-Override: Arthur Sonzogni <arthursonzogni@chromium.org> Commit-Queue: Paul Semel <paulsemel@chromium.org> Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org> Cr-Commit-Position: refs/heads/main@{#1153261}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
2a45690cdc
commit
d3c00ef3dd
base/metrics
chrome/browser/ui/views
components/web_resource
content/browser/renderer_host
gin
media/mojo
net/reporting
pdf/pdfium
services/network/public/cpp/server
ui
events
platform
views
controls
webview
@ -257,7 +257,7 @@ class BASE_EXPORT HistogramSamples {
|
||||
// external object. The callers guarantees the value will outlive this
|
||||
// instance.
|
||||
std::unique_ptr<Metadata> meta_owned_;
|
||||
raw_ptr<Metadata> meta_;
|
||||
raw_ptr<Metadata, LeakedDanglingUntriaged> meta_;
|
||||
};
|
||||
|
||||
class BASE_EXPORT SampleCountIterator {
|
||||
|
@ -900,7 +900,7 @@ class BASE_EXPORT DelayedPersistentAllocation {
|
||||
// The underlying object that does the actual allocation of memory. Its
|
||||
// lifetime must exceed that of all DelayedPersistentAllocation objects
|
||||
// that use it.
|
||||
const raw_ptr<PersistentMemoryAllocator> allocator_;
|
||||
const raw_ptr<PersistentMemoryAllocator, LeakedDanglingUntriaged> allocator_;
|
||||
|
||||
// The desired type and size of the allocated segment plus the offset
|
||||
// within it for the defined request.
|
||||
@ -912,7 +912,8 @@ class BASE_EXPORT DelayedPersistentAllocation {
|
||||
// stored once the allocation is complete. If multiple delayed allocations
|
||||
// share the same pointer then an allocation on one will amount to an
|
||||
// allocation for all.
|
||||
const raw_ptr<volatile std::atomic<Reference>> reference_;
|
||||
const raw_ptr<volatile std::atomic<Reference>, LeakedDanglingUntriaged>
|
||||
reference_;
|
||||
|
||||
// No DISALLOW_COPY_AND_ASSIGN as it's okay to copy/move these objects.
|
||||
};
|
||||
|
@ -98,13 +98,14 @@ class BASE_EXPORT PersistentSampleMap : public HistogramSamples {
|
||||
|
||||
// The allocator that manages histograms inside persistent memory. This is
|
||||
// owned externally and is expected to live beyond the life of this object.
|
||||
raw_ptr<PersistentHistogramAllocator> allocator_;
|
||||
raw_ptr<PersistentHistogramAllocator, LeakedDanglingUntriaged> allocator_;
|
||||
|
||||
// The object that manages sample records inside persistent memory. This is
|
||||
// owned by the |allocator_| object (above) and so, like it, is expected to
|
||||
// live beyond the life of this object. This value is lazily-initialized on
|
||||
// first use via the GetRecords() accessor method.
|
||||
raw_ptr<PersistentSampleMapRecords> records_ = nullptr;
|
||||
raw_ptr<PersistentSampleMapRecords, LeakedDanglingUntriaged> records_ =
|
||||
nullptr;
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
|
@ -113,7 +113,7 @@ class BASE_EXPORT SampleVectorBase : public HistogramSamples {
|
||||
mutable std::atomic<HistogramBase::AtomicCount*> counts_{nullptr};
|
||||
|
||||
// Shares the same BucketRanges with Histogram object.
|
||||
const raw_ptr<const BucketRanges> bucket_ranges_;
|
||||
const raw_ptr<const BucketRanges, LeakedDanglingUntriaged> bucket_ranges_;
|
||||
};
|
||||
|
||||
// A sample vector that uses local memory for the counts array.
|
||||
|
@ -186,11 +186,11 @@ class BookmarkMenuDelegate : public bookmarks::BaseBookmarkModelObserver,
|
||||
// an id.
|
||||
int GetAndIncrementNextMenuID();
|
||||
|
||||
const raw_ptr<Browser> browser_;
|
||||
raw_ptr<Profile> profile_;
|
||||
const raw_ptr<Browser, LeakedDanglingUntriaged> browser_;
|
||||
raw_ptr<Profile, LeakedDanglingUntriaged> profile_;
|
||||
|
||||
// Parent of menus.
|
||||
raw_ptr<views::Widget> parent_;
|
||||
raw_ptr<views::Widget, LeakedDanglingUntriaged> parent_;
|
||||
|
||||
// Maps from menu id to BookmarkNode.
|
||||
MenuIDToNodeMap menu_id_to_node_map_;
|
||||
|
@ -34,7 +34,7 @@ class PriceTrackingView : public views::FlexLayoutView {
|
||||
raw_ptr<views::Label> body_label_;
|
||||
raw_ptr<views::ToggleButton> toggle_button_;
|
||||
|
||||
raw_ptr<Profile> profile_;
|
||||
raw_ptr<Profile, LeakedDanglingUntriaged> profile_;
|
||||
bool is_price_track_enabled_;
|
||||
|
||||
base::WeakPtrFactory<PriceTrackingView> weak_ptr_factory_{this};
|
||||
|
@ -110,7 +110,7 @@ class FakeTabSlotController : public TabSlotController {
|
||||
}
|
||||
|
||||
private:
|
||||
raw_ptr<TabStripController> tab_strip_controller_;
|
||||
raw_ptr<TabStripController, LeakedDanglingUntriaged> tab_strip_controller_;
|
||||
raw_ptr<TabContainer, DanglingUntriaged> tab_container_;
|
||||
ui::ListSelectionModel selection_model_;
|
||||
raw_ptr<Tab, DanglingUntriaged> active_tab_ = nullptr;
|
||||
|
@ -139,8 +139,8 @@ class ResourceRequestAllowedNotifier
|
||||
raw_ptr<Observer> observer_;
|
||||
|
||||
NetworkConnectionTrackerGetter network_connection_tracker_getter_;
|
||||
raw_ptr<network::NetworkConnectionTracker> network_connection_tracker_ =
|
||||
nullptr;
|
||||
raw_ptr<network::NetworkConnectionTracker, LeakedDanglingUntriaged>
|
||||
network_connection_tracker_ = nullptr;
|
||||
network::mojom::ConnectionType connection_type_ =
|
||||
network::mojom::ConnectionType::CONNECTION_UNKNOWN;
|
||||
bool connection_initialized_ = false;
|
||||
|
@ -1170,7 +1170,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl
|
||||
// An expiry time for resetting the pending_user_activation_timer_.
|
||||
static const base::TimeDelta kActivationNotificationExpireTime;
|
||||
|
||||
raw_ptr<FrameTree> frame_tree_;
|
||||
raw_ptr<FrameTree, LeakedDanglingUntriaged> frame_tree_;
|
||||
|
||||
// RenderWidgetHost are either:
|
||||
// - Owned by RenderViewHostImpl.
|
||||
@ -1212,7 +1212,8 @@ class CONTENT_EXPORT RenderWidgetHostImpl
|
||||
// dynamically fetching it from `site_instance_group_` since its
|
||||
// value gets cleared early in `SiteInstanceGroup` via
|
||||
// RenderProcessHostDestroyed before this object is destroyed.
|
||||
const raw_ref<AgentSchedulingGroupHost> agent_scheduling_group_;
|
||||
const raw_ref<AgentSchedulingGroupHost, LeakedDanglingUntriaged>
|
||||
agent_scheduling_group_;
|
||||
|
||||
// The SiteInstanceGroup this RenderWidgetHost belongs to.
|
||||
// TODO(https://crbug.com/1420333) Turn this into base::SafeRef
|
||||
|
@ -37,7 +37,7 @@ class GIN_EXPORT NamedPropertyInterceptor {
|
||||
v8::Isolate* isolate);
|
||||
|
||||
private:
|
||||
raw_ptr<v8::Isolate> isolate_;
|
||||
raw_ptr<v8::Isolate, LeakedDanglingUntriaged> isolate_;
|
||||
raw_ptr<WrappableBase> base_;
|
||||
};
|
||||
|
||||
@ -59,7 +59,7 @@ class GIN_EXPORT IndexedPropertyInterceptor {
|
||||
v8::Isolate* isolate);
|
||||
|
||||
private:
|
||||
raw_ptr<v8::Isolate> isolate_;
|
||||
raw_ptr<v8::Isolate, LeakedDanglingUntriaged> isolate_;
|
||||
raw_ptr<WrappableBase> base_;
|
||||
};
|
||||
|
||||
|
@ -120,7 +120,8 @@ class MojoVideoDecoder final : public VideoDecoder,
|
||||
// Manages VideoFrame destruction callbacks.
|
||||
scoped_refptr<MojoVideoFrameHandleReleaser> mojo_video_frame_handle_releaser_;
|
||||
|
||||
raw_ptr<GpuVideoAcceleratorFactories> gpu_factories_ = nullptr;
|
||||
raw_ptr<GpuVideoAcceleratorFactories, LeakedDanglingUntriaged>
|
||||
gpu_factories_ = nullptr;
|
||||
|
||||
// Raw pointer is safe since both `this` and the `media_log` are owned by
|
||||
// WebMediaPlayerImpl with the correct declaration order.
|
||||
|
@ -101,10 +101,11 @@ class MEDIA_MOJO_EXPORT MojoVideoDecoderService final
|
||||
std::string codec_string_;
|
||||
|
||||
// Decoder factory.
|
||||
raw_ptr<MojoMediaClient> mojo_media_client_;
|
||||
raw_ptr<MojoMediaClient, LeakedDanglingUntriaged> mojo_media_client_;
|
||||
|
||||
// A helper object required to get the CDM from a CDM ID.
|
||||
const raw_ptr<MojoCdmServiceContext> mojo_cdm_service_context_ = nullptr;
|
||||
const raw_ptr<MojoCdmServiceContext, LeakedDanglingUntriaged>
|
||||
mojo_cdm_service_context_ = nullptr;
|
||||
|
||||
// Channel for sending async messages to the client.
|
||||
mojo::AssociatedRemote<mojom::VideoDecoderClient> client_;
|
||||
|
@ -179,8 +179,9 @@ class TestReportingContext : public ReportingContext {
|
||||
// Owned by the DeliveryAgent and GarbageCollector, respectively, but
|
||||
// referenced here to preserve type:
|
||||
|
||||
raw_ptr<base::MockOneShotTimer> delivery_timer_;
|
||||
raw_ptr<base::MockOneShotTimer> garbage_collection_timer_;
|
||||
raw_ptr<base::MockOneShotTimer, LeakedDanglingUntriaged> delivery_timer_;
|
||||
raw_ptr<base::MockOneShotTimer, LeakedDanglingUntriaged>
|
||||
garbage_collection_timer_;
|
||||
};
|
||||
|
||||
// A unit test base class that provides a TestReportingContext and shorthand
|
||||
|
@ -31,7 +31,7 @@ class FileAvail : public FX_FILEAVAIL {
|
||||
return file_avail->doc_loader_->IsDataAvailable(offset, size);
|
||||
}
|
||||
|
||||
raw_ptr<DocumentLoader> doc_loader_;
|
||||
raw_ptr<DocumentLoader, LeakedDanglingUntriaged> doc_loader_;
|
||||
};
|
||||
|
||||
class DownloadHints : public FX_DOWNLOADHINTS {
|
||||
@ -51,7 +51,7 @@ class DownloadHints : public FX_DOWNLOADHINTS {
|
||||
return download_hints->doc_loader_->RequestData(offset, size);
|
||||
}
|
||||
|
||||
raw_ptr<DocumentLoader> doc_loader_;
|
||||
raw_ptr<DocumentLoader, LeakedDanglingUntriaged> doc_loader_;
|
||||
};
|
||||
|
||||
class FileAccess : public FPDF_FILEACCESS {
|
||||
@ -73,7 +73,7 @@ class FileAccess : public FPDF_FILEACCESS {
|
||||
return file_access->doc_loader_->GetBlock(position, size, buffer);
|
||||
}
|
||||
|
||||
raw_ptr<DocumentLoader> doc_loader_;
|
||||
raw_ptr<DocumentLoader, LeakedDanglingUntriaged> doc_loader_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
@ -56,7 +56,7 @@ class WebSocket final {
|
||||
const std::string& message,
|
||||
const net::NetworkTrafficAnnotationTag traffic_annotation);
|
||||
|
||||
const raw_ptr<HttpServer> server_;
|
||||
const raw_ptr<HttpServer, LeakedDanglingUntriaged> server_;
|
||||
const raw_ptr<HttpConnection> connection_;
|
||||
std::unique_ptr<WebSocketEncoder> encoder_;
|
||||
bool closed_;
|
||||
|
@ -20,8 +20,8 @@ constexpr int kPriorityFdWatch = G_PRIORITY_DEFAULT_IDLE - 10;
|
||||
struct GLibWaylandSource : public GSource {
|
||||
// Note: The GLibWaylandSource is created and destroyed by GLib. So its
|
||||
// constructor/destructor may or may not get called.
|
||||
raw_ptr<WaylandEventWatcherGlib> event_watcher;
|
||||
raw_ptr<GPollFD> poll_fd;
|
||||
raw_ptr<WaylandEventWatcherGlib, LeakedDanglingUntriaged> event_watcher;
|
||||
raw_ptr<GPollFD, LeakedDanglingUntriaged> poll_fd;
|
||||
};
|
||||
|
||||
gboolean WatchSourcePrepare(GSource* source, gint* timeout_ms) {
|
||||
|
@ -15,8 +15,8 @@ namespace {
|
||||
struct GLibX11Source : public GSource {
|
||||
// Note: The GLibX11Source is created and destroyed by GLib. So its
|
||||
// constructor/destructor may or may not get called.
|
||||
raw_ptr<x11::Connection> connection;
|
||||
raw_ptr<GPollFD> poll_fd;
|
||||
raw_ptr<x11::Connection, LeakedDanglingUntriaged> connection;
|
||||
raw_ptr<GPollFD, LeakedDanglingUntriaged> poll_fd;
|
||||
};
|
||||
|
||||
gboolean XSourcePrepare(GSource* source, gint* timeout_ms) {
|
||||
|
@ -201,7 +201,7 @@ class WEBVIEW_EXPORT WebView : public View,
|
||||
// Set to true when |holder_| is letterboxed (scaled to be smaller than this
|
||||
// view, to preserve its aspect ratio).
|
||||
bool is_letterboxing_ = false;
|
||||
raw_ptr<content::BrowserContext> browser_context_;
|
||||
raw_ptr<content::BrowserContext, LeakedDanglingUntriaged> browser_context_;
|
||||
bool allow_accelerators_ = false;
|
||||
raw_ptr<View, DanglingUntriaged> crashed_overlay_view_ = nullptr;
|
||||
bool is_primary_web_contents_for_window_ = false;
|
||||
|
Reference in New Issue
Block a user