From b202e546671a4e7df5492cbbd0d444d94bf96577 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Wed, 31 Jan 2024 23:19:44 -0800 Subject: [PATCH 1/3] Improve JniLocalReferenceManager class (#31813) --- src/lib/support/JniTypeWrappers.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/support/JniTypeWrappers.h b/src/lib/support/JniTypeWrappers.h index 7f481739c34b97..6a70b1e04f8b5d 100644 --- a/src/lib/support/JniTypeWrappers.h +++ b/src/lib/support/JniTypeWrappers.h @@ -186,13 +186,14 @@ class JniGlobalRefWrapper class JniLocalReferenceManager { public: - JniLocalReferenceManager(JNIEnv * env) : mEnv(env) + explicit JniLocalReferenceManager(JNIEnv * env) : mEnv(env) { if (mEnv->PushLocalFrame(JNI_LOCAL_REF_COUNT) == 0) { mlocalFramePushed = true; } } + ~JniLocalReferenceManager() { if (mlocalFramePushed) @@ -202,8 +203,12 @@ class JniLocalReferenceManager } } + // Delete copy constructor and copy assignment operator + JniLocalReferenceManager(const JniLocalReferenceManager &) = delete; + JniLocalReferenceManager & operator=(const JniLocalReferenceManager &) = delete; + private: - JNIEnv * mEnv = nullptr; + JNIEnv * const mEnv; bool mlocalFramePushed = false; }; From d27d65ee94297a168475522389f1ac19845ddfd0 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 1 Feb 2024 03:56:49 -0500 Subject: [PATCH 2/3] Add orphan src/ble files to gn (#31805) --- src/ble/BUILD.gn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ble/BUILD.gn b/src/ble/BUILD.gn index a9f2f07419f77f..bfdc3db2548044 100644 --- a/src/ble/BUILD.gn +++ b/src/ble/BUILD.gn @@ -73,7 +73,9 @@ if (chip_config_network_layer_ble) { "BleError.h", "BleLayer.cpp", "BleLayer.h", + "BleLayerDelegate.h", "BlePlatformDelegate.h", + "BleRole.h", "BleUUID.cpp", "BleUUID.h", "BtpEngine.cpp", From cfd15516053ca5b548d8d5f2b8d71b3178670128 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 1 Feb 2024 03:57:55 -0500 Subject: [PATCH 3/3] Correct dependencies of GlobalAttributes (#31798) * Correct dependencies of GlobalAttributes * Fix comment --- src/app/BUILD.gn | 8 ++++++-- src/app/GlobalAttributes.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index 73e9d643abf81e..6b800a2213a2fb 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -97,8 +97,12 @@ source_set("paths") { source_set("global-attributes") { sources = [ "GlobalAttributes.h" ] - # This also depends on zap-generated code which is currently impossible to split outs - public_deps = [ "${chip_root}/src/lib/support" ] + # This also depends on zap-generated code which is currently impossible to split out + # as a dependency + public_deps = [ + ":app_config", + "${chip_root}/src/lib/support", + ] } source_set("pre-encoded-value") { diff --git a/src/app/GlobalAttributes.h b/src/app/GlobalAttributes.h index d0b2a05a53f259..5096792309a880 100644 --- a/src/app/GlobalAttributes.h +++ b/src/app/GlobalAttributes.h @@ -18,6 +18,7 @@ #pragma once #include +#include #include namespace chip {