0
Commit Graph

199 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
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
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
acb01c42ec task posting v3: remove all calls to task_runner_util.h manually
This also removes task_runner_util.h and task_runner_util_unittests.cc.

This is the last part of a chrome-wide refactor changing calls like
base::PostTaskAndReplyWithResult(task_runner[...] to calls like
task_runner->PostTaskAndReplyWithResult([...]

Bug: 1026641
Change-Id: I86e5b09ee5b62f55aa03c878102644a438f85301
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4062277
Commit-Queue: Sean Maher <spvw@chromium.org>
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@{#1078168}
2022-12-01 18:22:23 +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
Rohit Bhatia
6b92d02c53 [DownloadBubble] Remove nested runloop and synchronously call GetPlugins
Remove nested runloops from production code.

Instead, this CL creates a synchronous version of GetPlugin, and calls
it when DownloadItemModel::ShouldPreferOpeningInBrowser() is queried.
This is required because this should be resolved synchronously for its
callers, which include context menus, or downloads being opened.

The GetPlugins method does not perform any disk IO, and it is safe to
create a synchronous version of it.

This synchronous method is queried only under DownloadBubbleV2 flag,
and should not affect anything if the flag is off.

Screencast (Context Menu): http://go/scrcast/NTY4MTM0Mjk4MjM4OTc2MHwyOWY4YzZhMy1hNA
Screencast (Download Bubble): http://go/scrcast/NTA2NTk0NjY0NjQ0NjA4MHw5ZDdlYTUzMS01NQ
Screencast (Download Page): http://go/scrcast/NjAyODQyMjEwODE1MTgwOHwwN2ZjN2VmMC1jOQ
New Downloads:
http://go/scrcast/NjE3OTgwNTkzMTI0MTQ3MnxhOGY5NmQxNy05Zg

Bug: 1369673
Change-Id: Ieb1054c0c122fd7f341dae9c32dd6b611a15ee17
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3928952
Reviewed-by: Xinghui Lu <xinghuilu@chromium.org>
Reviewed-by: Min Qin <qinmin@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Rohit Bhatia <bhatiarohit@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1055303}
2022-10-05 15:40:54 +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
K. Moon
67441a1b5b Rename PepperPluginInfo to ContentPluginInfo
Renames PepperPluginInfo to ContentPluginInfo, in order to reflect that
this struct no longer is used only with PPAPI.

The name ContentPluginInfo was chosen because the name PluginInfo is
overloaded already for 3 different types in Chromium. The name also
emphasizes that this type supports the //content layer specifically.

Most of this change is mechanical, with the following exceptions:

1. Some other names have been changed to drop references to Pepper, such
   as renaming ContentClient::AddPepperPlugins() to
   ContentClient::AddPlugins(). Note that Pepper-specific functions like
   MakePepperPluginInfo() intentionally still mention Pepper.
2. Refactored PluginManager::UpdatePluginListWithNaClModules() to use
   range-based "for" loops, instead of iterators.

Bug: 1344644
Change-Id: I9b8596f6a53593ed7c4b7e06a266b57c82b0d9bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3835746
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1040827}
2022-08-30 07:26:43 +00:00
Rohit Bhatia
23df04c021 Find Plugins by BrowserContext
This CL adds newer functions that check safety of plugins by
BrowserContext, and not renderer_process_id.

This is needed as we want to set pdfs loaded from history service to
open in the browser by default, which requires this check. The pdfs do
not have an associated renderer process, and the check only requires a
BrowserContext anyway.

Bug: 1352120
Change-Id: I232071529b62b0213e4e760796596f6b07fd5b83
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3849622
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Min Qin <qinmin@chromium.org>
Commit-Queue: Rohit Bhatia <bhatiarohit@google.com>
Reviewed-by: Xinghui Lu <xinghuilu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1038995}
2022-08-24 22:42:14 +00:00
K. Moon
b91ba27698 Register PDF plugin even when enable_ppapi=false
Registers the PDF plugin even when PPAPI is disabled. This requires two
main changes:

1. Allowing use of PepperPluginInfo, regardless of the ENABLE_PPAPI
   buildflag. This required making the "internal_entry_points" member
   conditional.
2. Registering the PDF plugin in ChromeContentClint::AddPepperPlugins(),
   regardless of the ENABLE_PPAPI buildflag.

This change also makes several other improvements to PepperPluginInfo:

1. Uses default member initializers, greatly reducing the need for
   conditional compilation in pepper_plugin_info.cc.
2. Adds a move constructor, since there's already a copy constructor.
3. Drops the "is_external" field, which became dead code in
   crrev.com/1037953.

Finally, this change inlines ComputeBuiltInPlugins(), since the
remaining code is relatively straightforward.

Fixed: 1306610
Change-Id: Ia8927b632f31f53c23a965766c2d8946b5062b16
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3837314
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1038300}
2022-08-23 16:56:02 +00:00
K. Moon
c5aece5014 Use PpapiPluginProcessHost only with ENABLE_PPAPI
Puts all remaining uses of PpapiPluginProcessHost behind the
ENABLE_PPAPI buildflag.

As all the existing tests for PluginServiceImpl depend on
PpapiPluginProcessHost, also adds a new test that does not.

Also reorganizes plugin_service_impl.h's include order to follow the
style guide more closely.

Bug: 1306610
Change-Id: Ia9ee1e660def3ed0b790539fe3995938770170bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3840473
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1036854}
2022-08-18 23:24:43 +00:00
K. Moon
ba8ddfb2e3 Separate plugin and PPAPI sources in //content
Separates sources for plugin support from sources for PPAPI support in
BUILD.gn files under the //content tree.

Note that enable_plugins=true, enable_ppapi=false should compile, but
does not link. This is fine, as this configuration isn't supported yet.

Note that compiling plugin_service_impl.cc with enable_ppapi=false
requires some additional changes, as some includes are conditional on
BUILDFLAG(ENABLE_PPAPI).

Note that ShellPluginServiceFilter doesn't actually depend on PPAPI, so
the dependency simply can be dropped

This change also refactors //content/common/BUILD.gn to follow the more
common pattern of adding sources when the feature is enabled, rather
than removing sources when the feature is disabled.

Bug: 1306610
Change-Id: I5ec7829a9c9bae8003d4537896ade0b646f4af6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3811451
Auto-Submit: K. Moon <kmoon@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1032221}
2022-08-06 02:47:46 +00:00
K. Moon
de11886024 Remove CountPpapiPluginProcessesForProfile() API
Removes the CountPpapiPluginProcessesForProfile() API from
PluginService. This API is only used externally by
plugin_response_interceptor_url_loader_throttle_browsertest.cc for
counting PDF plugin processes, but is unfit for this purpose ever since
the PDF viewer migrated from Pepper (crbug.com/702993).

This API is still used internally by PluginServiceImpl, but an anonymous
free function in plugin_service_impl.cc suffices.

Bug: 1306610
Change-Id: I055c5ed2d2c192c859c594a100faeb6dc8bdfc3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3789927
Reviewed-by: Nigi <nigi@chromium.org>
Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1029489}
2022-07-28 22:21:51 +00:00
K. Moon
5f45789f0e Delete ContentBrowserClient::ShouldAllowPluginCreation()
Deletes the ContentBrowserClient::ShouldAllowPluginCreation() API, which
always returns true now.

Bug: 702990
Change-Id: I765aa133f254acb0ce09ed3c3a3095c717b687e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3731258
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1026893}
2022-07-21 18:53:52 +00:00
Gabriel Charette
bdd68018e8 [base] Remove unused post_task.h includes
This CL is a no-op.

Bug: 1026641
AX-Relnotes: n/a
Change-Id: If45d30e748b65097bb6be666dc305c27183d83ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3555247
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Commit-Queue: Francois Pierre Doray <fdoray@chromium.org>
Owners-Override: Francois Pierre Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/main@{#987328}
2022-03-31 04:00:05 +00:00
Lei Zhang
88b95f8c9c Remove NetworkServiceRestartBrowserTest.Plugin.
This test, along with the CORB test PPAPI plugin, were used to ensure
the PPAPI PDF plugin behaved correctly. Delete them now that the PPAPI
PDF plugin is gone.

Bug: 1302684
Change-Id: Ib9624774a7a4028b6f7c48dc85c2ea585971dd82
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3506231
Reviewed-by: K. Moon <kmoon@chromium.org>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Derek Schuff <dschuff@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#979388}
2022-03-09 20:12:19 +00:00
Xiaohan Wang
1ecfd006fd content: Use BUILDFLAG for OS checking
Use BUILDFLAG(IS_XXX) instead of defined(OS_XXX).

Generated by `os_buildflag_migration.py` (https://crrev.com/c/3311983).

R=thakis@chromium.org

Bug: 1234043
Test: No functionality change
Change-Id: Ia0eae6f9396065e190929d42600012c9324c07e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3399774
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Owners-Override: Xiaohan Wang <xhwang@chromium.org>
Auto-Submit: Xiaohan Wang <xhwang@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Owners-Override: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#961157}
2022-01-19 22:33:10 +00:00
Dave Tapuska
a1d4d4358d Remove unused variables from GetPluginInfo
These variables went unused so remove them so we don't need
to look them up.

BUG=850278

Change-Id: Ib92a305f858919c10ba614d06641b632ff813182
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3308826
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#946716}
2021-11-30 22:48:23 +00:00
Sharon Yang
a005ca1217 Move ProcessLock to a separate file
ProcessLock is a large enough class that it should be in its own file.

Test: CQ (no functionality changed)
Change-Id: Id706fc5c4fc1b5ba4835507519df7db3bb6cd1a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3271768
Commit-Queue: Sharon Yang <yangsharon@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#942265}
2021-11-16 20:09:42 +00:00
Avi Drissman
bb0f59d26e Remove Flash debug URLs
Start with Flash debug URLs, and remove lots of code related to
handling them.

Fixed: 1263693
Change-Id: I17f898db54589ec9ddc6450ee77c7b8f329436f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3245978
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Robert Kaplow <rkaplow@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#935993}
2021-10-28 18:12:54 +00:00
K. Moon
343ae351c9 Remove unused PluginServiceFilter parameters
Removes unused parameters from PluginServiceFilter::IsPluginAvailable().
Note that because Blink caches plugin availability per process, it's not
correct to vary plugin availability on most of these parameters, which
resulted in bugs like crbug.com/1261758.

Also adds back ChromePluginServiceFilterTest cases for
IsPluginAvailable(), as crrev.com/833469 dropped all of the existing
tests.

Bug: 850278
Change-Id: I82f15c476ac93bb0c1cb719c640ca068374f1b42
Fixed: 1261922
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3248711
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#935617}
2021-10-27 22:10:54 +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
John Abd-El-Malek
b09daeecd3 More simplifications in content now that ProcessHostOnUI is the only path.
Bug: 904556
Change-Id: I811629156a2cc24d55e7f859d8881639dc8e4431
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3176490
Auto-Submit: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#924315}
2021-09-23 15:29:34 +00:00
Lei Zhang
7ca4a7aa95 Remove unnecessary includes of web_contents_impl.h.
Don't include it if it is not needed, especially since
web_contents_impl.h is a big header. Add other headers that
web_contents_impl.h transitively included to fix the build.

Bug: 242216
Change-Id: I62050b638b402a32a5a6846a1240228b29b879dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3033578
Reviewed-by: Charlie Reis <creis@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#902511}
2021-07-16 17:39:44 +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
Jan Wilken Dörrie
522370fb5f [LSC] Disallow base::ASCIIToUTF16("...") outside of tests
This change modifies base::ASCIIToUTF16 to cause compilation errors when
it is used with a string constant outside of tests. Instead, callers
should just use a UTF16 literal (u"...") instead.

Bug: 1189439
Change-Id: If6650eb69ce7de5c5f371b6b6003705aaf508393
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2826458
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#873352}
2021-04-16 17:22:39 +00:00
John Abd-El-Malek
1b4dbdacb9 Move ProcessHosts for non renderer processes to the main thread.
They were on the IO thread to avoid deadlocks with NPAPI plugins, but we don't have that anymore.

Currently this is off by default behind a feature flag. I have tried to minimize the churn in the code to enable this. Some places where it would involve too much duplication or refactoring I've kept with PostTasks from UI to UI thread. Once this is enabled by default then I'll simplify all the callsites.

Bug: 904556
Change-Id: Ib664d644e0af016d5736348218bcc38cb79341f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2806425
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Owners-Override: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#870614}
2021-04-08 18:15:42 +00:00
Jan Wilken Dörrie
aace0cfef2 [LSC] Replace base::string16 with std::u16string in //{chrome*,content}
This change replaces base::string16 with std::u16string in //chrome,
//chromecast, //chromeos and //content.

Reproduction steps:
$ git grep -lw 'base::string16' chrome* content | \
      xargs sed -i 's/\bbase::string16\b/std::u16string/g'
$ git cl format

Bug: 1184339
Change-Id: I8fae0ab25b5d9bf1cb416ae5f47d7f680fb8f3ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2752229
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#862152}
2021-03-11 22:01:58 +00:00
Lukasz Anforowicz
37893bf803 No Flash => removing CrossOriginReadBlockingExceptionForPlugin.
This CL removes network::CrossOriginReadBlockingExceptionForPlugin and
content::RenderProcessHostImpl::AddCorbExceptionForPlugin (and any other
code these removals transitively enable).

The CL also needs to adjust how the test plugins work:

1. Changing PluginServiceImpl::FindOrStartPpapiPluginProcess to use the
   NetworkService::AddAllowedRequestInitiatorForPlugin mechanism for
   the test plugin (the same mechanism that is used for the PDF plugin).
   This is needed to make sure that the test plugin continues passing
   request_initiator_origin_lock checks and CORB checks.

   This change requires that FindOrStartPpapiPluginProcess always sees a
   non-null `origin_lock` - this is accomplished by isolating all
   non-NaCl plugins in IsOriginIsolatedPepperPlugin (also avoiding
   isolation in presence of the --ppapi-in-process switch used by some
   tests).

2. Removing CORB/Flash-specific tests and supporting test code,
   or tweaking them to simulate PDF-related functionality.

Fixed: 1134401
Change-Id: Iac3579b2f3c66ac434583fcbb3119ac6857ec436
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2560827
Reviewed-by: Raymes Khoury <raymes@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Weilun Shi <sweilun@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834542}
2020-12-08 03:13:03 +00:00
Dave Tapuska
8f372b1bce Prepare for content/common/view_messsage.h removal.
Remove unnecessary includes.
Move a few param definitions over to content_param_traits_macros.h

BUG=1097816

Change-Id: I684d06cb3d518448cbb15049477f4bb3ce65b779
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2490247
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Martin Barbella <mbarbella@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821739}
2020-10-28 16:16:03 +00:00
Bill Budge
1d71c85d74 [Flash] Delete PPB_Broker_Trusted, PPP_Broker APIs
- Removes PPB_Broker_Trusted and PPP_Broker APIs.
- Removes Broker related messages and browser implementation.
- Removes kPpapiBrokerProcess and kPpapiFlashArgs content flags.
- Removes kPpapiBrokerProcess Sandbox flag. No plugin processes
  can generate executable code.
- Removes PluginGlobals::GetCmdLine method.

Bug: chromium:1064652,chromium:1133894,chromium:1133887
Change-Id: I697aeae388f1d14edcb737579830a35fcac390f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2473438
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817905}
2020-10-16 14:00:26 +00:00
Lukasz Anforowicz
dcd286f70f s/request_initiator_site_lock/request_initiator_origin_lock/
After r797542 (which removed
SiteInstanceImpl::GetRequestInitiatorSiteLock) we always use an exact
origin (never an approximate site) as |request_initiator_site_lock|.
Because of that, this CL renames ..._site_lock to ..._origin_lock.

Bug: 918967
Tbr: mmenke@chromium.org (//chrome/renderer/net)
Tbr: dbertoni@chromium.org (//extensions/browser)
Tbr: chromium-metrics-reviews@google.com (histograms.xml)
Change-Id: Ifbe801eafccd641d11cb14ecef83ab097d01eb0f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2274251
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799354}
2020-08-18 22:16:31 +00:00
Avi Drissman
7c57be77a7 Migrate to OS_MAC and OS_APPLE in content
Because content is not used by iOS, this migrates
 defined(OS_MACOSX) -> defined(OS_MAC)

Bug: 1105907
Change-Id: Ibf85273fea9c5566594ca00f2589b890515be6c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2321210
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792842}
2020-07-29 20:09:46 +00:00
W. James MacLean
e84fa11351 Refactor to use ProcessLock.
The second CL in implementing origin-/site-keying of SiteInstances.
https://crbug.com/1085275/#c2 lists the sequence of CLs and what each
will accomplish.

This CL is a refactor to introduce the ProcessLock class to replace
the GURLs returned by GetOriginLock() and related functions.

It also combines some argument lists that take both a SiteURL and a
LockURL and instead uses SiteInfo or ProcessLock. One notable example
is RenderProcessHostImpl::IsSuitableHost().

Bug: 1067389, 846155
Change-Id: I3c6f67f2bf6f1ce3ed2bc394dbd92827ebd8a50a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2246923
Commit-Queue: James MacLean <wjmaclean@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Aaron Colwell <acolwell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#788226}
2020-07-14 17:25:54 +00:00
Gabriel Charette
e7cdc5cd07 [BrowserThread] Migration callers without full content:: namespace
Note to QA: This CL is purely mechanical and shouldn't be blamed
for future regressions on touched files.

This is a follow-up to https://chromium-review.googlesource.com/c/chromium/src/+/2211138
which already removed all usage using content::BrowserThread.

Hence this script now matches unqualified BrowserThread:: without
risking having "content::" be selected as "traits_before" by the regex
(ran on same revision as step ).

content:: is now always added if outside namespace content {}
(deleting unused using content::BrowserThread; decls)

Script @ https://crbug.com/1026641#c92

(will TBR fdoray@ post-review for mechanical change)
TBR=fdoray@hchromium.org

AX-Relnotes: n/a.
Bug: 1026641
Change-Id: I51ae2f83eb17d19b54563fd9b4fc040d2aa0c948
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212469
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772458}
2020-05-27 23:35:05 +00:00
Alexander Timin
e3ec419d4f [content] Add RenderFrameHostImpl::GetPageUkmSourceId.
Replace WebContentsImpl::GetUkmSourceIdForLastCommittedSource with a
RenderFrameHost-based method.

- RenderFrameHost-based method works correctly for non-current frames,
  unlike WebContentsImpl-based method.
- GetPageUkmSourceId (page load == main-frame committed cross-document
  navigation) should be more intuitive than
  GetUkmSourceIdForLastCommittedSource.

BUG=1061899
R=alexmos@chromium.org,rkaplow@chromium.org
TBR=alexmos@chromium.org
CC=​​​​bmcquade@chromium.org,csharrison@chromium.org

Change-Id: I66d1520fbcb8ea4b59d7d0c3cbcbdbfa16516789
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132393
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Bryan McQuade <bmcquade@chromium.org>
Reviewed-by: Steven Holte <holte@chromium.org>
Commit-Queue: Alexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760530}
2020-04-20 16:39:40 +00:00
Gabriel Charette
9fb704a00b Mass-migrate users of base::ThreadPool() as a trait to base::ThreadPool:: API [content/]
Split content/ from https://chromium-review.googlesource.com/c/chromium/src/+/2026350
as it had trouble landing in one go.

The following script was used to generate this CL (run on every C++
file in the codebase; processing .h before matching .cc/.mm):
https://bugs.chromium.org/p/chromium/issues/detail?id=1026641#c22
(intentionally ignores cleaning post_task.h for now).

TBR=fdoray@chromium.org, tsepez@chromium.org

Bug: 1026641
Change-Id: I27c51f5648ea518122b90fde09f09b19afd07972
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2074918
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744669}
2020-02-26 16:10:21 +00:00
Lukasz Anforowicz
66224ac5c6 [reland] Relax request_initiator_site_lock checks for PDF plugin.
In some scenarios (e.g. http range requests for linearized PDFs) the PDF
plugin may need to initiate requests on behalf of the PDF's origin.
Such requests are currently proxied by the renderer process hosting the
plugin (i.e. the renderer hosting the PDF extension -
mhjfbmdgcfjbbpaeojofohoefgiehjai) and therefore go through
URLLoaderFactory that is locked via request_initiator_site_lock to a
different origin (i.e. the origin of the PDF extension, rather than the
origin of the website that hosts the PDF file).

Before this CL, such requests would be classified by
CorsURLLoaderFactory::IsSane and
VerifyRequestInitiatorLockWithPluginCheck as incorrect and possibly
malicious.  After this CL, the request_initiator checks are relaxed by
PluginServiceImpl::FindOrStartPpapiPluginProcess using a new mechanism
similar to AddCorbExceptionForPlugin exemption available for Flash.

We don't want to relax request_initiator_site_lock checks for renderer
processes hosting arbitrary origins from the web, so as a
defense-in-depth the CL adds a CHECK to FindOrStartPpapiPluginProcess
that verifies the origin lock of the renderer process that is granted
the extra capabilities.

Relevant tests:
- ChromeFindRequestManagerTest.FindInChunkedPDF (tests that range
  request do not result in a request initiator lock mismatch)
- PDFExtensionTest.EnsureInternalPluginDisabled (tests that the PDF
  plugin may only be embedded in trustworthy contexts)
- PDFExtensionTest.RedirectsFailInPlugin (the 'noRedirectsSucceed' testcase
  tests non-range requests initiated by the PDF plugin)

Bug: 1027173
Tbr: creis@chromium.org
Tbr: nasko@chromium.org
Tbr: yhirano@chromium.org
Change-Id: I9a8f284a8927b1230c5088f8c46aca118e934c8d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2036558
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737939}
2020-02-03 22:04:33 +00:00
Łukasz Anforowicz
56690d0d3b Revert "Relax request_initiator_site_lock checks for PDF plugin."
This reverts commit ad44950ea6.

Reason for revert: Test flakiness reported in https://crbug.com/1047941

Original change's description:
> Relax request_initiator_site_lock checks for PDF plugin.
> 
> In some scenarios (e.g. http range requests for linearized PDFs) the PDF
> plugin may need to initiate requests on behalf of the PDF's origin.
> Such requests are currently proxied by the renderer process hosting the
> plugin (i.e. the renderer hosting the PDF extension -
> mhjfbmdgcfjbbpaeojofohoefgiehjai) and therefore go through
> URLLoaderFactory that is locked via request_initiator_site_lock to a
> different origin (i.e. the origin of the PDF extension, rather than the
> origin of the website that hosts the PDF file).
> 
> Before this CL, such requests would be classified by
> CorsURLLoaderFactory::IsSane and
> VerifyRequestInitiatorLockWithPluginCheck as incorrect and possibly
> malicious.  After this CL, the request_initiator checks are relaxed by
> PluginServiceImpl::FindOrStartPpapiPluginProcess using a new mechanism
> similar to AddCorbExceptionForPlugin exemption available for Flash.
> 
> We don't want to relax request_initiator_site_lock checks for renderer
> processes hosting arbitrary origins from the web, so as a
> defense-in-depth the CL adds a CHECK to FindOrStartPpapiPluginProcess
> that verifies the origin lock of the renderer process that is granted
> the extra capabilities.
> 
> Relevant tests:
> - ChromeFindRequestManagerTest.FindInChunkedPDF (tests that range
>   request do not result in a request initiator lock mismatch)
> - PDFExtensionTest.EnsureInternalPluginDisabled (tests that the PDF
>   plugin may only be embedded in trustworthy contexts)
> - PDFExtensionTest.RedirectsFailInPlugin (the 'noRedirectsSucceed' testcase
>   tests non-range requests initiated by the PDF plugin)
> 
> Bug: 1027173
> Change-Id: Ib5111fd7a5d5b31727a9754c46c316e75def5143
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1986923
> Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
> Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
> Reviewed-by: Nasko Oskov <nasko@chromium.org>
> Reviewed-by: Charlie Reis <creis@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#737503}

TBR=creis@chromium.org,nasko@chromium.org,yhirano@chromium.org,lukasza@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1027173
Change-Id: Icc030c676025c042b7647f5ac265511bbb6f25cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2035857
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737832}
2020-02-03 18:06:14 +00:00
Lukasz Anforowicz
ad44950ea6 Relax request_initiator_site_lock checks for PDF plugin.
In some scenarios (e.g. http range requests for linearized PDFs) the PDF
plugin may need to initiate requests on behalf of the PDF's origin.
Such requests are currently proxied by the renderer process hosting the
plugin (i.e. the renderer hosting the PDF extension -
mhjfbmdgcfjbbpaeojofohoefgiehjai) and therefore go through
URLLoaderFactory that is locked via request_initiator_site_lock to a
different origin (i.e. the origin of the PDF extension, rather than the
origin of the website that hosts the PDF file).

Before this CL, such requests would be classified by
CorsURLLoaderFactory::IsSane and
VerifyRequestInitiatorLockWithPluginCheck as incorrect and possibly
malicious.  After this CL, the request_initiator checks are relaxed by
PluginServiceImpl::FindOrStartPpapiPluginProcess using a new mechanism
similar to AddCorbExceptionForPlugin exemption available for Flash.

We don't want to relax request_initiator_site_lock checks for renderer
processes hosting arbitrary origins from the web, so as a
defense-in-depth the CL adds a CHECK to FindOrStartPpapiPluginProcess
that verifies the origin lock of the renderer process that is granted
the extra capabilities.

Relevant tests:
- ChromeFindRequestManagerTest.FindInChunkedPDF (tests that range
  request do not result in a request initiator lock mismatch)
- PDFExtensionTest.EnsureInternalPluginDisabled (tests that the PDF
  plugin may only be embedded in trustworthy contexts)
- PDFExtensionTest.RedirectsFailInPlugin (the 'noRedirectsSucceed' testcase
  tests non-range requests initiated by the PDF plugin)

Bug: 1027173
Change-Id: Ib5111fd7a5d5b31727a9754c46c316e75def5143
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1986923
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737503}
2020-01-31 23:00:10 +00:00
Lukasz Anforowicz
4600ea3f8c Enforcing in the browser process which origins may embed the PDF plugin.
Before this CL, the PDF plugin process would enforce that it may only be
embedded inside the PDF extension's origin
(mhjfbmdgcfjbbpaeojofohoefgiehjai) and inside chrome://print.  After
this CL, this enforcement is done in the browser process instead.  The
earlier enforcement helps add security assertions that follow-up CLs may
depend on - for example see:
https://crrev.com/c/1986923/15/content/browser/plugin_service_impl.cc#211

The already existing PDFExtensionTest.EnsureInternalPluginDisabled test
makes sure that the PDF plugin may not be embedded in a data: URL.

Bug: 1027173
Change-Id: I0d1d47d9dee7de92d1f3cbb44a72d38b14236f69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2003262
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733121}
2020-01-18 02:37:48 +00:00
Hans Wennborg
5ffd1393b3 Include bloat: reduce number of includes in content_browser_client.h
This reduces the number of preprocessor tokens in
content_browser_client.h from 1,335,281 to 754,474. Since this is a
widely included file, reducing build times a fair bit (see bug).

TBR=tsepez for content/browser/child_process_security_policy_*

Bug: 1014009
Change-Id: Id3c2de29f5b08cab80820d01aff722afeb1618e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1857126
Commit-Queue: Hans Wennborg <hans@chromium.org>
Reviewed-by: Richard Coles <torne@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Camille Lamy <clamy@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706388}
2019-10-16 11:00:02 +00:00
Clark DuVall
1df2052bf8 Remove ResourceContext from PluginService
This switches to using BrowserContext instead of ResourceContext for
PluginService and plugin_utils.cc. This required moving
PluginRegistryImpl, PluginInfoHostImpl, and
RenderFrameMessageFilter::OnGetPluginInfo to run on the UI thread.

This eliminates one of the major dependencies of extensions::InfoMap.

Bug: 980774
Change-Id: I7b26c5b40dc8b98c518339b771249ef16e6ec856
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1730093
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#684082}
2019-08-05 19:58:46 +00:00
Sami Kyostila
8e4d5a915e content/browser: Always specify thread affinity when posting tasks
*** Note: There is no behavior change from this patch. ***

The PostTask APIs will shortly be changed to require all tasks to explicitly
specify their thread affinity, i.e., whether the task should run on the thread
pool or a specific named thread such as a BrowserThread. This patch updates all
call sites with thread affinity annotation. We also remove the "WithTraits"
suffix to make the call sites more readable.

Before:

    // Thread pool task.
    base::PostTaskWithTraits(FROM_HERE, {...}, ...);

    // UI thread task.
    base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI, ...}, ...);

After:

    // Thread pool task.
    base::PostTask(FROM_HERE, {base::ThreadPool(), ...}, ...);

    // UI thread task.
    base::PostTask(FROM_HERE, {BrowserThread::UI, ...}, ...);

This patch was semi-automatically prepared with these steps:

    1. Patch in https://chromium-review.googlesource.com/c/chromium/src/+/1635827
       to make thread affinity a build-time requirement.
    2. Run an initial pass with a clang rewriter:
       https://chromium-review.googlesource.com/c/chromium/src/+/1635623
    3. ninja -C out/Debug | grep 'requested here' | cut -d: -f1-3 | sort | \
           uniq > errors.txt
    4. while read line; do
         f=$(echo $line | cut -d: -f 1)
         r=$(echo $line | cut -d: -f 2)
         c=$(echo $line | cut -d: -f 3)
         sed -i "${r}s/./&base::ThreadPool(),/$c" $f
       done < errors.txt
    5. GOTO 3 until build succeeds.
    6. Remove the "WithTraits" suffix from task API call sites:

       $ tools/git/mffr.py -i <(cat <<EOF
       [
         ["PostTaskWithTraits",                            "PostTask"],
         ["PostDelayedTaskWithTraits",                     "PostDelayedTask"],
         ["PostTaskWithTraitsAndReply",                    "PostTaskAndReply"],
         ["CreateTaskRunnerWithTraits",                    "CreateTaskRunner"],
         ["CreateSequencedTaskRunnerWithTraits",           "CreateSequencedTaskRunner"],
         ["CreateUpdateableSequencedTaskRunnerWithTraits", "CreateUpdateableSequencedTaskRunner"],
         ["CreateSingleThreadTaskRunnerWithTraits",        "CreateSingleThreadTaskRunner"],
         ["CreateCOMSTATaskRunnerWithTraits",              "CreateCOMSTATaskRunner"]
       ]
       EOF
       )

This CL was uploaded by git cl split.

R=boliu@chromium.org, tsepez@chromium.org

Bug: 968047
Change-Id: I346372d16a3856186ea74d14e0dd8a12f7cacae5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1729589
Commit-Queue: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Auto-Submit: Sami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683554}
2019-08-02 12:45:05 +00:00
Tommy C. Li
8d6b229ad8 Reland "Click to Open PDF: Improve first-time IFRAME throttle behavior"
This is a reland of 5fdbf6eb24

Original change's description:
> Click to Open PDF: Improve first-time IFRAME throttle behavior
>
> Currently, the IFRAME throttle doesn't always work on first-time use,
> when the Chrome process is first started. This is because the IFRAME
> throttle itself doesn't trigger the plugin list load.
>
> This CL updates the throttle to also trigger the plugin list load
> itself (only if it hasn't been loaded already), and should make the
> behavior less flaky.
>
> Bug: 924823
> Change-Id: If51e85bf2d7005af1a5a825279388dd6d9324409
> Reviewed-on: https://chromium-review.googlesource.com/c/1452771
> Commit-Queue: Lei Zhang <thestig@chromium.org>
> Reviewed-by: Nasko Oskov <nasko@chromium.org>
> Reviewed-by: Camille Lamy <clamy@chromium.org>
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#629878}

TBR=

Bug: 924823
Change-Id: I717d5f9d3e7ff902b1adbc6656666fc9c4395dab
Reviewed-on: https://chromium-review.googlesource.com/c/1464654
Commit-Queue: Tommy Li <tommycli@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632281}
2019-02-14 17:55:16 +00:00
Karan Bhatia
291c813431 Revert "Click to Open PDF: Improve first-time IFRAME throttle behavior"
This reverts commit 5fdbf6eb24.

Reason for revert: Introduced tests are failing

Original change's description:
> Click to Open PDF: Improve first-time IFRAME throttle behavior
> 
> Currently, the IFRAME throttle doesn't always work on first-time use,
> when the Chrome process is first started. This is because the IFRAME
> throttle itself doesn't trigger the plugin list load.
> 
> This CL updates the throttle to also trigger the plugin list load
> itself (only if it hasn't been loaded already), and should make the
> behavior less flaky.
> 
> Bug: 924823
> Change-Id: If51e85bf2d7005af1a5a825279388dd6d9324409
> Reviewed-on: https://chromium-review.googlesource.com/c/1452771
> Commit-Queue: Lei Zhang <thestig@chromium.org>
> Reviewed-by: Nasko Oskov <nasko@chromium.org>
> Reviewed-by: Camille Lamy <clamy@chromium.org>
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#629878}

TBR=nasko@chromium.org,thestig@chromium.org,tommycli@chromium.org,clamy@chromium.org

Change-Id: Icb6d2acff0ad9d3bcc9072bf3e6ca42d653f27a3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 924823, 929819
Reviewed-on: https://chromium-review.googlesource.com/c/1459339
Reviewed-by: Karan Bhatia <karandeepb@chromium.org>
Commit-Queue: Karan Bhatia <karandeepb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#630041}
2019-02-07 20:19:39 +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
Tommy C. Li
5fdbf6eb24 Click to Open PDF: Improve first-time IFRAME throttle behavior
Currently, the IFRAME throttle doesn't always work on first-time use,
when the Chrome process is first started. This is because the IFRAME
throttle itself doesn't trigger the plugin list load.

This CL updates the throttle to also trigger the plugin list load
itself (only if it hasn't been loaded already), and should make the
behavior less flaky.

Bug: 924823
Change-Id: If51e85bf2d7005af1a5a825279388dd6d9324409
Reviewed-on: https://chromium-review.googlesource.com/c/1452771
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Camille Lamy <clamy@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#629878}
2019-02-07 05:04:26 +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