mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Roll forward up to cl/355302206.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "platform/base/cancellation_flag.h"
|
||||
|
||||
#include "platform/base/feature_flags.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -15,6 +17,11 @@ CancellationFlag::CancellationFlag(bool cancelled) {
|
||||
void CancellationFlag::Cancel() {
|
||||
absl::MutexLock lock(mutex_.get());
|
||||
|
||||
// Return immediately as no-op if feature flag is not enabled.
|
||||
if (!FeatureFlags::GetInstance().GetFlags().enable_cancellation_flag) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cancelled_) {
|
||||
// Someone already cancelled. Return immediately.
|
||||
return;
|
||||
@@ -25,6 +32,11 @@ void CancellationFlag::Cancel() {
|
||||
bool CancellationFlag::Cancelled() const {
|
||||
absl::MutexLock lock(mutex_.get());
|
||||
|
||||
// Return falsea as no-op if feature flag is not enabled.
|
||||
if (!FeatureFlags::GetInstance().GetFlags().enable_cancellation_flag) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return cancelled_;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user