0
Commit Graph

21 Commits

Author SHA1 Message Date
Arthur Sonzogni
c686e8f4fd Rename {absl => std}::optional in //content/
Automated patch, intended to be effectively a no-op.

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

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

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

# Skipping unrelated "check_network_annotation" errors.
NOTRY=True

Bug: chromium:1500249
Change-Id: Icfd31a71d8faf63a2e8d5401127e7ee74cc1c413
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5185537
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1245739}
2024-01-11 08:36:37 +00:00
Ho Cheung
a18707a4c7 [base] Rename DIR_SOURCE_ROOT to DIR_SRC_TEST_DATA_ROOT in //content
Bug: 1264897
Change-Id: I2a30d7d5d068b7a11d4db8292877bdac5547637d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4952599
Commit-Queue: Ho Cheung <uioptt24@gmail.com>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1211523}
2023-10-18 15:30:40 +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
Sean Maher
52fa5a7f26 task posting v3: moving away from SequencedTaskRunnerHandle
To continue the migration away from TaskRunnerHandles, the codebase
was refactored using the following scripts:
shell script:
https://paste.googleplex.com/4673967729147904
python:
https://paste.googleplex.com/5302682490241024

This will do a few sed-like modifications, changing calls to methods of
SequencedTaskRunnerHandle to calls to methods of
SequencedTaskRunner::CurrentDefaultHandle, and swapping includes.

Bug: 1026641
AX-Relnotes: n/a.
Change-Id: I49e50a2bd1e78b00e7c067219fff96d2e0bc0b46
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3983373
Commit-Queue: Gabriel Charette <gab@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1071032}
2022-11-14 15:53:25 +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
Claudio DeSouza
d2afab4fda Reland "Implementing DataDecoder ValueOrError with base::expected"
This CL had caused a build breakage on the linux-chromeos-chrome CI,
which is not public. These changes fix the case in question.

This is a reland of commit 479ba74184

Original change's description:
> Implementing DataDecoder ValueOrError with base::expected
>
> This CL removes DataDecoder's ValueOrError type for the use of
> base::expected. This will make the use of these interfaces not only
> simpler, but it will also remove the redundant, and bug prone presence
> of the optional value for the success path, which is mostly always
> assumed to be populated, whenever there's no error present.
>
> Change-Id: If6e80d510193f2be508d4e938752422877b3f388
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3757983
> Owners-Override: Robert Sesek <rsesek@chromium.org>
> Commit-Queue: Claudio DeSouza <cdesouza@igalia.com>
> Reviewed-by: Robert Sesek <rsesek@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1023818}

Change-Id: I83f44a40f2ce6b818ac0933a8660f09bd85775f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3760789
Commit-Queue: Claudio DeSouza <cdesouza@igalia.com>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Owners-Override: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1024404}
2022-07-14 20:40:51 +00:00
Findit
74d2127b7b Revert "Implementing DataDecoder ValueOrError with base::expected"
This reverts commit 479ba74184.

Reason for revert:
Findit (https://goo.gl/kROfz5) identified this CL at revision 479ba74184 as
the culprit for failures in the continuous build including:

Sample Failed Build: https://ci.chromium.org/b/8808733252724801841
Sample Failed Step: compile

If it is a false positive, please report it at https://bugs.chromium.org/p/chromium/issues/entry?status=Available&comment=Datastore+key+for+the+culprit+entity%3A+chromium.googlesource.com%2Fchromium%2Fsrc%2Frefs%2Fheads%2Fmain%2F479ba7418475df5ef32e9c57f5a980e6a24f7cf8&labels=Test-Findit-Wrong&components=Tools%3ETest%3EFindIt&summary=Wrongly+blame+479ba7418475df5ef32e9c57f5a980e6a24f7cf8

Original change's description:
> Implementing DataDecoder ValueOrError with base::expected
> 
> This CL removes DataDecoder's ValueOrError type for the use of
> base::expected. This will make the use of these interfaces not only
> simpler, but it will also remove the redundant, and bug prone presence
> of the optional value for the success path, which is mostly always
> assumed to be populated, whenever there's no error present.
> 
> Change-Id: If6e80d510193f2be508d4e938752422877b3f388
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3757983
> Owners-Override: Robert Sesek <rsesek@chromium.org>
> Commit-Queue: Claudio DeSouza <cdesouza@igalia.com>
> Reviewed-by: Robert Sesek <rsesek@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1023818}


Change-Id: Ic4c91a880062b1904ee8f2a8b5c711a0e009ac54
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3760861
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Owners-Override: Andrey Kosyakov <caseq@chromium.org>
Owners-Override: Ian Clelland <iclelland@chromium.org>
Commit-Queue: Andrey Kosyakov <caseq@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1023965}
2022-07-13 22:06:28 +00:00
Claudio DeSouza
479ba74184 Implementing DataDecoder ValueOrError with base::expected
This CL removes DataDecoder's ValueOrError type for the use of
base::expected. This will make the use of these interfaces not only
simpler, but it will also remove the redundant, and bug prone presence
of the optional value for the success path, which is mostly always
assumed to be populated, whenever there's no error present.

Change-Id: If6e80d510193f2be508d4e938752422877b3f388
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3757983
Owners-Override: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Claudio DeSouza <cdesouza@igalia.com>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1023818}
2022-07-13 17:45:13 +00:00
Robert Sesek
31db673339 DataDecoder: Implement callback lifetime guarantees as documented.
The DataDecoder instance-based API says that callbacks "will only be
called if the parsing operation succeeds or fails before this
DataDecoder is destroyed." However, this is not what the implementation
currently does: nothing binds the lifetime of the DataDecoder instance
to the callback. That makes it potentially unsafe to store an instance
of a DataDecoder as a member variable and then bind Unretained
`this` pointers to the DataDecoder callbacks.

This change adds a cancellation flag to DataDecoder requests so that the
API guarantees are fulfilled.

Bug: 1327312
Change-Id: Ic973cb62c802c8f6fceb2d3fe4c826579cd6b0c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3660173
Commit-Queue: Nasko Oskov <nasko@chromium.org>
Auto-Submit: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1007974}
2022-05-26 20:43:26 +00:00
Gabriel Charette
d87f10f467 [base] IWYU for base::Time
This CL is a no-op.

Only fixing instances where base::Time (and Ticks/Delta) is used in
a statement (i.e. not as a parameter to avoid adding includes in mere
overrides). Skipping pointer and reference qualified instances.

i.e. matches this regex:
'(\n *[^/\n][^/\n][^/\n]*base::(Time|Thread)(Ticks|Delta)?\b[^*&][^)]*;)'

and skipping files that have any existing fwd-decl for any of the
variants.

This is a prereq to remove unused base/task/post_task.h includes in
https://chromium-review.googlesource.com/c/chromium/src/+/3555247

Bug: 1026641
Change-Id: I87b43a8dc92bdceb67f4bd59b327b54813aa72a6
AX-Relnotes: n/a.
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3557354
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#987283}
2022-03-31 00:44:22 +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 Kasting
e5a38eddbd Migrate "base::TimeDelta::FromX" to "base:X".
All changes were done automatically with git grep, sed, xargs, etc.

No-Presubmit: true
No-Try: true
Bug: 1243777
Change-Id: I7cc197e9027f7837cd36afc67a209079f85ec364
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3198824
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Owners-Override: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#927512}
2021-10-02 03:06:35 +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
Lukasz Anforowicz
84dbd4d42c Add UMA to //services/data_decoder to record time spent decoding images.
This CL adds the following histograms/metrics:

- Security.DataDecoder.Image.DecodingTime
  (time spent decoding an image, typically inside a utility process)

- Security.DataDecoder.Image.Isolated.EndToEndTime
  (end-to-end time spent spawning a utility process, sending IPCs,
   and decoding an image - as measured from within a browser process)

- Security.DataDecoder.Image.Isolated.ProcessOverhead
  (the difference between Isolated.EndToEndTime and DecodingTime - this
  covers the end-to-end time spent spawning a utility process and the
  IPC overhead)

- Security.DataDecoder.Image.Reusable.EndToEndTime,
  Security.DataDecoder.Image.Reusable.ProcessOverhead
  (just as the 2 metrics above, but potentially reusing an already
  existing utility process)

Bug: 1069271
Change-Id: Ide06c7819e7d5b17b23ec82d55b29591e2523850
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3116444
Reviewed-by: Chris Thompson <cthomp@chromium.org>
Reviewed-by: Jon Mann <jonmann@chromium.org>
Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Justin DeWitt <dewittj@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/main@{#919930}
2021-09-09 19:58:21 +00:00
Anton Bikineev
f62d1bf48e content: Replace base::Optional and friends with absl counterparts
This replaces:
- base::Optional -> absl::optional
- include "base/optional.h"
  ->
  include "third_party/abseil-cpp/absl/types/optional.h"
- base::nullopt -> absl::nullopt
- base::make_optional -> absl::make_optional

Bug: 1202909
Change-Id: Ie9f37bcbf6115632a19f4d063387d07b3723926f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2897246
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Owners-Override: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#883270}
2021-05-15 17:56:07 +00:00
Peter Kasting
919ce657e4 Add missing #includes of browser_test.h.
This is a step towards doing full IWYU of browser_test.h, which will
have other benefits.

Completely mechanical and already R+ed as part of r765923.

Tbr: sky
Bug: none
Change-Id: Icb7ab728098a6cf29c0920da4b524e96a7c024c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2186411
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#766361}
2020-05-07 10:22:36 +00:00
Balazs Engedy
683d2c7a8f Revert "IWYU for browser_test.h."
This reverts commit 66a53c909a.

Reason for revert: Breaks compile on official branded builders.

Original change's description:
> IWYU for browser_test.h.
> 
> Include this directly in relevant test files.  This lets us convert the
> HAS_OUT_OF_PROC_TEST_RUNNER checks in this file and
> view_event_test_base.h into #errors, and force people to not even
> include this file in files that can't use it.
> 
> Bug: none
> Tbr: sky
> Change-Id: I86626099eb047eb53e8b3611de38ba6bebc01a0b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2136117
> Commit-Queue: Peter Kasting <pkasting@chromium.org>
> Reviewed-by: Scott Violet <sky@chromium.org>
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#765923}

TBR=sky@chromium.org,pkasting@chromium.org,thestig@chromium.org

Change-Id: I4583916602404c310a93f571dd2c78645c6bd567
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: none
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2184132
Reviewed-by: Balazs Engedy <engedy@chromium.org>
Commit-Queue: Balazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#765931}
2020-05-06 10:36:40 +00:00
Peter Kasting
66a53c909a IWYU for browser_test.h.
Include this directly in relevant test files.  This lets us convert the
HAS_OUT_OF_PROC_TEST_RUNNER checks in this file and
view_event_test_base.h into #errors, and force people to not even
include this file in files that can't use it.

Bug: none
Tbr: sky
Change-Id: I86626099eb047eb53e8b3611de38ba6bebc01a0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2136117
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#765923}
2020-05-06 09:38:56 +00:00
Ken Rockot
27a62d51d2 Reland "Introduce DataDecoder API"
This is a reland of 756519940d

Original change's description:
> Introduce DataDecoder API
>
> This provides a new DataDecoder API in the data_decoder client library,
> allowing for clients to use the service for isolated and batched
> operations without any dependency on the Service Manager or the
> cumbersome usage of batch IDs.
>
> Only JSON parsing facilities are added to DataDecoder in this CL.
>
> The JsonSanitizer API is cleaned up a bit too, as is some test code.
>
> Bug: 977637
> Change-Id: I5798982a500a403ddb345ab40db35d466dc6b7fc
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1879792
> Reviewed-by: Robert Sesek <rsesek@chromium.org>
> Reviewed-by: Avi Drissman <avi@chromium.org>
> Reviewed-by: Sorin Jianu <sorin@chromium.org>
> Reviewed-by: Colin Blundell <blundell@chromium.org>
> Commit-Queue: Robert Sesek <rsesek@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#710438}

Bug: 977637
Change-Id: I2d5146230e40db0bc3bc74b1b08c0409054d9917
Tbr: avi@chromium.org
Tbr: blundell@chromium.org
Tbr: rsesek@chromium.org
Tbr: sorin@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1888783
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#710600}
2019-10-30 01:57:01 +00:00
Tommy Steimel
bcc7f1b6d2 Revert "Introduce DataDecoder API"
This reverts commit 756519940d.

Reason for revert: Suspected cause of ios compile failures: https://ci.chromium.org/p/chromium/builders/ci/ios-device/139770

Original change's description:
> Introduce DataDecoder API
> 
> This provides a new DataDecoder API in the data_decoder client library,
> allowing for clients to use the service for isolated and batched
> operations without any dependency on the Service Manager or the
> cumbersome usage of batch IDs.
> 
> Only JSON parsing facilities are added to DataDecoder in this CL.
> 
> The JsonSanitizer API is cleaned up a bit too, as is some test code.
> 
> Bug: 977637
> Change-Id: I5798982a500a403ddb345ab40db35d466dc6b7fc
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1879792
> Reviewed-by: Robert Sesek <rsesek@chromium.org>
> Reviewed-by: Avi Drissman <avi@chromium.org>
> Reviewed-by: Sorin Jianu <sorin@chromium.org>
> Reviewed-by: Colin Blundell <blundell@chromium.org>
> Commit-Queue: Robert Sesek <rsesek@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#710438}

TBR=avi@chromium.org,rockot@google.com,blundell@chromium.org,sorin@chromium.org,rsesek@chromium.org

Change-Id: I6c7d890c5ce7abea1d80b26a85c867e72bab32d3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 977637
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1888739
Reviewed-by: Tommy Steimel <steimel@chromium.org>
Commit-Queue: Tommy Steimel <steimel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710451}
2019-10-29 21:54:46 +00:00
Ken Rockot
756519940d Introduce DataDecoder API
This provides a new DataDecoder API in the data_decoder client library,
allowing for clients to use the service for isolated and batched
operations without any dependency on the Service Manager or the
cumbersome usage of batch IDs.

Only JSON parsing facilities are added to DataDecoder in this CL.

The JsonSanitizer API is cleaned up a bit too, as is some test code.

Bug: 977637
Change-Id: I5798982a500a403ddb345ab40db35d466dc6b7fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1879792
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Sorin Jianu <sorin@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710438}
2019-10-29 20:55:03 +00:00