mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
BEGIN_PUBLIC
Microsoft has updated the winrt library END_PUBLC PiperOrigin-RevId: 387168248
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
load("//tools/build_defs/cc:cc_fake_binary.bzl", "cc_fake_binary")
|
||||
|
||||
licenses(["notice"])
|
||||
# Copyright 2020 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -12,8 +15,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
load("//tools/build_defs/cc:cc_fake_binary.bzl", "cc_fake_binary")
|
||||
|
||||
cc_library(
|
||||
name = "types",
|
||||
srcs = [
|
||||
@@ -56,13 +57,13 @@ cc_library(
|
||||
],
|
||||
deps = [
|
||||
":logging",
|
||||
"//absl/base:core_headers",
|
||||
"//absl/time",
|
||||
"//platform/api:platform",
|
||||
"//platform/api:types",
|
||||
"//platform/base",
|
||||
"//platform/base:logging",
|
||||
"//platform/base:util",
|
||||
"//absl/base:core_headers",
|
||||
"//absl/time",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -89,12 +90,12 @@ cc_library(
|
||||
":logging",
|
||||
":types",
|
||||
"//proto/connections:offline_wire_formats_portable_proto",
|
||||
"//absl/container:flat_hash_map",
|
||||
"//absl/strings",
|
||||
"//platform/api:comm",
|
||||
"//platform/api:platform",
|
||||
"//platform/base",
|
||||
"//platform/base:cancellation_flag",
|
||||
"//absl/container:flat_hash_map",
|
||||
"//absl/strings",
|
||||
"//webrtc/api:libjingle_peerconnection_api",
|
||||
],
|
||||
)
|
||||
@@ -141,13 +142,13 @@ cc_test(
|
||||
":comm",
|
||||
":logging",
|
||||
":types",
|
||||
"//platform/base",
|
||||
"//platform/base:test_util",
|
||||
"//platform/impl/g3", # build_cleaner: keep
|
||||
"//testing/base/public:gunit_main",
|
||||
"//absl/strings",
|
||||
"//absl/synchronization",
|
||||
"//absl/time",
|
||||
"//platform/base",
|
||||
"//platform/base:test_util",
|
||||
"//platform/impl/g3", # build_cleaner: keep
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace nearby {
|
||||
// A boolean value that may be updated atomically.
|
||||
// See documentation in
|
||||
// cpp/platform/api/atomic_boolean.h
|
||||
class AtomicBoolean final : public api::AtomicBoolean {
|
||||
class AtomicBoolean final : public api::AtomicBoolean {
|
||||
public:
|
||||
using Platform = api::ImplementationPlatform;
|
||||
explicit AtomicBoolean(bool value = false)
|
||||
|
||||
@@ -41,8 +41,7 @@ bool BleMedium::StartScanning(
|
||||
peripherals_.clear();
|
||||
}
|
||||
return impl_->StartScanning(
|
||||
service_id,
|
||||
fast_advertisement_service_uuid,
|
||||
service_id, fast_advertisement_service_uuid,
|
||||
{
|
||||
.peripheral_discovered_cb =
|
||||
[this](api::BlePeripheral& peripheral,
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#ifndef PLATFORM_PUBLIC_BLE_H_
|
||||
#define PLATFORM_PUBLIC_BLE_H_
|
||||
|
||||
#include "absl/container/flat_hash_map.h"
|
||||
#include "platform/api/ble.h"
|
||||
#include "platform/api/platform.h"
|
||||
#include "platform/base/byte_array.h"
|
||||
@@ -23,7 +24,6 @@
|
||||
#include "platform/base/output_stream.h"
|
||||
#include "platform/public/bluetooth_adapter.h"
|
||||
#include "platform/public/mutex.h"
|
||||
#include "absl/container/flat_hash_map.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "platform/base/medium_environment.h"
|
||||
#include "platform/public/count_down_latch.h"
|
||||
#include "platform/public/logging.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "platform/api/bluetooth_adapter.h"
|
||||
#include "platform/api/bluetooth_classic.h"
|
||||
#include "platform/api/platform.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
@@ -98,9 +98,7 @@ class BluetoothAdapter final {
|
||||
|
||||
// Synchronously sets the scan mode of the adapter, and returns true if the
|
||||
// operation was a success.
|
||||
bool SetScanMode(ScanMode scan_mode) {
|
||||
return impl_->SetScanMode(scan_mode);
|
||||
}
|
||||
bool SetScanMode(ScanMode scan_mode) { return impl_->SetScanMode(scan_mode); }
|
||||
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#getName()
|
||||
// Returns an empty string on error
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
|
||||
#include "platform/public/bluetooth_adapter.h"
|
||||
|
||||
#include "platform/base/bluetooth_utils.h"
|
||||
#include "platform/public/logging.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "platform/base/bluetooth_utils.h"
|
||||
#include "platform/public/logging.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/container/flat_hash_map.h"
|
||||
#include "platform/api/bluetooth_classic.h"
|
||||
#include "platform/api/platform.h"
|
||||
#include "platform/base/byte_array.h"
|
||||
@@ -29,7 +30,6 @@
|
||||
#include "platform/public/bluetooth_adapter.h"
|
||||
#include "platform/public/logging.h"
|
||||
#include "platform/public/mutex.h"
|
||||
#include "absl/container/flat_hash_map.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/time/time.h"
|
||||
#include "platform/base/medium_environment.h"
|
||||
#include "platform/public/bluetooth_adapter.h"
|
||||
#include "platform/public/count_down_latch.h"
|
||||
#include "platform/public/logging.h"
|
||||
#include "platform/public/single_thread_executor.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/time/time.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -41,9 +41,7 @@ class CancelableAlarm {
|
||||
: name_(name),
|
||||
cancelable_(scheduled_executor->Schedule(std::move(runnable), delay)) {}
|
||||
~CancelableAlarm() = default;
|
||||
CancelableAlarm(CancelableAlarm&& other) {
|
||||
*this = std::move(other);
|
||||
}
|
||||
CancelableAlarm(CancelableAlarm&& other) { *this = std::move(other); }
|
||||
CancelableAlarm& operator=(CancelableAlarm&& other) {
|
||||
MutexLock lock(&mutex_);
|
||||
{
|
||||
@@ -59,9 +57,7 @@ class CancelableAlarm {
|
||||
return cancelable_.Cancel();
|
||||
}
|
||||
|
||||
bool IsValid() {
|
||||
return cancelable_.IsValid();
|
||||
}
|
||||
bool IsValid() { return cancelable_.IsValid(); }
|
||||
|
||||
private:
|
||||
Mutex mutex_;
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
|
||||
#include "platform/public/cancelable_alarm.h"
|
||||
|
||||
#include "platform/public/atomic_boolean.h"
|
||||
#include "platform/public/scheduled_executor.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/time/time.h"
|
||||
#include "platform/public/atomic_boolean.h"
|
||||
#include "platform/public/scheduled_executor.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
|
||||
#include "platform/public/condition_variable.h"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/time/time.h"
|
||||
#include "platform/public/logging.h"
|
||||
#include "platform/public/mutex.h"
|
||||
#include "platform/public/single_thread_executor.h"
|
||||
#include "platform/public/system_clock.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/time/time.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "absl/time/time.h"
|
||||
#include "platform/api/count_down_latch.h"
|
||||
#include "platform/api/platform.h"
|
||||
#include "platform/base/exception.h"
|
||||
#include "absl/time/time.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
#include "platform/public/count_down_latch.h"
|
||||
|
||||
#include "platform/public/single_thread_executor.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "platform/public/single_thread_executor.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
|
||||
#include "platform/public/crypto.h"
|
||||
|
||||
#include "platform/base/byte_array.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "platform/base/byte_array.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -34,9 +34,7 @@ class Future final {
|
||||
void AddListener(Runnable runnable, api::Executor* executor) {
|
||||
impl_->AddListener(std::move(runnable), executor);
|
||||
}
|
||||
bool IsSet() const {
|
||||
return impl_->IsSet();
|
||||
}
|
||||
bool IsSet() const { return impl_->IsSet(); }
|
||||
|
||||
private:
|
||||
// Instance of future implementation is wrapped in shared_ptr<> to make
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
|
||||
#include "platform/public/future.h"
|
||||
|
||||
#include "platform/public/single_thread_executor.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/time/clock.h"
|
||||
#include "absl/time/time.h"
|
||||
#include "platform/public/single_thread_executor.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
@@ -102,7 +102,7 @@ TEST(FutureTest, GetBlocksWhenNotReady) {
|
||||
Future<int> future;
|
||||
SingleThreadExecutor executor;
|
||||
absl::Time start = absl::Now();
|
||||
executor.Execute([&future](){
|
||||
executor.Execute([&future]() {
|
||||
absl::SleepFor(absl::Milliseconds(500));
|
||||
future.Set(10);
|
||||
});
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/time/time.h"
|
||||
#include "platform/base/runnable.h"
|
||||
#include "platform/public/system_clock.h"
|
||||
#include "absl/time/time.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
#ifndef PLATFORM_PUBLIC_MULTI_THREAD_EXECUTOR_H_
|
||||
#define PLATFORM_PUBLIC_MULTI_THREAD_EXECUTOR_H_
|
||||
|
||||
#include "absl/base/thread_annotations.h"
|
||||
#include "platform/api/platform.h"
|
||||
#include "platform/public/submittable_executor.h"
|
||||
#include "absl/base/thread_annotations.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
|
||||
#include "platform/base/exception.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/synchronization/mutex.h"
|
||||
#include "absl/time/clock.h"
|
||||
#include "absl/time/time.h"
|
||||
#include "platform/base/exception.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "absl/base/thread_annotations.h"
|
||||
#include "platform/api/mutex.h"
|
||||
#include "platform/api/platform.h"
|
||||
#include "absl/base/thread_annotations.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
#ifndef PLATFORM_PUBLIC_MUTEX_LOCK_H_
|
||||
#define PLATFORM_PUBLIC_MUTEX_LOCK_H_
|
||||
|
||||
#include "absl/base/thread_annotations.h"
|
||||
#include "platform/api/mutex.h"
|
||||
#include "platform/public/mutex.h"
|
||||
#include "absl/base/thread_annotations.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
|
||||
#include "platform/public/mutex.h"
|
||||
|
||||
#include "platform/public/condition_variable.h"
|
||||
#include "platform/public/single_thread_executor.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/synchronization/mutex.h"
|
||||
#include "absl/time/clock.h"
|
||||
#include "absl/time/time.h"
|
||||
#include "platform/public/condition_variable.h"
|
||||
#include "platform/public/single_thread_executor.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -64,8 +64,7 @@ void PendingJobRegistry::RemoveRunningJob(const std::string& name,
|
||||
void PendingJobRegistry::ListJobs() {
|
||||
auto current_time = SystemClock::ElapsedRealtime();
|
||||
MutexLock lock(&mutex_);
|
||||
if (current_time - list_jobs_time_ < kMinReportInterval)
|
||||
return;
|
||||
if (current_time - list_jobs_time_ < kMinReportInterval) return;
|
||||
for (auto& job : pending_jobs_) {
|
||||
auto age = current_time - job.second;
|
||||
if (age >= kReportPendingJobsOlderThan) {
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
#ifndef PLATFORM_PUBLIC_PENDING_JOB_REGISTRY_H_
|
||||
#define PLATFORM_PUBLIC_PENDING_JOB_REGISTRY_H_
|
||||
|
||||
#include "platform/public/mutex.h"
|
||||
#include "absl/base/thread_annotations.h"
|
||||
#include "absl/time/time.h"
|
||||
#include "platform/public/mutex.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "platform/base/prng.h"
|
||||
#include "platform/base/runnable.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include "absl/base/thread_annotations.h"
|
||||
#include "absl/time/time.h"
|
||||
#include "platform/api/platform.h"
|
||||
#include "platform/api/scheduled_executor.h"
|
||||
#include "platform/base/runnable.h"
|
||||
@@ -30,8 +32,6 @@
|
||||
#include "platform/public/mutex_lock.h"
|
||||
#include "platform/public/thread_check_callable.h"
|
||||
#include "platform/public/thread_check_runnable.h"
|
||||
#include "absl/base/thread_annotations.h"
|
||||
#include "absl/time/time.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
|
||||
#include "platform/base/exception.h"
|
||||
#include "platform/public/count_down_latch.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/synchronization/mutex.h"
|
||||
#include "absl/time/clock.h"
|
||||
#include "absl/time/time.h"
|
||||
#include "platform/base/exception.h"
|
||||
#include "platform/public/count_down_latch.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
#ifndef PLATFORM_PUBLIC_SINGLE_THREAD_EXECUTOR_H_
|
||||
#define PLATFORM_PUBLIC_SINGLE_THREAD_EXECUTOR_H_
|
||||
|
||||
#include "platform/public/submittable_executor.h"
|
||||
#include "absl/base/thread_annotations.h"
|
||||
#include "platform/public/submittable_executor.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
#include "platform/base/exception.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/synchronization/mutex.h"
|
||||
#include "absl/time/clock.h"
|
||||
#include "platform/base/exception.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/base/thread_annotations.h"
|
||||
#include "platform/api/executor.h"
|
||||
#include "platform/api/submittable_executor.h"
|
||||
#include "platform/base/callable.h"
|
||||
@@ -31,7 +32,6 @@
|
||||
#include "platform/public/mutex_lock.h"
|
||||
#include "platform/public/thread_check_callable.h"
|
||||
#include "platform/public/thread_check_runnable.h"
|
||||
#include "absl/base/thread_annotations.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
#ifndef PLATFORM_PUBLIC_THREAD_CHECK_CALLABLE_H_
|
||||
#define PLATFORM_PUBLIC_THREAD_CHECK_CALLABLE_H_
|
||||
|
||||
#include "absl/base/thread_annotations.h"
|
||||
#include "platform/base/callable.h"
|
||||
#include "platform/public/lockable.h"
|
||||
#include "absl/base/thread_annotations.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "absl/time/time.h"
|
||||
#include "platform/public/scheduled_executor.h"
|
||||
#include "platform/public/single_thread_executor.h"
|
||||
#include "absl/time/time.h"
|
||||
|
||||
// Snippets of invalid code that should trigger an error during thread
|
||||
// safety analysis at compile time.
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "absl/base/thread_annotations.h"
|
||||
#include "platform/base/runnable.h"
|
||||
#include "platform/public/lockable.h"
|
||||
#include "absl/base/thread_annotations.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -149,7 +149,7 @@ WifiLanSocket WifiLanMedium::Connect(WifiLanService& wifi_lan_service,
|
||||
}
|
||||
|
||||
WifiLanService WifiLanMedium::GetRemoteService(const std::string& ip_address,
|
||||
int port) {
|
||||
int port) {
|
||||
return WifiLanService(impl_->GetRemoteService(ip_address, port));
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#ifndef PLATFORM_PUBLIC_WIFI_LAN_H_
|
||||
#define PLATFORM_PUBLIC_WIFI_LAN_H_
|
||||
|
||||
#include "absl/container/flat_hash_map.h"
|
||||
#include "platform/api/platform.h"
|
||||
#include "platform/api/wifi_lan.h"
|
||||
#include "platform/base/byte_array.h"
|
||||
@@ -23,7 +24,6 @@
|
||||
#include "platform/base/nsd_service_info.h"
|
||||
#include "platform/base/output_stream.h"
|
||||
#include "platform/public/mutex.h"
|
||||
#include "absl/container/flat_hash_map.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "platform/base/medium_environment.h"
|
||||
#include "platform/public/count_down_latch.h"
|
||||
#include "platform/public/logging.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "platform/base/medium_environment.h"
|
||||
#include "platform/public/count_down_latch.h"
|
||||
#include "platform/public/logging.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
Reference in New Issue
Block a user