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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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.ccTBR=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}
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}
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.orgR=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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
//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}
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}
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}
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}
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}
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}
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.orgTBR=haraken@chromium.org
Review-Url: https://codereview.chromium.org/2620633004
Cr-Commit-Position: refs/heads/master@{#443539}
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.orgTBR=vabr@chromium.org (ICWYU)
TBR=ben@chromium.org (toplevel ICWYU)
Review-Url: https://codereview.chromium.org/2514093002
Cr-Commit-Position: refs/heads/master@{#433795}
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}
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}
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}
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}
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}