mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Roll forward to cl/314549634
Change-Id: I4d1e7eacd5fa4078a094571ad6d5f51e422535ff
This commit is contained in:
committed by
Alexey Polyudov
parent
ae1c427b99
commit
cffbc04508
+1
-5
@@ -3,7 +3,6 @@ cc_library(
|
||||
srcs = [
|
||||
"base64_utils.cc",
|
||||
"cancelable_alarm.cc",
|
||||
"file_impl.cc",
|
||||
"pipe.cc",
|
||||
"prng.cc",
|
||||
"reliability_utils.cc",
|
||||
@@ -11,7 +10,6 @@ cc_library(
|
||||
hdrs = [
|
||||
"base64_utils.h",
|
||||
"cancelable_alarm.h",
|
||||
"file_impl.h",
|
||||
"pipe.h",
|
||||
"prng.h",
|
||||
"reliability_utils.h",
|
||||
@@ -63,7 +61,7 @@ cc_library(
|
||||
visibility = [
|
||||
"//googlemac/iPhone/Shared/Nearby/Connections:__subpackages__",
|
||||
"//core:__subpackages__",
|
||||
"//platform_v2/public:__pkg__",
|
||||
"//platform_v2/base:__pkg__",
|
||||
],
|
||||
deps = [
|
||||
"//absl/base",
|
||||
@@ -78,7 +76,6 @@ cc_test(
|
||||
"atomic_reference_test.cc",
|
||||
"byte_array_test.cc",
|
||||
"container_of_test.cc",
|
||||
"file_impl_test.cc",
|
||||
"pipe_test.cc",
|
||||
"prng_test.cc",
|
||||
"ptr_test.cc",
|
||||
@@ -86,7 +83,6 @@ cc_test(
|
||||
],
|
||||
deps = [
|
||||
":utils",
|
||||
"//file/util:temp_path",
|
||||
"//platform:types",
|
||||
"//platform/api",
|
||||
"//platform/impl/g3",
|
||||
|
||||
@@ -47,7 +47,7 @@ cc_library(
|
||||
"//platform/port:string",
|
||||
"//absl/strings",
|
||||
"//absl/types:any",
|
||||
"//webrtc/files/stable/webrtc/api:libjingle_peerconnection_api",
|
||||
"//webrtc/api:libjingle_peerconnection_api",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
#include "platform/api/condition_variable.h"
|
||||
#include "platform/api/count_down_latch.h"
|
||||
#include "platform/api/hash_utils.h"
|
||||
#include "platform/api/input_file.h"
|
||||
#include "platform/api/lock.h"
|
||||
#include "platform/api/output_file.h"
|
||||
#include "platform/api/scheduled_executor.h"
|
||||
#include "platform/api/server_sync.h"
|
||||
#include "platform/api/settable_future_def.h"
|
||||
@@ -71,6 +73,9 @@ class ImplementationPlatform {
|
||||
static Ptr<HashUtils> createHashUtils();
|
||||
static Ptr<ThreadUtils> createThreadUtils();
|
||||
static Ptr<SystemClock> createSystemClock();
|
||||
static Ptr<InputFile> createInputFile(std::int64_t payload_id,
|
||||
std::int64_t total_size);
|
||||
static Ptr<OutputFile> createOutputFile(std::int64_t payload_id);
|
||||
|
||||
// Java-like Executors
|
||||
// Type aliases used to API 1.0 compatibility.
|
||||
@@ -96,7 +101,6 @@ class ImplementationPlatform {
|
||||
static Ptr<WebRtcSignalingMessenger> createWebRtcSignalingMessenger(
|
||||
const std::string& self_id);
|
||||
static std::string getDeviceId();
|
||||
static std::string getPayloadPath(int64_t payload_id);
|
||||
};
|
||||
|
||||
} // namespace platform
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "platform/byte_array.h"
|
||||
#include "platform/ptr.h"
|
||||
#include "webrtc/files/stable/webrtc/api/peer_connection_interface.h"
|
||||
#include "webrtc/api/peer_connection_interface.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
@@ -15,6 +15,7 @@ cc_library(
|
||||
"//platform:types",
|
||||
"//platform/api",
|
||||
"//platform/impl/shared:atomic_boolean",
|
||||
"//platform/impl/shared:file",
|
||||
"//platform/impl/shared:posix_condition_variable",
|
||||
"//platform/impl/shared:posix_lock",
|
||||
"//platform/port:string",
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "platform/impl/g3/settable_future_impl.h"
|
||||
#include "platform/impl/g3/system_clock_impl.h"
|
||||
#include "platform/impl/shared/atomic_boolean_impl.h"
|
||||
#include "platform/impl/shared/file_impl.h"
|
||||
#include "platform/impl/shared/posix_condition_variable.h"
|
||||
#include "platform/impl/shared/posix_lock.h"
|
||||
#include "platform/port/string.h"
|
||||
@@ -37,6 +38,12 @@ namespace location {
|
||||
namespace nearby {
|
||||
namespace platform {
|
||||
|
||||
namespace {
|
||||
std::string getPayloadPath(std::int64_t payload_id) {
|
||||
return "/tmp/" + std::to_string(payload_id);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Ptr<SubmittableExecutor> ImplementationPlatform::createSingleThreadExecutor() {
|
||||
return Ptr<SubmittableExecutor>(/*new SingleThreadExecutorImpl()*/);
|
||||
}
|
||||
@@ -87,6 +94,16 @@ Ptr<AtomicBoolean> ImplementationPlatform::createAtomicBoolean(
|
||||
return Ptr<AtomicBoolean>(new AtomicBooleanImpl(initial_value));
|
||||
}
|
||||
|
||||
Ptr<InputFile> ImplementationPlatform::createInputFile(
|
||||
std::int64_t payload_id, std::int64_t total_size) {
|
||||
return MakePtr(new InputFileImpl(getPayloadPath(payload_id), total_size));
|
||||
}
|
||||
|
||||
Ptr<OutputFile> ImplementationPlatform::createOutputFile(
|
||||
std::int64_t payload_id) {
|
||||
return MakePtr(new OutputFileImpl(getPayloadPath(payload_id)));
|
||||
}
|
||||
|
||||
Ptr<BluetoothClassicMedium>
|
||||
ImplementationPlatform::createBluetoothClassicMedium() {
|
||||
return Ptr<BluetoothClassicMedium>();
|
||||
@@ -128,10 +145,6 @@ std::string ImplementationPlatform::getDeviceId() {
|
||||
return "google3";
|
||||
}
|
||||
|
||||
std::string ImplementationPlatform::getPayloadPath(int64_t payload_id) {
|
||||
return "/tmp/" + std::to_string(payload_id);
|
||||
}
|
||||
|
||||
} // namespace platform
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
@@ -14,6 +14,7 @@ cc_library(
|
||||
"//platform:types",
|
||||
"//platform:utils",
|
||||
"//platform/api",
|
||||
"//platform/impl/shared:file",
|
||||
"//platform/impl/shared/sample:sample_wifi_medium",
|
||||
"//platform/port:string",
|
||||
"//absl/time",
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "platform/cancelable.h"
|
||||
#include "platform/impl/sample/atomic_reference_impl.h"
|
||||
#include "platform/impl/sample/settable_future_impl.h"
|
||||
#include "platform/impl/shared/file_impl.h"
|
||||
#include "platform/impl/shared/sample/sample_wifi_medium.h"
|
||||
#include "platform/port/string.h"
|
||||
#include "platform/ptr.h"
|
||||
@@ -30,6 +31,12 @@ namespace location {
|
||||
namespace nearby {
|
||||
namespace platform {
|
||||
|
||||
namespace {
|
||||
std::string getPayloadPath(std::int64_t payload_id) {
|
||||
return "/tmp/sample-" + std::to_string(payload_id);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Ptr<ScheduledExecutor> ImplementationPlatform::createScheduledExecutor() {
|
||||
return Ptr<ScheduledExecutor>{};
|
||||
}
|
||||
@@ -80,6 +87,16 @@ Ptr<AtomicBoolean> ImplementationPlatform::createAtomicBoolean(
|
||||
return Ptr<AtomicBoolean>{};
|
||||
}
|
||||
|
||||
Ptr<InputFile> ImplementationPlatform::createInputFile(
|
||||
std::int64_t payload_id, std::int64_t total_size) {
|
||||
return MakePtr(new InputFileImpl(getPayloadPath(payload_id), total_size));
|
||||
}
|
||||
|
||||
Ptr<OutputFile> ImplementationPlatform::createOutputFile(
|
||||
std::int64_t payload_id) {
|
||||
return MakePtr(new OutputFileImpl(getPayloadPath(payload_id)));
|
||||
}
|
||||
|
||||
Ptr<BluetoothClassicMedium>
|
||||
ImplementationPlatform::createBluetoothClassicMedium() {
|
||||
return Ptr<BluetoothClassicMedium>();
|
||||
@@ -116,10 +133,6 @@ Ptr<HashUtils> ImplementationPlatform::createHashUtils() {
|
||||
|
||||
std::string ImplementationPlatform::getDeviceId() { return "sample"; }
|
||||
|
||||
std::string ImplementationPlatform::getPayloadPath(int64_t payload_id) {
|
||||
return "/tmp/sample-" + std::to_string(payload_id);
|
||||
}
|
||||
|
||||
} // namespace platform
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
@@ -43,3 +43,31 @@ cc_library(
|
||||
],
|
||||
deps = ["//platform/api"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "file",
|
||||
srcs = ["file_impl.cc"],
|
||||
hdrs = ["file_impl.h"],
|
||||
visibility = [
|
||||
"//googlemac/iPhone/Shared/Nearby/Connections:__subpackages__",
|
||||
"//core:__subpackages__",
|
||||
"//platform/impl:__subpackages__",
|
||||
],
|
||||
deps = [
|
||||
"//platform:types",
|
||||
"//platform/api",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "file_test",
|
||||
timeout = "short",
|
||||
srcs = [
|
||||
"file_impl_test.cc",
|
||||
],
|
||||
deps = [
|
||||
":file",
|
||||
"//file/util:temp_path",
|
||||
"//testing/base/public:gunit_main",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "platform/file_impl.h"
|
||||
#include "platform/impl/shared/file_impl.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef PLATFORM_FILE_IMPL_H_
|
||||
#define PLATFORM_FILE_IMPL_H_
|
||||
#ifndef PLATFORM_IMPL_SHARED_FILE_IMPL_H_
|
||||
#define PLATFORM_IMPL_SHARED_FILE_IMPL_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
@@ -43,4 +43,4 @@ class OutputFileImpl final : public OutputFile {
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_FILE_IMPL_H_
|
||||
#endif // PLATFORM_IMPL_SHARED_FILE_IMPL_H_
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "platform/file_impl.h"
|
||||
#include "platform/impl/shared/file_impl.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
Reference in New Issue
Block a user