0

DanglingPointer: annotate for unittests base+linux [1/N]

The DanglingPointerDetector is configured only when the test enters the
ContentMain function. See https://crbug.com/1400059

I would like to configure it no matter the kind of test. For this to
happen, we need to annotate every pre-existing dangling pointers.

This patch annotates the ones you can find by running targets depending
on the GoogleTest library.

Statistic:

This adds 1776 new DanglingUntriaged. Among them:
- 1288 are in unittests.
- 488 are in implementation.

To produce those numbers, I used the command:
```bash
git diff annotate-linux origin/main -- "*test*" | grep "DanglingUntriaged" | wc -l
```

This patch has been generated by:

1. Apply the "auto-annotator" patch:
   https://chromium-review.googlesource.com/c/chromium/src/+/4474553

2. Compile the compiler again:
   ```bash
   ./tools/clang/scripts/build.py
   ```

3. List and run all the targets. You can use a bash script like:
   https://docs.google.com/document/d/1AMMERcqy0eafFWopUCHYsIKIKEp3J8DFxqW9UIbzIHo

4. Concatenate output, filter by "Found dangling ptr", sort, remove
   duplicate.

5. Apply the rewriter script from:
   https://github.com/ArthurSonzogni/chrome-dangling-ptr-apply-edit

6. Revert the "auto-annotate" patch.

7. Apply `git cl format`

AX-Relnotes: n/a.
Bug: chromium:1400059
Change-Id: I217d5c0b925da5176fc53baf95919a3690f1e9a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4570424
Reviewed-by: danakj <danakj@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1151859}
This commit is contained in:
Arthur Sonzogni
2023-06-01 15:02:25 +00:00
committed by Chromium LUCI CQ
parent 0847bf8645
commit e98d214c48
1184 changed files with 2113 additions and 1774 deletions
apps
base
cc
chrome
browser
apps
app_service
background
badging
browser_switcher
browsing_data
cart
complex_tasks
component_updater
content_settings
device_identity
dips
download
engagement
enterprise
extensions
feed
feedback
first_party_sets
hid
history_clusters
media
media_galleries
metrics
net
new_tab_page
notifications
optimization_guide
page_load_metrics
password_manager
performance_manager
permissions
plugins
policy
predictors
preloading
privacy_sandbox
process_singleton_posix_unittest.cc
profiles
renderer_context_menu
resource_coordinator
safe_browsing
search
send_tab_to_self
sessions
sharing
signin
ssl
supervised_user
sync
sync_file_system
task_manager
themes
ui
autofill
bookmarks
browser.hbrowser_list_unittest.ccbrowser_unittest.cc
content_settings
cookie_controls
exclusive_access
extensions
global_media_controls
intent_picker_tab_helper.hintent_picker_tab_helper_unittest.cc
media_router
passwords
recently_audible_helper_unittest.cc
tab_contents
tabs
toolbar
views
apps
autofill
bookmarks
bubble
commerce
desktop_capture
device_chooser_content_view_unittest.cc
extensions
frame
global_media_controls
intent_picker_bubble_view_unittest.cc
layout
location_bar
media_router
omnibox
page_action
page_info
passwords
permissions
profiles
qrcode_generator
send_tab_to_self
sharing_hub
side_panel
site_data
tabs
toolbar
translate
user_education
webid
webui
updates
announcement_notification
web_applications
commands
extensions
externally_managed_app_manager.hexternally_managed_app_manager_impl_unittest.ccexternally_managed_app_manager_unittest.cc
isolated_web_apps
os_integration
policy
preinstalled_web_app_manager_unittest.cc
test
web_app_command_manager_unittest.ccweb_app_command_scheduler_unittest.ccweb_app_database.hweb_app_database_unittest.ccweb_app_icon_manager_unittest.ccweb_app_install_manager.h
webid
common
services
test
components
autofill
blocked_content
blocklist
bookmarks
browsing_data
captive_portal
commerce
consent_auditor
constrained_window
content_capture
content_settings
contextual_search
cronet
custom_handlers
device_signals
domain_reliability
download
enterprise
favicon
feature_engagement
feed
flags_ui
fullscreen_control
gcm_driver
global_media_controls
grpc_support
history
image_fetcher
invalidation
media_message_center
media_router
mirroring
no_state_prefetch
offline_pages
omnibox
open_from_clipboard
optimization_guide
origin_trials
os_crypt
page_info
page_load_metrics
password_manager
payments
performance_manager
permissions
policy
power_metrics
privacy_sandbox
proxy_config
query_tiles
reading_list
reduce_accept_language
reporting
safe_browsing
safe_search_api
search_provider_logos
security_interstitials
segmentation_platform
services
storage
dom_storage
indexed_db
sessions
signin
site_engagement
storage_monitor
subresource_filter
sync
sync_preferences
sync_sessions
system_media_controls
translate
trusted_vault
undo
unexportable_keys
unified_consent
update_client
url_formatter
user_education
visitedlink
viz
web_modal
webrtc_logging
content
browser
background_fetch
background_sync
bluetooth
browsing_data
byte_stream.cc
code_cache
compute_pressure
fenced_frame
file_system_access
geolocation
idle
indexed_db
interest_group
loader
media
notifications
permissions
picture_in_picture
plugin_list_unittest.cc
preloading
private_aggregation
push_messaging
renderer_host
screen_orientation
screenlock_monitor
service_worker
sms
speech
storage_partition_impl.h
web_package
webauth
webid
xr
public
services
test
courgette
dbus
device
extensions
google_apis/gcm/engine
gpu
ipc
media
net
remoting
services
audio
device
network
preferences
proxy_resolver
resource_coordinator
memory_instrumentation
public
cpp
memory_instrumentation
tracing
video_capture
sql
storage/browser
third_party/blink/public/platform/scheduler
ui
aura
base
compositor
events
gfx
message_center
ozone
views
accessibility
animation
bubble
color_chooser
controls
corewm
event_monitor_unittest.cc
focus
interaction
layout
test
touchui
view.hview_unittest.cc
widget
window
wm

@ -88,7 +88,7 @@ class SafeSearchURLCheckerTest : public testing::Test {
}
size_t next_url_{0};
raw_ptr<FakeURLCheckerClient> fake_client_;
raw_ptr<FakeURLCheckerClient, DanglingUntriaged> fake_client_;
std::unique_ptr<URLChecker> checker_;
base::test::SingleThreadTaskEnvironment task_environment_;
};