0
Commit Graph

13 Commits

Author SHA1 Message Date
Md Hasibul Hasan
a963a934b5 Convert base::StringPiece to std::string_view in content/browser
The changes of this CL are made using the following script.

```
target_directory="content/browser"
replace_string_in_files() {
  old_string="$1"
  new_string="$2"

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

delete_include() {
    find "$target_directory" \( -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" \( -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: I2bc22c79dd9a0c839745afe065123f7a53c4a5ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5401117
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1281746}
2024-04-03 10:15:14 +00:00
Lei Zhang
8403fa6515 Change content::PluginList to only run on the UI thread.
All the callers are now on the UI thread, so remove all the locking and
complicated threading requirements. Do the same for PluginService.

Bug: 990013
Change-Id: Ie4dac75b4829825978d5873fd28f4ce75c14510b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3866812
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1058235}
2022-10-12 20:15:26 +00:00
Lei Zhang
9ffa3d1711 Fix ClangTidy warnings in PluginList.
Initialize members in plugin_list.h and use emplace_back() in
PluginListTest.

Change-Id: I2d7a045c218c61bc00e1b046f219d0eb27ceda40
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3936497
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1057252}
2022-10-11 01:05:45 +00:00
Peter Kasting
ff5db66924 Change std::find() to use base:: functions: content/
Simplifies code slightly.

Bug: 1368812
Change-Id: Iecb3c9ce7d8da507ef4bc6cfce8233385c3ba5bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3926100
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1055935}
2022-10-06 18:57:24 +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
Lei Zhang
de1976728f Swap out base/stl_util.h for base/containers/contains.h.
Files that only use base::Contains() and no other base/stl_util.h helper
can replace base/stl_util.h with base/containers/contains.h.

Use grep to find all the files that include base/stl_util.h. Then filter
out the ones that need base/stl_util.h by running "grep -L base::func"
where "func" is a function that base/stl_util.h provides. For the
remaining files, grep for ones that use base::Contains(), and do search
and replace for stl_util.h. Take the resulting CL and run clang format.

Bug: 970209
Change-Id: I2fb47d7c91d910a2d431ab178b398f9bfa0eb8c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2853072
Owners-Override: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#877398}
2021-04-29 08:11:24 +00:00
Hans Wennborg
0917de897c Remove/replace unnecessary logging.h includes in .cc files (content)
CHECK, CHECK_EQ etc., and NOTREACHED/NOTIMPLEMENTED have moved
to the much smaller headers check.h, check_op.h, and notreached.h,
respectively.

This CL updates .cc files to use those headers instead when
possible, with the purpose of saving compile time.

(Split out from https://crrev.com/c/2164525 which also has
notes on how the change was generated.)

Bug: 1031540
Change-Id: I643818242b92e19a1048fac89dd8aae323e8b1ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2164510
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Alex Gough <ajgo@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Commit-Queue: Hans Wennborg <hans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#763511}
2020-04-28 20:21:15 +00:00
Jan Wilken Dörrie
531be7ca19 [base] Replace Contains{Key,Value} with Contains in //content
This change replaces usages of base::ContainsKey() and base::ContainsValue()
with base::Contains() in //content.

Reproduction:
 - sed -i 's/\bbase::ContainsKey\b/base::Contains/g'
 - sed -i 's/\bbase::ContainsValue\b/base::Contains/g'
 - git cl format

This CL was uploaded by git cl split.

R=falken@chromium.org

Bug: 970209
Change-Id: Icbe57df713f3b326c5729cad76348c425d59fb7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1648187
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#667069}
2019-06-07 10:05:57 +00:00
Lei Zhang
0960d56494 Fix bad refactoring in PluginList::GetPluginInfoArray().
In r630011, a LoadPlugins() call should have been removed, since it was
guarded by a conditional that was always false. Instead, it is always
being called.

Change-Id: I4dfb2294f0ee66aed9ed94a046176eb6b57b38dd
Reviewed-on: https://chromium-review.googlesource.com/c/1464927
Reviewed-by: Antoine Labour <piman@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#631420}
2019-02-12 22:49:23 +00:00
Lei Zhang
c923379ed9 Remove a check that is always true in PluginList::GetPluginInfoArray().
It only has one non-test caller, and that caller always passes in a
valid |use_stale| parameter. Update the unit tests to pass in the
parameter as well. After that, change it from an out parameter to the
return value.

Change-Id: Ia7862d74363b052c18ed9f37d4253c5f515f1d5f
Reviewed-on: https://chromium-review.googlesource.com/c/1456987
Reviewed-by: Antoine Labour <piman@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#630011}
2019-02-07 18:13:08 +00:00
Lei Zhang
41da878553 Modernize for-loops in PluginList.
Change-Id: I0d096d161eb4d98fce431eb9db8cb1df58ddd2c0
Reviewed-on: https://chromium-review.googlesource.com/c/1457019
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#629812}
2019-02-07 00:45:30 +00:00
Lei Zhang
c213e12397 Use base::RepeatingCallback in PluginList.
Change-Id: I7cca1653fff5f990785d7c1cf28e83a6d96ba26e
Reviewed-on: https://chromium-review.googlesource.com/c/1456981
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#629794}
2019-02-07 00:17:02 +00:00
Lei Zhang
d8c5318dc8 Move PluginList to content/browser/.
It does not need to live in content/common/. Run git cl format along the
way.

Change-Id: I04e063334b7df182f0c5fa4eb235e61f49e77beb
Reviewed-on: https://chromium-review.googlesource.com/c/1456947
Reviewed-by: Antoine Labour <piman@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#629754}
2019-02-06 22:24:39 +00:00