mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Use Rand instead of absl::Random
Use Nearby's common Rand() util instead of absl::Random PiperOrigin-RevId: 495386054
This commit is contained in:
committed by
Copybara-Service
parent
73c1fba668
commit
b3f8534226
@@ -270,7 +270,6 @@ cc_test(
|
||||
"//internal/platform/implementation/g3", # build_cleaner: keep
|
||||
"//presence/implementation/mediums",
|
||||
"@com_github_protobuf_matchers//protobuf-matchers",
|
||||
"@com_google_absl//absl/random",
|
||||
"@com_google_absl//absl/time",
|
||||
"@com_google_googletest//:gtest_main",
|
||||
],
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "internal/crypto/random.h"
|
||||
#include "presence/implementation/advertisement_factory.h"
|
||||
|
||||
namespace nearby {
|
||||
@@ -157,7 +158,7 @@ void BroadcastManager::StopBroadcast(BroadcastSessionId id) {
|
||||
}
|
||||
|
||||
BroadcastSessionId BroadcastManager::GenerateBroadcastSessionId() {
|
||||
return absl::Uniform<BroadcastSessionId>(bit_gen_);
|
||||
return ::crypto::RandData<BroadcastSessionId>();
|
||||
}
|
||||
|
||||
void BroadcastManager::BroadcastSessionState::SetAdvertisingSession(
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/base/thread_annotations.h"
|
||||
#include "absl/random/random.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "internal/platform/single_thread_executor.h"
|
||||
#include "internal/proto/credential.pb.h"
|
||||
@@ -89,7 +88,6 @@ class BroadcastManager {
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(*executor_);
|
||||
absl::flat_hash_map<BroadcastSessionId, BroadcastSessionState> sessions_
|
||||
ABSL_GUARDED_BY(*executor_);
|
||||
absl::BitGen bit_gen_;
|
||||
};
|
||||
|
||||
} // namespace presence
|
||||
|
||||
@@ -28,7 +28,6 @@ cc_library(
|
||||
deps = [
|
||||
"//internal/platform:comm",
|
||||
"//internal/platform:uuid",
|
||||
"//internal/platform/implementation:comm",
|
||||
"//presence:types",
|
||||
],
|
||||
)
|
||||
@@ -42,7 +41,6 @@ cc_test(
|
||||
shard_count = 16,
|
||||
deps = [
|
||||
":mediums",
|
||||
"//internal/platform:base",
|
||||
"//internal/platform:comm",
|
||||
"//internal/platform:test_util",
|
||||
"//internal/platform:types",
|
||||
@@ -51,8 +49,6 @@ cc_test(
|
||||
"//internal/platform/implementation/g3", # build_cleaner: keep
|
||||
"//presence:types",
|
||||
"@com_github_protobuf_matchers//protobuf-matchers",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/time",
|
||||
"@com_google_googletest//:gtest_main",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/random/random.h"
|
||||
#include "absl/types/variant.h"
|
||||
#include "internal/crypto/random.h"
|
||||
#include "internal/platform/future.h"
|
||||
#include "internal/platform/implementation/ble_v2.h"
|
||||
#include "internal/platform/implementation/credential_callbacks.h"
|
||||
@@ -50,7 +50,7 @@ namespace presence {
|
||||
|
||||
ScanSessionId ScanManager::StartScan(ScanRequest scan_request,
|
||||
ScanCallback cb) {
|
||||
ScanSessionId id = absl::Uniform<BroadcastSessionId>(bit_gen_);
|
||||
ScanSessionId id = ::crypto::RandData<ScanSessionId>();
|
||||
RunOnServiceControllerThread(
|
||||
"start-scan",
|
||||
[this, id, scan_request, scan_callback = std::move(cb)]()
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "absl/container/flat_hash_map.h"
|
||||
#include "absl/random/random.h"
|
||||
#include "internal/platform/single_thread_executor.h"
|
||||
#include "internal/proto/credential.pb.h"
|
||||
#include "presence/data_types.h"
|
||||
@@ -86,7 +85,6 @@ class ScanManager {
|
||||
absl::flat_hash_map<ScanSessionId, ScanSessionState> scan_sessions_
|
||||
ABSL_GUARDED_BY(*executor_);
|
||||
SingleThreadExecutor* executor_;
|
||||
absl::BitGen bit_gen_;
|
||||
};
|
||||
|
||||
} // namespace presence
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "gmock/gmock.h"
|
||||
#include "protobuf-matchers/protocol-buffer-matchers.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/random/random.h"
|
||||
#include "absl/time/time.h"
|
||||
#include "internal/platform/bluetooth_adapter.h"
|
||||
#include "internal/platform/count_down_latch.h"
|
||||
|
||||
Reference in New Issue
Block a user