diff options
author | chrome-bot <chrome-bot@chromium.org> | 2024-05-18 05:17:21 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-05-18 17:54:23 +0000 |
commit | 792eed141437400f0702c68a93d5a076b0fea0f3 (patch) | |
tree | 02c4314ea4062063d2815e6190928fdb9f57c841 | |
parent | d9797dab973b56c33a040e6e62695b23dd0516de (diff) | |
parent | f638cab97010ffb7d49cc2b77036b6324f2b590e (diff) | |
download | libchrome-upstream-main.tar.gz |
Automated commit: libchrome r1302897 uprevupstream-main
Merge with upstream commit f638cab97010ffb7d49cc2b77036b6324f2b590e
BUG=None
TEST=sudo emerge libchrome
Change-Id: If56bd59a200a2b68bd5542e94a6ff123aa6203f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/libchrome/+/5545750
Commit-Queue: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Bot-Commit: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
26 files changed, 194 insertions, 74 deletions
@@ -1 +1 @@ -1302486 +1302897 diff --git a/base/cpu_reduction_experiment.cc b/base/cpu_reduction_experiment.cc index d8291f3ce0..66b43b29d3 100644 --- a/base/cpu_reduction_experiment.cc +++ b/base/cpu_reduction_experiment.cc @@ -10,8 +10,6 @@ #include "base/dcheck_is_on.h" #include "base/feature_list.h" #include "base/rand_util.h" -#include "base/synchronization/lock.h" -#include "base/thread_annotations.h" namespace base { @@ -25,16 +23,16 @@ BASE_FEATURE(kReduceCpuUtilization, class CpuReductionExperimentSubSampler { public: - CpuReductionExperimentSubSampler() = default; + CpuReductionExperimentSubSampler() : counter_(base::RandUint64()) {} bool ShouldLogHistograms() { - AutoLock hold(lock_); - return sub_sampler_.ShouldSample(0.001); + // Relaxed memory order since no memory access depends on value. + uint64_t val = counter_.fetch_add(1, std::memory_order_relaxed); + return val % 1000 == 0; } private: - Lock lock_; - MetricsSubSampler sub_sampler_ GUARDED_BY(lock_); + std::atomic<uint64_t> counter_{0}; }; // Singleton instance of CpuReductionExperimentSubSampler. This is only set when diff --git a/base/functional/concurrent_callbacks.h b/base/functional/concurrent_callbacks.h index 649911e2c2..f120743c07 100644 --- a/base/functional/concurrent_callbacks.h +++ b/base/functional/concurrent_callbacks.h @@ -13,6 +13,7 @@ #include "base/functional/callback.h" #include "base/location.h" #include "base/memory/raw_ptr.h" +#include "base/sequence_checker.h" #include "base/task/bind_post_task.h" #include "base/task/sequenced_task_runner.h" @@ -78,6 +79,7 @@ class ConcurrentCallbacks { // Create a callback for the done callback to wait for. [[nodiscard]] OnceCallback<void(T)> CreateCallback() { CHECK(info_); + DCHECK_CALLED_ON_VALID_SEQUENCE(info_->sequence_checker_); ++info_->pending_; return info_run_callback_; } @@ -89,6 +91,7 @@ class ConcurrentCallbacks { void Done(OnceCallback<void(Results)> done_callback, const Location& location = FROM_HERE) && { CHECK(info_); + DCHECK_CALLED_ON_VALID_SEQUENCE(info_->sequence_checker_); info_->done_callback_ = BindPostTask(SequencedTaskRunner::GetCurrentDefault(), std::move(done_callback), location); @@ -104,6 +107,7 @@ class ConcurrentCallbacks { Info() = default; void Run(T value) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); CHECK_GT(pending_, 0u); --pending_; results_.push_back(std::move(value)); @@ -112,9 +116,11 @@ class ConcurrentCallbacks { } } - size_t pending_ = 0u; - Results results_; - OnceCallback<void(Results)> done_callback_; + size_t pending_ GUARDED_BY_CONTEXT(sequence_checker_) = 0u; + Results results_ GUARDED_BY_CONTEXT(sequence_checker_); + OnceCallback<void(Results)> done_callback_ + GUARDED_BY_CONTEXT(sequence_checker_); + SEQUENCE_CHECKER(sequence_checker_); }; RepeatingCallback<void(T)> info_run_callback_; diff --git a/base/memory/shared_memory_mapping.cc b/base/memory/shared_memory_mapping.cc index 868493fde4..53938f465b 100644 --- a/base/memory/shared_memory_mapping.cc +++ b/base/memory/shared_memory_mapping.cc @@ -49,6 +49,7 @@ SharedMemoryMapping::SharedMemoryMapping(span<uint8_t> mapped_span, const UnguessableToken& guid, SharedMemoryMapper* mapper) : mapped_span_(mapped_span), size_(size), guid_(guid), mapper_(mapper) { + CHECK_LE(size_, mapped_span_.size()); // Note: except on Windows, `mapped_span_.size() == size_`. SharedMemoryTracker::GetInstance()->IncrementMemoryUsage(*this); } diff --git a/base/memory/shared_memory_mapping.h b/base/memory/shared_memory_mapping.h index 42d53a14f3..165e78c7b7 100644 --- a/base/memory/shared_memory_mapping.h +++ b/base/memory/shared_memory_mapping.h @@ -74,9 +74,8 @@ class BASE_EXPORT SharedMemoryMapping { size_t size, const UnguessableToken& guid, SharedMemoryMapper* mapper); - void* raw_memory_ptr() const { - return reinterpret_cast<void*>(mapped_span_.data()); - } + // Returns a span over the full mapped memory. + span<uint8_t> mapped_memory() const { return mapped_span_; } private: friend class SharedMemoryTracker; @@ -108,7 +107,7 @@ class BASE_EXPORT ReadOnlySharedMemoryMapping : public SharedMemoryMapping { // Returns the base address of the read-only mapping. Returns nullptr for // invalid instances. - const void* memory() const { return raw_memory_ptr(); } + const void* memory() const { return mapped_memory().data(); } // Returns a pointer to a page-aligned const T if the mapping is valid and // large enough to contain a T, or nullptr otherwise. @@ -121,7 +120,7 @@ class BASE_EXPORT ReadOnlySharedMemoryMapping : public SharedMemoryMapping { return nullptr; if (sizeof(T) > size()) return nullptr; - return static_cast<const T*>(raw_memory_ptr()); + return reinterpret_cast<const T*>(mapped_memory().data()); } // Returns a span of const T. The number of elements is autodeduced from the @@ -153,7 +152,12 @@ class BASE_EXPORT ReadOnlySharedMemoryMapping : public SharedMemoryMapping { return span<const T>(); if (size() / sizeof(T) < count) return span<const T>(); - return span<const T>(static_cast<const T*>(raw_memory_ptr()), count); + // SAFETY: There is an internal invariant (enforced in the constructors) + // that `size() <= mapped_memory().size()`. `count` is the number of objects + // of type T that fit within size(), so the pointer given to span() points + // to at least that many T objects. + return UNSAFE_BUFFERS( + span(reinterpret_cast<const T*>(mapped_memory().data()), count)); } private: @@ -183,7 +187,7 @@ class BASE_EXPORT WritableSharedMemoryMapping : public SharedMemoryMapping { // Returns the base address of the writable mapping. Returns nullptr for // invalid instances. - void* memory() const { return raw_memory_ptr(); } + void* memory() const { return mapped_memory().data(); } // Returns a pointer to a page-aligned T if the mapping is valid and large // enough to contain a T, or nullptr otherwise. @@ -196,7 +200,7 @@ class BASE_EXPORT WritableSharedMemoryMapping : public SharedMemoryMapping { return nullptr; if (sizeof(T) > size()) return nullptr; - return static_cast<T*>(raw_memory_ptr()); + return reinterpret_cast<T*>(mapped_memory().data()); } // Returns a span of T. The number of elements is autodeduced from the size of @@ -227,7 +231,12 @@ class BASE_EXPORT WritableSharedMemoryMapping : public SharedMemoryMapping { return span<T>(); if (size() / sizeof(T) < count) return span<T>(); - return span<T>(static_cast<T*>(raw_memory_ptr()), count); + // SAFETY: There is an internal invariant (enforced in the constructors) + // that `size() <= mapped_memory().size()`. `count` is the number of objects + // of type T that fit within size(), so the pointer given to span() points + // to at least that many T objects. + return UNSAFE_BUFFERS( + span(reinterpret_cast<T*>(mapped_memory().data()), count)); } private: @@ -243,17 +252,7 @@ class BASE_EXPORT WritableSharedMemoryMapping : public SharedMemoryMapping { const UnguessableToken& guid, SharedMemoryMapper* mapper); - friend class DiscardableSharedMemory; - // Returns a span over the entire mapped memory, which may be more than the - // logical requested memory. Bytes outside of the logical size should not be - // used. - span<uint8_t> mapped_memory() const { - if (!IsValid()) { - return span<uint8_t>(); - } - return UNSAFE_BUFFERS( - span(static_cast<uint8_t*>(raw_memory_ptr()), mapped_size())); - } + friend class DiscardableSharedMemory; // Give access to mapped_memory(). }; } // namespace base diff --git a/base/memory/shared_memory_tracker.cc b/base/memory/shared_memory_tracker.cc index 7021891d52..05d0c89935 100644 --- a/base/memory/shared_memory_tracker.cc +++ b/base/memory/shared_memory_tracker.cc @@ -45,28 +45,28 @@ const trace_event::MemoryAllocatorDump* SharedMemoryTracker::GetOrCreateSharedMemoryDump( const SharedMemoryMapping& shared_memory, trace_event::ProcessMemoryDump* pmd) { - return GetOrCreateSharedMemoryDumpInternal(shared_memory.raw_memory_ptr(), - shared_memory.mapped_size(), - shared_memory.guid(), pmd); + return GetOrCreateSharedMemoryDumpInternal( + shared_memory.mapped_memory().data(), + shared_memory.mapped_memory().size(), shared_memory.guid(), pmd); } void SharedMemoryTracker::IncrementMemoryUsage( const SharedMemoryMapping& mapping) { AutoLock hold(usages_lock_); - DCHECK(usages_.find(mapping.raw_memory_ptr()) == usages_.end()); - usages_.emplace(mapping.raw_memory_ptr(), - UsageInfo(mapping.mapped_size(), mapping.guid())); + DCHECK(usages_.find(mapping.mapped_memory().data()) == usages_.end()); + usages_.emplace(mapping.mapped_memory().data(), + UsageInfo(mapping.mapped_memory().size(), mapping.guid())); } void SharedMemoryTracker::DecrementMemoryUsage( const SharedMemoryMapping& mapping) { AutoLock hold(usages_lock_); - const auto it = usages_.find(mapping.raw_memory_ptr()); + const auto it = usages_.find(mapping.mapped_memory().data()); // TODO(pbos): When removing this NotFatalUntil, use erase(it) below. We can't // do that now because if this CHECK is actually failing there'd be a memory // bug. CHECK(it != usages_.end(), base::NotFatalUntil::M125); - usages_.erase(mapping.raw_memory_ptr()); + usages_.erase(mapping.mapped_memory().data()); } SharedMemoryTracker::SharedMemoryTracker() { diff --git a/base/metrics/field_trial.cc b/base/metrics/field_trial.cc index 72aebc7813..d3cbd65435 100644 --- a/base/metrics/field_trial.cc +++ b/base/metrics/field_trial.cc @@ -226,7 +226,10 @@ bool FieldTrial::FieldTrialEntry::GetParams( PickleIterator FieldTrial::FieldTrialEntry::GetPickleIterator() const { Pickle pickle = Pickle::WithUnownedBuffer( - span(GetPickledDataPtr(), checked_cast<size_t>(pickle_size))); + // TODO(crbug.com/40284755): FieldTrialEntry should be constructed with a + // span over the pickle memory. + UNSAFE_BUFFERS( + span(GetPickledDataPtr(), checked_cast<size_t>(pickle_size)))); return PickleIterator(pickle); } diff --git a/base/test/launcher/test_results_tracker.cc b/base/test/launcher/test_results_tracker.cc index 1237a29e5f..ff79865a4b 100644 --- a/base/test/launcher/test_results_tracker.cc +++ b/base/test/launcher/test_results_tracker.cc @@ -32,6 +32,7 @@ #include "base/test/test_switches.h" #include "base/time/time.h" #include "base/values.h" +#include "build/build_config.h" #include "third_party/icu/source/i18n/unicode/timezone.h" namespace base { @@ -600,6 +601,7 @@ bool TestResultsTracker::SaveSummaryAsJSON( return false; } +#if BUILDFLAG(IS_FUCHSIA) // File::Flush() will call fsync(). This is important on Fuchsia to ensure // that the file is written to the disk - the system running under qemu will // shutdown shortly after the test completes. On Fuchsia fsync() times out @@ -618,6 +620,9 @@ bool TestResultsTracker::SaveSummaryAsJSON( } return false; +#else + return true; +#endif } TestResultsTracker::TestStatusMap diff --git a/ipc/ipc_channel_common.cc b/ipc/ipc_channel_common.cc index d5f1ccdedc..66badf1db7 100644 --- a/ipc/ipc_channel_common.cc +++ b/ipc/ipc_channel_common.cc @@ -66,11 +66,17 @@ Channel::AssociatedInterfaceSupport* Channel::GetAssociatedInterfaceSupport() { return nullptr; } -void Channel::Pause() { NOTREACHED(); } +void Channel::Pause() { + NOTREACHED_IN_MIGRATION(); +} -void Channel::Unpause(bool flush) { NOTREACHED(); } +void Channel::Unpause(bool flush) { + NOTREACHED_IN_MIGRATION(); +} -void Channel::Flush() { NOTREACHED(); } +void Channel::Flush() { + NOTREACHED_IN_MIGRATION(); +} void Channel::SetUrgentMessageObserver(UrgentMessageObserver* observer) { // Ignored for non-mojo channels. diff --git a/ipc/ipc_channel_mojo_unittest.cc b/ipc/ipc_channel_mojo_unittest.cc index 5c8f014211..6ac9c774d8 100644 --- a/ipc/ipc_channel_mojo_unittest.cc +++ b/ipc/ipc_channel_mojo_unittest.cc @@ -275,7 +275,7 @@ class ListenerThatBindsATestStructPasser : public IPC::Listener, void OnChannelConnected(int32_t peer_pid) override {} - void OnChannelError() override { NOTREACHED(); } + void OnChannelError() override { NOTREACHED_IN_MIGRATION(); } void OnAssociatedInterfaceRequest( const std::string& interface_name, @@ -288,7 +288,7 @@ class ListenerThatBindsATestStructPasser : public IPC::Listener, private: // IPC::mojom::TestStructPasser: - void Pass(IPC::mojom::TestStructPtr) override { NOTREACHED(); } + void Pass(IPC::mojom::TestStructPtr) override { NOTREACHED_IN_MIGRATION(); } mojo::AssociatedReceiver<IPC::mojom::TestStructPasser> receiver_{this}; }; @@ -313,7 +313,7 @@ class ListenerThatExpectsNoError : public IPC::Listener { std::move(connect_closure_).Run(); } - void OnChannelError() override { NOTREACHED(); } + void OnChannelError() override { NOTREACHED_IN_MIGRATION(); } private: base::OnceClosure connect_closure_; @@ -797,7 +797,9 @@ class ListenerWithSimpleProxyAssociatedInterface std::move(callback).Run(next_expected_value_); } - void RequestValue(RequestValueCallback callback) override { NOTREACHED(); } + void RequestValue(RequestValueCallback callback) override { + NOTREACHED_IN_MIGRATION(); + } void RequestQuit(RequestQuitCallback callback) override { std::move(callback).Run(); diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h index 4a51cbf9c7..f3a99516ea 100644 --- a/ipc/ipc_message_macros.h +++ b/ipc/ipc_message_macros.h @@ -396,10 +396,10 @@ } \ break; -#define IPC_MESSAGE_UNHANDLED_ERROR() \ - IPC_MESSAGE_UNHANDLED(NOTREACHED() << \ - "Invalid message with type = " << \ - ipc_message__.type()) +#define IPC_MESSAGE_UNHANDLED_ERROR() \ + IPC_MESSAGE_UNHANDLED(NOTREACHED_IN_MIGRATION() \ + << "Invalid message with type = " \ + << ipc_message__.type()) #define IPC_END_MESSAGE_MAP() \ } \ diff --git a/ipc/ipc_sync_channel_unittest.cc b/ipc/ipc_sync_channel_unittest.cc index a0c7f5278c..56e98f5127 100644 --- a/ipc/ipc_sync_channel_unittest.cc +++ b/ipc/ipc_sync_channel_unittest.cc @@ -147,7 +147,7 @@ class Worker : public Listener, public Sender { SyncChannel* channel() { return channel_.get(); } // Functions for derived classes to implement if they wish. virtual void Run() { } - virtual void OnAnswer(int* answer) { NOTREACHED(); } + virtual void OnAnswer(int* answer) { NOTREACHED_IN_MIGRATION(); } virtual void OnAnswerDelay(Message* reply_msg) { // The message handler map below can only take one entry for // SyncChannelTestMsg_AnswerToLife, so since some classes want @@ -159,7 +159,7 @@ class Worker : public Listener, public Sender { SyncChannelTestMsg_AnswerToLife::WriteReplyParams(reply_msg, answer); Send(reply_msg); } - virtual void OnDouble(int in, int* out) { NOTREACHED(); } + virtual void OnDouble(int in, int* out) { NOTREACHED_IN_MIGRATION(); } virtual void OnDoubleDelay(int in, Message* reply_msg) { int result; OnDouble(in, &result); diff --git a/mojo/core/channel.cc b/mojo/core/channel.cc index bc6e96d9e0..0af1315b61 100644 --- a/mojo/core/channel.cc +++ b/mojo/core/channel.cc @@ -112,7 +112,9 @@ struct IpczMessage : public Channel::Message { ~IpczMessage() override = default; // Channel::Message: - void SetHandles(std::vector<PlatformHandle>) override { NOTREACHED(); } + void SetHandles(std::vector<PlatformHandle>) override { + NOTREACHED_IN_MIGRATION(); + } void SetHandles(std::vector<PlatformHandleInTransit>) override { NOTREACHED_IN_MIGRATION(); } diff --git a/mojo/core/message_unittest.cc b/mojo/core/message_unittest.cc index 5a14fb18b0..bc852cbc8e 100644 --- a/mojo/core/message_unittest.cc +++ b/mojo/core/message_unittest.cc @@ -121,8 +121,10 @@ class NeverSerializedMessage : public TestMessageBase { void GetSerializedSize(size_t* num_bytes, size_t* num_handles) override { NOTREACHED_IN_MIGRATION(); } - void SerializeHandles(MojoHandle* handles) override { NOTREACHED(); } - void SerializePayload(void* buffer) override { NOTREACHED(); } + void SerializeHandles(MojoHandle* handles) override { + NOTREACHED_IN_MIGRATION(); + } + void SerializePayload(void* buffer) override { NOTREACHED_IN_MIGRATION(); } base::OnceClosure destruction_callback_; }; diff --git a/mojo/core/trap_unittest.cc b/mojo/core/trap_unittest.cc index de71931cae..0d68e6af4b 100644 --- a/mojo/core/trap_unittest.cc +++ b/mojo/core/trap_unittest.cc @@ -871,8 +871,8 @@ TEST_F(TrapTest, MultipleTriggers) { // Add a trigger whose condition is always satisfied so we can't arm. Arming // should fail with only this new watch's information. - uintptr_t writable_c_context = - helper.CreateContext([](const MojoTrapEvent&) { NOTREACHED(); }); + uintptr_t writable_c_context = helper.CreateContext( + [](const MojoTrapEvent&) { NOTREACHED_IN_MIGRATION(); }); MojoHandle c, d; CreateMessagePipe(&c, &d); @@ -1017,7 +1017,8 @@ TEST_F(TrapTest, ImplicitRemoveOtherTriggerWithinEventHandler) { EXPECT_EQ(MOJO_RESULT_OK, helper.CreateTrap(&t)); uintptr_t readable_a_context = helper.CreateContextWithCancel( - [](const MojoTrapEvent&) { NOTREACHED(); }, [&] { wait.Signal(); }); + [](const MojoTrapEvent&) { NOTREACHED_IN_MIGRATION(); }, + [&] { wait.Signal(); }); uintptr_t readable_c_context = helper.CreateContext([&](const MojoTrapEvent& event) { @@ -1080,8 +1081,8 @@ TEST_F(TrapTest, ExplicitRemoveOtherTriggerWithinEventHandler) { MojoHandle t; EXPECT_EQ(MOJO_RESULT_OK, helper.CreateTrap(&t)); - uintptr_t readable_a_context = - helper.CreateContext([](const MojoTrapEvent&) { NOTREACHED(); }); + uintptr_t readable_a_context = helper.CreateContext( + [](const MojoTrapEvent&) { NOTREACHED_IN_MIGRATION(); }); uintptr_t readable_c_context = helper.CreateContext([&](const MojoTrapEvent& event) { diff --git a/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc b/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc index 72d3dcf870..e8b1607cb6 100644 --- a/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc +++ b/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc @@ -141,7 +141,7 @@ class IntegerSenderImpl : public IntegerSender { else echo_handler_.Run(value, std::move(callback)); } - void Send(int32_t value) override { NOTREACHED(); } + void Send(int32_t value) override { NOTREACHED_IN_MIGRATION(); } ReceiverType* receiver() { return &receiver_; } diff --git a/mojo/public/cpp/bindings/tests/idle_tracking_unittest.cc b/mojo/public/cpp/bindings/tests/idle_tracking_unittest.cc index 12f7e7d57f..d3f24b4211 100644 --- a/mojo/public/cpp/bindings/tests/idle_tracking_unittest.cc +++ b/mojo/public/cpp/bindings/tests/idle_tracking_unittest.cc @@ -70,8 +70,9 @@ TEST_P(IdleTrackingTest, ControlMessagesDontExpectAck) { TestServiceImpl impl(remote.BindNewPipeAndPassReceiver()); base::RunLoop loop; - remote.set_idle_handler(base::TimeDelta(), - base::BindRepeating([] { NOTREACHED(); })); + remote.set_idle_handler(base::TimeDelta(), base::BindRepeating([] { + NOTREACHED_IN_MIGRATION(); + })); remote.FlushAsyncForTesting(loop.QuitClosure()); EXPECT_EQ(0u, remote.GetNumUnackedMessagesForTesting()); loop.Run(); @@ -105,8 +106,9 @@ TEST_P(IdleTrackingTest, PendingRepliesPreventIdling) { TestServiceImpl impl(remote.BindNewPipeAndPassReceiver()); impl.HoldNextPingPong(); - remote.set_idle_handler(base::TimeDelta(), - base::BindRepeating([] { NOTREACHED(); })); + remote.set_idle_handler(base::TimeDelta(), base::BindRepeating([] { + NOTREACHED_IN_MIGRATION(); + })); bool idle = false; bool replied = false; @@ -162,8 +164,9 @@ TEST_P(IdleTrackingTest, OtherBoundReceiversPreventIdling) { // First see that we can bind another receiver and that the Remote does not // invoke its idle handler even though its number of unacked messages goes to // zero. - remote.set_idle_handler(base::TimeDelta(), - base::BindRepeating([] { NOTREACHED(); })); + remote.set_idle_handler(base::TimeDelta(), base::BindRepeating([] { + NOTREACHED_IN_MIGRATION(); + })); Remote<mojom::KeepAlive> keepalive; remote->BindKeepAlive(keepalive.BindNewPipeAndPassReceiver()); EXPECT_EQ(1u, remote.GetNumUnackedMessagesForTesting()); @@ -214,8 +217,9 @@ TEST_P(IdleTrackingTest, SubInterfacesCanIdleSeparately) { // First see that we can bind another receiver and that the Remote does not // invoke its idle handler even though its number of unacked messages goes to // zero. - remote.set_idle_handler(base::TimeDelta(), - base::BindRepeating([] { NOTREACHED(); })); + remote.set_idle_handler(base::TimeDelta(), base::BindRepeating([] { + NOTREACHED_IN_MIGRATION(); + })); Remote<mojom::KeepAlive> keepalive; remote->BindKeepAlive(keepalive.BindNewPipeAndPassReceiver()); EXPECT_EQ(1u, remote.GetNumUnackedMessagesForTesting()); diff --git a/mojo/public/cpp/bindings/tests/receiver_unittest.cc b/mojo/public/cpp/bindings/tests/receiver_unittest.cc index 3441892547..6361869143 100644 --- a/mojo/public/cpp/bindings/tests/receiver_unittest.cc +++ b/mojo/public/cpp/bindings/tests/receiver_unittest.cc @@ -520,8 +520,9 @@ TEST_P(ReceiverTest, CustomImplPointerType) { { // Attempt to dispatch another message after the WeakPtr is invalidated. - impl.set_ping_handler(base::BindRepeating([] { NOTREACHED(); })); - remote->Ping(base::BindOnce([] { NOTREACHED(); })); + impl.set_ping_handler( + base::BindRepeating([] { NOTREACHED_IN_MIGRATION(); })); + remote->Ping(base::BindOnce([] { NOTREACHED_IN_MIGRATION(); })); // The receiver will close its end of the pipe which will trigger a // disconnect on |remote|. diff --git a/mojo/public/cpp/platform/platform_channel_server_posix.cc b/mojo/public/cpp/platform/platform_channel_server_posix.cc index 914c93edd5..d5b11ece65 100644 --- a/mojo/public/cpp/platform/platform_channel_server_posix.cc +++ b/mojo/public/cpp/platform/platform_channel_server_posix.cc @@ -66,7 +66,9 @@ class ListenerImpl : public PlatformChannelServer::Listener, PlatformChannelEndpoint{PlatformHandle{std::move(socket)}}); } - void OnFileCanWriteWithoutBlocking(int fd) override { NOTREACHED(); } + void OnFileCanWriteWithoutBlocking(int fd) override { + NOTREACHED_IN_MIGRATION(); + } private: void Stop() { diff --git a/mojo/public/cpp/system/tests/simple_watcher_unittest.cc b/mojo/public/cpp/system/tests/simple_watcher_unittest.cc index b193006e83..5688c42c0f 100644 --- a/mojo/public/cpp/system/tests/simple_watcher_unittest.cc +++ b/mojo/public/cpp/system/tests/simple_watcher_unittest.cc @@ -31,7 +31,7 @@ SimpleWatcher::ReadyCallback OnReady(Handler f) { } SimpleWatcher::ReadyCallback NotReached() { - return OnReady([](MojoResult) { NOTREACHED(); }); + return OnReady([](MojoResult) { NOTREACHED_IN_MIGRATION(); }); } class SimpleWatcherTest : public testing::Test { diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd23_array_of_optionals_less_than_necessary_bytes.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd23_array_of_optionals_less_than_necessary_bytes.data new file mode 100644 index 0000000000..918c757471 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd23_array_of_optionals_less_than_necessary_bytes.data @@ -0,0 +1,26 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]23 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method23_params +[u4]0 // version +[dist8]param0_ptr // param0: array<bool?> +[dist8]param1_ptr // param1: array<uint32?> +[anchr]method23_params + +[anchr]param0_ptr +[dist4]param0_member // num_bytes +[u4]0 // num_elements +[anchr]param0_member + +[anchr]param1_ptr +[dist4]param1_member // num_bytes +[u4]2 // num_elements +[u4]0 // bitfield +[u4]0 // element 0 + // truncated and missing element here +[anchr]param1_member diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd23_array_of_optionals_less_than_necessary_bytes.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd23_array_of_optionals_less_than_necessary_bytes.expected new file mode 100644 index 0000000000..5a1ec4ef20 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd23_array_of_optionals_less_than_necessary_bytes.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd24_map_of_optionals_less_than_necessary_bytes.data b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd24_map_of_optionals_less_than_necessary_bytes.data new file mode 100644 index 0000000000..e969e414e5 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd24_map_of_optionals_less_than_necessary_bytes.data @@ -0,0 +1,52 @@ +[dist4]message_header // num_bytes +[u4]0 // version +[u4]0 // interface ID +[u4]24 // name +[u4]0 // flags +[u4]0 // padding +[anchr]message_header + +[dist4]method24_params +[u4]0 // version +[dist8]param0_ptr // param0: map<uint32, bool?> +[dist8]param1_ptr // param1: map<uint32, uint64?> +[anchr]method24_params + +[anchr]param0_ptr +[dist4]param0_map_data_struct_header // num_bytes +[u4]0 // version +[dist8]param0_key_array_ptr +[dist8]param0_value_array_ptr +[anchr]param0_map_data_struct_header + +[anchr]param0_key_array_ptr +[dist4]param0_key_array_member // num_bytes +[u4]0 // num_elements +[anchr]param0_key_array_member + +[anchr]param0_value_array_ptr +[dist4]param0_value_array_member // num_bytes +[u4]0 // num_elements +[anchr]param0_value_array_member + +[anchr]param1_ptr +[dist4]param1_map_data_struct_header // num_bytes +[u4]0 // version +[dist8]param1_key_array_ptr +[dist8]param1_value_array_ptr +[anchr]param1_map_data_struct_header + +[anchr]param1_key_array_ptr +[dist4]param1_key_array_member // num_bytes +[u4]2 // num_elements +[u4]1 // key +[u4]2 // key +[anchr]param1_key_array_member + +[anchr]param1_value_array_ptr +[dist4]param1_value_array_member // num_bytes +[u4]2 // num_elements +[u8]0 // bitfield +[u8]6 // value + // truncated and missing element here +[anchr]param1_value_array_member diff --git a/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd24_map_of_optionals_less_than_necessary_bytes.expected b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd24_map_of_optionals_less_than_necessary_bytes.expected new file mode 100644 index 0000000000..5a1ec4ef20 --- /dev/null +++ b/mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd24_map_of_optionals_less_than_necessary_bytes.expected @@ -0,0 +1 @@ +VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER diff --git a/mojo/public/interfaces/bindings/tests/validation_data_files.gni b/mojo/public/interfaces/bindings/tests/validation_data_files.gni index d497733045..955b86c2db 100644 --- a/mojo/public/interfaces/bindings/tests/validation_data_files.gni +++ b/mojo/public/interfaces/bindings/tests/validation_data_files.gni @@ -145,8 +145,12 @@ mojo_public_interfaces_bindings_test_validation_data_files = [ "data/validation/conformance_mthd21_empty_extensible_enum_accepts_any_value.expected", "data/validation/conformance_mthd22_empty_nonextensible_enum_accepts_no_values.data", "data/validation/conformance_mthd22_empty_nonextensible_enum_accepts_no_values.expected", + "data/validation/conformance_mthd23_array_of_optionals_less_than_necessary_bytes.data", + "data/validation/conformance_mthd23_array_of_optionals_less_than_necessary_bytes.expected", "data/validation/conformance_mthd23_good.data", "data/validation/conformance_mthd23_good.expected", + "data/validation/conformance_mthd24_map_of_optionals_less_than_necessary_bytes.data", + "data/validation/conformance_mthd24_map_of_optionals_less_than_necessary_bytes.expected", "data/validation/conformance_mthd24_good.data", "data/validation/conformance_mthd24_good.expected", "data/validation/conformance_mthd2_good.data", diff --git a/mojo/public/interfaces/bindings/tests/validation_unittest_bundle_data.filelist b/mojo/public/interfaces/bindings/tests/validation_unittest_bundle_data.filelist index 362f6b739f..9494cf6c4e 100644 --- a/mojo/public/interfaces/bindings/tests/validation_unittest_bundle_data.filelist +++ b/mojo/public/interfaces/bindings/tests/validation_unittest_bundle_data.filelist @@ -146,10 +146,14 @@ //mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd21_empty_extensible_enum_accepts_any_value.expected //mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd22_empty_nonextensible_enum_accepts_no_values.data //mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd22_empty_nonextensible_enum_accepts_no_values.expected +//mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd23_array_of_optionals_less_than_necessary_bytes.data +//mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd23_array_of_optionals_less_than_necessary_bytes.expected //mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd23_good.data //mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd23_good.expected //mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd24_good.data //mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd24_good.expected +//mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd24_map_of_optionals_less_than_necessary_bytes.data +//mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd24_map_of_optionals_less_than_necessary_bytes.expected //mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_good.data //mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_good.expected //mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd2_multiple_pointers_to_same_struct.data |