0
Commit Graph

26 Commits

Author SHA1 Message Date
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
Julie Jeongeun Kim
39a991e6ff Convert BrowserAssociatedInterface to new Mojo types
This CL converts BrowserAssociatedInterface to new Mojo types
using AssociatedReceiverSet instead of AssociatedBindingSet.

Bug: 955171
Change-Id: I42d3885e3986fbdb5ead5d658b9ab32b274462b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1946189
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#721966}
2019-12-05 11:01:20 +00:00
Julie Jeongeun Kim
d7ef146478 Clean up old Mojo types for BrowserAssociatedInterfaceTestDriver and WebContentsFrameBindingSetTest
This CL cleans up old Mojo types for
mojom::BrowserAssociatedInterfaceTestDriver and
mojom::WebContentsFrameBindingSetTest with using
AssociatedRemote and PendingAssociatedRecevier.

Bug: 955171
Change-Id: Ifd937d9c3014af8616d12426ad239dce98efee59
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1880407
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#709736}
2019-10-26 02:12:00 +00:00
Gabriel Charette
c710874894 Reland "[TaskEnvironment] Complete migration with header rename"
This is a reland of 18947083c7

The move_source_file.py script's formatting rules incorrectly
formatted services/device/generic_sensor/platform_sensor_and_provider_unittest_win.cc
after all. But we also can't rely 100% on git cl format (crbug.com/997063)
so I ended up performing a git cl format && git add -up
(+interactive addition of missing blank line after foo.h when included
from top of foo.cc)

Also added
$ tools/git/move_source_file.py net/test/test_with_scoped_task_environment.h net/test/test_with_task_environment.h

Original change's description:
> [TaskEnvironment] Complete migration with header rename
>
> This is merely:
>
> $ tools/git/move_source_file.py base/test/scoped_task_environment.h base/test/task_environment.h
> $ tools/git/move_source_file.py base/test/scoped_task_environment.cc base/test/task_environment.cc
> $ tools/git/move_source_file.py base/test/scoped_task_environment_unittest.cc base/test/task_environment_unittest.cc
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.h content/public/test/browser_task_environment.h
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.cc content/public/test/browser_task_environment.cc
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle_unittest.cc content/public/test/browser_task_environment_unittest.cc
> $ tools/git/move_source_file.py ios/web/public/test/test_web_thread_bundle.h ios/web/public/test/web_task_environment.h
> $ tools/git/move_source_file.py ios/web/test/test_web_thread_bundle.cc ios/web/test/web_task_environment.cc
>
> and a few manual renames in DEPS files missed by the script
>
> This CL uses --bypass-hooks to avoid having to git cl format because
> many headers are being reordered by git cl format and it's too many to
> figure out in a no-op CL which ones are okay with it.
> windows.h for one should typically be first and another one of the
> reorderings in PS3 even caused a compile failure:
> https://chromium-review.googlesource.com/c/chromium/src/+/1764962/3/components/services/font/font_loader_unittest.cc
>
> TBR=dcheng@chromium.org
>
> Bug: 992483
> Change-Id: I32a4afd43ef779393c95d9873c157be2d3da1dd1
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1764962
> Reviewed-by: Gabriel Charette <gab@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Commit-Queue: Gabriel Charette <gab@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#689778}

TBR=dcheng@chromium.org

Bug: 992483
Change-Id: I6179dd1329a4d30bf5c65450ea893537f31e6f85
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1767658
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689794}
2019-08-23 03:31:40 +00:00
Gabriel Charette
b69fcd4f6e Revert "[TaskEnvironment] Complete migration with header rename"
This reverts commit 18947083c7.

Reason for revert: broke Win

Original change's description:
> [TaskEnvironment] Complete migration with header rename
> 
> This is merely:
> 
> $ tools/git/move_source_file.py base/test/scoped_task_environment.h base/test/task_environment.h
> $ tools/git/move_source_file.py base/test/scoped_task_environment.cc base/test/task_environment.cc
> $ tools/git/move_source_file.py base/test/scoped_task_environment_unittest.cc base/test/task_environment_unittest.cc
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.h content/public/test/browser_task_environment.h
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.cc content/public/test/browser_task_environment.cc
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle_unittest.cc content/public/test/browser_task_environment_unittest.cc
> $ tools/git/move_source_file.py ios/web/public/test/test_web_thread_bundle.h ios/web/public/test/web_task_environment.h
> $ tools/git/move_source_file.py ios/web/test/test_web_thread_bundle.cc ios/web/test/web_task_environment.cc
> 
> and a few manual renames in DEPS files missed by the script
> 
> This CL uses --bypass-hooks to avoid having to git cl format because
> many headers are being reordered by git cl format and it's too many to
> figure out in a no-op CL which ones are okay with it.
> windows.h for one should typically be first and another one of the
> reorderings in PS3 even caused a compile failure:
> https://chromium-review.googlesource.com/c/chromium/src/+/1764962/3/components/services/font/font_loader_unittest.cc
> 
> TBR=dcheng@chromium.org
> 
> Bug: 992483
> Change-Id: I32a4afd43ef779393c95d9873c157be2d3da1dd1
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1764962
> Reviewed-by: Gabriel Charette <gab@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Commit-Queue: Gabriel Charette <gab@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#689778}

TBR=dcheng@chromium.org,gab@chromium.org

Change-Id: I9aa8ff558d1ff78cebe0c25e559c017578ad4f53
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 992483
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1767657
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689780}
2019-08-23 02:13:29 +00:00
Gabriel Charette
18947083c7 [TaskEnvironment] Complete migration with header rename
This is merely:

$ tools/git/move_source_file.py base/test/scoped_task_environment.h base/test/task_environment.h
$ tools/git/move_source_file.py base/test/scoped_task_environment.cc base/test/task_environment.cc
$ tools/git/move_source_file.py base/test/scoped_task_environment_unittest.cc base/test/task_environment_unittest.cc
$ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.h content/public/test/browser_task_environment.h
$ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.cc content/public/test/browser_task_environment.cc
$ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle_unittest.cc content/public/test/browser_task_environment_unittest.cc
$ tools/git/move_source_file.py ios/web/public/test/test_web_thread_bundle.h ios/web/public/test/web_task_environment.h
$ tools/git/move_source_file.py ios/web/test/test_web_thread_bundle.cc ios/web/test/web_task_environment.cc

and a few manual renames in DEPS files missed by the script

This CL uses --bypass-hooks to avoid having to git cl format because
many headers are being reordered by git cl format and it's too many to
figure out in a no-op CL which ones are okay with it.
windows.h for one should typically be first and another one of the
reorderings in PS3 even caused a compile failure:
https://chromium-review.googlesource.com/c/chromium/src/+/1764962/3/components/services/font/font_loader_unittest.cc

TBR=dcheng@chromium.org

Bug: 992483
Change-Id: I32a4afd43ef779393c95d9873c157be2d3da1dd1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1764962
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689778}
2019-08-23 02:05:33 +00:00
Gabriel Charette
f893a28a02 [BrowserTaskEnvironment] Rename variables with uncommon names too
As discussed @
https://chromium-review.googlesource.com/c/chromium/src/+/1758440/8#message-f222f67d1440dc03932cb7b666ad65dde5a22b33

Used the following regex to identify files with such variables:
(Browser|Web)TaskEnvironment ([^t]|t[^a]|ta[^s]|tas[^k])\w*;

And then replaced remaining \w*(threads_|bundle_)\w* in the affected
files.

TBR=dcheng@chromium.org

Bug: 992483
Change-Id: Ie363916c3b362d3b1b797db97000b51bceb148aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1762330
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689148}
2019-08-21 20:37:19 +00:00
Gabriel Charette
798fde7bc9 [Browser/WebTaskEnvironment] Mass-migrate away from Test(Browser|Web)ThreadBundle
This is
 1) s/TestBrowserThreadBundle/BrowserTaskEnvironment/ on src/
 2) s/([^/])\b\w*thread_bundle(_)?/\1task_environment\2/ on files modified in (1)
 3) git cl format
 4) Manually fix up remainder "ThreadBundle" and "thread_bundle" found via
    string search on the whole of src/.

For ease of review:
 * Step  is the diff between patch sets 1..2
 * Step  is the diff between patch sets 2..3

TBR=dcheng@chromium.org
(for post-review owners bypass per mechanical change)

Bug: 992483
Change-Id: I4945141f6d78bdc6c98444198e5012ddc8e5bff0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1758440
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688755}
2019-08-20 22:24:04 +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
Carlos Caballero
dd8bf7b04a Deprecate MessageLoop::Type
It is currently just an alias to MessagePump::Type. This patch changes
a bunch of references to use MessagePump::Type as MessageLoop will eventually
disappear.

Also rename base::Thread::Options::message_loop_type to message_pump_type
It is weird to see things like

message_loop_type = MessagePump::Type::UI

Also change some other instances that I happened to see in the form
loop_type = MessagePump::Type::UI
to
pump_type = MessagePump::Type::UI

This is a mechanical change that will be reviewed according to
https://chromium.googlesource.com/chromium/src/+/master/docs/code_reviews.md#mechanical-changes

BUG=891670
TBR=gab@chromium.org

Change-Id: Ib41ccc6547b8c9fa0bdba5d23c4767ae03f2a97d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1718331
Commit-Queue: Carlos Caballero <carlscab@google.com>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682254}
2019-07-30 14:14:15 +00:00
Sebastien Marchand
f8cbfab434 Include base/bind.h in the files that use it (in //content).
Gab, I've used your refactoring script for this, the rule is:
  matches = re.compile(r'(\n *[^/\n][^/\n]*base::Bind(Once|Repeating)?\b[^*])', re.DOTALL).findall(content)

  if not matches:
    return False

  updated_content = refactor_lib.AddInclude(file_path, content, "base/bind.h")

  if updated_content == content:
    return False

  # Write updated file
  refactor_lib.WriteFile(file_path, updated_content)

TBR=gab@chromium.org

Change-Id: I6cca9dff7fa4937fd7accdc57fe774674f6c147b
Reviewed-on: https://chromium-review.googlesource.com/c/1437100
Commit-Queue: Sébastien Marchand <sebmarchand@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#626088}
2019-01-25 16:02:30 +00:00
Alexander Timin
4f9c35c363 [message_loop] Remove message_loop_forward.h
As a final step, replace all includes back:
- mv message_loop_current.h message_loop.h
- s/message_loop_forward.h/message_loop.h/ in all includes.
- s/message_loop_forward.h/message_loop.h/ in base/BUILD.gn
- Remove message_loop_forward.h from third_party/DEPS.

TBR=gab@chromium.org
R=gab@chromium.org
BUG=891670

Change-Id: I623077025701459ddb7045cbcfdad138aa90a9e4
Reviewed-on: https://chromium-review.googlesource.com/c/1313110
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604690}
2018-11-01 20:15:20 +00:00
Alexander Timin
c643d0e146 [message_loop] Temporary introduce message_loop_forward.h.
To facilitate splitting MessageLoop into MessageLoop and MessageLoopImpl
introduce message_loop_forward.h and use it everywhere.

- s/message_loop.h/message_loop_forward.h/ in all includes.
- Add message_loop_forward.h to base/BUILD.gn.
- Add message_loop_forward.h to third_party/DEPS.

TBR=gab@chromium.org
BUG=891670

Change-Id: Ibac3a24f5bd4291c9d57dd32c627477e4e6ef324
Reviewed-on: https://chromium-review.googlesource.com/c/1313108
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604672}
2018-11-01 19:43:28 +00:00
Eric Seckler
8652dcd5d8 content: Replace uses of BrowserThread task posting with post_task.h API
This patch updates callsites of BrowserThread task posting methods to
use the post_task.h API instead.

Background: We're changing the way tasks are posted to a BrowserThread,
see PSA [1] and design doc [2]. This unifies the way tasks are posted
and paves the way for annotating tasks with task types and other
attributes that can be used to prioritize tasks in the future browser
UI thread scheduler (design doc [3]).

This CL changes callsites of the following forms:
(a) BrowserThread::Post*Task(BrowserThread::UI/IO, ..) to
    base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI/IO}, ..),
(b) BrowserThread::GetTaskRunnerForThread(BrowserThread::UI/IO) to
    base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI/IO}).

It also adds necessary includes. These mechanical changes were applied
by a script.

Tasks posted with the same BrowserThread::ID trait (via
PostTaskWithTraits or TaskRunners obtained from
Create*TaskRunnerWithTraits) will still execute in the order they
were posted, see [4].

[1] https://groups.google.com/a/chromium.org/d/topic/chromium-dev/A3_snMVXv8A/discussion
[2] https://docs.google.com/document/d/1SGy9VTXUwyXEX_yBZ0ukFAnS8B0hDeMUJD-1iALaE-Q/edit?usp=sharing
[3] https://docs.google.com/document/d/1z1BDq9vzcEpkhN9LSPF5XMnZ0kLJ8mWWkNAi4OI7cos/edit?usp=sharing
[4] https://cs.chromium.org/chromium/src/base/task/post_task.h?l=66

TBR=achuith@chromium.org, afakhry@chromium.org, agl@chromium.org, avi@chromium.org, bbudge@chromium.org, bengr@chromium.org, benwells@chromium.org, bnc@chromium.org, calamity@chromium.org, ccameron@chromium.org, chiniforooshan@chromium.org, cjgrant@chromium.org, cmumford@chromium.org, csharrison@chromium.org, dalecurtis@chromium.org, delphick@chromium.org, dgozman@chromium.org, dmazzoni@chromium.org, droger@chromium.org, dschuff@chromium.org, dullweber@chromium.org, erikchen@chromium.org, felt@chromium.org, fgorski@chromium.org, gogerald@chromium.org, groby@chromium.org, horo@chromium.org, imcheng@chromium.org, jcivelli@chromium.org, jianli@chromium.org, jinho.bang@samsung.com, jkarlin@chromium.org, jochen@chromium.org, kinuko@chromium.org, lazyboy@chromium.org, lpy@chromium.org, markusheintz@chromium.org, mattcary@chromium.org, maxmorin@chromium.org, miu@chromium.org, mkwst@chromium.org, mmenke@chromium.org, mpearson@chromium.org, msramek@chromium.org, nick@chromium.org, nparker@chromium.org, nyquist@chromium.org, peter@chromium.org, pwnall@chromium.org, qinmin@chromium.org, rbpotter@chromium.org, rdevlin.cronin@chromium.org, rouslan@chromium.org, scottmg@chromium.org, servolk@chromium.org, skuhne@chromium.org, sky@chromium.org, tapted@chromium.org, tbansal@chromium.org, thestig@chromium.org, tommi@chromium.org, tommycli@chromium.org, torne@chromium.org, tschumann@chromium.org, vabr@chromium.org, vakh@chromium.org, waffles@chromium.org, yfriedman@chromium.org, zmo@chromium.org, bartfab@chromium.org

Bug: 878356
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:linux_vr;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I37526c8e75630ee7bec29421276094a30e903894
Reviewed-on: https://chromium-review.googlesource.com/1186623
Reviewed-by: Eric Seckler <eseckler@chromium.org>
Reviewed-by: Vaclav Brozek <vabr@chromium.org>
Reviewed-by: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Commit-Queue: Eric Seckler <eseckler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592750}
2018-09-20 10:42:28 +00:00
Gabriel Charette
ea9180109b [MessageLoop cleanup] Mass migrate away from MessageLoop::QuitWhenIdleClosure().
TBR=danakj@chromium.org, kylechar@chromium.org

Bug: 825327
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I0d9637bd1a7ef0c7096482d0e612f67da3a8dc1d
Reviewed-on: https://chromium-review.googlesource.com/1055887
Reviewed-by: kylechar <kylechar@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559043}
2018-05-16 11:53:44 +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
Hajime Hoshi
a98f110fa1 Make IPC::ChannelMojo's proxy task runner changeable
This CL adds an argument for listener task runner to IPC::ChannelMojo::
Create{Server,Client} so that we can have more flexible task scheduling.
Now all arguments are base::ThreadTaskRunnerHandle::Get() and this CL
doesn't change the behavior. This CL is just a preparation.

Doc: https://docs.google.com/document/d/1yOhE6-1HLb3aeNWmoa9O2LlnegWjd4awYUn2OhUL4vk/edit#
Change-Id: I2f5c70ff3af499766e7b42de8e33f13dafcefbff
Reviewed-on: https://chromium-review.googlesource.com/756821
Reviewed-by: Yuzhu Shen <yzshen@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Commit-Queue: Hajime Hoshi <hajimehoshi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517764}
2017-11-20 06:34:35 +00:00
Gabriel Charette
dae6f32712 Fix accidental EOF new lines added by script
TBR=thestig@chromium.org

Bug: 781352
Change-Id: I8204f68dae7b360cfa8b9efa573c428e4ac863fd
Reviewed-on: https://chromium-review.googlesource.com/763730
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#515730}
2017-11-10 23:12:48 +00:00
Hajime Hoshi
ff15e975de Make IPC listener task runner changeable
This CL adds an argument for listener task runner to
IPC::ChannelProxy::Create and IPC::SyncChannel::Create so that we
can have more flexible task scheduling. Now all arguments are
base::ThreadTaskRunnerHandle::Get() and this CL doesn't change the
behavior. This CL is just a preparation.

We've already known that channel proxy's OnMessageReceivedNoFilter
posts the most heaviest tasks to the listener task runner.

Doc: https://docs.google.com/document/d/1yOhE6-1HLb3aeNWmoa9O2LlnegWjd4awYUn2OhUL4vk/edit#

Bug: 780785
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Ia0d798c55aeb739d7150e9368350ecd28f4159c6
Reviewed-on: https://chromium-review.googlesource.com/750922
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Commit-Queue: Hajime Hoshi <hajimehoshi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#515115}
2017-11-09 06:37:09 +00:00
Gabriel Charette
aa0a89fc8e Migrate MessageLoop::ScopedNestableTaskAllower to RunLoop::Type::kNestableTasksAllowed in /content/browser
This pass focuses on ML::SNTA in same scope as an anonymous RunLoop().Run()
Scripted via a small tweak of https://bugs.chromium.org/p/chromium/issues/detail?id=781352#c1
which focused on RunLoops with a variable name.

The script should have replaced a MessageLoop::ScopedNestableTaskAllower
in the same scope as a RunLoop with a RunLoop of
Type::kNestableTasksAllowed. If there was a comment above the
MessageLoop::ScopedNestableTaskAllower, it should have been moved
alongside the augmented RunLoop.

Please CQ if LGTY

This CL was uploaded by git cl split.

R=boliu@chromium.org

Bug: 781352
Change-Id: I03737ca2c1e31a2bbcdd6b587e7e5ecff5d4959f
Reviewed-on: https://chromium-review.googlesource.com/758607
Commit-Queue: Gabriel Charette <gab@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#514988}
2017-11-08 23:01:40 +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
Ken Rockot
201a233484 Fix race in BrowserAssociatedInterface setup
It's possible for BrowserAssociatedInterface's InternalState to have
Initialize invoked after ClearBindings, which can in turn lead to a
violation of the assumption that ClearBindings ensures no future message
dispatches to the bound implementation. This can occur in the following
rare but plausible scenario for a type X which inherits
BrowserAssociatedInterface<T>:

  1. Post task to IO thread which may destroy some yet-uncreated
     instance x of type X (e.g. maybe it posts a render process ID
     and we'll later have an X associated with that RPH)
  2. Create x as an instance of type X (posts an IO thread task to
     Initialize x's Internal State)
  3. Interface request is received, posting an IO thread task to bind a
     handle to x.
  3. Task from  executes, locating and deleting x; resetting
     InternalState bindings (not yet initialized anyway).
  4. Task from  executes, initializing the InternalState bindings.
  5. Task from  executes, bindings a handle to the InternalState
  6. Message is received on the bound handle, dispatched to deleted x
  7. UAF!

As it turns out, AssociatedBindingSet does not own any thread-affine
state upon default construction; therefore it can be created on any
thread as long as it's subsequently used and destroyed from a single
thread. Since InternalState already guarantees those conditions, this
CL simply removes the async Initialize step.

BUG=753672
R=jam@chromium.org

Change-Id: Id603fb57d412daf3741b61f7857a29edeaac5443
Reviewed-on: https://chromium-review.googlesource.com/610924
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Ken Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#493797}
2017-08-11 17:52:40 +00:00
Gabriel Charette
53a9ef8107 Mass replace MessageLoop::Quit*() with RunLoop::QuitCurrent*Deprecated().
And added runloop.h alongside message_loop.h in allowed //base dependencies
in Blink platform code as RunLoop is effectively an extension of
MessageLoop and I don't see a reason not to allow it.

TBR: danakj@chromium.org (for the scripted change)
TBR: kinuko@chromium.org (for third_party\Webkit\Source\platform\DEPS tweak)
Bug: 748715
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I36c934a0f22e3ee7ff44d3efb80c6a1fe710b7b5
Reviewed-on: https://chromium-review.googlesource.com/585732
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#489617}
2017-07-26 12:36:23 +00:00
Matt Falkenhagen
507a9fd30d Clear Mojo bindings for associated interfaces in OnFilterRemoved()
This clears the bindings right when the filter is removed, instead
of when the filter is destructed.

Speculative fix for the bug where apparently Mojo messages arrive after
the ServiceWorkerDispatcherHost has been destroyed.

Bug: 736203
Change-Id: Ifae0db23a6a17cfa30b558f714916001d37f6571
Reviewed-on: https://chromium-review.googlesource.com/564746
Commit-Queue: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Makoto Shimazu <shimazu@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486781}
2017-07-14 16:50:26 +00:00
tzik
edb2060602 Use OnceCallback on Mojo interfaces in //content
This CL flips `use_once_calback` flag on the Mojo code generator, and
fixes all compile errors after it. After this CL, Mojo interfaces in
//content starts using base::OnceCallback instead of base::Callback
on its return value handling.

The migration recipe was:
 - Convert pass-by-ref callback objects to pass-by-value.
 - Use std::move() to forward it to other consumer, or to invoke it
   with Callback::Run().
 - Handle wherever copies are required manually.
 - Check if the conversion doesn't change the semantics. As the transfer
   and invocation clobber the callback object, care about use-after-move.
   It's considered safe to consume almost scoped-out callback.

BUG=714018

Review-Url: https://codereview.chromium.org/2871523002
Cr-Commit-Position: refs/heads/master@{#470344}
2017-05-09 15:39:32 +00:00
rockot
a32ca4b3ff Adds BrowserAssociatedInterface
BrowserAssociatedInterface can be implemented in conjunction with
BrowserMessageFilter in order to provide browser-side Mojo bindings
which dispatch on the IO thread and maintain FIFO with respect
to legacy IPC messages on the same channel.

BUG=612500,619202
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2164783005
Cr-Commit-Position: refs/heads/master@{#407644}
2016-07-26 00:15:00 +00:00