gfe-relnote: use QUIC_foo instead of ABSL_foo for mutex annotations in QUIC. Not flag protected. No behavior change. This effectively reverts cr/266433516 and cr/266428140 (which were in turn reverts of cr/265958257 and cr/265940959) and then replaces the ABSL_ prefixes with QUIC_ PiperOrigin-RevId: 266445797 Change-Id: I369c0c929e5dc44a332635e695d526a2f91fa3f6
diff --git a/quic/core/crypto/crypto_secret_boxer.h b/quic/core/crypto/crypto_secret_boxer.h index 395d389..eba7a57 100644 --- a/quic/core/crypto/crypto_secret_boxer.h +++ b/quic/core/crypto/crypto_secret_boxer.h
@@ -59,7 +59,7 @@ // state_ is an opaque pointer to whatever additional state the concrete // implementation of CryptoSecretBoxer requires. - std::unique_ptr<State> state_ GUARDED_BY(lock_); + std::unique_ptr<State> state_ QUIC_GUARDED_BY(lock_); }; } // namespace quic
diff --git a/quic/core/crypto/quic_crypto_server_config.h b/quic/core/crypto/quic_crypto_server_config.h index d8d9cab..3fb424d 100644 --- a/quic/core/crypto/quic_crypto_server_config.h +++ b/quic/core/crypto/quic_crypto_server_config.h
@@ -508,7 +508,7 @@ // Get a ref to the config with a given server config id. QuicReferenceCountedPointer<Config> GetConfigWithScid( QuicStringPiece requested_scid) const - SHARED_LOCKS_REQUIRED(configs_lock_); + QUIC_SHARED_LOCKS_REQUIRED(configs_lock_); // A snapshot of the configs associated with an in-progress handshake. struct Configs { @@ -537,7 +537,7 @@ // SelectNewPrimaryConfig reevaluates the primary config based on the // "primary_time" deadlines contained in each. void SelectNewPrimaryConfig(QuicWallTime now) const - EXCLUSIVE_LOCKS_REQUIRED(configs_lock_); + QUIC_EXCLUSIVE_LOCKS_REQUIRED(configs_lock_); // EvaluateClientHello checks |client_hello_state->client_hello| for gross // errors and determines whether it is fresh (i.e. not a replay). The results @@ -850,7 +850,7 @@ // Returns true if the next config promotion should happen now. bool IsNextConfigReady(QuicWallTime now) const - SHARED_LOCKS_REQUIRED(configs_lock_); + QUIC_SHARED_LOCKS_REQUIRED(configs_lock_); // replay_protection_ controls whether the server enforces that handshakes // aren't replays. @@ -869,12 +869,12 @@ // configs_ contains all active server configs. It's expected that there are // about half-a-dozen configs active at any one time. - ConfigMap configs_ GUARDED_BY(configs_lock_); + ConfigMap configs_ QUIC_GUARDED_BY(configs_lock_); // primary_config_ points to a Config (which is also in |configs_|) which is // the primary config - i.e. the one that we'll give out to new clients. mutable QuicReferenceCountedPointer<Config> primary_config_ - GUARDED_BY(configs_lock_); + QUIC_GUARDED_BY(configs_lock_); // fallback_config_ points to a Config (which is also in |configs_|) which is // the fallback config, which will be used if the other configs are unuseable @@ -882,15 +882,16 @@ // // TODO(b/112548056): This is currently always nullptr. QuicReferenceCountedPointer<Config> fallback_config_ - GUARDED_BY(configs_lock_); + QUIC_GUARDED_BY(configs_lock_); // next_config_promotion_time_ contains the nearest, future time when an // active config will be promoted to primary. - mutable QuicWallTime next_config_promotion_time_ GUARDED_BY(configs_lock_); + mutable QuicWallTime next_config_promotion_time_ + QUIC_GUARDED_BY(configs_lock_); // Callback to invoke when the primary config changes. std::unique_ptr<PrimaryConfigChangedCallback> primary_config_changed_cb_ - GUARDED_BY(configs_lock_); + QUIC_GUARDED_BY(configs_lock_); // Used to protect the source-address tokens that are given to clients. CryptoSecretBoxer source_address_token_boxer_;
diff --git a/quic/platform/api/quic_logging.h b/quic/platform/api/quic_logging.h index ba48dc1..ce706e5 100644 --- a/quic/platform/api/quic_logging.h +++ b/quic/platform/api/quic_logging.h
@@ -25,6 +25,7 @@ #define QUIC_LOG_IF(severity, condition) QUIC_LOG_IF_IMPL(severity, condition) #define QUIC_PREDICT_FALSE(x) QUIC_PREDICT_FALSE_IMPL(x) +#define QUIC_PREDICT_TRUE(x) QUIC_PREDICT_TRUE_IMPL(x) // This is a noop in release build. #define QUIC_NOTREACHED() QUIC_NOTREACHED_IMPL()
diff --git a/quic/platform/api/quic_mutex.h b/quic/platform/api/quic_mutex.h index 162863a..d35c660 100644 --- a/quic/platform/api/quic_mutex.h +++ b/quic/platform/api/quic_mutex.h
@@ -7,31 +7,42 @@ #include "net/quic/platform/impl/quic_mutex_impl.h" +#define QUIC_EXCLUSIVE_LOCKS_REQUIRED QUIC_EXCLUSIVE_LOCKS_REQUIRED_IMPL +#define QUIC_GUARDED_BY QUIC_GUARDED_BY_IMPL +#define QUIC_LOCKABLE QUIC_LOCKABLE_IMPL +#define QUIC_LOCKS_EXCLUDED QUIC_LOCKS_EXCLUDED_IMPL +#define QUIC_SHARED_LOCKS_REQUIRED QUIC_SHARED_LOCKS_REQUIRED_IMPL +#define QUIC_EXCLUSIVE_LOCK_FUNCTION QUIC_EXCLUSIVE_LOCK_FUNCTION_IMPL +#define QUIC_UNLOCK_FUNCTION QUIC_UNLOCK_FUNCTION_IMPL +#define QUIC_SHARED_LOCK_FUNCTION QUIC_SHARED_LOCK_FUNCTION_IMPL +#define QUIC_SCOPED_LOCKABLE QUIC_SCOPED_LOCKABLE_IMPL +#define QUIC_ASSERT_SHARED_LOCK QUIC_ASSERT_SHARED_LOCK_IMPL + namespace quic { // A class representing a non-reentrant mutex in QUIC. -class LOCKABLE QUIC_EXPORT_PRIVATE QuicMutex { +class QUIC_LOCKABLE QUIC_EXPORT_PRIVATE QuicMutex { public: QuicMutex() = default; QuicMutex(const QuicMutex&) = delete; QuicMutex& operator=(const QuicMutex&) = delete; // Block until this Mutex is free, then acquire it exclusively. - void WriterLock() EXCLUSIVE_LOCK_FUNCTION(); + void WriterLock() QUIC_EXCLUSIVE_LOCK_FUNCTION(); // Release this Mutex. Caller must hold it exclusively. - void WriterUnlock() UNLOCK_FUNCTION(); + void WriterUnlock() QUIC_UNLOCK_FUNCTION(); // Block until this Mutex is free or shared, then acquire a share of it. - void ReaderLock() SHARED_LOCK_FUNCTION(); + void ReaderLock() QUIC_SHARED_LOCK_FUNCTION(); // Release this Mutex. Caller could hold it in shared mode. - void ReaderUnlock() UNLOCK_FUNCTION(); + void ReaderUnlock() QUIC_UNLOCK_FUNCTION(); // Returns immediately if current thread holds the Mutex in at least shared // mode. Otherwise, may report an error (typically by crashing with a // diagnostic), or may return immediately. - void AssertReaderHeld() const ASSERT_SHARED_LOCK(); + void AssertReaderHeld() const QUIC_ASSERT_SHARED_LOCK(); private: QuicLockImpl impl_; @@ -39,13 +50,13 @@ // A helper class that acquires the given QuicMutex shared lock while the // QuicReaderMutexLock is in scope. -class SCOPED_LOCKABLE QUIC_EXPORT_PRIVATE QuicReaderMutexLock { +class QUIC_SCOPED_LOCKABLE QUIC_EXPORT_PRIVATE QuicReaderMutexLock { public: - explicit QuicReaderMutexLock(QuicMutex* lock) SHARED_LOCK_FUNCTION(lock); + explicit QuicReaderMutexLock(QuicMutex* lock) QUIC_SHARED_LOCK_FUNCTION(lock); QuicReaderMutexLock(const QuicReaderMutexLock&) = delete; QuicReaderMutexLock& operator=(const QuicReaderMutexLock&) = delete; - ~QuicReaderMutexLock() UNLOCK_FUNCTION(); + ~QuicReaderMutexLock() QUIC_UNLOCK_FUNCTION(); private: QuicMutex* const lock_; @@ -53,13 +64,14 @@ // A helper class that acquires the given QuicMutex exclusive lock while the // QuicWriterMutexLock is in scope. -class SCOPED_LOCKABLE QUIC_EXPORT_PRIVATE QuicWriterMutexLock { +class QUIC_SCOPED_LOCKABLE QUIC_EXPORT_PRIVATE QuicWriterMutexLock { public: - explicit QuicWriterMutexLock(QuicMutex* lock) EXCLUSIVE_LOCK_FUNCTION(lock); + explicit QuicWriterMutexLock(QuicMutex* lock) + QUIC_EXCLUSIVE_LOCK_FUNCTION(lock); QuicWriterMutexLock(const QuicWriterMutexLock&) = delete; QuicWriterMutexLock& operator=(const QuicWriterMutexLock&) = delete; - ~QuicWriterMutexLock() UNLOCK_FUNCTION(); + ~QuicWriterMutexLock() QUIC_UNLOCK_FUNCTION(); private: QuicMutex* const lock_;
diff --git a/quic/qbone/bonnet/icmp_reachable.h b/quic/qbone/bonnet/icmp_reachable.h index 4b6403e..b4ce4c1 100644 --- a/quic/qbone/bonnet/icmp_reachable.h +++ b/quic/qbone/bonnet/icmp_reachable.h
@@ -75,9 +75,10 @@ // Initializes this reachability probe. Must be called from within the // |epoll_server|'s thread. - bool Init() LOCKS_EXCLUDED(header_lock_) override; + bool Init() QUIC_LOCKS_EXCLUDED(header_lock_) override; - int64 /* allow-non-std-int */ OnAlarm() LOCKS_EXCLUDED(header_lock_) override; + int64 /* allow-non-std-int */ OnAlarm() + QUIC_LOCKS_EXCLUDED(header_lock_) override; static QuicStringPiece StatusName(Status status); @@ -110,7 +111,7 @@ IcmpReachable* reachable_; }; - bool OnEvent(int fd) LOCKS_EXCLUDED(header_lock_); + bool OnEvent(int fd) QUIC_LOCKS_EXCLUDED(header_lock_); const absl::Duration timeout_; @@ -128,7 +129,7 @@ int recv_fd_; QuicMutex header_lock_; - icmp6_hdr icmp_header_ GUARDED_BY(header_lock_){}; + icmp6_hdr icmp_header_ QUIC_GUARDED_BY(header_lock_){}; absl::Time start_ = absl::InfinitePast(); absl::Time end_ = absl::InfinitePast();
diff --git a/quic/test_tools/packet_dropping_test_writer.h b/quic/test_tools/packet_dropping_test_writer.h index 92c8956..4b3e8af 100644 --- a/quic/test_tools/packet_dropping_test_writer.h +++ b/quic/test_tools/packet_dropping_test_writer.h
@@ -161,14 +161,14 @@ uint64_t num_calls_to_write_; QuicMutex config_mutex_; - int32_t fake_packet_loss_percentage_ GUARDED_BY(config_mutex_); - int32_t fake_drop_first_n_packets_ GUARDED_BY(config_mutex_); - int32_t fake_blocked_socket_percentage_ GUARDED_BY(config_mutex_); - int32_t fake_packet_reorder_percentage_ GUARDED_BY(config_mutex_); - QuicTime::Delta fake_packet_delay_ GUARDED_BY(config_mutex_); - QuicBandwidth fake_bandwidth_ GUARDED_BY(config_mutex_); - QuicByteCount buffer_size_ GUARDED_BY(config_mutex_); - int32_t num_consecutive_packet_lost_ GUARDED_BY(config_mutex_); + int32_t fake_packet_loss_percentage_ QUIC_GUARDED_BY(config_mutex_); + int32_t fake_drop_first_n_packets_ QUIC_GUARDED_BY(config_mutex_); + int32_t fake_blocked_socket_percentage_ QUIC_GUARDED_BY(config_mutex_); + int32_t fake_packet_reorder_percentage_ QUIC_GUARDED_BY(config_mutex_); + QuicTime::Delta fake_packet_delay_ QUIC_GUARDED_BY(config_mutex_); + QuicBandwidth fake_bandwidth_ QUIC_GUARDED_BY(config_mutex_); + QuicByteCount buffer_size_ QUIC_GUARDED_BY(config_mutex_); + int32_t num_consecutive_packet_lost_ QUIC_GUARDED_BY(config_mutex_); }; } // namespace test
diff --git a/quic/test_tools/quic_crypto_server_config_peer.h b/quic/test_tools/quic_crypto_server_config_peer.h index 3f5a984..baaa9b8 100644 --- a/quic/test_tools/quic_crypto_server_config_peer.h +++ b/quic/test_tools/quic_crypto_server_config_peer.h
@@ -73,7 +73,7 @@ // ConfigsDebug returns a std::string that contains debugging information // about the set of Configs loaded in |server_config_| and their status. std::string ConfigsDebug() - SHARED_LOCKS_REQUIRED(server_config_->configs_lock_); + QUIC_SHARED_LOCKS_REQUIRED(server_config_->configs_lock_); void SelectNewPrimaryConfig(int seconds);
diff --git a/quic/test_tools/server_thread.h b/quic/test_tools/server_thread.h index ffbce7f..d430297 100644 --- a/quic/test_tools/server_thread.h +++ b/quic/test_tools/server_thread.h
@@ -73,13 +73,13 @@ std::unique_ptr<QuicServer> server_; QuicSocketAddress address_; mutable QuicMutex port_lock_; - int port_ GUARDED_BY(port_lock_); + int port_ QUIC_GUARDED_BY(port_lock_); bool initialized_; QuicMutex scheduled_actions_lock_; QuicDeque<std::function<void()>> scheduled_actions_ - GUARDED_BY(scheduled_actions_lock_); + QUIC_GUARDED_BY(scheduled_actions_lock_); }; } // namespace test
diff --git a/quic/tools/quic_memory_cache_backend.h b/quic/tools/quic_memory_cache_backend.h index ff76c9a..8e202c0 100644 --- a/quic/tools/quic_memory_cache_backend.h +++ b/quic/tools/quic_memory_cache_backend.h
@@ -177,15 +177,15 @@ // Cached responses. QuicUnorderedMap<std::string, std::unique_ptr<QuicBackendResponse>> responses_ - GUARDED_BY(response_mutex_); + QUIC_GUARDED_BY(response_mutex_); // The default response for cache misses, if set. std::unique_ptr<QuicBackendResponse> default_response_ - GUARDED_BY(response_mutex_); + QUIC_GUARDED_BY(response_mutex_); // A map from request URL to associated server push responses (if any). std::multimap<std::string, QuicBackendResponse::ServerPushInfo> - server_push_resources_ GUARDED_BY(response_mutex_); + server_push_resources_ QUIC_GUARDED_BY(response_mutex_); // Protects against concurrent access from test threads setting responses, and // server threads accessing those responses.