0
Commit Graph

135 Commits

Author SHA1 Message Date
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
Lukasz Anforowicz
9bc03e7ac6 Move blink/public/common/browser_interface_broker_proxy.h to platform/
This CL moves
`third_party/blink/public/common/browser_interface_broker_proxy.h`
to
`third_party/blink/public/platform/browser_interface_broker_proxy.h`

Motivation:

* This header is not included from any browser-process code and
  therefore doesn't need to be in `.../common/...`.
* This resolves layering ickiness introduced by the previous CL (see
  https://crrev.com/c/5647559) which moved implementation of this type
  deeper into Blink (e.g. using `CrossVariantMojoRemote` and similar
  utilities which are normally available to the `platform` code but not
  to the `common` code).

This CL has been generated semi-automatically - most of the files
changed by this CL have just been updated to use the new `#include` path
(as generated by `tools/git/mass-rename.sh`).  Manual changes are
concentrated in the following files:

* Moving
  `third_party/blink/public/common/browser_interface_broker_proxy.h`
  to
  `third_party/blink/public/platform/browser_interface_broker_proxy.h`
    - This also removed a `nogncheck` ickiness left by the previous CL
    - This had to switch from `BLINK_COMMON_EXPORT` to
      `BLINK_PLATFORM_EXPORT`
* Removing layering ickiness in `third_party/blink/public/common/DEPS`
* `DEPS` update and/or simplification in:
    - `chromecast/media/DEPS`
    - `components/page_image_annotation/content/renderer/DEPS`
    - `components/translate/content/renderer/DEPS`
    - `media/mojo/clients/DEPS`
* Changing a dependency in `media/fuchsia/video/BUILD.gn` and
  `chromecast/media/audio/BUILD.gn`
* Adjusting which target builds the moved files:
    - `third_party/blink/common/BUILD.gn`
    - `third_party/blink/public/BUILD.gn`
* Deleting `third_party/blink/common/browser_interface_broker_proxy.cc`
    - This also involves tweaking
      `third_party/blink/public/common/BUILD.gn`
    - Parts of that `.cc` file have been preserved in
      `.../platform/mojo/browser_interface_broker_proxy_impl.cc`
      (e.g. `EmptyBrowserInterfaceBrokerProxy` and default definitions
      of `BrowserInterfaceBrokerProxy`'s constructor and destructor)

Bug: 41482945
Change-Id: I6048c855279c438b7dbfc8467b859df70e2d2012
AX-Relnotes: n/a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5651622
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1327283}
2024-07-14 20:25:02 +00:00
Dave Tapuska
68f09cf8a6 [Android] Remove Legacy IPC based GIN java bridge
The mojo variant is fully shipped to stable so now we can get rid
of the old code.

Bug: 40815663
Change-Id: Ie546af46e254318e5e703b89dae4442abc7e54cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5419164
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Richard (Torne) Coles <torne@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1316656}
2024-06-18 20:15:33 +00:00
Nasko Oskov
ee48dfb4fa Prepare to remove //content/ from unsafe_bufers_paths.txt
Suppress unsafe buffer usage on a file-by-file basis.  Out of
approximately 5850 .cc and .h files only roughly 160 files fail
compilation with the unsafe buffers warning.

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

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

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

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

Bug: 40580068
Change-Id: I3b48b89911ac5e9ffcb211622992f917f8f9e8d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5539619
Auto-Submit: Peter Boström <pbos@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1301096}
2024-05-15 04:36:02 +00:00
Bartek Nowierski
f473c24b5e Obliterate ExperimentalRenderer
crrev.com/c/5298894 rendered it not needed. Remove the definition and all usages.

This CL is a no-op.

Bug: 40064499
Change-Id: Ief3c6f697040cf704a8fca57ed8d4fd593db60c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5309774
Owners-Override: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1262758}
2024-02-20 17:51:15 +00:00
David Bertoni
d785df4144 [Code Health] Remove a use of base::SupportsWeakPtr. (java)
Bug: 647430
Change-Id: I6f2d010c9a07f1b45992d3fdb425ed0bbd6d3ec3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5231022
Auto-Submit: David Bertoni <dbertoni@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1251622}
2024-01-24 20:05:17 +00:00
Dave Tapuska
54ee3d5e12 Add additional CHECKs to figure out recent Gin Java bridge crashes
In the past couple of days we've started to see a handful of crashes
on WebView Canary only. The crashes do not make sense so add some
additional state checks.

Bug: 1517105
Change-Id: Ic04c2e6c3955016337413f22f0af0ca42853f50b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5190331
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Richard (Torne) Coles <torne@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1246004}
2024-01-11 19:12:38 +00:00
Matthias Liedtke
181a179b52 [v8] gin_java_bridge_object.cc: Include missing headers
The missing includes broke the v8 roll (https://crrev.com/c/5079935).

Bug: chromium:1507016
Change-Id: If80daab9abb3905eceaa05602600f81867a923af
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5077471
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Richard (Torne) Coles <torne@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1232621}
2023-12-04 10:11:36 +00:00
Dave Tapuska
4569c1ba65 [gin_java_bridge] Fix race around GinJavaBridgeDispatherHost being bound
Requesting a Remote interface via GetBrowserInterfaceBroker can get
dropped if it is in between a navigation. This can happen because
the DidClearWindow is invoked first then the GetRemoteObjectHost can
get called followed by the BrowserInterfaceBroker getting reset.

Avoid this by just passing in the Host to the GinJavaBridge when
it is bound. It simplifies code and avoids the race.

Bug: 1501450
Change-Id: I5e20ddb7fdb271277e2db3a05a3e3c78ea2f5b60
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5033241
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Richard (Torne) Coles <torne@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1225169}
2023-11-15 21:46:20 +00:00
Dave Tapuska
bfae2a44bc [gin_java_bridge] Do not attempt to bind java bridge early
ForEachRenderFrameHostIncludingSpeculative visits every
RenderFrameHost we should not send the named objects to
RenderFrameHosts that are not alive yet as this can lead to dropped
mojo messages.

RenderFrameCreated will get called when the RenderFrame on the renderer has been indeed created and it is safe then to send the
mojo messages.

Handle the host being disconnected and rebind.


Bug: 1501450
Change-Id: I74c4b053662ad60bce4968062753af5b091e18b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5029320
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Richard (Torne) Coles <torne@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1224502}
2023-11-14 20:28:42 +00:00
Dave Tapuska
69f6d21137 [gin_java_bridge] Deal with the fact the remote object closed
Code prior to mojom based bridge did not initialize error value
correctly which caused a CheckError when the mojo object failed
to send the InvokeMethod call. Check the return code and assign
the correct initialization value to error.

Bug: 1501450
Change-Id: I001bb6dc370dab1835e7b649eed5b9b2bbccef86
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5029575
Reviewed-by: Richard (Torne) Coles <torne@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1224410}
2023-11-14 18:38:29 +00:00
Dave Tapuska
20433a56cf Add a mojo based gin java bridge
This is a slightly different approach as taken in the past.
 - The GinJavaBridge needs to be an associated interface so that the
   AddNamedObject doesn't race with the navigation messages.
 - The serialization is kept the same (no onion souping yet), all
   serialization still occurs in content/renderer/java
 - The content.mojom.GinJavaBridge interfaces are similar to the
   blink.mojom.RemoteObject interfaces in the hopes that once this
   approach proves correct and we have removed the legacy IPC we
   can then proceed to change the serialization (and hosting where
   the objects on the renderer side are bound but keeping the
   content/browser/android/java implementation) and as well remove
   the java based implementation that doesn't support associated
   interfaces.
This interface is disabled by default and is toggled via the
GinJavaBridgeMojo feature flag.

Bug: 794320
Change-Id: Ifb0ad0b71ccb69f7149bbb772eee925adccb2050
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4968451
Reviewed-by: Richard (Torne) Coles <torne@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1220543}
2023-11-06 22:02:39 +00:00
Dave Tapuska
4958bb798f [gin_java_bridge] Pass ListValue in to Invoke
Mojo's bindings for ListValue require transfer of ownership not a
const ref, so change the definition in preparation for conditionally
compiling this against a mojo target.

Bug: 1286517
Change-Id: Ifc4e248f82eeac72db024c0e37e1d823e66dfc7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4960974
Reviewed-by: Richard (Torne) Coles <torne@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1213854}
2023-10-24 00:37:16 +00:00
Dave Tapuska
153fd706c7 [gin_java_bridge] Move error messages into mojo
In preparation to move these messages to mojo move the error constants
first.

Bug: 1286517
Change-Id: I6a4add1f215b57e22fa7a7ad3050a1a3c0b3ea1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4960973
Reviewed-by: Richard (Torne) Coles <torne@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1213777}
2023-10-23 22:14:27 +00:00
Peter Kasting
4524c839c9 Convert various const strings to constexprs: content/
This makes it possible to supply them to absl::StrFormat() as format
strings, and may enable better codegen.

Bug: 1371963
Change-Id: Ic174e2e1a03032fc93286b8c576b04bca03faf6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4945111
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1210892}
2023-10-17 15:55:08 +00:00
Kalvin Lee
bc3754aeb1 MiraclePtr: Rewrite renderer
This change is not intended to change any behavior. This is a
mediumweight rewrite applied primarily to renderer code, promoting a
bunch of `T*` into `raw_ptr<T>` (or `T&` to `raw_ref<T>`).

MiraclePtr is not yet generally enabled in the renderer process,
so this should only affect rewritten members by turning them into
no-op `raw_ptr` (thought to have negligible overhead).

Given the scope of the rewrite and the security benefits, we feel that
the binary size increase is unavoidable.

AX-Relnotes: n/a.
Binary-Size: Size increase is unavoidable (see above).
Bug: 1444624
Change-Id: I1cda6fe446b1a8552cb3c98c1afeae0f15218619
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4904523
Owners-Override: Keishi Hattori <keishi@chromium.org>
Commit-Queue: Kalvin Lee <kdlee@chromium.org>
Reviewed-by: Keishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1203810}
2023-10-01 22:37:34 +00:00
Dave Tapuska
d1aaf8a173 Rewrite blink::MainThreadIsolate in //content/
Use the AgentGroupScheduler's isolate where possible.

Bug: 263412
Change-Id: Ifaa0ac3d902fd594003385f23bc14438a0f36cf0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4854097
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1195388}
2023-09-12 14:50:34 +00:00
Ho Cheung
0fd8f22105 [renderer] Use base::Contains() instead of std::find()
Use base::Contains() instead of std::find() where appropriate in
//content/renderer.

AX-Relnotes: n/a.
Bug: 561800
Change-Id: I6433110aa90db9078982cb27e57ad58a8f7f7874
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4724725
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1176609}
2023-07-28 14:36:05 +00:00
Camillo Bruni
d0313f7a1b [v8] Move over to context-based v8::MicrotasksScope constructor
... the isolate-based version is deprecated as it's not clear from
the api-call which context should be used to run the micotasks.

Change-Id: Ideb1cf207c66324f9bd91cc01f103d0622abe67c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4660772
Reviewed-by: Marc Treib <treib@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1165370}
2023-07-03 17:44:52 +00:00
Owners Cleanup
26c9e1b702 Remove michaelbai@chromium.org from content/renderer/java/OWNERS.
This suggested change is automatically generated based on group memberships and affiliations.
If this change is unnecessary or in error, vote CR -1 and the bot will abandon it. Vote CR +1/2 to approve this change.
See the owner's recent activity for context: https://chromium-review.googlesource.com/q/michaelbai@chromium.org

To report an issue, file a bug in the Infra>Security component.

Change-Id: I8f9b5b18c8873792a94b80337b061c7c17a35acb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4411334
Commit-Queue: Richard Coles <torne@chromium.org>
Commit-Queue: Owners Cleanup <swarming-tasks@owners-cleanup-prod.google.com.iam.gserviceaccount.com>
Reviewed-by: Richard Coles <torne@chromium.org>
Auto-Submit: Owners Cleanup <swarming-tasks@owners-cleanup-prod.google.com.iam.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1128698}
2023-04-11 16:49:47 +00:00
Avi Drissman
adac219925 Update header includes for /base/functional in /content
bind.h, callback.h, callback_forward.h, and callback_helpers.h
moved into /base/functional/. Update the include paths to
directly include them in their new location.

Bug: 1364441
Change-Id: I32ec425b9c0e52ec4b50047bf3290fecc5c905ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4148554
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1091567}
2023-01-11 23:46:39 +00:00
Jan Keitel
39feb33be6 [CodeHealth] Use base::Value v2 API in GinJavaBridge.
Bug: 1303949
Change-Id: I2805cedacac5aaa9bba391ede629c1fdb48a2c8e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4079150
Commit-Queue: Jan Keitel <jkeitel@google.com>
Reviewed-by: Michael Bai <michaelbai@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1080215}
2022-12-07 08:15:12 +00:00
Minoru Chikamune
b96c138336 Code Health Rotation: Migrate base::ListValue to base::Value::List
- content/renderer/java/gin_java_bridge_value_converter.cc

Bug: 1187062
Change-Id: I7c699f2981b0b81957d9067418cc1d7f15833d2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4082309
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Minoru Chikamune <chikamune@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1079738}
2022-12-06 13:40:12 +00:00
David Bertoni
113016ff15 [Code Health] Convert Value::GetListDeprecated() to Value::GetList() in /content/renderer/java.
This CL was uploaded by git cl split.

R=michaelbai@chromium.org

Bug: 1303949
Change-Id: Iecd9f7d0939cf7721c9f370bb6e263b57565a2ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3945949
Auto-Submit: David Bertoni <dbertoni@chromium.org>
Reviewed-by: Michael Bai <michaelbai@chromium.org>
Commit-Queue: Michael Bai <michaelbai@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1059038}
2022-10-14 00:51:23 +00:00
Lei Zhang
2a9af7baea Convert various Gin Java bridge code to use base::Value::List.
Switch to base::Value::List from deprecated base::ListValue. Along the
way, convert "new" keyword usage to std::make_unique() and
base::MakeRefcounted(), and also apply various code modernizations that
ClangTidy would warn about.

Bug: 1187062
Change-Id: I4558f4a3986d65ea778344465275f253c227d875
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3945688
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Richard Coles <torne@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1057685}
2022-10-11 21:12:43 +00:00
Avi Drissman
4e1b7bc33d Update copyright headers in content/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c34.

No-Try: true
No-Presubmit: true
Bug: 1098010
Change-Id: I8c0f009d16350271f07d8e5e561085822cc9dd27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3895935
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1047456}
2022-09-15 14:03:50 +00:00
Nan Lin
c4f90a2bf2 [Code Heath] Replace base::{ListValue,DictionaryValue} in skia et al
This CL also updates `V8ValueConverter::ToV8Value()` to take
`ValueView` so that `base::Value::Dict` and `base::Value::List` can be
passed in.

Bug: 1187061
Change-Id: I5831fd07ac847be5ff98cef517a4060b21c8bc8a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3737382
Reviewed-by: Sean Topping <seantopping@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Nan Lin <linnan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1024386}
2022-07-14 20:02:08 +00:00
David Bertoni
865d74db17 [CodeHealth] Remove uses of ListValue::Append() in /content/renderer/java.
This CL removes calls to this deprecated member function. When
it's not too intrusive, this CL attempts to modernize the use
of DictionaryValue and ListValue to base::Value::Dict and
base::Value::List to avoid using Value::FromUniquePtrValue.

This CL was uploaded by git cl split.

R=michaelbai@chromium.org

Bug: 1187097
Change-Id: I7b38bb7611ccbc31dc82e305110f59fbc6d080f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3516602
Auto-Submit: David Bertoni <dbertoni@chromium.org>
Reviewed-by: Michael Bai <michaelbai@chromium.org>
Commit-Queue: Michael Bai <michaelbai@chromium.org>
Cr-Commit-Position: refs/heads/main@{#980245}
2022-03-12 01:23:03 +00:00
Maks Orlovich
effa75b354 FLEDGE: Stop using locker mode for v8
It's unneeded since we always use an isolate from a single thread, and causes trouble with other tests in content_unittests also covering v8 (see e.g. crbug.com/1228034, crbug.com/1228033)
Further, we might need to use renderer processes on Android, in which case configuring V8 differently from blink will be trouble.

This CL also reverts previous workarounds in other tests for the trouble our use of locker caused that were added in https://chromium-review.googlesource.com/c/chromium/src/+/3173813

Bug: 1228034
Bug: 1228033

Change-Id: Ie205e19a4a10887b20d9f8ecd8684d66c45b3a1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3216493
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/main@{#976742}
2022-03-02 18:29:55 +00:00
Daniel Cheng
ad44af2f53 Migrate base::{size,empty,data} to STL equivalents in //content.
Bug: 1299695
Change-Id: Iefec40ecc9327c04732785eaed5a3214d17e552f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3491685
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#975485}
2022-02-26 18:07:54 +00:00
Lei Zhang
0b76fe527d Delete an unused include in render_frame_observer.h.
Prior CLs deleted the code that required this include, but the include
is being removed separately here because many files transitively depends
on it. Add forward declarations and includes all over the place to fix
the build.

Bug: 242216
Change-Id: Ie0ef0d21d47bc9ae21bd4dff8caef9aeaa22797a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3473347
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Kevin Marshall <kmarshall@chromium.org>
Reviewed-by: Junbo Ke <juke@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Erik Staab <estaab@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#974266}
2022-02-23 19:15:49 +00:00
Hiroki Nakagawa
89948ea4cf CodeHealth: Remove base::ListValue::Get()
To remove base::ListValue::Get(), this CL replaces it with
base::Value::GetListDeprecated(). GetListDeprecated() is also marked as
deprecated but this should be a good intermediate step to remove both
the functions.

Bug: 1187084
Change-Id: I0122f1f692b2620734b5b42a89604c1936f55063
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3440088
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/main@{#968219}
2022-02-08 07:44:57 +00:00
Daniel Cheng
354945de1f Migrate base::Value::GetList() to base::Value::GetListDeprecated(): 1/N.
GetList() will be reimplemented in a future CL with an updated
signature, so existing uses need to be renamed out of the way.

Unlike TakeList() and TakeDict(), GetList() is used quite widely. This
CL migrates a number of uses using the following set of automated steps:

sed -i "s|->GetList()|->GetListDeprecated()|g" \
    $(git gs "GetList()" --name-only)
git checkout -- base/values_unittest.cc third_party/dom_distiller_js
git cl format

Bug: 1291666
Change-Id: I1b7a92fcb4874e7afb82d4bd092c1c9de2cc3d05
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3430698
Reviewed-by: danakj chromium <danakj@chromium.org>
Owners-Override: danakj chromium <danakj@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#966487}
2022-02-02 23:39:17 +00:00
David Bienvenu
30eec7e56e Replace GetAsList with GetList in content
Use is_list and GetList instead of GetAsList, part of base::ListValue
refactoring.

Bug: 1187009
AX-Relnotes: n/a.
Change-Id: I9ab3d700214c4a444e0fa314d28715004dca262b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3307457
Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
Reviewed-by: Richard Coles <torne@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#946725}
2021-11-30 22:59:21 +00:00
Peter Boström
1d6a095400 Remove unused "base/macros.h" in content/
Removes `#include "base/macros.h"` from files in content/ that do not
contain `ignore_result(`.

Bug: 1010217
No-Try: true
Change-Id: I887403408704241047e3bd66e953ff7df195368b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3274993
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#940781}
2021-11-11 16:07:03 +00:00
Peter Boström
9b036533b6 Remove DISALLOW_* macros from content/
This inlines all remaining DISALLOW_* macros in content/. This is done
manually (vim regex + manually finding insertion position).

IWYU cleanup is left as a separate pass that is easier when these macros
go away.

Bug: 1010217
Change-Id: I8b5ea6dd9f8a3f584cf3eef82634017a38b15be8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3193883
Commit-Queue: Peter Boström <pbos@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Auto-Submit: Peter Boström <pbos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#936160}
2021-10-28 23:37:28 +00:00
Takashi Sakamoto
b26bf566fa Fix V8ValueConverterImplTest and GinJavaBridgeValueConverterTest flakiness.
Once v8::Locker is active, HandleScope will crash without any proper
locking. Since *WorkletTest, SharedStorageObjectMethodTest and so on use
v8::Locker, after running one of the tests, HandleScope needs locking.

Change-Id: Ia5cd093ae139f2ff18c559783fac1d2f69c78f53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3173813
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Michael Bai <michaelbai@chromium.org>
Commit-Queue: Takashi Sakamoto <tasak@google.com>
Cr-Commit-Position: refs/heads/main@{#924612}
2021-09-24 02:44:54 +00:00
Nico Weber
fb1b2ece5c blink/public: Use more granular v8 headers more
Bug: 242216
Change-Id: I43ce775f35fe8cbb0aae26f44a35a5a7df7feb64
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3173291
Commit-Queue: Nico Weber <thakis@chromium.org>
Commit-Queue: Arthur Eubanks <aeubanks@google.com>
Owners-Override: Nico Weber <thakis@chromium.org>
Auto-Submit: Nico Weber <thakis@chromium.org>
Reviewed-by: Arthur Eubanks <aeubanks@google.com>
Cr-Commit-Position: refs/heads/main@{#923480}
2021-09-21 17:58:27 +00:00
Peter Boström
828b902994 Replace DISALLOW_COPY_AND_ASSIGN in content/
This replaces DISALLOW_COPY_AND_ASSIGN with explicit constructor deletes
where a local script is able to detect its insertion place (~Foo() is
public => insert before this line).

This is incomplete as not all classes have a public ~Foo() declared, so
not all DISALLOW_COPY_AND_ASSIGN occurrences are replaced.

IWYU cleanup is left as a separate pass that is easier when these macros
go away.

Bug: 1010217
Change-Id: Iea478401b7580682c7b9f195f7af9cbbdb6ce315
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3167292
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#923194}
2021-09-21 02:28:43 +00:00
Dan Elphick
c925673600 Use fine-grained v8 headers in content/renderer
Now that v8.h has been split into many parts, include only the parts
that are needed.

Also updates content/public/renderer/DEPS to allow includes of the new
v8 headers.

Bug: v8:11965
Change-Id: I0fde0a93f09efdad45f9191421e8e444fdb569f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3161998
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Auto-Submit: Dan Elphick <delphick@chromium.org>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/main@{#922058}
2021-09-16 09:30:11 +00:00
Clark DuVall
5db63ed247 [Code Health] Remove ListValue::GetSize in //content
This was an automated change done with a slightly modified copy of
//tools/clang/value_cleanup.

Bug: 1187064
Change-Id: I989116e3920e912860d8c82c61ac497966c7cb09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3139093
Auto-Submit: Clark DuVall <cduvall@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#917532}
2021-09-02 04:06:19 +00:00
Lei Zhang
ae2ff1ebed Swap from base/stl_util.h to cxx17_backports.h in content/ .cc files.
base::size() has been moved to base/cxx17_backports.h, so .cc files that
use base::size(), but no other function from base/stl_util.h, can
directly include base/cxx17_backports.h and not base/stl_util.h.

Bug: 1210983
Change-Id: I42a598a9c2b8fcbfd1e225329109ae3308bd9518
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2915348
Reviewed-by: Camille Lamy <clamy@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#886358}
2021-05-25 17:29:39 +00:00
Austin Sullivan
12c5e9b91e [Code Health] Remove uses of Value::DeepCopy()
Uses have been replaced with Value::Clone(), wrapped with
base::Value::ToUniquePtrValue() when necessary.

Bug: 1187012
Change-Id: I1b52aa70f4f1e2a8e95dcd054db04b59f75cfad2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2873230
Commit-Queue: Austin Sullivan <asully@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#881291}
2021-05-10 23:00:32 +00:00
Ayu Ishii
ce69c24b23 CodeHealth: Remove use of Value::GetAsDouble
This change removes the use of Value::GetAsDouble
and replaces with Value::is_double(), Value::GetDouble(),
Value::GetIfDouble().

Bug: 1187006
Change-Id: Iff2bddce1e88fd50610c192a786dc9a87e224530
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2870489
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#879638}
2021-05-06 00:42:24 +00:00
Lei Zhang
df291f648f Do not return std::unique_ptr<T>() in content/.
This is just a convoluted way of writing nullptr, so rewrite it in the
simpler form. PRESUBMIT.py already disallows new instances of
std::unique_ptr<T>(). This removes existing instances.

Change-Id: Id2bbf661765d1ef149164d655c09a4ea6e2e476c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2824941
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#872501}
2021-04-14 17:23:44 +00:00
Miyoung Shin
cf449d3691 Fix the wrong conversion of Int8Array and Uint{16, 32}Array js value to Java value
This CL fixes problems that -1 of Int8Array is converted to 255 since it
is the casting as the char type and that a maximum value of
Uint{16, 32}Arrays are converted to -1 since they are the casting as the
signed types in TypedArraySerializerImpl.
For Uint32Array, this CL serializes/deserializes the value as the binary
type since base::Value supports the only int for the integer type.

Bug: 1148997
Change-Id: I52af228070606e4cd3f293dd80e4f0ca53b6b082
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2589535
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Richard Coles <torne@chromium.org>
Reviewed-by: Shimi Zhang <ctzsm@chromium.org>
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Cr-Commit-Position: refs/heads/master@{#841033}
2021-01-07 13:42:03 +00:00
Camillo Bruni
e5440c7690 [v8] Update v8::String::NewFromUtf8 users
- Avoid v8::NewStringType::kNormal where possible
- Use v8::NewStringType::kInternalized for object properties

Bug: v8:10884
Change-Id: Ic7ec1e8dbdc1c56a72ed651da361b920c8145e7d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2398544
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805700}
2020-09-10 11:53:35 +00:00
danakj
3db17d8251 Convert Callback to {Once,Repeating}Callback in content/renderer p2p & fetchers
Nothing especially interesting here, just using OnceCallback where
possible, and BindRepeating for places that expect a RepeatingCallback.

Renamed "Callback" type alias in the fetcher code to "StartCallback" to
not look like the base::Callback type.

R=avi@chromium.org

Bug: 953861, 751838
Change-Id: Ifac10f07a90a86fa5b784b3e1c6dbdee4ce626d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1626345
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Frank Liberato <liberato@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#663299}
2019-05-24 22:51:42 +00:00
danakj
ab347580cf Convert Callback usage to {Once,Repeating}Callback in V8 values and post-task
The PostTaskToInProcessRendererAndWait() method can take a OnceCallback
since it runs it once, so we do, and callers are changed use BindOnce().

The V8ValueConverter takes a Callback which it never uses, so remove it
from the parameters instead of converting it to an appropriate type.

A few other simple conversions in content/renderer/worker and service_worker.

R=avi@chromium.org

Bug: 953861
Change-Id: I8e77532b6d5e40b5961b6f5193acde6bc9818389
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1623489
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662297}
2019-05-22 19:05:17 +00:00