0
Commit Graph

2059 Commits

Author SHA1 Message Date
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
Dave Tapuska
710d94e5df Reland "Remove WebThreadScheduler::CompositorTaskRunner"
This reverts commit 058b0367ab.

Reason for revert: Cause of Timeout was GPU crashing on lacros which
was addressed in https://chromium-review.googlesource.com/c/chromiumos/platform/tast-tests/+/5553256

Original change's description:
> Revert "Remove WebThreadScheduler::CompositorTaskRunner"
>
> This reverts commit fd7a732bd8.
>
> Reason for revert: Cause some tests failure on chromeos uprev
> see b/341794182 for more details.
>
> Original change's description:
> > Remove WebThreadScheduler::CompositorTaskRunner
> >
> > We had a whole task queue associated for the only caller of falling
> > back to software mode. Just use the default IPC task runner for this.
> >
> > Change-Id: I29bc6ca00ab66e591c10f233204ebbc26639ba9d
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5545793
> > Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
> > Reviewed-by: Scott Haseley <shaseley@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1302846}
>
> Change-Id: I6d63108be8e7ecaba431535286e46eb634604d2f
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5552319
> Reviewed-by: David Munro <davidmunro@google.com>
> Commit-Queue: David Munro <davidmunro@google.com>
> Owners-Override: David Munro <davidmunro@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Cr-Commit-Position: refs/heads/main@{#1303570}

Change-Id: I6a0040e30833a73056e6c0a4953610c63463446f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5558487
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Scott Haseley <shaseley@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1305279}
2024-05-23 19:31:28 +00:00
Clark DuVall
80eecb39c5 Add feature to use the main IO thread for in-process GPU child IO thread
I'm looking at reducing the number of threads created in WebView where
the in-process GPU is used.

Bug: 341151462
Change-Id: I93e09fc2c7fb3f2911d72aac7c5a088b1b35087a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5545171
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1303884}
2024-05-21 17:52:01 +00:00
Min Chen
058b0367ab Revert "Remove WebThreadScheduler::CompositorTaskRunner"
This reverts commit fd7a732bd8.

Reason for revert: Cause some tests failure on chromeos uprev
see b/341794182 for more details.

Original change's description:
> Remove WebThreadScheduler::CompositorTaskRunner
>
> We had a whole task queue associated for the only caller of falling
> back to software mode. Just use the default IPC task runner for this.
>
> Change-Id: I29bc6ca00ab66e591c10f233204ebbc26639ba9d
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5545793
> Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
> Reviewed-by: Scott Haseley <shaseley@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1302846}

Change-Id: I6d63108be8e7ecaba431535286e46eb634604d2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5552319
Reviewed-by: David Munro <davidmunro@google.com>
Commit-Queue: David Munro <davidmunro@google.com>
Owners-Override: David Munro <davidmunro@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1303570}
2024-05-21 02:59:21 +00:00
Dave Tapuska
fd7a732bd8 Remove WebThreadScheduler::CompositorTaskRunner
We had a whole task queue associated for the only caller of falling
back to software mode. Just use the default IPC task runner for this.

Change-Id: I29bc6ca00ab66e591c10f233204ebbc26639ba9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5545793
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Scott Haseley <shaseley@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1302846}
2024-05-17 20:54:14 +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
Daniel Cheng
da767b91d5 Consistently use BASE_FEATURE() to define features
It turns out there are still a few places that construct base::Features
directly, or use otherwise creative ways to construct a base::Feature.
Migrate them all to using the macro in preparation for implementing a
stricter check.

Bug: 40239032
Change-Id: I2a9e96a65bdffa909ccad7c94a1b22dd925239fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5507544
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Owners-Override: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1295486}
2024-05-02 15:32:12 +00:00
Alison Gale
81f4f2c793 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: Iee14d10d544e9f0ec046117cc4ec8a55c427adc0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5469947
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@{#1290838}
2024-04-22 19:33:31 +00:00
Takuto Ikuta
c8d6b16f02 format windows headers using new config.
Test new config:
https://chromium-review.googlesource.com/c/chromium/src/+/5197064

by applying clang-format on every problematic windows headers.

This CL is cloned from https://crrev.com/c/5366045.

Script:
-------

```
function replace {
    echo "Replacing $1 by $2"
    git grep -l "$1" \
        | cut -f1 -d: \
        | grep \
              -e "\.h" \
              -e "\.cc" \
        | grep -v "third_party/[^b]" \
        | sort \
        | uniq \
        | xargs sed -i "s/$1/$2/gi"
}

git checkout origin/main
git branch -D change-5197064 || true

git new-branch change-5197064
replace "#include <\(initguid|mmdeviceapi\|windows\|winsock2\|ws2tcpip\|shobjidl\|atlbase\|ole2\|unknwn\|objbase\|tchar\).h>" ""
replace "#include \"base\\/win\\/atl.h\"" ""
replace "#include <uiautomation.*>" ""
git add -u
git commit -m "remove problematic windows headers"
git revert HEAD --no-commit
git add -u
git commit -m "add problematic windows headers"
git cl format --upstream=HEAD~
git add -u
git commit -m "format"

git cl issue 5367127
git cl upload -df --bypass-hook
```

Also removed some unnecessary comments.

Bug: 329138753
Change-Id: I161c28ea2d27c569825e0c789a4c143530937f58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5367127
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Owners-Override: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1287420}
2024-04-15 16:59:19 +00:00
Anthony Vallée-Dubois
2bc6a8772e Don't align wakeups to 32ms in renderers for battery saver mode
We suspect this is causing renderer OOMs, so the BatterySaverModeRenderTuning experiment was disabled. Removing this from battery saver renderer tuning will allow us to re-start the experiment.

Bug: 328805793
Change-Id: I2e3181cfe0d5071b5f412d850137142ef600ab1d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5444734
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Anthony Vallée-Dubois <anthonyvd@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1287370}
2024-04-15 15:34:41 +00:00
Md Hasibul Hasan
8d4451517d Convert base::StringPiece to std::string_view in //content except for
content/browser

The changes of this CL are made using the following script.
```
target_directory="content"
replace_string_in_files() {
  old_string="$1"
  new_string="$2"

  find "$target_directory" -type d \( -path "$target_directory/browser" -prune \) -o \( -name "*.cc" -o -name "*.h" \) -exec sed -i '' "s/$old_string/$new_string/g" {} +
}

delete_include() {
    find "$target_directory" -type d \( -path "$target_directory/browser" -prune \) -o \( -name "*.h" -o -name "*.cc" \) -print0 | while IFS= read -r -d '' file; do
        grep -v '#include "base/strings/string_piece.h"' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
    done
}

add_include() {
    find "$target_directory" -type d \( -path "$target_directory/browser" -prune \) -o \( -name "*.h" -o -name "*.cc" \) -print0 | while IFS= read -r -d '' file; do
        local include_added=false
        local tempfile=$(mktemp)

        if grep -qE 'std::(string|u16string)_view' "$file"; then
            while IFS= read -r line; do
                echo "$line" >> "$tempfile"
                if [[ $line =~ ^\s*#include ]]; then
                    if ! $include_added; then
                        echo "#include <string_view>" >> "$tempfile"
                        include_added=true
                    fi
                fi
            done < "$file"

            mv "$tempfile" "$file"

            if $include_added; then
                echo "Added #include <string_view> after the first include line in $file"
            else
                echo "No include line found in $file"
            fi
        else
            echo "std::string_view not found in $file"
        fi
    done
}

replace_string_in_files "base::StringPiece16" "std::u16string_view"
replace_string_in_files "base::StringPiece" "std::string_view"
delete_include
add_include

```
Replaced base::StringPiece16 with std::u16string_view
Replaced base::StringPiece with std::string_view
Removed header "base/strings/string_piece.h"
Added header "<string_view>" where applicable

Bug: 40506050
Change-Id: Ia6d2fd65a16e1a3db59532c085652fbb45dc6abc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5401324
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Commit-Queue: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1285651}
2024-04-11 07:38:50 +00:00
Saifuddin Hitawala
28ba88f7ce [media] Remove RasterInterfaceInVideoResourceUpdater killswitch
Remove RasterInterfaceInVideoResourceUpdater killswitch which is
currently present only for Android. It was enabled for Android
in M123 which is in stable for quite some time.

Also, clean up surrounding code in VideoResourceUpdater that is GL
specific and remove ScopedTexture.

Bug: 332564976, 40276184
Change-Id: I92265198033b75ea18eaf58b3a1f99f2856156d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5420132
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1283205}
2024-04-05 16:58:49 +00:00
Sam Davis Omekara
39689a4eae Remove forced_colors and is_dark_mode from UpdateSystemColorInfo()
This CL cleans up of the UpdateSystemColorInfo() pipeline by removing
the `forced_colors` and `is_dark_mode` param. Originally, this pipeline
was designed to inform Blink of the system color info states changes.
However, with system colors now being retrieved from color providers
(CL:5322440) and forced colors now existing as a Web setting
(CL:5368321), these params have become redundant and therefore can be
safely removed.

Bug: 1231644, 41489514
Change-Id: Ic5320cde57947523daea5b8ac481a276bdda1611
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5381326
Reviewed-by: Thomas Lukaszewicz <tluk@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Sam Davis Omekara <samomekarajr@microsoft.com>
Reviewed-by: Alison Maher <almaher@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1278739}
2024-03-27 02:56:00 +00:00
Sam Davis Omekara
d2b85b251f Remove the colors param in UpdateSystemColorInfo() pipeline
This CL begins the cleaning up of the UpdateSystemColorInfo() pipeline
by removing the colors parameter. Originally, this pipeline was
designed to enable the LayoutTheme retrieve system colors from the
NativeTheme. However, as system colors are now retrieved through color
providers in Blink, the colors parameter has become redundant and
therefore can be removed.

Next steps will involve removing the `is_dark_mode` and `forced_colors`
parameters. This will be carried out following the ongoing efforts to
make forced colors state in Blink a web setting, as initiated in
CL:5324688.

Bug: 1430181, 40779801
Change-Id: Id14c501faff3b47488a5ca43d639dc72afd6acb3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5341963
Commit-Queue: Sam Davis Omekara <samomekarajr@microsoft.com>
Reviewed-by: Thomas Lukaszewicz <tluk@chromium.org>
Reviewed-by: Alison Maher <almaher@microsoft.com>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1274229}
2024-03-18 17:05:45 +00:00
Scott Violet
493a9465b3 [reland] pa: couple of tweaks based on Speedometer
I believe the reason for the crashes is that when
shrinking the ring buffer size (AdjustForBackground), I
wasn't adjusting global_empty_slot_span_ring_index. This
meant that if global_empty_slot_span_ring_index was >
kMinFreeableSpans, a slot-span could end up being assigned
an index beyond the ring buffer size. This is because
SlotSpanMetadata::RegisterEmpty increments
global_empty_slot_span_ring_index based on the current index and
global_empty_slot_span_ring_size:

https://source.chromium.org/chromium/chromium/src/+/main:third_party/dawn/third_party/angle/third_party/dawn/third_party/angle/third_party/dawn/third_party/partition_alloc/src/partition_alloc/partition_page.cc;l=115-116;drc=4b0447a323de1a925d2b08127e256ef735d73fc3

Also, in this version the features are all disabled. I'll enable
via field trial.

Original description:

Calling to madvise/mprotect is expensive on macs. This patch aims
to reduce the number of such calls. It adds the following:
. Increases empty cache index bits by 8.
. If RegisterEmpty() is called and the slot span was already
  registered, don't do anything. This is in hopes of avoiding
  churn if a slot-span is reused a bunch.
. Increases max_empty_slot_spans_dirty_bytes_shift by a factor of 2.
. Adds feature for that makes blink's partition for buffers use the
  large empty slot span ring.

Bug: 329199197
Change-Id: I819ba2ba82bbed83cba40d7561f21f4aa19ff088
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5362719
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Benoit Lize <lizeb@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1272345}
2024-03-13 19:18:58 +00:00
Scott Violet
9853da2297 Revert "pa: couple of tweaks based on Speedometer"
This reverts commit 660e70eeac.

Reason for revert: This seems to have caused some crashes. See https://crbug.com/328875414

Original change's description:
> pa: couple of tweaks based on Speedometer
>
> Calling to madvise/mprotect is expensive on macs. This patch aims
> to reduce the number of such calls. It adds the following:
> . Increases empty cache index bits by 8.
> . If RegisterEmpty() is called and the slot span was already
>   registered, don't do anything. This is in hopes of avoiding
>   churn if a slot-span is reused a bunch.
> . Increases max_empty_slot_spans_dirty_bytes_shift by a factor of 2.
> . Adds feature for that makes blink's partition for buffers use the
>   large empty slot span ring.
>
> Change-Id: I6bde3c62e1e9edd280f649ec71eb6d1bf04eb644
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5181724
> Reviewed-by: Scott Violet <sky@chromium.org>
> Commit-Queue: Scott Violet <sky@chromium.org>
> Reviewed-by: Benoit Lize <lizeb@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1270352}

Bug: 328875414
Change-Id: Iba537e69f2f64b35c3352368e36a762d3eea2d36
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5360238
Commit-Queue: Scott Violet <sky@chromium.org>
Owners-Override: Fred Shih <ffred@chromium.org>
Reviewed-by: Benoit Lize <lizeb@chromium.org>
Reviewed-by: Fred Shih <ffred@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1271054}
2024-03-11 17:51:35 +00:00
Scott Violet
660e70eeac pa: couple of tweaks based on Speedometer
Calling to madvise/mprotect is expensive on macs. This patch aims
to reduce the number of such calls. It adds the following:
. Increases empty cache index bits by 8.
. If RegisterEmpty() is called and the slot span was already
  registered, don't do anything. This is in hopes of avoiding
  churn if a slot-span is reused a bunch.
. Increases max_empty_slot_spans_dirty_bytes_shift by a factor of 2.
. Adds feature for that makes blink's partition for buffers use the
  large empty slot span ring.

Change-Id: I6bde3c62e1e9edd280f649ec71eb6d1bf04eb644
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5181724
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: Benoit Lize <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1270352}
2024-03-08 19:55:17 +00:00
Maggie Chen
bee973bfe9 Plumb ShareImageInterface to VideoResourceUpdater::SoftwarePlaneResource
From blink::WebVideoFrameSubmitter to VideFrameResourceProvider then
VideoResourceUpdater::SoftwarePlaneResource. ShareImageInterface will
be used for creating SharedImage for software video resource.

Bug: b:40064122
Change-Id: I7c00552dfea37e9628183e55ef2672501c63450c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5251261
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Stefan Zager <szager@chromium.org>
Auto-Submit: Maggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1267829}
2024-03-04 14:33:43 +00:00
Colin Blundell
3625f8d3bf [//media] Make RasterInterfaceInVideoResourceUpdater Android-only
The new codepath landed enabled-by-default on platforms other than
Android in 119 [1] (on Android it did so only in 123 [2]). This CL moves
the killswitch to being Android-only, making the new codepath
unconditional on all other platforms.

The concrete motivation for doing this now is to unblock followup
simplifications in VizTransportProcessFactory, which is not used on
Android [3], by removing the dependence on this killswitch being enabled
there.

[1] https://chromiumdash.appspot.com/commit/b7c5afd44c88ff27ad015378b7dd620fb3fba629
[2] https://chromiumdash.appspot.com/commit/fef2d15708cf5e482e30837a1a41164ba9930156
[3] https://source.chromium.org/chromium/chromium/src/+/main:content/browser/BUILD.gn;l=3352-3361?q=viz_process_transport_factory.cc&ss=chromium

Bug: 40276184
Change-Id: Id8f4471ed6876762c2d6de0d5c60437bf0be9743
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5317623
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Frank Liberato <liberato@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1265262}
2024-02-26 17:04:47 +00:00
Scott Violet
43a6a68066 base: removes base/allocator/allocator_extension
Looks it's dead code.

Bug: none
Change-Id: I41969fc9c9ef585cd2bcd3bd834567b52ce3a508
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5320270
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1264712}
2024-02-23 20:18:45 +00:00
Sam Davis Omekara (from Dev Box)
9edae8a827 Reland "Paint controls using Page's color provider"
This is a reland of commit 73317c46c9.
The issue was that we were tried to paint with null color providers.
This occurred when a Page is created through the non-standard route
(i.e. not associated with a web view). This issue is now addressed in
CL:5230300 where we plumb the color maps required to create color
providers via WebView::Create down to page creation. For places where
the color maps are unavailable such as non-ordinary pages or tests we
fall back to a default set of color maps. This ensures that every Page
created has valid color provider instances.

This change also adds a unit test to ensure all Pages created (ordinary
and non-ordinary) have non-null color provider instances.

Original change's description:

Paint controls using Page's color provider

This CL is a follow up on CL:5042390 and CL:5046572, where we plumbed
the page's color providers and added color provider support for tests.
This CL uses the plumbed provider to paint by passing it as an argument
to the NativeTheme Paint function in WebThemeEngineDefault::Paint.

This CL cleans up the previous pipeline which originally saw color
provider instances exist in Blink::WebThemeEngineDefault. This clean up
also saw us change the ExecutePageBroadcastMethod call to
ExecutePageBroadcastMethodForAllPages in
WebContentsImpl::OnColorProviderChanged.

Additionally, this CL moves the logic of determining the color scheme
based on the accent color to the ThemePainterDefault and ensures the
correct color scheme is calculated before painting.

Bug: 1430181
Change-Id: Ib5b38436d8872f36bd42f61febb9f7018f3f1d26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5282903
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Sam Davis Omekara <samomekarajr@microsoft.com>
Reviewed-by: Thomas Lukaszewicz <tluk@chromium.org>
Reviewed-by: Alison Maher <almaher@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1263607}
2024-02-21 22:04:47 +00:00