Remove quiche_mutex_impl.h override
This abstraction predates Abseil being consistently available everywhere QUICHE is used. Nowadays, QUICHE generally depends on Abseil, but this override still exists. As QUICHE is a standalone library, dependencies on //base are tricky at best. Using absl is more straightforward. Per the discussion below, the absl/synchronization ban is just about 1p conventions, and not a technical incompatibility: https://groups.google.com/a/chromium.org/g/cxx/c/oCqPxL7GBtQ/m/YHi08xYOAAAJ Remove the override so that QUICHE can avoid this now unnecessary internal abstraction. This also means QUICHE in Chromium more consistently matches QUICHE as it is developed upstream. (E.g. Chromium's override silently turned every read lock into a write lock, so we've been risking deadlocks if QUICHE ever relied on read locks working.) Moreover, looking at binary size difference and xrefs for QuicheMutex/QuicheNotification, it seems QuicheMutex never ends up in the Chromium binary anyway, just unit tests. So Chromium especially has no reason to care about this. If this change sticks, we can follow-up with removing the indirection from QUICHE. Change-Id: I05cb018d8ee4c288486238b3767c3a8a3c363fe5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6020098 Auto-Submit: David Benjamin <davidben@chromium.org> Reviewed-by: Victor Vasiliev <vasilvv@chromium.org> Commit-Queue: Victor Vasiliev <vasilvv@chromium.org> Cr-Commit-Position: refs/heads/main@{#1383142}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
3f992d444d
commit
1de32b7a41
net/third_party/quiche
4
net/third_party/quiche/BUILD.gn
vendored
4
net/third_party/quiche/BUILD.gn
vendored
@ -59,8 +59,6 @@ component("quiche") {
|
||||
"overrides/quiche_platform_impl/quiche_export_impl.h",
|
||||
"overrides/quiche_platform_impl/quiche_iovec_impl.h",
|
||||
"overrides/quiche_platform_impl/quiche_logging_impl.h",
|
||||
"overrides/quiche_platform_impl/quiche_mutex_impl.cc",
|
||||
"overrides/quiche_platform_impl/quiche_mutex_impl.h",
|
||||
"overrides/quiche_platform_impl/quiche_reference_counted_impl.h",
|
||||
"overrides/quiche_platform_impl/quiche_server_stats_impl.h",
|
||||
"overrides/quiche_platform_impl/quiche_stack_trace_impl.cc",
|
||||
@ -71,6 +69,8 @@ component("quiche") {
|
||||
"overrides/quiche_platform_impl/quiche_url_utils_impl.h",
|
||||
"src/quiche/common/platform/default/quiche_platform_impl/quiche_flags_impl.cc",
|
||||
"src/quiche/common/platform/default/quiche_platform_impl/quiche_flags_impl.h",
|
||||
"src/quiche/common/platform/default/quiche_platform_impl/quiche_mutex_impl.cc",
|
||||
"src/quiche/common/platform/default/quiche_platform_impl/quiche_mutex_impl.h",
|
||||
"src/quiche/common/platform/default/quiche_platform_impl/quiche_prefetch_impl.h",
|
||||
"src/quiche/http2/hpack/hpack_static_table_entries.inc",
|
||||
] + quiche_core_hdrs + quiche_core_srcs + binary_http_srcs +
|
||||
|
@ -1,25 +0,0 @@
|
||||
// Copyright 2016 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "net/third_party/quiche/overrides/quiche_platform_impl/quiche_mutex_impl.h"
|
||||
|
||||
namespace quiche {
|
||||
|
||||
void QuicheLockImpl::WriterLock() {
|
||||
lock_.Acquire();
|
||||
}
|
||||
|
||||
void QuicheLockImpl::WriterUnlock() {
|
||||
lock_.Release();
|
||||
}
|
||||
|
||||
void QuicheLockImpl::ReaderLock() {
|
||||
lock_.Acquire();
|
||||
}
|
||||
|
||||
void QuicheLockImpl::ReaderUnlock() {
|
||||
lock_.Release();
|
||||
}
|
||||
|
||||
} // namespace quiche
|
@ -1,110 +0,0 @@
|
||||
// Copyright 2016 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_MUTEX_IMPL_H_
|
||||
#define NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_MUTEX_IMPL_H_
|
||||
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
#include "net/third_party/quiche/src/quiche/common/platform/api/quiche_export.h"
|
||||
|
||||
#define QUICHE_EXCLUSIVE_LOCKS_REQUIRED_IMPL EXCLUSIVE_LOCKS_REQUIRED
|
||||
#define QUICHE_GUARDED_BY_IMPL GUARDED_BY
|
||||
#define QUICHE_LOCKABLE_IMPL LOCKABLE
|
||||
#define QUICHE_LOCKS_EXCLUDED_IMPL LOCKS_EXCLUDED
|
||||
#define QUICHE_SHARED_LOCKS_REQUIRED_IMPL SHARED_LOCKS_REQUIRED
|
||||
#define QUICHE_EXCLUSIVE_LOCK_FUNCTION_IMPL EXCLUSIVE_LOCK_FUNCTION
|
||||
#define QUICHE_UNLOCK_FUNCTION_IMPL UNLOCK_FUNCTION
|
||||
#define QUICHE_SHARED_LOCK_FUNCTION_IMPL SHARED_LOCK_FUNCTION
|
||||
#define QUICHE_SCOPED_LOCKABLE_IMPL SCOPED_LOCKABLE
|
||||
#define QUICHE_ASSERT_SHARED_LOCK_IMPL ASSERT_SHARED_LOCK
|
||||
|
||||
#ifndef EXCLUSIVE_LOCK_FUNCTION
|
||||
#define EXCLUSIVE_LOCK_FUNCTION(...)
|
||||
#endif
|
||||
|
||||
#ifndef UNLOCK_FUNCTION
|
||||
#define UNLOCK_FUNCTION(...)
|
||||
#endif
|
||||
|
||||
#ifndef SHARED_LOCK_FUNCTION
|
||||
#define SHARED_LOCK_FUNCTION(...)
|
||||
#endif
|
||||
|
||||
#ifndef ASSERT_SHARED_LOCK
|
||||
#define ASSERT_SHARED_LOCK(...)
|
||||
#endif
|
||||
|
||||
#ifndef LOCKABLE
|
||||
#define LOCKABLE
|
||||
#endif
|
||||
|
||||
#ifndef SCOPED_LOCKABLE
|
||||
#define SCOPED_LOCKABLE
|
||||
#endif
|
||||
|
||||
#ifndef GUARDED_BY
|
||||
#define GUARDED_BY(x)
|
||||
#endif
|
||||
|
||||
#ifndef SHARED_LOCKS_REQUIRED
|
||||
#define SHARED_LOCKS_REQUIRED(...)
|
||||
#endif
|
||||
|
||||
#ifndef EXCLUSIVE_LOCKS_REQUIRED
|
||||
#define EXCLUSIVE_LOCKS_REQUIRED(...)
|
||||
#endif
|
||||
|
||||
namespace quiche {
|
||||
|
||||
// A class wrapping a non-reentrant mutex.
|
||||
class QUICHE_LOCKABLE_IMPL QUICHE_EXPORT QuicheLockImpl {
|
||||
public:
|
||||
QuicheLockImpl() = default;
|
||||
|
||||
QuicheLockImpl(const QuicheLockImpl&) = delete;
|
||||
QuicheLockImpl& operator=(const QuicheLockImpl&) = delete;
|
||||
|
||||
// Block until lock_ is free, then acquire it exclusively.
|
||||
void WriterLock() EXCLUSIVE_LOCK_FUNCTION();
|
||||
|
||||
// Release lock_. Caller must hold it exclusively.
|
||||
void WriterUnlock() UNLOCK_FUNCTION();
|
||||
|
||||
// Block until lock_ is free or shared, then acquire a share of it.
|
||||
void ReaderLock() SHARED_LOCK_FUNCTION();
|
||||
|
||||
// Release lock_. Caller could hold it in shared mode.
|
||||
void ReaderUnlock() UNLOCK_FUNCTION();
|
||||
|
||||
// Not implemented.
|
||||
void AssertReaderHeld() const ASSERT_SHARED_LOCK() {}
|
||||
|
||||
private:
|
||||
base::Lock lock_;
|
||||
};
|
||||
|
||||
// A Notification allows threads to receive notification of a single occurrence
|
||||
// of a single event.
|
||||
class QUICHE_EXPORT QuicheNotificationImpl {
|
||||
public:
|
||||
QuicheNotificationImpl()
|
||||
: event_(base::WaitableEvent::ResetPolicy::MANUAL,
|
||||
base::WaitableEvent::InitialState::NOT_SIGNALED) {}
|
||||
QuicheNotificationImpl(const QuicheNotificationImpl&) = delete;
|
||||
QuicheNotificationImpl& operator=(const QuicheNotificationImpl&) = delete;
|
||||
|
||||
bool HasBeenNotified() { return event_.IsSignaled(); }
|
||||
|
||||
void Notify() { event_.Signal(); }
|
||||
|
||||
void WaitForNotification() { event_.Wait(); }
|
||||
|
||||
private:
|
||||
base::WaitableEvent event_;
|
||||
};
|
||||
|
||||
} // namespace quiche
|
||||
|
||||
#endif // NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_MUTEX_IMPL_H_
|
Reference in New Issue
Block a user