aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorkharcheva <kharcheva@yandex-team.com>2024-10-02 11:05:02 +0300
committerkharcheva <kharcheva@yandex-team.com>2024-10-02 11:16:26 +0300
commit2cfac96412e943de3a142da74b90da74fece6920 (patch)
tree0c6f3c78d97d4fad6d2cf2d2647e47c44a8596a4 /contrib
parent11097c25778aa8dbd4cdec5d0b6eb02b6e44efbc (diff)
downloadydb-2cfac96412e943de3a142da74b90da74fece6920.tar.gz
Support Android build for gRPC
commit_hash:273b353454e6490ebf71ed39743b7059c188690b
Diffstat (limited to 'contrib')
-rw-r--r--contrib/libs/grpc/include/grpcpp/create_channel_binder.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/security/binder_security_policy.h2
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/binder/client/endpoint_binder_pool.cc2
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/binder/client/jni_utils.h2
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/binder/security_policy/binder_security_policy.cc2
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/binder/server/binder_server.cc2
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/binder/utils/binder_auto_utils.h76
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/binder/utils/ndk_binder.h2
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/binder/wire_format/binder_android.h4
9 files changed, 85 insertions, 9 deletions
diff --git a/contrib/libs/grpc/include/grpcpp/create_channel_binder.h b/contrib/libs/grpc/include/grpcpp/create_channel_binder.h
index 1a2963b40e..56ae80882c 100644
--- a/contrib/libs/grpc/include/grpcpp/create_channel_binder.h
+++ b/contrib/libs/grpc/include/grpcpp/create_channel_binder.h
@@ -19,7 +19,7 @@
#ifdef GPR_ANDROID
-#error #include <jni.h>
+#include <jni.h>
#include <memory>
diff --git a/contrib/libs/grpc/include/grpcpp/security/binder_security_policy.h b/contrib/libs/grpc/include/grpcpp/security/binder_security_policy.h
index fa14a98f79..e1c951fc66 100644
--- a/contrib/libs/grpc/include/grpcpp/security/binder_security_policy.h
+++ b/contrib/libs/grpc/include/grpcpp/security/binder_security_policy.h
@@ -19,7 +19,7 @@
#ifdef GPR_ANDROID
-#error #include <jni.h>
+#include <jni.h>
#endif
diff --git a/contrib/libs/grpc/src/core/ext/transport/binder/client/endpoint_binder_pool.cc b/contrib/libs/grpc/src/core/ext/transport/binder/client/endpoint_binder_pool.cc
index 2b41c1db9a..5ecae2a775 100644
--- a/contrib/libs/grpc/src/core/ext/transport/binder/client/endpoint_binder_pool.cc
+++ b/contrib/libs/grpc/src/core/ext/transport/binder/client/endpoint_binder_pool.cc
@@ -22,7 +22,7 @@
#ifdef GPR_SUPPORT_BINDER_TRANSPORT
-#error #include <jni.h>
+#include <jni.h>
#include "src/core/ext/transport/binder/wire_format/binder_android.h"
diff --git a/contrib/libs/grpc/src/core/ext/transport/binder/client/jni_utils.h b/contrib/libs/grpc/src/core/ext/transport/binder/client/jni_utils.h
index cd05b90e02..234c7be99a 100644
--- a/contrib/libs/grpc/src/core/ext/transport/binder/client/jni_utils.h
+++ b/contrib/libs/grpc/src/core/ext/transport/binder/client/jni_utils.h
@@ -19,7 +19,7 @@
#include <grpc/support/port_platform.h>
-#error #include <jni.h>
+#include <jni.h>
#include <functional>
#include <util/generic/string.h>
diff --git a/contrib/libs/grpc/src/core/ext/transport/binder/security_policy/binder_security_policy.cc b/contrib/libs/grpc/src/core/ext/transport/binder/security_policy/binder_security_policy.cc
index 5da1ec9507..a97bb6c945 100644
--- a/contrib/libs/grpc/src/core/ext/transport/binder/security_policy/binder_security_policy.cc
+++ b/contrib/libs/grpc/src/core/ext/transport/binder/security_policy/binder_security_policy.cc
@@ -20,7 +20,7 @@
#ifdef GPR_ANDROID
-#error #include <jni.h>
+#include <jni.h>
#include <unistd.h>
#include <grpc/support/log.h>
diff --git a/contrib/libs/grpc/src/core/ext/transport/binder/server/binder_server.cc b/contrib/libs/grpc/src/core/ext/transport/binder/server/binder_server.cc
index 59bbf9654a..7141aded3f 100644
--- a/contrib/libs/grpc/src/core/ext/transport/binder/server/binder_server.cc
+++ b/contrib/libs/grpc/src/core/ext/transport/binder/server/binder_server.cc
@@ -36,7 +36,7 @@
#ifdef GPR_SUPPORT_BINDER_TRANSPORT
-#error #include <jni.h>
+#include <jni.h>
extern "C" {
diff --git a/contrib/libs/grpc/src/core/ext/transport/binder/utils/binder_auto_utils.h b/contrib/libs/grpc/src/core/ext/transport/binder/utils/binder_auto_utils.h
new file mode 100644
index 0000000000..c72f776076
--- /dev/null
+++ b/contrib/libs/grpc/src/core/ext/transport/binder/utils/binder_auto_utils.h
@@ -0,0 +1,76 @@
+// Copyright 2021 gRPC authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_UTILS_BINDER_AUTO_UTILS_H
+#define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_UTILS_BINDER_AUTO_UTILS_H
+
+#include <grpc/support/port_platform.h>
+
+#ifdef GPR_SUPPORT_BINDER_TRANSPORT
+
+#include "src/core/ext/transport/binder/utils/ndk_binder.h"
+
+namespace grpc_binder {
+namespace ndk_util {
+
+///
+/// Represents one strong pointer to an AIBinder object.
+/// Copied from binder/ndk/include_cpp/android/binder_auto_utils.h
+///
+class SpAIBinder {
+ public:
+ SpAIBinder() : mBinder(nullptr) {}
+ explicit SpAIBinder(AIBinder* binder) : mBinder(binder) {}
+ SpAIBinder(std::nullptr_t)
+ : SpAIBinder() {} // NOLINT(google-explicit-constructor)
+ SpAIBinder(const SpAIBinder& other) { *this = other; }
+
+ ~SpAIBinder() { set(nullptr); }
+ SpAIBinder& operator=(const SpAIBinder& other) {
+ if (this == &other) {
+ return *this;
+ }
+ AIBinder_incStrong(other.mBinder);
+ set(other.mBinder);
+ return *this;
+ }
+
+ void set(AIBinder* binder) {
+ AIBinder* old = *const_cast<AIBinder* volatile*>(&mBinder);
+ if (old != nullptr) AIBinder_decStrong(old);
+ if (old != *const_cast<AIBinder* volatile*>(&mBinder)) {
+ __assert(__FILE__, __LINE__, "Race detected.");
+ }
+ mBinder = binder;
+ }
+
+ AIBinder* get() const { return mBinder; }
+ AIBinder** getR() { return &mBinder; }
+
+ bool operator!=(const SpAIBinder& rhs) const { return get() != rhs.get(); }
+ bool operator<(const SpAIBinder& rhs) const { return get() < rhs.get(); }
+ bool operator<=(const SpAIBinder& rhs) const { return get() <= rhs.get(); }
+ bool operator==(const SpAIBinder& rhs) const { return get() == rhs.get(); }
+ bool operator>(const SpAIBinder& rhs) const { return get() > rhs.get(); }
+ bool operator>=(const SpAIBinder& rhs) const { return get() >= rhs.get(); }
+
+ private:
+ AIBinder* mBinder = nullptr;
+};
+} // namespace ndk_util
+} // namespace grpc_binder
+
+#endif
+
+#endif // GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_UTILS_BINDER_AUTO_UTILS_H
diff --git a/contrib/libs/grpc/src/core/ext/transport/binder/utils/ndk_binder.h b/contrib/libs/grpc/src/core/ext/transport/binder/utils/ndk_binder.h
index cabf21a7b5..1ca82c8162 100644
--- a/contrib/libs/grpc/src/core/ext/transport/binder/utils/ndk_binder.h
+++ b/contrib/libs/grpc/src/core/ext/transport/binder/utils/ndk_binder.h
@@ -20,7 +20,7 @@
#ifdef GPR_SUPPORT_BINDER_TRANSPORT
#include <assert.h>
-#error #include <jni.h>
+#include <jni.h>
#include <memory>
diff --git a/contrib/libs/grpc/src/core/ext/transport/binder/wire_format/binder_android.h b/contrib/libs/grpc/src/core/ext/transport/binder/wire_format/binder_android.h
index c1844e94f6..32c8b17354 100644
--- a/contrib/libs/grpc/src/core/ext/transport/binder/wire_format/binder_android.h
+++ b/contrib/libs/grpc/src/core/ext/transport/binder/wire_format/binder_android.h
@@ -19,13 +19,13 @@
#ifdef GPR_SUPPORT_BINDER_TRANSPORT
-#error #include <jni.h>
+#include <jni.h>
#include <memory>
#include "y_absl/memory/memory.h"
-#error #include "src/core/ext/transport/binder/utils/binder_auto_utils.h"
+#include "src/core/ext/transport/binder/utils/binder_auto_utils.h"
#include "src/core/ext/transport/binder/utils/ndk_binder.h"
#include "src/core/ext/transport/binder/wire_format/binder.h"
#include "src/core/ext/transport/binder/wire_format/wire_reader.h"