0
Commit Graph

19 Commits

Author SHA1 Message Date
Tom Sepez
26b69dddce Remove file-wide unsafe buffer suppression from content/ [1 of N].
-- Several files are already clean.
-- Use UNSAFE_TODO() per-expression otherwise.
-- Convert one span to implicit construction.

Bug: 342213636
Change-Id: Id5face27dbc80de7bef4fc539f4cccef7f025494
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6341209
Reviewed-by: Bo Liu <boliu@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1430970}
2025-03-11 10:18:31 -07:00
Georg Neis
35ff854b7e Remove Lacros leftovers from content/browser, part 2
Main changes:
- Replace IS_CHROMEOS_ASH with the equivalent IS_CHROMEOS
- Remove obsolete build flag includes/dependencies

Bug: b:354842935
AX-Relnotes: n/a.
Change-Id: I079b003a4664a7a3f7281905323611b6fc4fe3da
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6090635
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1397108}
2024-12-16 18:02:08 -08:00
Emily Andrews
2eab36ae86 Add API to generate a strongly typed ChildProcessId in ChildProcessHost
Using int32_t for the child process id can be fraught with peril.
Developers can mistake this for the PID. Bugs can be created by passing
in an invalid value by mistake. Using a strongly typed ChildProcessId
instead will allow the compiler to catch errors.

This change creates a ChildProcessId type and modifies
ChildProcessHost::GenerateChildProcessUniqueId to use this new type.
During the investigation, it was determined
GenerateChildProcessUniqueId should only be called on the UI thread,
so a check to ensure it's only called on the UI thread was added.

Follow-ups will be required to modify references.

Bug: 379869738
Change-Id: I3e3998a864a398c7323852969c01cc6186d89670
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6034112
Auto-Submit: Emily Andrews <emiled@microsoft.com>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Stefan Smolen <ssmole@microsoft.com>
Reviewed-by: Mike Wasserman <msw@chromium.org>
Commit-Queue: Mike Wasserman <msw@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1391188}
2024-12-03 20:15:48 +00:00
Peter Boström
fc7ddc185b Migrate to NOTREACHED() in content/
NOTREACHED() and NOTREACHED_IN_MIGRATION() are both CHECK-fatal now.
The former is [[noreturn]] so this CL also performs dead-code removal
after the NOTREACHED().

This CL does not attempt to do additional rewrites of any surrounding
code, like:

if (!foo) {
  NOTREACHED();
}

to CHECK(foo);

Those transforms take a non-trivial amount of time (and there are
thousands of instances). Cleanup can be left as an exercise for the
reader.

This does clean up kCrashOnDanglingBrowserContext as both paths of the
kill switch are currently fatal. This has been rolled out for a long
time.

Bug: 40580068, 40062641
Change-Id: Ib88e710d003e2e48df3fc502ca54d2341d157a0e
Cq-Include-Trybots: luci.chromium.try:linux-dcheck-off-rel
Low-Coverage-Reason: OTHER Should-be-unreachable code
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5974816
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Auto-Submit: Peter Boström <pbos@chromium.org>
Reviewed-by: Sam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1376522}
2024-10-31 19:37:21 +00:00
Tom Sepez
5972fdf9ca Convert as_bytes(span_from_ref()) to byte_span_from_ref().
Use simpler helper function where possible.

Fully automated change.

Change-Id: I16752035554eb4045d7b9d869a299318c48eb148
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5757162
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1337563}
2024-08-05 23:20:00 +00:00
Tom Sepez
b075e1978c Convert some "unsafe" make_span() calls to span_from_ref()
This will facilitate removing unsafe_buffer usage in the future.

Fully automated change.

Change-Id: I0d5f0369fe002a61d6da83db807612cf6a51c064
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5758178
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1336912}
2024-08-03 01:54:40 +00:00
Etienne Pierre-doray
e531336ad9 [battery] Enable heavy AlignWakeUps under battery saver mode
- Add a feature kBatterySaverModeAlignWakeUps
- Add a signal to all child processes
- Call OverrideAlignWakeUpsState in browser,
  renderers and child processes

Bug: 40158967
Change-Id: I6588dfa20182fb5d410bf2b839588066f6f270a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5347739
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Reviewed-by: Anthony Vallée-Dubois <anthonyvd@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1329769}
2024-07-18 20:07:24 +00:00
Nasko Oskov
ee48dfb4fa Prepare to remove //content/ from unsafe_bufers_paths.txt
Suppress unsafe buffer usage on a file-by-file basis.  Out of
approximately 5850 .cc and .h files only roughly 160 files fail
compilation with the unsafe buffers warning.

Suppress only, by inserting boilerplate into affected files. Do not
re-write any code to work around the issues. Properly fixing each file
will be done in follow-up CLs.

//content/ is not removed from unsafe_bufers_paths.txt file and will be
also done as a follow-up, so it makes potential reverts simpler.

Bug: 342213636
Change-Id: I4a936e63dea95a78951f7bfae6d5487708ae3c0b
AX-Relnotes: n/a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5608913
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1312393}
2024-06-08 05:13:06 +00:00
Peter Boström
8472105d01 Use NOTREACHED_IN_MIGRATION() in content/
This was generated by replacing "  NOTREACHED()" with
"  NOTREACHED_IN_MIGRATION()" and running git cl format.

This prepares for making NOTREACHED() [[noreturn]] alongside
NotReachedIsFatal migration of existing inventory.

Bug: 40580068
Change-Id: I3b48b89911ac5e9ffcb211622992f917f8f9e8d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5539619
Auto-Submit: Peter Boström <pbos@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1301096}
2024-05-15 04:36:02 +00:00
Alison Gale
53c77f6b62 Migrate TODOs referencing old crbug IDs to the new issue tracker IDs
The canonical bug format is TODO(crbug.com/<id>). TODOs of the
following forms will all be migrated to the new format:

- TODO(crbug.com/<old id>)
- TODO(https://crbug.com/<old id>)
- TODO(crbug/<old id>)
- TODO(crbug/monorail/<old id>)
- TODO(<old id>)
- TODO(issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/u/1/issues/<old id>)
- TODO(bugs.chromium.org/<old id>)

Bug id mapping is sourced from go/chrome-on-buganizer-prod-issues.
See go/crbug-todo-migration for details.

#crbug-todo-migration

Bug: b/321899722
Change-Id: Iabdfea2fd5393d6bbc54390ca0c995eb2c55bbaa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5469882
Reviewed-by: Darryl James <dljames@chromium.org>
Owners-Override: Alison Gale <agale@chromium.org>
Commit-Queue: Alison Gale <agale@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1290673}
2024-04-22 15:16:27 +00:00
Marijn Kruisselbrink
67f4101883 Add histogram support in app shims using shared memory.
Following the same pattern other child processes uses, this CL
adds support for histograms to app shim process using shared
memory. Histograms collected before the shared memory connection
is set up are transmitted using the ChildHistogramFetcher mojo
interface (and are lost if a connection is never established).
Histograms after are shared immediately via shared memory (but
are lost if the browser process crashes before they are processed,
matching behavior for other child processes).

See https://docs.google.com/document/d/19dANu83w-9q-Ft5PU1cxDHiKdZv4hDLyAdr2Zf3JgSc/edit?usp=sharing for more background.

Bug: 40281917
Include-Ci-Only-Tests: true
Change-Id: I0f00edba892bae3549293d46ab9af602dbf5176e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5363833
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1288435}
2024-04-17 00:35:53 +00:00
Lei Zhang
6ed42ea04a Remove various RunServiceDeprecated() methods in //content
LaunchUtilityProcessServiceDeprecated() is gone, so all the
RunServiceDeprecated() methods are now dead code. Remove them. Then
transitively remove CastContentUtilityClient.

Bug: 240192080
Change-Id: If697b7b9ee6d90c4bf4831b014e00981dfabefd5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5405776
Reviewed-by: Chris Bookholt <bookholt@chromium.org>
Reviewed-by: Vigen Issahhanjan <vigeni@google.com>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1280450}
2024-03-30 00:54:21 +00:00
Arthur Sonzogni
c686e8f4fd Rename {absl => std}::optional in //content/
Automated patch, intended to be effectively a no-op.

Context:
https://groups.google.com/a/chromium.org/g/cxx/c/nBD_1LaanTc/m/ghh-ZZhWAwAJ?utm_medium=email&utm_source=footer

As of https://crrev.com/1204351, absl::optional is now a type alias for
std::optional. We should migrate toward it.

Script:
```
function replace {
  echo "Replacing $1 by $2"
  git grep -l "$1" \
    | cut -f1 -d: \
    | grep \
      -e "^content" \
    | sort \
    | uniq \
    | grep \
      -e "\.h" \
      -e "\.cc" \
      -e "\.mm" \
      -e "\.py" \
    | xargs sed -i "s/$1/$2/g"
}
replace "absl::make_optional" "std::make_optional"
replace "absl::optional" "std::optional"
replace "absl::nullopt" "std::nullopt"
replace "absl::in_place" "std::in_place"
replace "absl::in_place_t" "std::in_place_t"
replace "\"third_party\/abseil-cpp\/absl\/types\/optional.h\"" "<optional>"
git cl format
```

# Skipping unrelated "check_network_annotation" errors.
NOTRY=True

Bug: chromium:1500249
Change-Id: Icfd31a71d8faf63a2e8d5401127e7ee74cc1c413
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5185537
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1245739}
2024-01-11 08:36:37 +00:00
Dave Tapuska
0189cf30e3 Remove AddFilter when legacy IPC is disabled in content
- Conditionally include browser_message_filter.h/cc in the build
- Remove unused imports of browser_message_filter.h
- Remove unused chrome::bad_message::ReceivedBadMessage
- Remove unused BrowserAssociatedInterface

Bug: 993189
Change-Id: Icf114631fbc495b660aafe1a148e716cc7a19f25
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5177633
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Dominic Farolino <dom@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1244658}
2024-01-09 15:06:14 +00:00
Lukasz Anforowicz
de7891f8c2 Call SetPseudonymizationSalt earlier in OnChannelConnected.
This CL tweaks `RenderProcessHostImpl::OnChannelConnected` so that it
sends the `SetPseudonymizationSalt` mojo IPC earlier than before. It
also adds comments to `OnChannelConnected` implementation in
`RenderProcessHostImpl` and `ChildProcessHostImpl` that explain why this
mojo IPC needs to be sent earlier rather than later.

Bug: 1479308
Change-Id: Ife5f4d4a9996df2a0ba523138103eac196ec249d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5014194
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1221929}
2023-11-08 22:42:55 +00:00
Avi Drissman
eac566b060 Move foundation_util to base/apple, leave a forwarding header
Crashpad is not yet updated for the new location, so leave a
forwarding header to be removed later.

Skipping trybots. This is a Mac change, and it’s passing all
trybots except for android_optional_gpu_tests_rel that is
repeatedly failing on an unrelated issue.

NOTRY=true

Bug: 1444927
Cq-Include-Trybots: luci.chrome.try:mac-chrome
Change-Id: Iad0c903187b0e1e5584c68f2eb00b5b026085596
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4790744
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1185029}
2023-08-18 02:56:21 +00:00
Marshall Greenblatt
46a4055a13 mac: Simplify logic for embedder-specific helper paths
This allows us to leverage the existing path calculation logic in
ChildProcessHost::GetChildPath for determining all helper paths.

Change-Id: Ie22a0d548826e197441b737a57d4a14a58408d4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4456752
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Marshall Greenblatt <marshall@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1134010}
2023-04-21 20:23:36 +00:00
Will Harris
e61641f724 Enable explicit conversion checks for base::span sizes.
This CL adds compile-time checks that the size parameter passed
to base::span either by the constructor or the base::make_span
function will fit into a size_t type and are not unsigned.

This is achieved by use of base::StrictNumeric parameter to the
methods and constructor.

This has no runtime overhead, as the checks are done at compile
time.

This CL also contains all the remaining mechanical changes needed
to convert signed numeric literal values to unsigned by adding
a 'u' on the end. Any functional or more complex changes have
already landed in other CLs tagged to this bug with separate
owner review.

This CL also adds no-compile tests for the new APIs.

BUG=1385166

Change-Id: Ic2dbd950842dd811a8dc40ac539c8b824ed983a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4219636
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Owners-Override: danakj <danakj@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Commit-Queue: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1102320}
2023-02-07 19:35:02 +00:00
Will Harris
cd57b83d9f Move ChildProcessHost* from content/common to content/browser
This is a prerequisite for moving a browser-only API that is
used by ChildProcessHostImpl from common to browser.

BUG=1402942

Change-Id: I6eea0952e6bf1ef30498b6f465067e599ea0ff53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4134795
Commit-Queue: Will Harris <wfh@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Owners-Override: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1089401}
2023-01-05 20:03:10 +00:00