0
Commit Graph

2079 Commits

Author SHA1 Message Date
Helmut Januschka
42c8320787 use base::ToString() where possible //content
Bug: 335797528
Change-Id: I50b5d409bbed663acb5526f714bc5c82ef89da9e
AX-Relnotes: n/a.
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6304962
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1426762}
2025-03-01 17:13:12 -08:00
Zhenyao Mo
b308489135 Remove GPU_FEATURE_TYPE_CANVAS_OOP_RASTERIZATION.
TEST=bots,gpu_unittests

Bug: 391648152
Change-Id: Icac938390d6865e79e6e43a552d9aac5d9155a88
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6306645
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1426307}
2025-02-28 07:45:45 -08:00
vikas soni
c8bce922e8 [MappableSI] Remove GMBManager from GpuVideoFrameAcceleratorFactories.
Remove GMBManager and all related usages from
GpuVideoFrameAcceleratorFactories since all the clients using it have
been converted to use MappableSI.

This is a functional no-op CL.

Bug: 40263579
Change-Id: I8b5969da374f58396eca065832197261c45979a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6227359
Reviewed-by: Stefan Zager <szager@chromium.org>
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@chromium.org>
Commit-Queue: vikas soni <vikassoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1417548}
2025-02-07 13:15:41 -08:00
Thomas Lukaszewicz
80544b02d5 Introduce webui bundled bytecode web security policy
This policy makes explicit which schemes are allowed to participate
in webui bundled bytecode in the renderer.

The intention is to make it easier to identify whether schemes opted
into bundled code caching are in scope when analyzing attack
surfaces.

Bug: 378504631
Change-Id: I985f0bceeed0d0b9b58d6b500eddf3ea7aa5662b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6207229
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Commit-Queue: Thomas Lukaszewicz <tluk@chromium.org>
Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1417056}
2025-02-06 15:27:20 -08:00
Xianzhu Wang
aece0d42b5 Remove WebVector: Automatic changes
Replace WebVector (which has been an alias of std::vector since
crrev.com/c/6204022) with std::vector.

function cg() {
  git grep --name-only "$1" -- *.mm *.h *.cc
}
sed -i 's/include.*web_vector.h"/include <vector>/' `cg web_vector.h`
sed -i '/^using blink::WebVector;/d' `cg 'using blink::WebVector'`
sed -i '/^using ::blink::WebVector;/d' `cg 'using ::blink::WebVector'`
sed -i 's/blink::WebVector\b/std::vector/g' `cg blink::WebVector`
sed -i 's/\bWebVector\b/std::vector/g' `cg WebVector`
git checkout -- third_party/blink/public/platform/web_vector.h
git cl format

Only manual changes are to remove unused "#include <vector>" added by
the above script, based on presubmit warnings.

BYPASS_LARGE_CHANGE_WARNING=`git cl split` will create too many CLs needing too many reviewers while this CL doesn't need much manual review.

Bug: 40865165
Change-Id: Ib70af44863ceaa73f470c77abe74d8994e2822a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6209609
Owners-Override: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1412669}
2025-01-28 17:57:12 -08:00
Peter Kasting
1557e5fbe4 [cleanup] Replace base::ranges with std::ranges: content/
Done entirely with `git grep` and `sed` + `git cl format`, no
hand-editing.

Bug: 386918226
Change-Id: I8561612cb02c9d62c455836dba414ab402e40694
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6199140
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Owners-Override: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1412009}
2025-01-27 17:14:08 -08:00
Etienne Pierre-doray
4898bbcd46 Reland "[tracing] Cleanup up trace_log"
This is a reland of commit 235af46635
Reason for revert:
LUCI Bisection has identified this change as the cause of a test failure. See the analysis: https://ci.chromium.org/ui/p/chromium/bisection/test-analysis/b/5650878292819968

Fix: initialize TraceEventHandle to 0 to avoid
MemorySanitizer: use-of-uninitialized-value error

Original change's description:
> [tracing] Cleanup up trace_log
>
> This CL cleans up some of the unused functionalities in trace_log
> - legacy metadata
> - member AddTraceEvent* function: replaced by static ones
> - SetTrackDescriptor: covered by TrackNameRecorder
>     We no longer update SetTrackDescriptor on UpdateProcessLabel;
>     this is unnecessary because TrackNameRecorder calls
>     SetTrackDescriptor when the session ends.
>
> Bug: 343404899
> Change-Id: Ia3c4524cd3b3dd4d4ad12a0348e60480b5d03f67
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6120057
> Reviewed-by: Derek Schuff <dschuff@chromium.org>
> Reviewed-by: Gabriel Charette <gab@chromium.org>
> Reviewed-by: Alexander Timin <altimin@chromium.org>
> Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
> Reviewed-by: Mikhail Khokhlov <khokhlov@google.com>
> Cr-Commit-Position: refs/heads/main@{#1403710}

Bug: 343404899
Change-Id: Icb14722297b39f3b8fc7be0985452182a7b5846f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6163823
Reviewed-by: Alexander Timin <altimin@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: Mikhail Khokhlov <khokhlov@google.com>
Reviewed-by: Derek Schuff <dschuff@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1404225}
2025-01-09 08:51:48 -08:00
luci-bisection@appspot.gserviceaccount.com
88740bf833 Revert "[tracing] Cleanup up trace_log"
This reverts commit 235af46635.

Reason for revert:
LUCI Bisection has identified this change as the cause of a test failure. See the analysis: https://ci.chromium.org/ui/p/chromium/bisection/test-analysis/b/5650878292819968

Sample build with failed test: https://ci.chromium.org/b/8726281365613516081
Affected test(s):
[ninja://components/viz:viz_unittests/YUVReadbackTest.YUVReadbackOptTest](https://ci.chromium.org/ui/test/chromium/ninja:%2F%2Fcomponents%2Fviz:viz_unittests%2FYUVReadbackTest.YUVReadbackOptTest?q=VHash%3Ac51c420b0ffd64f9)
[ninja://content/test:content_browsertests/EmergencyStopTracingTest.StopOnThreadPool/All.0](https://ci.chromium.org/ui/test/chromium/ninja:%2F%2Fcontent%2Ftest:content_browsertests%2FEmergencyStopTracingTest.StopOnThreadPool%2FAll.0?q=VHash%3Abba65c387ca28365)
[ninja://content/test:content_browsertests/EmergencyStopTracingTest.StopOnThreadPoolTwice/All.0](https://ci.chromium.org/ui/test/chromium/ninja:%2F%2Fcontent%2Ftest:content_browsertests%2FEmergencyStopTracingTest.StopOnThreadPoolTwice%2FAll.0?q=VHash%3Abba65c387ca28365)
[ninja://content/test:content_browsertests/StartupTracingTest.TestEnableTracing/All.0](https://ci.chromium.org/ui/test/chromium/ninja:%2F%2Fcontent%2Ftest:content_browsertests%2FStartupTracingTest.TestEnableTracing%2FAll.0?q=VHash%3Abba65c387ca28365)
[ninja://content/test:content_browsertests/StartupTracingTest.TestEnableTracing/All.1](https://ci.chromium.org/ui/test/chromium/ninja:%2F%2Fcontent%2Ftest:content_browsertests%2FStartupTracingTest.TestEnableTracing%2FAll.1?q=VHash%3Abba65c387ca28365)
and 5 more ...

If this is a false positive, please report it at http://b.corp.google.com/createIssue?component=1199205&description=Analysis%3A+https%3A%2F%2Fci.chromium.org%2Fui%2Fp%2Fchromium%2Fbisection%2Ftest-analysis%2Fb%2F5650878292819968&format=PLAIN&priority=P3&title=Wrongly+blamed+https%3A%2F%2Fchromium-review.googlesource.com%2Fc%2Fchromium%2Fsrc%2F%2B%2F6120057&type=BUG

Original change's description:
> [tracing] Cleanup up trace_log
>
> This CL cleans up some of the unused functionalities in trace_log
> - legacy metadata
> - member AddTraceEvent* function: replaced by static ones
> - SetTrackDescriptor: covered by TrackNameRecorder
>     We no longer update SetTrackDescriptor on UpdateProcessLabel;
>     this is unnecessary because TrackNameRecorder calls
>     SetTrackDescriptor when the session ends.
>
> Bug: 343404899
> Change-Id: Ia3c4524cd3b3dd4d4ad12a0348e60480b5d03f67
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6120057
> Reviewed-by: Derek Schuff <dschuff@chromium.org>
> Reviewed-by: Gabriel Charette <gab@chromium.org>
> Reviewed-by: Alexander Timin <altimin@chromium.org>
> Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
> Reviewed-by: Mikhail Khokhlov <khokhlov@google.com>
> Cr-Commit-Position: refs/heads/main@{#1403710}
>

Bug: 343404899
Change-Id: I31fb4bd8e2e195e2f58f7805ee4ddb4aafcada27
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6160654
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Owners-Override: Rebekah Potter <rbpotter@google.com>
Cr-Commit-Position: refs/heads/main@{#1403913}
2025-01-08 16:13:53 -08:00
Etienne Pierre-doray
235af46635 [tracing] Cleanup up trace_log
This CL cleans up some of the unused functionalities in trace_log
- legacy metadata
- member AddTraceEvent* function: replaced by static ones
- SetTrackDescriptor: covered by TrackNameRecorder
    We no longer update SetTrackDescriptor on UpdateProcessLabel;
    this is unnecessary because TrackNameRecorder calls
    SetTrackDescriptor when the session ends.

Bug: 343404899
Change-Id: Ia3c4524cd3b3dd4d4ad12a0348e60480b5d03f67
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6120057
Reviewed-by: Derek Schuff <dschuff@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: Mikhail Khokhlov <khokhlov@google.com>
Cr-Commit-Position: refs/heads/main@{#1403710}
2025-01-08 11:08:46 -08:00
Jordan Bayles
27c3106041 [Cast Streaming] Migrate GVAFImpl to MojoGVAF
This patch moves the GpuVideoAcceleratorImpl to media/mojo/clients
and renames it to MojoGpuVideoAccelerator. This class can now be used
both in content and in components/mirroring.

Cast Streaming will be updated to use this implementation to enable
hardware mirroring in the media::cast::MediaVideoEncoderWrapper
implementation.

Googlers may view the related design doc at:
http://go/cast-streaming-media-videoencoder

Publicly published design documentation available at:
https://tinyurl.com/cast-streaming-mvew

Bug: 282984511
Change-Id: I91bba38ea55007d3f3626027308d800aeda0a383
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6095257
Commit-Queue: Jordan Bayles <jophba@chromium.org>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Frank Liberato <liberato@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1398421}
2024-12-18 22:40:49 -08:00
Georg Neis
88d05ae28b Remove more Lacros leftovers from content/
- Remove IS_CHROMEOS_LACROS code
- Replace IS_CHROMEOS_ASH with the equivalent IS_CHROMEOS
- Similarly for is_chromeos_lacros/is_chromeos_ash.
- Drop obsolete includes/build dependencies.
- Drop lacros-chrome browser tag from gpu tests
- Drop obsolete skip directives from gpu tests

No change in behavior.

Bug: b:365742770 , b:365741912
AX-Relnotes: n/a.
Change-Id: I594d3677a9855d0649deba3ad836a1b3804440f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6097832
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1398368}
2024-12-18 18:25:18 -08:00
Michael Lippautz
ea64725211 renderer: Fix vtune dependency
All V8 third party deps have been moved to v8/third_party.

Bug: 383356859
Change-Id: I19b6a4b54abf662eaeb7dfa93da729aab7799ee3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6097449
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1396829}
2024-12-16 10:18:28 -08:00
Vasiliy Telezhnikov
2b096e2cf5 Remove SurfaceHandle from ContextProviderCommandBuffer ctor
It's always null.

Validate-Test-Flakiness: skip
Change-Id: Ia9440861cae9cd2e98255846d93687bbe970d4ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6072298
Reviewed-by: Colin Blundell <blundell@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1395509}
2024-12-12 10:47:26 -08:00
Nathan Memmott
eb4817946d Code Health: Clean up stale WebRTC-UseGpuMemoryBufferVideoFrames
Fixed: 356622801
Change-Id: Ie557e8bcb731bcc364960f45c00ccaa6ed1fc371
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6090051
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Nathan Memmott <memmott@chromium.org>
Reviewed-by: Emircan Uysaler <emircan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1395089}
2024-12-11 14:08:28 -08:00
Sharon Yang
0f8372fb3f Add tracing for renderer initialization
Add a flow that shows the delay from the browser initializing the
renderer to when it happens in the renderer.

Bug: 382303496
Change-Id: Ief0615f94240db35b4a57f27f37192702842fad8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6072128
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Sharon Yang <yangsharon@chromium.org>
Reviewed-by: Mustafa Emre Acer <meacer@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1392410}
2024-12-05 18:37:05 +00:00
Mason Freed
e379c4f2c9 Revert "Don't show popups (e.g. <select>) if the tab isn't focused"
This reverts commit 9a7e491a5c.

Reason for revert: Seems to have caused an extensions issue: https://issues.chromium.org/issues/377830108

Original change's description:
> Don't show popups (e.g. <select>) if the tab isn't focused
>
> It was previously possible for pickers like <select>'s picker to be
> shown on top of the not-currently-focused tab, confusing the user.
> With this change, the select picker must be the currently-focused
> tab for the picker to be opened. This is akin to existing protections
> for the tab being visible.
>
> Fixed: 365089001
> Change-Id: Id2b15f5d310cce877341d7e9d5a5c5d6da882887
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5909884
> Reviewed-by: Alexander Timin <altimin@chromium.org>
> Commit-Queue: Mason Freed <masonf@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1377731}

Change-Id: I94470d6e18b3393c0c9b814439bda5c61aad5565
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6012850
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Mason Freed <masonf@chromium.org>
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1381534}
2024-11-12 01:22:10 +00:00
Patrick Monette
02fc0f9489 Add a trace event for renderer visibility.
There is already a trace event for this value, but it is part of
the much larger "toplevel" category.

Change-Id: I73b23c50fe1d111f692b8ee7274a148b60af8e44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5982375
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Patrick Monette <pmonette@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1378743}
2024-11-06 05:03:24 +00:00
Mason Freed
9a7e491a5c Don't show popups (e.g. <select>) if the tab isn't focused
It was previously possible for pickers like <select>'s picker to be
shown on top of the not-currently-focused tab, confusing the user.
With this change, the select picker must be the currently-focused
tab for the picker to be opened. This is akin to existing protections
for the tab being visible.

Fixed: 365089001
Change-Id: Id2b15f5d310cce877341d7e9d5a5c5d6da882887
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5909884
Reviewed-by: Alexander Timin <altimin@chromium.org>
Commit-Queue: Mason Freed <masonf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1377731}
2024-11-04 17:33:17 +00:00
Patrick Monette
47cc13487e Show base::Process::Priority of renderer in tracing
While the process priority is mostly simplified to a
"backgrounded" or "foregrounded" boolean value, more priority
values will be used in the future and it'll be useful to know
in traces.

Change-Id: I5605560b8802ae47092b1251dbed75606514d69f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5722149
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Patrick Monette <pmonette@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1376864}
2024-11-01 14:46:03 +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
Joe Mason
51eb828535 Transfer scenario shared memory handles in DocumentCoordinationUnit
Following a suggestion by Nasko in https://crrev.com/c/5867574, this
handles performance scenario shared memory completely in the blink and
components/performance_manager layers, getting rid of a shim through
content/ and chrome/.

This will unblock a followup CL to attach the browser-side
StructuredSharedMemory region to ProcessNode instead of
RenderProcessHost, which is blocked by the content/ shim accessing it
synchronously on the UI thread. The cost is an extra IPC roundtrip on
process startup.

Includes a partial revert of https://crrev.com/c/5867574 that returns
mojom::Renderer::TransferSharedMemoryRegions to TransferSharedLastForegroundTime.

Bug: 365586676
Change-Id: I681a3c941661ebba7c10b7abaf54aa5c4e430a9e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5949866
Commit-Queue: Joe Mason <joenotcharles@google.com>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Auto-Submit: Joe Mason <joenotcharles@google.com>
Cr-Commit-Position: refs/heads/main@{#1372300}
2024-10-22 20:51:49 +00:00
Peter Kasting
6e6af3cdb6 Move cc switches from ::cc::switches to ::switches.
This is more compliant with
https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++-dos-and-donts.md#named-namespaces
and prevents namespace hiding issues. It is also a more typical practice
in Chrome (though there are also many counterexamples at the moment).

This uncovered a duplicate switch in ui/base/ that I believe was
supposed to have been the same as the cc/ switch. It was only used
once; changing components/viz/ to use the cc/ switch directly
required modifying DEPS.

Bug: 364987728
Change-Id: I3af891f18851836cc7ffd918bd5e2e253024efed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5912279
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Victor Miura <vmiura@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1368521}
2024-10-15 00:13:18 +00:00
Frank Li
486a40271e [media] avoid heap-use-after-free in OverlayStateObserverImpl::Create
In PS38 of
https://chromium-review.googlesource.com/c/chromium/src/+/3403933/37..38,
`scoped_refptr<OverlayStateServiceProvider>` parameter of
`OverlayStateObserverImpl::Create()' was changed into
`OverlayStateServiceProvider*`. This causes the heap-use-after-free
issue described in https://issuetracker.google.com/issues/354824998.

This CL is to follow existing code pattern of producing `scoped_refptr`
in `RenderThreadImpl::GetStreamTextureFactory()`/
`RenderThreadImpl::GetDCOMPTextureFactor()` instead of returning a raw
pointer in `RenderThreadImpl::GetOverlayStateServiceProvider()`.

Bug: 354824998
Change-Id: Ic188bf18b28a5f024488bd92fb11f6fca6c5d05a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5910432
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Frank Li <frankli@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1368423}
2024-10-14 21:00:53 +00:00
François Doray
6ed98d8945 [blink + content] Add features to fine-tune memory pressure response in renderers.
This CL adds 3 features to selectively disable/enable parts of the
memory pressure response in renderers:

"ForwardMemoryPressureToBlinkIsolates"
Controls whether memory pressure is forwarded to Blink isolates, which
has for effect to trigger a GC (critical) or start incremental marking
(moderate).

"ReleaseResourceStrongReferencesOnMemoryPressure"
Controls whether `blink::MemoryCache` and `blink::ResourceFetcher`
release their strong references to resources in response to memory
pressure. This affects whether previously used resources can be found
in the `blink::MemoryCache` in the future.

"ReleaseResourceDecodedDataOnMemoryPressure"
Controls whether `blink::Resource` releases its decoded data in
response to response to critical memory pressure. This affects
whether the data has to be decoded again if the resource is
reused in the future.

A previous experiment disabled *all* memory pressure clients in
renderers on desktop, with good impact on LCP but some memory
increase (go/finch50-no-memory-purge-in-renderers-desktop). The new
features will be used to assess the impact of important memory pressure
client on the LCP and memory metrics in isolation.

Bug: 40287434
Change-Id: I920389c3cadf3f6e82b6836e484adebf10ef90a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5913594
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Francois Pierre Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1366859}
2024-10-10 15:31:53 +00:00
Robert Mader
5482210941 media: Rename some 'Vaapi' features to 'Accelerated'
In preparation of patches that will allow V4L2 decoding to work by
default on Linux.

The VA-API and V4L2 backends provide essenitaly the same output -
DMABufs in formats like NV12/P010 etc. - and face similar restrictions
e.g. GL driver features. It therefore makes sense to have the same media
switches and in fact some of them - most importantly
`VaapiVideoDecodeLinux` - already apply to V4L2.

Thus in order to reduce confusion and avoid code duplication, rename
some of the `Vaapi` swiches used in common code to `Accelerated` but
keep the `Linux` suffix, making it clearer to what they apply. Also
ensure they are used for both APIs the same way and update the
`vaapi.md`.

Finally, add `AcceleratedVideoDecodeLinuxZeroCopyGL` to the VA-API
documentation.

Bug: b:334110478
Change-Id: Iea58966d6ab94ce995defb1cf1099dd9ba9fae26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5893615
Reviewed-by: Sean Topping <seantopping@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Fritz Koenig <frkoenig@chromium.org>
Commit-Queue: Fritz Koenig <frkoenig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1363231}
2024-10-02 19:21:17 +00:00
Mingyu Lei
2aa90626cc Prompt API: bind the ai value from execution context
In the previous CL, we programmatically enable the runtime feature for
prompt API in order to expose the JS handle to the self namespace, and
then copy the value to chrome.aiOriginTrial then reset it to
undefined.

The flow is now improved by getting the AIAssistantFactory directly
from the v8_context, with that, we can clear a lot of runtime features
check and unnecessary workaround code to make the implementation
cleaner.

Bug: 350642260
Change-Id: I71c99dddc7f6d0980a7819110f6d82f073c94aa2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5889515
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Mingyu Lei <leimy@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1360984}
2024-09-27 08:23:39 +00:00
Lei Mingyu
87e7b24e86 Prompt API: expose the API to chrome extension
This CL adds the following logic for the chrome extension prompt API
origin trial:
- adds `aiAssistantOriginTrial` extension permission
- adds `AIPromptAPIForExtension` feature flag
- when `AIPromptAPIForExtension` is turned on, also enable `AIPromptAPI`
for extension execution context, and create a copy of
`self.ai.assistant` in `chrome.ai.assistantOriginTrial`
- if `kEnableAIPromptAPIForWebPlatform` is not enabled, reset
`self.ai.assistant` to undefined.
- if none of the AI APIs for web platform is enabled, reset `self.ai`
to undefined.

Please refer to the following doc for more background information
- PRD: https://docs.google.com/document/d/1bw34RCCM9qcgbpFabZ1eE_jlkAX2HBmE6rKH3yDBc2A/edit
- one-pager for the feature flags: https://docs.google.com/document/d/1Hsch6SkNl_8R940mFzLnkST5SAOcT25TUaKs3RU8S30/edit

Bug: 350642260
Change-Id: Id46eb34713b20754a7d6c19d3a2419f62226e487
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5796431
Commit-Queue: Mingyu Lei <leimy@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Reviewed-by: Kelvin Jiang <kelvinjiang@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1360406}
2024-09-26 08:13:47 +00:00
Joe Mason
0c9a90a047 Add a shared memory channel for performance scenarios
* Renames TransferSharedLastForegroundTime to
  TransferSharedMemoryRegions and uses it to transfer multiple region
  handles. Also updates it to allow optional handles (the mojo typemap
  will crash on invalid handles otherwise.)
* Adds functions to manage the browser side of the channel in
  components/performance_manager.
* Adds accessors to ContentBrowserClient to return performance
  scenario region handles. The default implementation returns invalid
  handles, but ChromeContentBrowserClient gets the handles from
  components/performance_manager.
* Adds a test for TransferSharedMemoryRegions.

Bug: 365586676
Change-Id: Ib0ff85e07459d768896ea571e357d687cb9e8243
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5867574
Reviewed-by: Robert Kaplow <rkaplow@chromium.org>
Reviewed-by: Olivier Li <olivierli@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Joe Mason <joenotcharles@google.com>
Commit-Queue: Joe Mason <joenotcharles@google.com>
Cr-Commit-Position: refs/heads/main@{#1359994}
2024-09-25 16:41:38 +00:00
Maggie Chen
80b7361d95 Convert SharedBitmap to SharedImage for Pepper Graphics 2D
Replace AllocateSharedBitmap() with CreateShareImage() in
Pepper Graphics 2D.

Bug: 40064122
Change-Id: Ib4307d71f34d8747cd2e7188aad3eb3c03e137f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5868083
Commit-Queue: Maggie Chen <magchen@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1357376}
2024-09-18 22:58:31 +00:00
Peter Kasting
4b18d0c047 Replace ABSL_ATTRIBUTE_* with base/ macros.
Approved on
https://groups.google.com/a/chromium.org/g/cxx/c/lVQOJTng1RU.

Bug: none
Change-Id: Ibe0f8f16bce55b3ede4c1e1d2720e83e8dd4faf0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5852373
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Owners-Override: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1356840}
2024-09-18 00:56:11 +00:00
Scott Haseley
bb2680b6ac Remove kBlinkSchedulerPrioritizeNavigationIPCs flag
This feature was enabled by default in M127. This CL removes the flag
cleans up the related code.

Bug: 40114705
Change-Id: Ic74beecf8c189e0b1d7be2e81337a5f8be6fe4f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5868344
Commit-Queue: Scott Haseley <shaseley@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1356732}
2024-09-17 21:16:28 +00:00
Avi Drissman
6ea47de693 Remove unused code remnants
https://crrev.com/c/4676454 removed the guts of the
SystemColorsDidChange function, but failed to finish the job of
removing the now useless function.

Remove the bits of the code that remain, and remove the caller.

Bug: 40254578
Change-Id: I7ec4e3a3c85e1febd08a7b1cb1951b32cb6fdc02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5854579
Commit-Queue: Tom Burgin <bur@google.com>
Commit-Queue: Avi Drissman <avi@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Reviewed-by: Tom Burgin <bur@google.com>
Cr-Commit-Position: refs/heads/main@{#1353962}
2024-09-11 15:27:54 +00:00
Etienne Pierre-doray
8439625b8b [task] Merge kCompositing into kDisplayCritical
This is a no-op on most platforms because kDisplayCritical and kCompositing are equivalent already, as desired after progress
on crbug.com/1329208

On Linux and Fuchsia: kDisplayCritical is not equivalent to kCompositing, so this CL introduces change in behavior.

On Linux, this CL aligns behavior to ChromeOS (ChromeOS is already
running kCompositing threads with the same priority as kDisplayCritical).
Population is generally too small to draw reliable conclusion from
an experiment, so it's more robust to align with ChromeOS.
On Fuchsia, we simply drop kCompositing.
Effectively, this CL brings all kCompositing threads (each process' main thread, compositor thread and IO thread) to a higher priority than it was before.

Bug: 1329208
Change-Id: I6331a3eacb2396117e20d833eb993a91eadd1d47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4842549
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1344860}
2024-08-21 16:42:37 +00:00
Joe Mason
b305e9623c Add a StructuredSharedMemory wrapper
Adds a cleaner interface to ReadOnlySharedMemoryRegion /
SharedMemoryMapping, which specifies the type that's stored in the
memory when the memory is mapped rather than on every access.

Converts some simple users of shared memory to use
StructuredSharedMemory.

Bug: 357945779
Change-Id: I27105cf7feb2136c14c7e345617f7e2284f15e0c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5746992
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Joe Mason <joenotcharles@google.com>
Reviewed-by: Yuzhu Shen <yzshen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1343748}
2024-08-19 20:55:39 +00:00
Anthony Vallée-Dubois
75082778b1 Enable BatterySaverModeRenderTuning by default
This experiment made it to 50% stable. No regressions, improvements to
CPU time and Battery Discharge rate.

Bug: 41483040
Change-Id: I5964ad3f796328bd1aa7dfda98332845cd0afe09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5756958
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Commit-Queue: Anthony Vallée-Dubois <anthonyvd@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1337445}
2024-08-05 20:19:40 +00:00
Joe Mason
b124557ab4 Skip SetSharedLastForegroundTimeForMetrics in single-process mode
Also asserts on IsSingleProcess() in RenderThreadImpl's destructor, for
additional documentation that the destructor only runs in tests.

R=gab

Bug: 334983411
Change-Id: Ifdfa0fca7db898dfb8d9614c846353bfb342ac5d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5741760
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Joe Mason <joenotcharles@google.com>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1333891}
2024-07-27 06:13:11 +00:00
Etienne Pierre-doray
8af8eaea53 Reland "[PM] Send process priority to v8 isolates."
This is a reland of commit 9fd1641728
Reason for revert: Jetstream regressions crbug.com/353777699
Initialization of IsolateCurrentPriority unintentionally introduced behavior change.

Fix (patchset 2): Initialize IsolateCurrentPriority to kUserBlocking.

Original change's description:
> [PM] Send process priority to v8 isolates.
>
> Following up on https://chromium-review.googlesource.com/c/v8/v8/+/5683549
> - This replaces deprecated IsolateInForeground/BackgroundNotification
>   with SetIsolatePriority() which doesn't change behavior
> - Behind a feature `SetIsolatesPriority`, use SetProcessState
>   priority (eventually connected to performance manager) to send to
>   v8. This works toward connecting PM priority to v8 isolates.
>
> Bug: 350698335
> Change-Id: Ica423f1994f2bc5812a6916347653dd607697d14
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5703036
> Reviewed-by: Kentaro Hara <haraken@chromium.org>
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
> Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1329108}

Bug: 350698335, 353777699
Change-Id: I268d9fb1d21f520bbc8c6f8f8488c5ed23d2c61b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5721739
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1330202}
2024-07-19 13:38:26 +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
Etienne Pierre-Doray
77e73e7ab0 Revert "[PM] Send process priority to v8 isolates."
This reverts commit 9fd1641728.

Reason for revert: Jetstream regressions crbug.com/353777699
Initialization of IsolateCurrentPriority unintentionally introduced behavior change.
I'll reland with a fix.

Original change's description:
> [PM] Send process priority to v8 isolates.
>
> Following up on https://chromium-review.googlesource.com/c/v8/v8/+/5683549
> - This replaces deprecated IsolateInForeground/BackgroundNotification
>   with SetIsolatePriority() which doesn't change behavior
> - Behind a feature `SetIsolatesPriority`, use SetProcessState
>   priority (eventually connected to performance manager) to send to
>   v8. This works toward connecting PM priority to v8 isolates.
>
> Bug: 350698335
> Change-Id: Ica423f1994f2bc5812a6916347653dd607697d14
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5703036
> Reviewed-by: Kentaro Hara <haraken@chromium.org>
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
> Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1329108}

Bug: 350698335, 353777699
Change-Id: I3d3e6c8512431999a93e4fa49b7124f7ce56ce6c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5721132
Auto-Submit: Etienne Pierre-Doray <etiennep@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Owners-Override: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1329752}
2024-07-18 19:43:38 +00:00
Etienne Pierre-doray
9fd1641728 [PM] Send process priority to v8 isolates.
Following up on https://chromium-review.googlesource.com/c/v8/v8/+/5683549
- This replaces deprecated IsolateInForeground/BackgroundNotification
  with SetIsolatePriority() which doesn't change behavior
- Behind a feature `SetIsolatesPriority`, use SetProcessState
  priority (eventually connected to performance manager) to send to
  v8. This works toward connecting PM priority to v8 isolates.

Bug: 350698335
Change-Id: Ica423f1994f2bc5812a6916347653dd607697d14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5703036
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1329108}
2024-07-17 20:54:50 +00:00
Jeffrey Gour
6f946aad97 Reland "Make static initialization of base::ProtectedMemory objects required"
This is a reland of commit 7f04022ea0.
The original commit was reverted due to test failures in component
builds. These failures came in two flavors and this reland contains
fixes for both. They are:

1. Failures caused by the ProtectedMemory variable being initialized
not being in the proper memory address range. This is caused by the
memory segment code being defined in the .h file which means that
different DSOs can define different sections, and cross DSO calls
will show the memory in the wrong section. The fix is simply to
disable ProtectedMemory for component builds. Component builds are
never shipped so there is no value in supporting it for them.
2. The new get_{{feature.data_member_name}}() method added for
ProtectedMemory RuntimeEnabledFeatures, which is the method where the
static initializer was added, was defined in the include file instead
of the cc file. Thus the static initializer could be rerun in different DSOs. This resulted in the MojoJS runtime enabled feature
not necessarily getting the right value, causing tests that needed it
to be true to fail with MojoInterfaceInterceptor (because MojoJS
bindings weren't enabled). By moving the definition to the CC file,
this problem went away.

Original change's description:
> Make static initialization of base::ProtectedMemory objects required
>
> This change makes it so that static initialization of
> base::ProtectedMemory instances is always required, even if the type
> provides constant initialization. This achieved by removing the bool
> ConstructLazily template parameter from ProtectedMemory and related
> classes, and making the case where it's "true" the only case. Thus the
> lazy construction through base::ProtectedMemoryInitializer is required.
>
> This change is made in preparation of adding support for ProtectedMemory
> to non-windows platforms. On some platforms there is an issue with
> initializing the protected memory section to readonly at build/link
> time. To combat this, the required initialization of ProtectedMemory
> instances will be used to initialize the protected section to readonly
> at runtime.
>
> This change also updates previously added use cases of ProtectedMemory
> to add the now required initialization.
>
> Bug: 41495919
> Change-Id: Ice3d39caee28a3fc956d4d9ebca8c6f51d03ce1c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5668250
> Commit-Queue: Jeffrey Gour <jegour@microsoft.com>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1324440}

Bug: 41495919
Change-Id: Ic8d416e4278d1bddf892e0ba967999b3ba4e8f1b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5689823
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Jeffrey Gour <jegour@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1326184}
2024-07-11 16:07:54 +00:00
Will Harris
ca5caf82c9 Revert "Make static initialization of base::ProtectedMemory objects required"
This reverts commit 7f04022ea0.

Reason for revert: suspected cause of 351926112

Original change's description:
> Make static initialization of base::ProtectedMemory objects required
>
> This change makes it so that static initialization of
> base::ProtectedMemory instances is always required, even if the type
> provides constant initialization. This achieved by removing the bool
> ConstructLazily template parameter from ProtectedMemory and related
> classes, and making the case where it's "true" the only case. Thus the
> lazy construction through base::ProtectedMemoryInitializer is required.
>
> This change is made in preparation of adding support for ProtectedMemory
> to non-windows platforms. On some platforms there is an issue with
> initializing the protected memory section to readonly at build/link
> time. To combat this, the required initialization of ProtectedMemory
> instances will be used to initialize the protected section to readonly
> at runtime.
>
> This change also updates previously added use cases of ProtectedMemory
> to add the now required initialization.
>
> Bug: 41495919
> Change-Id: Ice3d39caee28a3fc956d4d9ebca8c6f51d03ce1c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5668250
> Commit-Queue: Jeffrey Gour <jegour@microsoft.com>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1324440}

Bug: 41495919,351994238
Change-Id: I7c3956923253affc5dad294d03f05e1a3c39fd17
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5688694
Reviewed-by: Trevor Perrier <perrier@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Owners-Override: Trevor Perrier <perrier@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1324954}
2024-07-09 17:47:44 +00:00
Jeffrey Gour
7f04022ea0 Make static initialization of base::ProtectedMemory objects required
This change makes it so that static initialization of
base::ProtectedMemory instances is always required, even if the type
provides constant initialization. This achieved by removing the bool
ConstructLazily template parameter from ProtectedMemory and related
classes, and making the case where it's "true" the only case. Thus the
lazy construction through base::ProtectedMemoryInitializer is required.

This change is made in preparation of adding support for ProtectedMemory
to non-windows platforms. On some platforms there is an issue with
initializing the protected memory section to readonly at build/link
time. To combat this, the required initialization of ProtectedMemory
instances will be used to initialize the protected section to readonly
at runtime.

This change also updates previously added use cases of ProtectedMemory
to add the now required initialization.

Bug: 41495919
Change-Id: Ice3d39caee28a3fc956d4d9ebca8c6f51d03ce1c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5668250
Commit-Queue: Jeffrey Gour <jegour@microsoft.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1324440}
2024-07-08 19:51:52 +00:00
Maggie Chen
40a628aad4 Do not call EstablishGpuChannel if the gpu remote has been disconnected
The GPU channel cannot be established when gpu_remote is disconnected.
Stop calling RequestNewLayerTreeFrameSink because it's going to fail
again and it will be stuck in a forever loop of retries. This makes the
processes unable to be killed after Chrome is closed.

Bug: 336164423
Change-Id: Ie7db1df5531e178b2d06063c10c23ded917217b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5676887
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Maggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1323390}
2024-07-04 16:19:36 +00:00
Jonathan Ross
25bf5b04ee Move CC Trees UkmManager
This manager is only used to report metrics calculated in cc/metrics.
It's location in cc/trees predates the cc/metrics folder.

This change moves it, ahead of some follow ups to it's ownership, and
potential new UKMs

Bug: 334977830
Change-Id: Icbab339fe18ea4ef0f06b42b03f023125f4801a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5648501
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Ian Vollick <vollick@chromium.org>
Commit-Queue: Jonathan Ross <jonross@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1322830}
2024-07-03 16:31:30 +00:00
Etienne Pierre-doray
f886cee01f [contention] Connect ThreadPool Restricted size to renderers
Based on renderer priority.
go/chrome-workload-prioritization

Bug: b/350698335
Change-Id: I8a11d6291c6c2ce2303912d58c29bec753020b2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5663898
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1322225}
2024-07-02 16:19:26 +00:00
Lukasz Anforowicz
5fd0efb315 Remove unused, unsafe AgentGroupSchedulerImpl::broker_ field.
This field is:

* Unsafe in presence of Oilpan (see https://crbug.com/40261265)
* Not actually used - there are no callers of
  `AgentGroupScheduler::GetBrowserInterfaceBroker`.  This method was
  added in https://crrev.com/c/2677585 and AFAICT no callers have ever
  been added later - for example this command finds no other commits:
  `git log -S AgentSched -- content/browser/browser_interface_binders.cc`

Removing this field also helps to make progress on
https://crbug.com/41482945 - this field is related to 1 out of 5 callers
of `BrowserInterfaceBrokerProxy::Bind` and the linked bug requires
passing `ContextLifecycleNotifier` to `HeapMojoRemote`.  I note that
`AgentGroupSchedulerImpl::BindInterfaceBroker` seems to be the only
caller of `BrowserInterfaceBrokerProxy::Bind` which doesn't have a 1:1
relationship with a `ContextLifecycleNotifier` (which IIUC roughly
corresponds to the `ExecutionContext`).  The other callers are 1)
constructor of `WorkerGlobalScope`, 2) constructor of
`content::RenderFrameImpl`, 3)
`MojoBindingContext::SetMojoJSInterfaceBroker` (we ignore here
`GetEmptyBrowserInterfaceBroker` which doesn't actually need to bind an
actual mojo remote).

Fixed: 40261265
Bug: 41482945
Change-Id: Id07826bb008bea6157a30868a56ad05ad3bbc675
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5646657
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Emily Stark <estark@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Scott Haseley <shaseley@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1319775}
2024-06-26 15:29:53 +00:00
Patrick Monette
7d8aca114d Pass the actual base::Process::Priority to the renderer instead
of a single boolean indicating if the process is backgrounded.

Currently a nop change as the enum is converted back to a single
boolean in the renderer, but it will be used in a later CL to
apply different interventions when a process is kUserVisible
versus kUserBlocking.

Bug: 41485666
Change-Id: Ide4130a1d7b9653ae434e0d0992d46f74fbb9e7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5555305
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Patrick Monette <pmonette@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1314537}
2024-06-13 12:11:10 +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
Gabriel Charette
8becf3eed3 [metrics] Introduce UMA_HISTOGRAM_WITH_BEST_EFFORT_SUPPORT
It will support automatic ".BestEffort" suffixing in renderers for
metrics that rely on timing.

It uses shared memory to share read-only std::atomic<TimeTicks> state
between RenderProcessHostImpl and the renderer.

"HangWatcher.IsThreadHung.RendererProcess.*" will be the first metric to
test this out. There was a recent "regression" caused to it by a
mix-shift when shipping more aggressive backgrounding of best-effort
renderers on Mac, recovering from that is how we test that this works.

Local chrome://histograms test: https://snipboard.io/KjNzMa.jpg

Bug: 334983411
Change-Id: I78259ca47514059a74fb1b672192e90b24551e31
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5459762
Reviewed-by: Robert Kaplow <rkaplow@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Joe Mason <joenotcharles@google.com>
Reviewed-by: Olivier Li <olivierli@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1311669}
2024-06-07 00:47:20 +00:00