0
Commit Graph

32 Commits

Author SHA1 Message Date
Arthur Sonzogni
e98d214c48 DanglingPointer: annotate for unittests base+linux [1/N]
The DanglingPointerDetector is configured only when the test enters the
ContentMain function. See https://crbug.com/1400059

I would like to configure it no matter the kind of test. For this to
happen, we need to annotate every pre-existing dangling pointers.

This patch annotates the ones you can find by running targets depending
on the GoogleTest library.

Statistic:

This adds 1776 new DanglingUntriaged. Among them:
- 1288 are in unittests.
- 488 are in implementation.

To produce those numbers, I used the command:
```bash
git diff annotate-linux origin/main -- "*test*" | grep "DanglingUntriaged" | wc -l
```

This patch has been generated by:

1. Apply the "auto-annotator" patch:
   https://chromium-review.googlesource.com/c/chromium/src/+/4474553

2. Compile the compiler again:
   ```bash
   ./tools/clang/scripts/build.py
   ```

3. List and run all the targets. You can use a bash script like:
   https://docs.google.com/document/d/1AMMERcqy0eafFWopUCHYsIKIKEp3J8DFxqW9UIbzIHo

4. Concatenate output, filter by "Found dangling ptr", sort, remove
   duplicate.

5. Apply the rewriter script from:
   https://github.com/ArthurSonzogni/chrome-dangling-ptr-apply-edit

6. Revert the "auto-annotate" patch.

7. Apply `git cl format`

AX-Relnotes: n/a.
Bug: chromium:1400059
Change-Id: I217d5c0b925da5176fc53baf95919a3690f1e9a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4570424
Reviewed-by: danakj <danakj@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1151859}
2023-06-01 15:02:25 +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
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
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
Keishi Hattori
0e45c020c4 Rewrite most Foo* field_ pointer fields to raw_ptr<Foo> field_.
DO NOT REVERT (unless absolutely necessary)! Report build breaks to keishi@(APAC)/glazunov@(EMEA)/sebmarchand@(NA) as soon as you see them. Fixes are expected to be trivial.

This commit was generated automatically, by running the following script: tools/clang/rewrite_raw_ptr_fields/rewrite-multiple-platforms.sh on commit fe74bc434e

For more information, see MiraclePtr One Pager [1], the PSA at chromium-dev@ [2], and the raw_ptr documentation in //base/memory/raw_ptr.md.

FYI This CL does not enable MiraclePtr protection and we expect no behavior change from this.

[1] https://docs.google.com/document/d/1pnnOAIz_DMWDI4oIOFoMAqLnf_MZ2GsrJNb_dbQ3ZBg/edit?usp=sharing
[2] https://groups.google.com/a/chromium.org/g/chromium-dev/c/vAEeVifyf78/m/SkBUc6PhBAAJ

Binary-Size: Increase of around 500kb was approved for MiraclePtr
Include-Ci-Only-Tests: true
No-Tree-Checks: true
No-Presubmit: true
Bug: 1272324, 1073933
Change-Id: I05c86a83bbb4b3f4b017f361dd7f4e7437697f69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3305132
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Reviewed-by: Bartek Nowierski <bartekn@chromium.org>
Owners-Override: Bartek Nowierski <bartekn@chromium.org>
Cr-Commit-Position: refs/heads/main@{#945735}
2021-11-27 09:25:52 +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
Patrick Monette
643cdf6190 Replace base/task/ temporary forward headers with their final locations
Note to QA: This merely changes includes and should not be blamed
for files it touched.

Bug: 1255932
Change-Id: I1ce4e31efd5792ebf2080812e665cae838a54972
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3226943
Reviewed-by: Gabriel Charette <gab@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#932153}
2021-10-15 19:13:42 +00:00
Patrick Monette
3d7d70920a Replace task-related headers to their equivalent in base/task/
This CL was generated by using tools/git/move_source_file.py to change
the includes for those files:
base/bind_post_task.h
base/deferred_sequenced_task_runner.h
base/post_task_and_reply_with_result_internal.h
base/sequenced_task_runner.h
base/sequenced_task_runner_helpers.h
base/single_thread_task_runner.h
base/task_runner.h
base/task_runner_util.h
base/updateable_sequenced_task_runner.h

Then formatted using "git cl format". DEPS files were fixed with a
simple search and replace script.

Bug: 1255932
Change-Id: I0d9b5ddd9260fde5e4581e6c6e0080bdb0ed2c44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3209175
Reviewed-by: Gabriel Charette <gab@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#929867}
2021-10-08 20:27:23 +00:00
Peter Boström
dd7e40ec31 Apply modernize-make-unique to content/
This is a large-scale change: go/chromium-modernize-make-unique

Bug: 1194272
Change-Id: Id035e6a5058ab109a4333f1b8f8225da1c6989e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2803034
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/master@{#869261}
2021-04-05 20:40:10 +00:00
danakj
f416ce9d3b Convert content/browser/ Callbacks to {Once,Repeating}Callback
Use OnceCallback where possible because the callback is only used once
and RepeatingCallback and BindRepeating otherwise.

R=avi@chromium.org

Bug: 1007760
Change-Id: I3d02fded4b40cdc843ac89e057a34bdf3766b1bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1962545
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#723954}
2019-12-11 20:45:45 +00:00
Mark Pilgrim
ec8bce34e3 Migrate ByteStreamReader and ByteStreamWriter to BindRepeating
Bug: 714018
Change-Id: I0e1a9f6b8646b414664dbb7a7a7254f0135a166e
Reviewed-on: https://chromium-review.googlesource.com/1061814
Commit-Queue: Mark Pilgrim <pilgrim@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559628}
2018-05-17 18:55:23 +00:00
tzik
ccf160cafa Remove unneeded base::Passed on base::BindOnce parameter in //content
This CL applies //tools/clang/base_bind_rewriter to //chrome, that
removes unneeded base::Passed as a parameter of base::BindOnce.
This doesn't contain any behavior change.

For example, on base::BindOnce call around |Foo|, |ptr|, and |ptr2| below:
  void Foo(std::unique_ptr<int>);
  std::unique_ptr<int> ptr;
  std::unique_ptr<int>* ptr2 = &ptr;

If the parameter of base::Passed() is an rvalue-reference, it just
removes the base::Passed call.
  // Before
  base::BindOnce([](&Foo, base::Passed(std::move(ptr)));
  // After
  base::BindOnce([](&Foo, std::move(ptr));

If the parameter is a pointer and its address is taken there, the
rewriter replaces base::Passed and `&` with std::move().
  // Before
  base::BindOnce(&Foo, base::Passed(&ptr));
  // After
  base::BindOnce(&Foo, std::move(ptr));

If the parameter is other form of pointer, the rewriter replaces it
with std::move().
  // Before

  base::BindOnce(&Foo, base::Passed(ptr2));
  // After
  base::BindOnce(&Foo, std::move(*ptr));

Change-Id: I2f8c1cd7b46143da8e79d0b4e917ba4d585485f2
Reviewed-on: https://chromium-review.googlesource.com/926081
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537763}
2018-02-20 12:43:13 +00:00
Ivan Kotenkov
2c0d2bb3fe Convert 0 to nullptr in content using clang-tidy.
Bug: 778942
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isolation
Change-Id: Iee6be84c23149c745b3afd6e6158764f92ccd17f
Reviewed-on: https://chromium-review.googlesource.com/732305
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Ivan Kotenkov <kotenkov@yandex-team.ru>
Cr-Commit-Position: refs/heads/master@{#513138}
2017-11-01 15:41:28 +00:00
Brett Wilson
cc8623dc8e Replace std::deque and std::queue in //content.
These are replaced with the base versions base::circular_deque and base::queue.

Typedefs were replaced with using statements in changed code, and adjacent
typedefs were also converted.

RTCTimestamps struct in rtc_video_encoder.cc was made copyable and moveable
(it's just an int64 and an int32) to support being put in a circular_deque.
BrowsingDataRemoverImpl::RemovalTask was made move-only (from previously
not movable or copyable).

BUG=757232

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isolation
Change-Id: Ib83f929ae4c014ae0d3766a57e9cb56cba446e2b
Reviewed-on: https://chromium-review.googlesource.com/656066
Commit-Queue: Brett Wilson <brettw@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501169}
2017-09-12 03:28:10 +00:00
tzik
4fea24afdc Apply base_bind_rewriters to //content/browser/{a,b,c,d,f,g}*
This CL applies //tools/clang/base_bind_rewriters to //content/browser/{a,b,c,d,f,g}*
It rewrites base::Bind to base::BindOnce where the resulting base::Callback
is immediately converted to base::OnceCallback, which is considered safe
to use base::BindOnce.

E.g.:
  base::PostTask(FROM_HERE, base::Bind([]{}));
  base::OnceClosure cb = base::Bind([]{});
are converted to:
  base::PostTask(FROM_HERE, base::BindOnce([]{}));
  base::OnceClosure cb = base::BindOnce([]{});
Change-Id: I11ae9ac169c8e0ff9d9b95452fec22a8b7c91df7

NOPRESUBMIT=true

Change-Id: I11ae9ac169c8e0ff9d9b95452fec22a8b7c91df7
Reviewed-on: https://chromium-review.googlesource.com/628003
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#496656}
2017-08-23 11:41:47 +00:00
peary2
229d9745b7 Rename TaskRunner::RunsTasksOnCurrentThread() in //content
renamed TaskRunner::RunsTasksOnCurrentThread() to
TaskRunner::RunsTasksInCurrentSequence() in //content

BUG=665062

Review-Url: https://codereview.chromium.org/2873333004
Cr-Commit-Position: refs/heads/master@{#471176}
2017-05-12 01:55:19 +00:00
meredithl
4fdd214c88 Make comments in byte_stream.cc gender neutral.
BUG=542537

Review-Url: https://codereview.chromium.org/2523393002
Cr-Commit-Position: refs/heads/master@{#434595}
2016-11-28 03:17:34 +00:00
dcheng
5971627d34 Convert //content/browser from scoped_ptr to std::unique_ptr
BUG=554298
R=avi@chromium.org

Review URL: https://codereview.chromium.org/1874893002

Cr-Commit-Position: refs/heads/master@{#386285}
2016-04-09 05:20:41 +00:00
dcheng
36b6aec9a5 Convert Pass()→std::move() in //content/browser
BUG=557422

Review URL: https://codereview.chromium.org/1545243002

Cr-Commit-Position: refs/heads/master@{#366894}
2015-12-26 06:17:30 +00:00
avi
b7348940d3 Switch to standard integer types in content/browser/.
BUG=138542
TBR=jam@chromium.org

Review URL: https://codereview.chromium.org/1549113002

Cr-Commit-Position: refs/heads/master@{#366868}
2015-12-25 20:58:00 +00:00
dcheng
c2282aa891 Standardize usage of virtual/override/final in content/browser/
This patch was automatically generated by applying clang fixit hints
generated by the plugin to the source tree.

BUG=417463
TBR=sky@chromium.org

Review URL: https://codereview.chromium.org/667943003

Cr-Commit-Position: refs/heads/master@{#300469}
2014-10-21 12:08:25 +00:00
mohan.reddy
7fc3ac7d5a Replace FINAL and OVERRIDE with their C++11 counterparts in content
This step is a giant search and replace for OVERRIDE and FINAL to
replace them with their lowercase versions.

BUG=417463

Review URL: https://codereview.chromium.org/637183002

Cr-Commit-Position: refs/heads/master@{#298804}
2014-10-09 05:24:24 +00:00
tyoshino@chromium.org
f9feef3e16 Explain the reason why we don't have thread check in destructor of ByteStreamReader/Writer.
They can be deleted before being used and it's safe to do so.

Review URL: https://codereview.chromium.org/22925003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257173 0039d316-1c4b-4281-b951-d872f2087c98
2014-03-14 19:14:42 +00:00
tyoshino@chromium.org
07516269ca Limit the total memory usage for Stream instances
Stream instances report their memory usage to StreamRegistry to get
approval. If rejected, they unregisters themselves.

writer_ and reader_ are cleared immediately when memory usage
violation happens. Added task runner DCHECKs to ByteStreamReaderImpl
and ByteStreamWriterImpl so that we can check we're not violating
thread restriction.

BUG=169957

Review URL: https://chromiumcodereview.appspot.com/22908008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218933 0039d316-1c4b-4281-b951-d872f2087c98
2013-08-22 07:43:24 +00:00
tyoshino@chromium.org
6a14c19a4f Clean up on byte_stream (mainly style and includes)
- Don't allocate ContentVector if input_contents_size_ is 0
- Remove unused weak_ptr.h and lock.h
- Add comments required by style guide
- Move includes not used in .h to .cc

BUG=

Review URL: https://chromiumcodereview.appspot.com/21839002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215958 0039d316-1c4b-4281-b951-d872f2087c98
2013-08-06 20:18:42 +00:00
tyoshino@chromium.org
8d0c23eeb7 Make ByteStream independent from DownloadInterruptReason
Change status type to int to make it portable to other component.

After this change, ByteStream could be moved under src/net/base/ or
src/base directory.

- Comment fix (MaybePostToPeer -> Write)

BUG=169957

Review URL: https://chromiumcodereview.appspot.com/18284005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215265 0039d316-1c4b-4281-b951-d872f2087c98
2013-08-02 11:02:30 +00:00
tyoshino@chromium.org
566357e5f9 Add Flush() method to ByteStream.
To be used by Stream implementation to push received data to
StreamURLRequestJob at arbitrary point.

BUG=169957

Review URL: https://chromiumcodereview.appspot.com/18098004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214545 0039d316-1c4b-4281-b951-d872f2087c98
2013-07-31 03:59:36 +00:00
dbeam@chromium.org
fb441961d6 Revert 198844 "Move sequenced_task_runner to base/task"
Reverting revisions that rely on r198820 so to unbreak the build.

> Move sequenced_task_runner to base/task
> 
> BUG=
> R=akalin@chromium.org
> 
> Review URL: https://codereview.chromium.org/14927008

TBR=brettw@chromium.org

Review URL: https://codereview.chromium.org/14985007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198848 0039d316-1c4b-4281-b951-d872f2087c98
2013-05-08 05:35:24 +00:00
brettw@chromium.org
002c726a0d Move sequenced_task_runner to base/task
BUG=
R=akalin@chromium.org

Review URL: https://codereview.chromium.org/14927008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198844 0039d316-1c4b-4281-b951-d872f2087c98
2013-05-08 04:14:58 +00:00
erg@chromium.org
59383c78c7 Cleanup: Remove unnecessary ".get()" from scoped_ptrs<>.
In r174057, ajwong@ added support for implicit testing to scoped_ptr<>. Removes
these in content/.

BUG=232084

Review URL: https://codereview.chromium.org/14081010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194608 0039d316-1c4b-4281-b951-d872f2087c98
2013-04-17 16:43:27 +00:00
zork@chromium.org
f8e92b5daa Move ByteStream to content/browser
BUG=180833


Review URL: https://chromiumcodereview.appspot.com/12440036

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189665 0039d316-1c4b-4281-b951-d872f2087c98
2013-03-21 18:35:46 +00:00