0
Commit Graph

52 Commits

Author SHA1 Message Date
Will Harris
e61641f724 Enable explicit conversion checks for base::span sizes.
This CL adds compile-time checks that the size parameter passed
to base::span either by the constructor or the base::make_span
function will fit into a size_t type and are not unsigned.

This is achieved by use of base::StrictNumeric parameter to the
methods and constructor.

This has no runtime overhead, as the checks are done at compile
time.

This CL also contains all the remaining mechanical changes needed
to convert signed numeric literal values to unsigned by adding
a 'u' on the end. Any functional or more complex changes have
already landed in other CLs tagged to this bug with separate
owner review.

This CL also adds no-compile tests for the new APIs.

BUG=1385166

Change-Id: Ic2dbd950842dd811a8dc40ac539c8b824ed983a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4219636
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Owners-Override: danakj <danakj@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Commit-Queue: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1102320}
2023-02-07 19:35:02 +00:00
Ken Rockot
7308d4b616 Mojo: Remove MessageQuotaChecker
This is effectively dead code, enabled only by feature flags which must
be manually enabled and which were added for investigations that are
no longer being done. The feature flags are also removed.

Fixed: 1399511
Change-Id: I3e6462c728c1ee39848670a2bff4f29be61f1865
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4093879
Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1082320}
2022-12-13 06:35:56 +00:00
Sean Maher
5b9af51fdd task posting v3: moving away from ThreadTaskRunnerHandle
To continue the migration away from TaskRunnerHandles, the codebase
was refactored using the following scripts:
shell script:
https://paste.googleplex.com/4673967729147904
python:
https://paste.googleplex.com/5824001174667264

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

Bug: 1026641
AX-Relnotes: n/a.
Change-Id: Ia33b6dfebb15937481c619f5c838720ce7bb2676
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4031817
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1074085}
2022-11-21 15:32:47 +00:00
Avi Drissman
ea1be23a8b Update copyright headers in ipc/, ios/, infra/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c95.

No-Try: true
Bug: 1098010
Change-Id: I958bc4caa48822ca0d15594e906783852cd0c499
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3893343
Reviewed-by: Mark Mentovai <mark@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1047189}
2022-09-14 23:29:06 +00:00
Peter Boström
c68c5aad6c Script remove more DISALLOW_COPY_AND_ASSIGNs
This applies a script previously used for large directories on all
remaining (smaller) directories as a single chunk.

This replaces DISALLOW_COPY_AND_ASSIGN with explicit constructor deletes
where a local script is able to detect its insertion place (~Foo() is
public => insert before this line).

This is incomplete as not all classes have a public ~Foo() declared, so
not all DISALLOW_COPY_AND_ASSIGN occurrences are replaced.

IWYU cleanup is left as a separate pass that is easier when these macros
go away.

Bug: 1010217
Change-Id: I572936462f763e1dd15dd88cdcf451ee14b34dd1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3182480
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#925533}
2021-09-28 00:28:00 +00:00
Ken Rockot
493a59f3e2 Mojo: Introduce GenericPendingAssociatedReceiver
This is analogous to GenericPendingReceiver but for associated
interfaces. It's needed for layering associated interfaces on
GpuChannel, but will also be useful for cleaning up legacy
Channel-associated interface support and for building whatever replaces
that in the future of browser-renderer IPC.

Bug: 1196476
Change-Id: I1380d1e47e3dc66c1364c82a938a7d30f4b4cf3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2903727
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#889485}
2021-06-04 22:16:50 +00:00
Ken Rockot
9fae8bcde8 Defer IPC Channel receiving until safe
For IPC Channels created directly on the main thread it's possible to
start IO-thread receiving too early. The net result is that very rarely
the initial SetPeerPid message may get dropped and stall the channel.

The fix is to wait until the internal Channel interface endpoints
are attached to the pipe before we start reading any messages from it.

Bug: 1216193
Change-Id: I8c33a7d171ae673cd7fdb06e4f7bc6ac48028c6f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2941102
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#889480}
2021-06-04 22:09:49 +00:00
Ken Rockot
fbbd444dee Reland "Allow earlier association of Channel interfaces"
Original CL: https://crrev.com/509586f3
Revert CL: https://crrev.com/676e37c4

This was reverted for breaking GPU Channel setup with the
ProcessHostOnUI experiment. As it turns out, the breakage was not
specific to that experiment and was a relatively straightforward
timing/threading issue.

The issue is fixed upstream by a precursor CL. This is a reland of the
rest of the original CL, essentially unmodified.

Bug: 904556, 1196476
Change-Id: I4fad5d64ebf652b67b3289e18c6619c3a797a54d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2934381
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#889107}
2021-06-04 01:19:14 +00:00
Ken Rockot
676e37c4e1 Revert "Allow earlier association of Channel interfaces"
This reverts commit 509586f352.

Reason for revert: was not sufficient to fix the issue and breaks the ProcessHostOnUI experiment

Original change's description:
> Allow earlier association of Channel interfaces
>
> Previously IPC Channels were always created on the IO thread, and they
> carried an implicit requirement that any Channel-associated interfaces
> could not be associated until after the IO thread initialization was
> done. This is incompatible with the effort to move process hosts to the
> UI thread.
>
> This loosens some unnecessary constraints on how all the ChannelMojo
> internals are set up, and enables off-thread construction and (limited)
> early use of the ChannelMojo prior to IO thread initialization.
>
> Bug: 904556
> Change-Id: I67a72d2b191b20d3757768bb38a5a77f29b3bea2
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2910960
> Commit-Queue: Ken Rockot <rockot@google.com>
> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#885330}

Bug: 904556
Change-Id: I57ba20065b860d8a524ec43db15b0fe4bb130f98
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2911700
Auto-Submit: Ken Rockot <rockot@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Owners-Override: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#885359}
2021-05-21 02:40:54 +00:00
John Abd-El-Malek
509586f352 Allow earlier association of Channel interfaces
Previously IPC Channels were always created on the IO thread, and they
carried an implicit requirement that any Channel-associated interfaces
could not be associated until after the IO thread initialization was
done. This is incompatible with the effort to move process hosts to the
UI thread.

This loosens some unnecessary constraints on how all the ChannelMojo
internals are set up, and enables off-thread construction and (limited)
early use of the ChannelMojo prior to IO thread initialization.

Bug: 904556
Change-Id: I67a72d2b191b20d3757768bb38a5a77f29b3bea2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2910960
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#885330}
2021-05-21 01:15:26 +00:00
Anton Bikineev
1f42a4528f ios, ipc, jingle: Replace base::Optional with absl::optional
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: I549f11d0110f53f4d83de0b514a122e569ae19f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2897880
Auto-Submit: Anton Bikineev <bikineev@chromium.org>
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@{#883282}
2021-05-15 18:02:50 +00:00
Ken Rockot
85bd7c8852 Don't use BigBuffer for IPC::Message transport
Fixed: 1184399
Change-Id: Iddd91ae8d7ae63022b61c96239f5e39261dfb735
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2737012
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#860010}
2021-03-04 23:38:13 +00:00
Alex Turner
02b697aa95 Migrate base::Closure to Once/Repeating for ipc/ directory
Use of base::Bind, base::Callback and base::Closure is deprecated in
favor of the more explicit Once/Repeating versions. Despite being marked
as fixed, ipc/ has a few remaining uses of base::Closure that were
missed in the conversion. This cl fixes those stragglers and enables the
presubmit to avoid any future regressions.

Bug: 1141533, 1007797
Change-Id: I7118bbb7aa45b4ea453909cfa5d1e3ce91c10ef4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505935
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821922}
2020-10-28 22:37:13 +00:00
Julie Jeongeun Kim
69604f6ff8 Convert ipc::mojom::GenericInterface to new Mojo types
This CL converts ipc::mojom::GenericInterface to new Mojo types
with PendingAssociatedReceiver instead of
GenericInterfaceAssociatedRequest.

It also updates GetAssociatedInterface() with
pending_associated_receiver from ipc/ipc.mojom.

Bug: 955171
Change-Id: I92ebbb25e51b1bbf5fba0417413d66455d277744
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1948385
Reviewed-by: Sam McNally <sammc@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#721310}
2019-12-04 01:59:52 +00:00
Sigurdur Asgeirsson
d655dd65fc Push message pipe back pressure back to IPC::ChannelProxy.
This CL implements mojo::internal::MessageQuotaChecker, that allows
unread message quota checking to be performed at send-time in
IPC::ChannelProxy. This in turn allows generating crash dumps with
the abusive producer on the call stack, red handed.

Bug: 1017827
Change-Id: Ib0a7f5cde2c9df00c89bb79834c1cffa211fa6f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1899909
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Commit-Queue: Sigurður Ásgeirsson <siggi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714591}
2019-11-12 19:32:20 +00:00
Julie Jeongeun Kim
903b34b2c2 Convert mojom::Channel to new Mojo types
This CL converts ChannelPtr, ChannelRequest,
ChannelAssociatedPtr, and ChannelAssociatedRequest to
new Mojo types using PendingRemote or Remote,
PendingReceiver, Receiver, PendingAssociatedRemote or
AssociatedRemote, PendingAssociatedReceiver and
AssociatedReceiver.

It also updates OnConnection from
secure_channel.mojom.

Bug: 955171
Change-Id: I6065f8208a2a79316f812e9f48af6b3b88240e7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1819288
Reviewed-by: Sam McNally <sammc@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Ryan Hansberry <hansberry@chromium.org>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#699702}
2019-09-25 11:11:54 +00:00
Gabriel Charette
c523fa633a Backport some tests in /ipc to SingleThreadTaskEnvironment
These tests were previously migrated from single-threaded MessageLoop to
a multi-threaded TaskEnvironment (then named ScopedTaskEnvironment) as
part of crbug.com/891670.

//base OWNERS decided in retrospect that it was better to keep a
single-threaded option for TaskEnvironment and introduced
SingleThreadTaskEnvironment. This CL retrofits that decision for
/ipc.

This CL is a no-op if it passes CQ.

This CL was uploaded by git cl split.

R=rockot@google.com

Bug: 891670
Change-Id: I410de34fd2b80faf6403ee60d3a81e9a0ac40a6b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1787059
Auto-Submit: Gabriel Charette <gab@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694970}
2019-09-09 23:03:32 +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
dfa3604eca [TaskEnvironment] Mass-migrate away from ScopedTaskEnvironment
(second half of
 https://chromium-review.googlesource.com/c/chromium/src/+/1756247)

This is step  of the mass migration. Some of these will be
backported to SingleThreadTaskEnvironment in a later phase.

scoped_task_environment.h will also only move in a follow-up CL.

TBR=dcheng@chromium.org

Bug: 992483
Change-Id: Ie80f083eeeb209180ab3c2884f1b566f73549cc6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1756248
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@{#688142}
2019-08-19 17:30:11 +00:00
Carlos Caballero
05cd1c34e6 Use ScopedTaskEnvironment instead of MessageLoop in /ipc
MessageLoop will go away, eventually.

ScopedTaskEnvironment will per default start a ThreadPool, which should
be fine in most of the cases. If you belive your test needs to make sure
that no ThreadPool runs let me know and I will update the patch.

BUG=891670
This CL was uploaded by git cl split.

R=rockot@google.com

Change-Id: Id5a57e02b84f50ed28caa406711ecc64c81f8d65
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1649363
Auto-Submit: Carlos Caballero <carlscab@google.com>
Reviewed-by: Ken Rockot <rockot@google.com>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#667168}
2019-06-07 16:42:14 +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
Ken Rockot
4c5bd80e5a Reland "Use BigBuffer for legacy IPC messages"
This is a reland of 3e126191c1,
unchanged.

https://chromium-review.googlesource.com/c/chromium/src/+/1134079
fixes the root cause of the failure which caused this to be
reverted. This CL can land once that one does.

Original change's description:
> Use BigBuffer for legacy IPC messages
>
> This replaces use of ReadOnlyBuffer with a new mojom Message type
> specific to //ipc. This type maps to another new C++ MessageView type
> which in turn wraps a BigBufferView.
>
> This allows us to transparently fall back onto shared memory for large
> IPC messages without increasing the number of copies during send or
> receive in any (small- or large-message) cases.
>
> In order to avoid introducing more mojo-base targets, this also removes
> the remaining [Native] structs from mojo_base mojom (LOGFONT and
> FileInfo) and replaces them with real mojom structures + StructTraits,
> thus allowing //ipc to depend on mojo/public/*/base in its entirety.
>
> Also fixes random missing public_deps entries for a
> chrome/services/file_util typemap, because it decided to start breaking
> all of my local builds. :3
>
> Bug: 784069
> Change-Id: I359b964ffc1fe44ffd6aa704405ea63156f4fbc9
> Reviewed-on: https://chromium-review.googlesource.com/1131685
> Commit-Queue: Ken Rockot <rockot@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#573956}

TBR=dcheng@chromium.org

Bug: 784069
Change-Id: I1224367e9db026cb06b0099ee5dfdada89804f23
Reviewed-on: https://chromium-review.googlesource.com/1134100
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Ken Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574449}
2018-07-12 01:37:11 +00:00
Alice Boxhall
b0cfd1d1cf Revert "Use BigBuffer for legacy IPC messages"
This reverts commit 3e126191c1.

Reason for revert: Seems to be causing test failures:
https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/Mac10.13%20Tests%20%28dbg%29
https://logs.chromium.org/v/?s=chromium%2Fbuildbucket%2Fcr-buildbucket.appspot.com%2F8941340516261567504%2F%2B%2Fsteps%2Fipc_tests%2F0%2Flogs%2FIPCChannelMojoTest.SendFailWithPendingMessages%2F0

Original change's description:
> Use BigBuffer for legacy IPC messages
> 
> This replaces use of ReadOnlyBuffer with a new mojom Message type
> specific to //ipc. This type maps to another new C++ MessageView type
> which in turn wraps a BigBufferView.
> 
> This allows us to transparently fall back onto shared memory for large
> IPC messages without increasing the number of copies during send or
> receive in any (small- or large-message) cases.
> 
> In order to avoid introducing more mojo-base targets, this also removes
> the remaining [Native] structs from mojo_base mojom (LOGFONT and
> FileInfo) and replaces them with real mojom structures + StructTraits,
> thus allowing //ipc to depend on mojo/public/*/base in its entirety.
> 
> Also fixes random missing public_deps entries for a
> chrome/services/file_util typemap, because it decided to start breaking
> all of my local builds. :3
> 
> Bug: 784069
> Change-Id: I359b964ffc1fe44ffd6aa704405ea63156f4fbc9
> Reviewed-on: https://chromium-review.googlesource.com/1131685
> Commit-Queue: Ken Rockot <rockot@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#573956}

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

Change-Id: Id30a64213605fb645e46632589d5ce2a4fbc0077
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 784069
Reviewed-on: https://chromium-review.googlesource.com/1132495
Reviewed-by: Alice Boxhall <aboxhall@chromium.org>
Commit-Queue: Alice Boxhall <aboxhall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574057}
2018-07-11 03:37:37 +00:00
Ken Rockot
3e126191c1 Use BigBuffer for legacy IPC messages
This replaces use of ReadOnlyBuffer with a new mojom Message type
specific to //ipc. This type maps to another new C++ MessageView type
which in turn wraps a BigBufferView.

This allows us to transparently fall back onto shared memory for large
IPC messages without increasing the number of copies during send or
receive in any (small- or large-message) cases.

In order to avoid introducing more mojo-base targets, this also removes
the remaining [Native] structs from mojo_base mojom (LOGFONT and
FileInfo) and replaces them with real mojom structures + StructTraits,
thus allowing //ipc to depend on mojo/public/*/base in its entirety.

Also fixes random missing public_deps entries for a
chrome/services/file_util typemap, because it decided to start breaking
all of my local builds. :3

Bug: 784069
Change-Id: I359b964ffc1fe44ffd6aa704405ea63156f4fbc9
Reviewed-on: https://chromium-review.googlesource.com/1131685
Commit-Queue: Ken Rockot <rockot@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573956}
2018-07-10 22:39:51 +00:00
Ken Rockot
8a7f35f9ff Mojo EDK -> Core: content, ipc, services
Moves dependencies from mojo/edk to mojo/core within the following
top-level directories: content, ipc, services

All mechanical changes, hence TBR(s).

TBR=jam@chromium.org

Bug: None
Cq-Include-Trybots: luci.chromium.try:linux_mojo
Change-Id: I4920cf92e3f4e7d7964cf408a29d9902331d508d
Reviewed-on: https://chromium-review.googlesource.com/1126414
Commit-Queue: Ken Rockot <rockot@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572637}
2018-07-04 19:40:56 +00:00
Ken Rockot
a47da1e4b0 Fix flaky IPCMojoBootstrapTest fixture
If you don't install a connection error handler before an error can
signal, you're gonna have a bad time.

Bug: 826450
Change-Id: I1a1b16b66449d89783aa8a9fae34e57e91a1d4f9
Reviewed-on: https://chromium-review.googlesource.com/998994
Reviewed-by: Wez <wez@chromium.org>
Commit-Queue: Ken Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548610}
2018-04-05 23:21:35 +00:00
Roger McFarlane
107d113b64 [sheriff] Disable IPCMojoBootstrapTest.ReceiveEmptyMessage
It's flaky as of https://chromium-review.googlesource.com/981445

Bug: 826450
Change-Id: I44227231a3cc954afab40e02508bb9fd552c1507
TBR: rockot@chromium.org, wez@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/982536
Commit-Queue: Roger McFarlane <rogerm@chromium.org>
Reviewed-by: Roger McFarlane <rogerm@chromium.org>
Reviewed-by: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546259}
2018-03-27 21:09:38 +00:00
Ken Rockot
146d089c5c Fix and re-enable IPCMojoBootstrapTest.ReceiveEmptyMessage
Lets the test run longer (i.e. until the child actually closes its
Channel) before asserting that we receive a message from the child.

Bug: 821254
Change-Id: I629d994baf5655899dbd95177b997b97fd112e32
Reviewed-on: https://chromium-review.googlesource.com/981445
Commit-Queue: Ken Rockot <rockot@chromium.org>
Reviewed-by: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545972}
2018-03-27 03:31:07 +00:00
Wez
f4331bcefa Disable IPCMojoBootstrapTest.ReceiveEmptyMessage temporarily.
This test is inherently flaky, so disable it pending a fix.

TBR: rockot
Bug: 821254
Change-Id: Ic9db63f5a66d1e775033e6e2c9fa029beb7c5e42
Reviewed-on: https://chromium-review.googlesource.com/959746
Reviewed-by: Wez <wez@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542710}
2018-03-13 03:12:12 +00:00
Wez
3fe9c08982 Reland "Add missing message-received expectation to IPCMojoBootstrapTest."
This is a reland of cdcb02624c, which was
reverted pending a fix for an underlying Mojo message-loss issue on
channel shutdown.

Original change's description:
> Add missing message-received expectation to IPCMojoBootstrapTest.
>
> Some of these tests expected a message from the child process, and would
> verify that it was valid/invalid as expected, but would still pass if
> no message were received at all.
>
> Bug: 816620
> Change-Id: Ie8acf85086f4416c7023118673c40d00a2e190d7
> Reviewed-on: https://chromium-review.googlesource.com/955554
> Reviewed-by: Ken Rockot <rockot@chromium.org>
> Commit-Queue: Wez <wez@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#542296}

TBR: rockot
Bug: 816620
Change-Id: Ifdf10581091be31a6c9d1aa53542f2ed6c2ccbfa
Reviewed-on: https://chromium-review.googlesource.com/958016
Reviewed-by: Wez <wez@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542650}
2018-03-12 23:19:23 +00:00
Wez
6d1fd84a5e Revert "Add missing message-received expectation to IPCMojoBootstrapTest."
This reverts commit cdcb02624c.

Reason for revert: We believe that this causes the tests to flake on various platforms, due to issue 816620. We'll re-land it when the mojo::edk::Channel fix has landed.


Original change's description:
> Add missing message-received expectation to IPCMojoBootstrapTest.
> 
> Some of these tests expected a message from the child process, and would
> verify that it was valid/invalid as expected, but would still pass if
> no message were received at all.
> 
> Bug: 816620
> Change-Id: Ie8acf85086f4416c7023118673c40d00a2e190d7
> Reviewed-on: https://chromium-review.googlesource.com/955554
> Reviewed-by: Ken Rockot <rockot@chromium.org>
> Commit-Queue: Wez <wez@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#542296}

TBR=wez@chromium.org,rockot@chromium.org

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

Bug: 816620
Change-Id: I534fa23c12072cf08507ed4c8073e7505edaf262
Reviewed-on: https://chromium-review.googlesource.com/959241
Reviewed-by: Wez <wez@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542526}
2018-03-12 17:29:56 +00:00
Wez
cdcb02624c Add missing message-received expectation to IPCMojoBootstrapTest.
Some of these tests expected a message from the child process, and would
verify that it was valid/invalid as expected, but would still pass if
no message were received at all.

Bug: 816620
Change-Id: Ie8acf85086f4416c7023118673c40d00a2e190d7
Reviewed-on: https://chromium-review.googlesource.com/955554
Reviewed-by: Ken Rockot <rockot@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542296}
2018-03-10 00:49:30 +00:00
Eve Martin-Jones
475e7e6382 Add dependency on //mojo/public/interfaces/bindings:bindings to
//ipc:mojom.

Now that the internal mojo bindings is a component target
(see cr/893655) ipc.mojom can safely import
//mojo/public/interfaces/bindings/native_struct.mojom and depend
on //mojo/public/interfaces/bindings:bindings.

The duplicated SerializedHandle definition in //ipc/ipc.mojom
can now be reverted.

Change-Id: I78288b86bd08ac2af2a75cf83f5b033dde4e4aa4
Reviewed-on: https://chromium-review.googlesource.com/913070
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Commit-Queue: Eve Martin-Jones <evem@chromium.org>
Cr-Commit-Position: refs/heads/master@{#536531}
2018-02-13 22:57:25 +00:00
Eve Martin-Jones
383325a1f7 Duplicate SerializedHandle definition in //ipc/ipc.mojom
Mojoms should declare all imported mojoms in their
public dependencies.

Currently, //ipc/ipc.mojom imports
//mojo/public/interfaces/bindings/native_struct.mojom. However,
the mojom target (//ipc:mojom) cannot depend on
//mojo/public/interfaces/bindings:bindings (the target which
defines native_struct) without causing the duplication of
symbols defined in that target which are already exported by
//mojo/public/cpp/interfaces.

This CL duplicates mojo::native::SerializedHandle into
//ipc/ipc.mojom from
//mojo/public/interfaces/bindings/native_struct.mojom allowing the
dependency on native_struct.mojom to be removed.

Change-Id: I956ccc5b18c33ee5259a2cedb4c5a96c332aaf6d
Reviewed-on: https://chromium-review.googlesource.com/885686
Commit-Queue: Eve Martin-Jones <evem@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: Yuzhu Shen <yzshen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533535}
2018-02-01 02:24:51 +00:00
Roman Karasev
a43d5b4e2a ACCESS_VIOLATION exception
When IPC::Message is constructed from empty data, it has invalid state.

Attempt to access its header (e.g. calling type() method) leads to

ACCESS_VIOLATION exception because header_ is nullptr at this time.

Change-Id: Id58df83d49d4de5f3d459c600abdecc76da36ecc

Bug: 793749
Change-Id: Id58df83d49d4de5f3d459c600abdecc76da36ecc
Reviewed-on: https://chromium-review.googlesource.com/800076
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#525754}
2017-12-21 18:55:12 +00:00
Chris Watkins
2d879af591 Run clang-tidy modernize-use-equals-{delete,default} on //ipc
See the bugs and cxx post for justification and details:
https://groups.google.com/a/chromium.org/forum/#!topic/cxx/RkOHzIK6Tq8

This change was done using clang-tidy as described here:
https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md

In some cases the the tool leaves behind a string of commas where it
replaced a member initializer list
(https://bugs.llvm.org/show_bug.cgi?id=35051). They were cleaned up with:
  git diff --name-only | \
    xargs sed -E -i 's/(^\s*|\)\s*):[ ,]*= default/\1 = default/'

BUG=778959,778957

Change-Id: If633879f6c88ba82525da48a35b4d71f29202e75
Reviewed-on: https://chromium-review.googlesource.com/789743
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Chris Watkins <watk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520389}
2017-11-30 02:11:59 +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
Ken Rockot
fd907634b5 Mojo Bindings: Support handles in native structs
Changes [Native] struct serialization to use an IPC::Message instead of
a base::Pickle, allowing ParamTraits for [Native]-mapped types to be
parameterized over IPC::Message once again. In order to support this,
IPC::Message and related attachment support code has been moved into a
separate leaf target in //ipc, avoiding circular dependencies with Mojo
bindings.

Also changes the wire representation of native structs to allow for
typed Mojo handle attachments, and wires up native struct
serialization to automatically convert between IPC::MessageAttachments
and these typed mojom handles.

The net result here is that [Native] mojom structs can be mapped to
native types whose ParamTraits use message attachments.

BUG=762025

Change-Id: Ib058eff2f32e0e7abfff9619da9f142113ad28ed
Reviewed-on: https://chromium-review.googlesource.com/650219
Commit-Queue: Ken Rockot <rockot@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Yuzhu Shen <yzshen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501866}
2017-09-14 04:23:41 +00:00
Yuzhu Shen
a0a2b36b3c IPC-over-mojo: Eliminate two buffer copies.
This CL:
- introduces a mojom type mojo.common.mojom.ReadOnlyBuffer and typemaps it to
base::span<const uint8_t>.
- changes ipc.mojom.Channel.Receive() to use this new type, so that we
can eliminate two buffer copies for each IPC message.

Please note that this approach relies on the fact that an incoming message stays
valid while making call to user code with the deseralized results.

=====================================================
Linux Z620; release component build

Before:
IPC_ChannelProxy_Perf_50000x_12 4247.97 ms
IPC_ChannelProxy_Perf_50000x_144  3626.01 ms
IPC_ChannelProxy_Perf_50000x_1728 4323.34 ms
IPC_ChannelProxy_Perf_12000x_20736  5419.29 ms
IPC_ChannelProxy_Perf_1000x_248832  4769.07 ms

After:
IPC_ChannelProxy_Perf_50000x_12 3770.21 ms
IPC_ChannelProxy_Perf_50000x_144  3710.2  ms
IPC_ChannelProxy_Perf_50000x_1728 4076.09 ms
IPC_ChannelProxy_Perf_12000x_20736  1461.84 ms
IPC_ChannelProxy_Perf_1000x_248832  1059.52 ms
=====================================================

BUG=758788

Change-Id: Id9d1ef0592482f6d75ff139feba6a36e79eb7e6d
Reviewed-on: https://chromium-review.googlesource.com/634450
Commit-Queue: Yuzhu Shen <yzshen@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#497565}
2017-08-25 22:31:39 +00:00
rockot
a628d0b45d Mojo C++ Bindings: Eliminiate unbound ThreadSafeInterfacePtr
Changes ThreadSafeInterfacePtr such that it is no longer possible
to create one which is unbound. Instead, it is now possible to
create one which will imminently be bound on a specific TaskRunner
but which is usable immediately.

Also introduces ThreadSafeForwarder as a reduced encapsulation of
thread-safe serialization and forwarding logic. This is used
to implement ThreadSafeInterfacePtrBase, as well as to support
immediate associated request forwarding on IPC::ChannelProxy in
a thread-safe manner, where the underlying AssociatedInterfacePtr
must remain owned by the channel's IPC::MessagePipeReader.

Finally, in order to facilitate IPC::Channel exposing ipc.mojom
types through its public interface, the //ipc:mojom target has
been folded into //ipc's component exports. Any prior dependents
on //ipc:mojom have been updated accordingly.

BUG=682334
R=yzshen@chromium.org
TEST=ipc_tests, mojo_public_bindings_unittests

Review-Url: https://codereview.chromium.org/2668153003
Cr-Commit-Position: refs/heads/master@{#449239}
2017-02-09 08:40:15 +00:00
rockot
e5180e0e70 Remove mojo::edk::test::ScopedIPCSupport
ScopedIPCSupport has two separate and subtly different implementations:
mojo::edk::test::ScopedIPCSupport for test-only use, and
mojo::edk::ScopedIPCSupport for general-purpose use.

This unifies them into a much simpler general-purpose ScopedIPCSupport
implementation suitable for all practical environments.

Also removes mojo::edk::ProcessDelegate, as it is abstraction overkill.
Instead of InitIPCSupport taking a ProcessDelegate which goes unused
until shutdown, ShutdownIPCSupport now simply takes a callback to be run
upon completion.

BUG=None
R=jam@chromium.org
TBR=haraken@chromium.org

Review-Url: https://codereview.chromium.org/2620633004
Cr-Commit-Position: refs/heads/master@{#443539}
2017-01-13 12:24:00 +00:00
rockot
cf1d7d0b6e Mojo EDK: Clean shutdown for ScopedIPCSupport in tests
This properly supports clean shutdown in test processes which
initialize the EDK, blocking ScopedIPCSupport destruction to wait
on EDK shutdown. Fixes some rare races in child process exit which
can cause premature message pipe breakage.

BUG=666356
R=yzshen@chromium.org
TBR=vabr@chromium.org (ICWYU)
TBR=ben@chromium.org (toplevel ICWYU)

Review-Url: https://codereview.chromium.org/2514093002
Cr-Commit-Position: refs/heads/master@{#433795}
2016-11-22 05:29:40 +00:00
sammc
b0a39f8c62 Support mojo connections between unrelated peer processes.
Currently, the mojo system assumes that a single, trusted and long-lived
process will act as the broker process for all other processes. For
connections between browser and service processes, each process can
launch and shut down at arbitrary times relative to the other and as
such neither assumption is satisfied. Thus, to support connections
between browser and service processes, a peer relationship between
processes communicating over mojo is required.

BUG=604282
TBR=rockot@chromium.org to workaround https://crbug.com/636215

Review-Url: https://codereview.chromium.org/2227553002
Cr-Commit-Position: refs/heads/master@{#410981}
2016-08-10 06:31:36 +00:00
rockot
0e4de5f9a5 Support early associated interface binding on ChannelMojo
Changes the associated bindings implementation for ChannelMojo
such that remote interfaces can be acquired immediately upon
ChannelMojo construction rather than having to wait for connection
on the IO thread.

Simplifies the Channel bootstrapping process, removing a round-trip
Init message (and in fact the entire IPC::mojom::Boostrap interface)
since there's no need to actually exchange associated interface handles
over the pipe. Instead both sides can assume the other will use a fixed,
reserved endpoint ID for their IPC::mojom::Channel interface.

This also removes the restriction that associated interfaces must be
added to a Channel after Init. Instead the same constraints apply as
with AddFilter: an associated interface, like a filter, may be added
at any time as long as either Init hasn't been called OR the remote
process hasn't been launched.

The result of this CL is that any place it's safe to AddFilter,
it's also safe to AddAssociatedInterface; and any place it's safe to
Send, it's also safe to GetRemoteAssociatedInterface and begin using
any such remote interface immediately.

Remote interface requests as well as all messages to remote interfaces
retain FIFO with respect to any Send calls on the same thread. Local
interface request dispatch as well as all messages on locally bound
associated interfaces retain FIFO with respect to any OnMessageReceived
calls on the same thread.

BUG=612500,619202

Committed: https://crrev.com/e1037f997da9e1d44ca3b09d4ff32f0465673091
Committed: https://crrev.com/508da24622f957a01b076ccd058bfdccc79068a4
Review-Url: https://codereview.chromium.org/2163633003
Cr-Original-Original-Commit-Position: refs/heads/master@{#406720}
Cr-Original-Commit-Position: refs/heads/master@{#407050}
Cr-Commit-Position: refs/heads/master@{#407264}
2016-07-22 21:20:12 +00:00
msramek
5507feebdc Revert of Support early associated interface binding on ChannelMojo (patchset id:120001 of https://codereview.chromium.org/2163633003/ )
Reason for revert:
Probable cause of failures on Mac ASan. See crbug.com/630564 for more details.

Original issue's description:
> Support early associated interface binding on ChannelMojo
>
> Changes the associated bindings implementation for ChannelMojo
> such that remote interfaces can be acquired immediately upon
> ChannelMojo construction rather than having to wait for connection
> on the IO thread.
>
> Simplifies the Channel bootstrapping process, removing a round-trip
> Init message (and in fact the entire IPC::mojom::Boostrap interface)
> since there's no need to actually exchange associated interface handles
> over the pipe. Instead both sides can assume the other will use a fixed,
> reserved endpoint ID for their IPC::mojom::Channel interface.
>
> This also removes the restriction that associated interfaces must be
> added to a Channel after Init. Instead the same constraints apply as
> with AddFilter: an associated interface, like a filter, may be added
> at any time as long as either Init hasn't been called OR the remote
> process hasn't been launched.
>
> The result of this CL is that any place it's safe to AddFilter,
> it's also safe to AddAssociatedInterface; and any place it's safe to
> Send, it's also safe to GetRemoteAssociatedInterface and begin using
> any such remote interface immediately.
>
> Remote interface requests as well as all messages to remote interfaces
> retain FIFO with respect to any Send calls on the same thread. Local
> interface request dispatch as well as all messages on locally bound
> associated interfaces retain FIFO with respect to any OnMessageReceived
> calls on the same thread.
>
> BUG=612500,619202
>
> Committed: https://crrev.com/e1037f997da9e1d44ca3b09d4ff32f0465673091
> Committed: https://crrev.com/508da24622f957a01b076ccd058bfdccc79068a4
> Cr-Original-Commit-Position: refs/heads/master@{#406720}
> Cr-Commit-Position: refs/heads/master@{#407050}

TBR=yzshen@chromium.org,rockot@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=612500,619202

Review-Url: https://codereview.chromium.org/2173753002
Cr-Commit-Position: refs/heads/master@{#407120}
2016-07-22 10:09:29 +00:00
rockot
508da24622 Support early associated interface binding on ChannelMojo
Changes the associated bindings implementation for ChannelMojo
such that remote interfaces can be acquired immediately upon
ChannelMojo construction rather than having to wait for connection
on the IO thread.

Simplifies the Channel bootstrapping process, removing a round-trip
Init message (and in fact the entire IPC::mojom::Boostrap interface)
since there's no need to actually exchange associated interface handles
over the pipe. Instead both sides can assume the other will use a fixed,
reserved endpoint ID for their IPC::mojom::Channel interface.

This also removes the restriction that associated interfaces must be
added to a Channel after Init. Instead the same constraints apply as
with AddFilter: an associated interface, like a filter, may be added
at any time as long as either Init hasn't been called OR the remote
process hasn't been launched.

The result of this CL is that any place it's safe to AddFilter,
it's also safe to AddAssociatedInterface; and any place it's safe to
Send, it's also safe to GetRemoteAssociatedInterface and begin using
any such remote interface immediately.

Remote interface requests as well as all messages to remote interfaces
retain FIFO with respect to any Send calls on the same thread. Local
interface request dispatch as well as all messages on locally bound
associated interfaces retain FIFO with respect to any OnMessageReceived
calls on the same thread.

BUG=612500,619202

Committed: https://crrev.com/e1037f997da9e1d44ca3b09d4ff32f0465673091
Review-Url: https://codereview.chromium.org/2163633003
Cr-Original-Commit-Position: refs/heads/master@{#406720}
Cr-Commit-Position: refs/heads/master@{#407050}
2016-07-22 03:56:48 +00:00
rockot
f192a075bc Revert of Support early associated interface binding on ChannelMojo (patchset id:80001 of https://codereview.chromium.org/2163633003/ )
Reason for revert:
Lots of browser_tests failures.

https://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/266272

Original issue's description:
> Support early associated interface binding on ChannelMojo
>
> Changes the associated bindings implementation for ChannelMojo
> such that remote interfaces can be acquired immediately upon
> ChannelMojo construction rather than having to wait for connection
> on the IO thread.
>
> Simplifies the Channel bootstrapping process, removing a round-trip
> Init message (and in fact the entire IPC::mojom::Boostrap interface)
> since there's no need to actually exchange associated interface handles
> over the pipe. Instead both sides can assume the other will use a fixed,
> reserved endpoint ID for their IPC::mojom::Channel interface.
>
> This also removes the restriction that associated interfaces must be
> added to a Channel after Init. Instead the same constraints apply as
> with AddFilter: an associated interface, like a filter, may be added
> at any time as long as either Init hasn't been called OR the remote
> process hasn't been launched.
>
> The result of this CL is that any place it's safe to AddFilter,
> it's also safe to AddAssociatedInterface; and any place it's safe to
> Send, it's also safe to GetRemoteAssociatedInterface and begin using
> any such remote interface immediately.
>
> Remote interface requests as well as all messages to remote interfaces
> retain FIFO with respect to any Send calls on the same thread. Local
> interface request dispatch as well as all messages on locally bound
> associated interfaces retain FIFO with respect to any OnMessageReceived
> calls on the same thread.
>
> BUG=612500,619202
>
> Committed: https://crrev.com/e1037f997da9e1d44ca3b09d4ff32f0465673091
> Cr-Commit-Position: refs/heads/master@{#406720}

TBR=yzshen@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=612500,619202

Review-Url: https://codereview.chromium.org/2167973002
Cr-Commit-Position: refs/heads/master@{#406739}
2016-07-21 01:35:32 +00:00